Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Went through entire documentation updating code examples and referenc…
…es to tinkerpop. Added gremlin.graph config option Added TimeUnit to auto imports for gremlin shell Updated gremlin server config Fixed elastic search antlr version collision with Cassandra #872
- Loading branch information
Showing
50 changed files
with
709 additions
and
879 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,30 @@ | ||
[[advanced-blueprints]] | ||
Advanced Blueprints | ||
Advanced Tinkerpop | ||
------------------- | ||
|
||
//image:https://raw.github.com/tinkerpop/blueprints/master/doc/images/blueprints-character-3.png[] | ||
http://tinkerpop.incubator.apache.org/[Tinkerpop] provides a set of common http://tinkerpop.incubator.apache.org/docs/3.0.0-SNAPSHOT/#traversalstrategy[traversal strategies] that add additional functionality to graphs. | ||
|
||
http://blueprints.tinkerpop.com/[Blueprints] provides a set of common property graph interfaces by which any vendor can implement and leverage the http://tinkerpop.com[TinkerPop] stack of technologies. Within Blueprints, there are other utilities that are generally useful like import/export formats as well graph wrappers. | ||
|
||
Using IdGraph | ||
Using ElementIdStrategy | ||
~~~~~~~~~~~~~ | ||
|
||
It is possible to use Blueprints' https://github.com/tinkerpop/blueprints/wiki/Id-Implementation[IdGraph] with Titan. IdGraph requires a property named `__id` that maps arbitrary user-provided identifiers to Titan's internally-assigned long identifiers. This property name is also available programmatically as the public static string `IdGraph.ID`. | ||
It is possible to use http://tinkerpop.incubator.apache.org/docs/3.0.0-SNAPSHOT/#_elementidstrategy[ElementIdStrategy] with Titan. ElementIdStrategy allow an arbitrary property to be used as the element ID instead of Titans's long identifiers. | ||
|
||
[IMPORTANT] | ||
The `__id` property key must be created and covered by a unique index in Titan prior to using `IdGraph` with Titan. | ||
The target property key must be created and covered by a unique index in Titan prior to using `ElementIdStrategy` with Titan, otherwise Vertex lookups will result in sequential scans of the graph. | ||
|
||
To prepare Titan for IdGraph, first create the `__id` property key. Set the `dataType` of the property key to match the custom IDs that you intend to use. Second, build a unique composite index on the `__id` property key. The following example shows how to define and index the `__id` property key to support IdGraph with string vertex IDs. | ||
To prepare Titan for ElementIdStrategy, first create the property key. Set the `dataType` of the property key to match the custom IDs that you intend to use. Second, build a unique composite index on the property key. The following example shows how to define and index the property key to support IdGraph with string vertex IDs. | ||
|
||
[source,gremlin] | ||
[source, gremlin] | ||
g = TitanFactory.open("berkeleyje:/tmp/test") | ||
// Define a property key and index for IdGraph-managed vertex IDs | ||
mgmt = g.getManagementSystem(); | ||
id = mgmt.makePropertyKey(IdGraph.ID).dataType(String.class).make() | ||
mgmt.buildIndex("byvid",Vertex.class).addKey(id).unique().buildCompositeIndex() | ||
// Define a property key and index for managed vertex IDs | ||
mgmt = g.openManagement() | ||
idKey = mgmt.makePropertyKey("name").dataType(String.class).make() | ||
mgmt.buildIndex("byName", Vertex.class).addKey(idKey).unique().buildCompositeIndex() | ||
mgmt.commit() | ||
// Create an IdGraph that manages vertex IDs but not edge IDs | ||
ig = new IdGraph(g, true, false) | ||
// Insert example vertex with custom identifier | ||
hercules = ig.addVertex("hercules") | ||
g.v("hercules") | ||
zeus = ig.addVertex("zeus") | ||
// Create an that manages vertex IDs but not edge IDs | ||
strategy = ElementIdStrategy.build().idPropertyKey("name").create() | ||
ig = GraphTraversalSource.build().with(strategy).create(g) | ||
|
||
// If only user defined ids on vertices (or edges) is needed, then use one of the overloaded `IdGraph` constructors. It is still helpful, although not strictly necessary, to define an index: | ||
// | ||
//[source,gremlin] | ||
//ig = new IdGraph(g, true, false) // true for vertices, false for edges | ||
// Insert example vertex with custom identifier | ||
hercules = ig.addV(T.id, "hercules") | ||
ig.V("hercules") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.