Skip to content

Instantly share code, notes, and snippets.

@pierredewilde
pierredewilde / gist:1156323
Created August 19, 2011 08:19
Finding all paths between 2 nodes in a directed and undirected graph using Gremlin
\,,,/
(o o)
-----oOOo-(_)-oOOo-----
gremlin> g = TinkerGraphFactory.createTinkerGraph()
==>tinkergraph[vertices:6 edges:6]
gremlin> A = '1'; B = '5'; N = 3
==>3
gremlin> g.v(A).out.loop(1){it.loops<=N && !(it.object.id in [A,B])}.has('id',B).path
==>[v[1], v[4], v[5]]
gremlin> g.v(A).both.loop(1){it.loops<=N && !(it.object.id in [A,B])}.has('id',B).path
@pierredewilde
pierredewilde / gist:1156635
Created August 19, 2011 11:44
Execute SPARQL on Neo4jGraph via Blueprints SailGraph
\,,,/
(o o)
-----oOOo-(_)-oOOo-----
gremlin> Gremlin.version()
==>1.3-SNAPSHOTgremlin> g = new SailGraph(new GraphSail(new Neo4jGraph('/data/neo4j/ian')))
==>sailgraph[graphsail]
gremlin> g.loadRDF('/data/rdf/ian.rdf', 'rdf-xml')
==>null
gremlin> g.E
==>e[http://example.com/test - rdf:type -> owl:Ontology]
@pierredewilde
pierredewilde / gist:1232082
Created September 21, 2011 13:54
Tinkerpop: new tickets proposition
[Tinkerpop] =========================================================
[Tinkerpop] Promotion
blog posts, project acquisitions, EC2 images (Stephen style), contact hosting services to host TinkerPop deployments, etc.
[Tinkerpop] More test cases and cleaner/concise documentation
[Tinkerpop] More control over our Hudson build
Or at least, getting someone to tweak the configuration of our projects so as to auto-deploy on successful builds. (Josh)
@pierredewilde
pierredewilde / gist:1253111
Created September 30, 2011 08:35
With rexster-0.7-SNAPSHOT running, 'mvn test' on blueprints-1.1-SNAPSHOT-rexster-graph
~$ cd Documents/_GraphDatabases/_Tinkerpop/_snapshot/blueprints/blueprints-rexster-graph/
~/Documents/_GraphDatabases/_Tinkerpop/_snapshot/blueprints/blueprints-rexster-graph$ mvn test
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Blueprints-RexsterGraph 1.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://tinkerpop.com/maven2/com/tinkerpop/blueprints/blueprints-core/1.1-SNAPSHOT/maven-metadata.xml
Downloaded: http://tinkerpop.com/maven2/com/tinkerpop/blueprints/blueprints-core/1.1-SNAPSHOT/maven-metadata.xml (954 B at 1.9 KB/sec)
@pierredewilde
pierredewilde / gist:1253114
Created September 30, 2011 08:36
With rexster-0.6 running, 'mvn test' on blueprints-1.0-rexster-graph
~/Documents/_GraphDatabases/_Tinkerpop/_release/blueprints-1.0/blueprints-rexster-graph$ mvn test
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Blueprints-RexsterGraph 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ blueprints-rexster-graph ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
~/Documents/_GraphDatabases/_Tinkerpop/_snapshot/gremlin$ git pull
Already up-to-date.
~/Documents/_GraphDatabases/_Tinkerpop/_snapshot/gremlin$ mvn clean install
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Gremlin: A Graph Traversal Language
[INFO] Gremlin-Core: The Core of the Gremlin Language
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Rexster: A RESTful Graph Shell 0.7-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://tinkerpop.com/maven2/com/tinkerpop/blueprints/blueprints-core/1.1-SNAPSHOT/maven-metadata.xml
Downloaded: http://tinkerpop.com/maven2/com/tinkerpop/blueprints/blueprints-core/1.1-SNAPSHOT/maven-metadata.xml (954 B at 2.3 KB/sec)
Downloading: http://tinkerpop.com/maven2/com/tinkerpop/blueprints/blueprints-core/1.1-SNAPSHOT/maven-metadata.xml
Downloaded: http://tinkerpop.com/maven2/com/tinkerpop/blueprints/blueprints-core/1.1-SNAPSHOT/maven-metadata.xml (954 B at 4.1 KB/sec)
Downloading: http://tinkerpop.com/maven2/com/tinkerpop/blueprints/blueprints/1.1-SNAPSHOT/maven-metadata.xml
curl -s http://localhost:8182/graphs/gratefulgraph/{vertices/1,edges/0}
time curl -s http://localhost:8182/graphs/gratefulgraph/vertices/[0-808] http://localhost:8182/graphs/gratefulgraph/edges/[0-8048] >nul
# 0.6
real 0m48.420s
user 0m2.052s
sys 0m0.841s
# 0.7-SNAPSHOT
real 0m20.769s