Skip to content
Snippets Groups Projects
Commit ebc197d0 authored by Jeffrey Phillips Freeman's avatar Jeffrey Phillips Freeman :boom:
Browse files

Added example using gremlin.

parent 348217bc
No related branches found
No related tags found
No related merge requests found
...@@ -117,5 +117,10 @@ ...@@ -117,5 +117,10 @@
<artifactId>titan-es</artifactId> <artifactId>titan-es</artifactId>
<version>0.4.4</version> <version>0.4.4</version>
</dependency> </dependency>
<dependency>
<groupId>com.tinkerpop.gremlin</groupId>
<artifactId>gremlin-java</artifactId>
<version>2.6.0</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -5,8 +5,7 @@ import com.thinkaurelius.titan.core.TitanGraph; ...@@ -5,8 +5,7 @@ import com.thinkaurelius.titan.core.TitanGraph;
import com.thinkaurelius.titan.core.TitanKey; import com.thinkaurelius.titan.core.TitanKey;
import com.thinkaurelius.titan.core.attribute.Geoshape; import com.thinkaurelius.titan.core.attribute.Geoshape;
import com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration; import com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration;
import com.tinkerpop.blueprints.Edge; import com.tinkerpop.blueprints.*;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.util.ElementHelper; import com.tinkerpop.blueprints.util.ElementHelper;
import org.apache.commons.configuration.BaseConfiguration; import org.apache.commons.configuration.BaseConfiguration;
import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.Configuration;
......
package com.syncleus.titangraph.example;
import com.thinkaurelius.titan.core.TitanGraph;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.gremlin.java.GremlinPipeline;
import org.junit.*;
public class GremlinTest {
@Test
public void testGremlin() {
final TitanGraph godGraph = TitanGods.create("./target/TitanTestDB");
final GremlinPipeline pipe = new GremlinPipeline();
final Vertex saturnVertex = godGraph.getVertices("name", "saturn").iterator().next();
final GremlinPipeline childsNamePipe = pipe.start(saturnVertex).in("father").property("name");
final String childsName = childsNamePipe.next().toString();
Assert.assertEquals(childsName, "jupiter");
}
}
...@@ -2,37 +2,13 @@ package com.syncleus.titangraph.example; ...@@ -2,37 +2,13 @@ package com.syncleus.titangraph.example;
import com.thinkaurelius.titan.core.TitanGraph; import com.thinkaurelius.titan.core.TitanGraph;
import com.tinkerpop.blueprints.Vertex; import com.tinkerpop.blueprints.Vertex;
import junit.framework.Test; import org.junit.*;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/** public class TitanGodsTest {
* Unit test for simple App. @Test
*/
public class TitanGodsTest
extends TestCase {
/**
* Create the test case
*
* @param testName name of the test case
*/
public TitanGodsTest(String testName) {
super(testName);
}
/**
* @return the suite of tests being tested
*/
public static Test suite() {
return new TestSuite(TitanGodsTest.class);
}
/**
* Rigourous Test :-)
*/
public void testApp() { public void testApp() {
TitanGraph godGraph = TitanGods.create("./target/TitanTestDB"); TitanGraph godGraph = TitanGods.create("./target/TitanTestDB");
Iterable<Vertex> skyVertices = godGraph.getVertices("name", "sky"); Iterable<Vertex> skyVertices = godGraph.getVertices("name", "sky");
assertTrue("no sky vertices found", skyVertices.iterator().hasNext()); Assert.assertTrue("no sky vertices found", skyVertices.iterator().hasNext());
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment