Last active
April 6, 2018 00:05
-
-
Save bshambaugh/d62a07e468246509ab701de36e6927d1 to your computer and use it in GitHub Desktop.
How do I output John and Bob???
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
import org.apache.commons.configuration.BaseConfiguration; | |
import org.apache.tinkerpop.gremlin.process.traversal.Order; | |
import org.apache.tinkerpop.gremlin.process.traversal.Path; | |
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; | |
import org.apache.tinkerpop.gremlin.structure.Graph; | |
import org.apache.tinkerpop.gremlin.structure.T; | |
import org.apache.tinkerpop.gremlin.structure.Vertex; | |
import org.umlg.sqlg.predicate.Text; | |
import org.umlg.sqlg.structure.SqlgGraph; | |
import java.util.Iterator; | |
import java.util.List; | |
public class GremlinJenaTest4 { | |
public static void main(String[] arg) { | |
BaseConfiguration conf = new BaseConfiguration(); | |
conf.setProperty("jdbc.url", "jdbc:postgresql://localhost:5432/sqlgraphdb"); | |
conf.setProperty("jdbc.username", "batman"); | |
conf.setProperty("jdbc.password", "password"); | |
Graph g = SqlgGraph.open(conf); | |
Vertex john = g.addVertex(T.label, "Manager", "name", "john"); | |
Vertex bob = g.addVertex(T.label, "Manager", "name", "bob"); | |
g.tx().commit(); | |
List<Vertex> persons = g.traversal().V().hasLabel("Manager").toList(); | |
// How do I grab john and bob??? | |
for (Vertex path : persons) { | |
System.out.println(path); | |
} | |
try { | |
g.close(); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment