Created
April 5, 2018 21:39
-
-
Save bshambaugh/59c09224bc993ed93947d07f2894f838 to your computer and use it in GitHub Desktop.
Gremlin Jena Test ....
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.structure.Graph; | |
import org.apache.tinkerpop.gremlin.structure.T; | |
import org.apache.tinkerpop.gremlin.structure.Vertex; | |
import org.umlg.sqlg.structure.SqlgGraph; | |
import java.util.Iterator; | |
import java.util.List; | |
public class GremlinJenaTest2 { | |
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); | |
g.addVertex(T.label, "A", "name", "halo"); | |
g.tx().commit(); | |
List<Vertex> vertices = g.traversal().V().hasLabel("A").toList(); | |
System.out.println(vertices.size()); | |
for(Vertex anObject : vertices){ | |
System.out.println(anObject.label()); | |
} | |
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
How does this compare to http://sql2gremlin.com/ ?