1,关于tinkerpop
之前体验了下tinkerpop的console服务。
存储数据,然后进行查询数据。
之前写的文章:
http://www.2cto.com/database/201506/406914.html
2,关于blueprints

Blueprints是一组针对属性图数据模型的接口、实现、测试套件,有些类似于JDBC,不同之处在于Blueprints是针对图形数据库的。Blueprints提供了一组通用的接口,允许开发者在他们的图形数据库后端即插即用。

这个图表示了blueprints的位置,在最底层,决定数据存储。
其中blueprints支持的存储:
TinkerGraph (TinkerGraph)
Neo4j Implementation (Neo4jGraph)
Neo4jHA Implementation (Neo4jHaGraph)
Neo4jBatch Implementation (Neo4jBatchGraph)
Sail Implementation (SailGraph)
Sparksee Implementation (SparkseeGraph)
Rexster Implementation (RexsterGraph)
Accumulo Implementation (AccumuloGraph – 3rd party – implements Blueprints 2.4.0)
ArangoDB Implementation (ArangoDBGraph – 3rd party – implements Blueprints 2.3.0)
Bitsy (BitsyGraph – 3rd party – implements Blueprints 2.4.0)
Bigdata (BigdataGraph – 3rd party – implements Blueprints 2.5.0)
FluxGraph - Datomic Implementation (FluxGraph – 3rd party – implements Blueprints 2.1.0)
FoundationDB Implementation (FoundationDBGraph – 3rd party – implements Blueprints 2.4.0)
InfiniteGraph Implementation (IGGraph – 3rd party – implements Blueprints 2.1.0)
JPA Implementation (JpaGraph – 3rd party – implements Blueprints 2.5.0)
MongoDB Implementation (MongoDBGraph – 3rd party – implements Blueprints 2.3.0)
Oracle NoSQL Implementation (KVGraph – 3rd party – implements Blueprints 2.1.0)
OrientDB Implementation (OrientGraph – 3rd party – implements Blueprints 2.4.0)
SQL/JDBC Implementation – 3rd party – implements Blueprints 2.4.0)
Titan Implementation (TitanGraph – 3rd party – implements Blueprints 2.3.0)
3,配置依赖包
maven依赖:
4.0.0
tinkerpop-demo
tinkerpop-demo
1.0
wingnest-repo
wingnest repo
http://www.wingnest.com/mvn-repo/
org.apache.tinkerpop
gremlin-core
3.0.0.M9-incubating
org.apache.tinkerpop
gremlin-driver
3.0.0.M9-incubating
com.tinkerpop.blueprints
blueprints-core
2.6.0
com.wingnest.blueprints
blueprints-jpa-graph
2.5.0_01
org.slf4j
slf4j-log4j12
1.7.5
test
org.slf4j
slf4j-simple
1.6.1
test
org.apache.derby
derby
10.11.1.1
test
org.apache.derby
derbytools
10.11.1.1
test
junit
junit
4.12
org.hibernate
hibernate-core
4.3.10.Final
org.hibernate
hibernate-entitymanager
4.3.10.Final
org.apache.derby
derby
10.11.1.1
src/main/java
src/main/resources
true
org.apache.maven.plugins
maven-compiler-plugin
2.5.1
1.7
1.7
UTF-8
org.apache.maven.plugins
maven-resources-plugin
2.4
测试代码:
package com.tinkerpop.demo; import com.tinkerpop.blueprints.Direction; import com.tinkerpop.blueprints.Edge; import com.tinkerpop.blueprints.Graph; import com.tinkerpop.blueprints.Vertex; import com.tinkerpop.blueprints.impls.tg.TinkerGraph; import com.wingnest.blueprints.impls.jpa.JpaGraph; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.File; import java.util.HashMap; import java.util.Map; /** * */ public class TinkerPopDemo { private JpaGraph jpaGraph = null; @Before public void setUp() { //初始化jpa。保存到数据库中。使用hibernate 自动创建表结构。 //如果要使用mysql,这里修改属性。 Map
props = new HashMap
(); props.put("javax.persistence.jdbc.url", String.format("jdbc:derb