http://www.k6k4.com/blog/show/aaapamn4v1547604938237
一、第一遍调试
还是上次的例子 FirstTest
:
public class FirstTest {
public static void main(String[] args) {
/*
* The example below will open a JanusGraph graph instance and load The Graph of the Gods dataset diagrammed above.
* JanusGraphFactory provides a set of static open methods,
* each of which takes a configuration as its argument and returns a graph instance.
* This tutorial calls one of these open methods on a configuration
* that uses the BerkeleyDB storage backend and the Elasticsearch index backend,
* then loads The Graph of the Gods using the helper class GraphOfTheGodsFactory.
* This section skips over the configuration details, but additional information about storage backends,
* index backends, and their configuration are available in
* Part III, “Storage Backends”, Part IV, “Index Backends”, and Chapter 13, Configuration Reference.
*/
// Loading the Graph of the Gods Into JanusGraph
JanusGraph graph = JanusGraphFactory
.open("janusgraph-dist/src/assembly/cfilter/conf/janusgraph-berkeleyje-es.properties");
GraphOfTheGodsFactory.load(graph);
GraphTraversalSource g = graph.traversal();
/*
* The typical pattern for accessing data in a graph database is to first locate the entry point into the graph
* using a graph index. That entry point is an element (or set of elements)
* — i.e. a vertex or edge. From the entry elements,
* a Gremlin path description describes how to traverse to other elements in the graph via the explicit graph structure.
* Given that there is a unique index on name property, the Saturn vertex can be retrieved.
* The property map (i.e. the key/value pairs of Saturn) can then be examined.
* As demonstrated, the Saturn vertex has a name of "saturn, " an age of 10000, and a type of "titan."
* The grandchild of Saturn can be retrieved with a traversal that expresses:
* "Who is Saturn’s grandchild?" (the inverse of "father" is "child"). The result is Hercules.
*/
// Global Graph Indices
Vertex saturn = g.V()