- https://jamesthornton.com#EXIWlRrkjKE
- https://twitter.com/Rangers/status/1641554510605611011
- https://twitter.com/astros/status/1641996751618940936
- https://www.youtube.com/watch?v=S7c3lzpDkvQ#7SlILk2WMTI
- https://gist.github.com/espeed/dd3026536ec3d38afea1072941670f52#3ch6eXkQWU8-C5TDc46E1G4-trIjpVH8h88-UcW056B9jeQ-LvG_M_fAkXU
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
def outE(_id,label) { | |
g.v(_id).outE(label) | |
} | |
def inE(_id,label) { | |
g.v(_id).inE(label) | |
} | |
def bothE(_id,label) { | |
g.v(_id).bothE(label) |
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
def outE(_id,label) { | |
if (label == null) | |
g.v(_id).outE() | |
else | |
g.v(_id).outE(label) | |
} | |
def inE(_id,label) { | |
if (label == null) | |
g.v(_id).inE() |
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
// A Gremlin script to warm Neo4j's cache | |
def warmCache() { | |
for (vertex in g.getVertices()) { | |
vertex.getOutEdges() | |
} | |
} |
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
// Neo4j requires you delete all adjacent edges first. | |
// Blueprints' removeVertex() method does that; the Neo4jServer DELETE URI does not. | |
def deleteVertex(_id) { | |
vertex = g.v(_id) | |
g.removeVertex(vertex) | |
} |
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
// Bulbs 0.3 Gremlin transaction for Neo4j | |
def create_indexed_vertex(data,index_name,keys) { | |
manager = g.getRawGraph().index() | |
index = manager.forNodes(index_name) | |
g.setMaxBufferSize(0) | |
g.startTransaction() | |
vertex = g.getRawGraph().createNode() | |
for (entry in data.entrySet()) { | |
if (entry.value == null) continue; |
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
junit.framework.ComparisonFailure: expected:<[[ 1.0, 2, 5, 6, 8 ]]> but was:<["sun.org.mozilla.javascript.NativeArray@58bd3b2d"]> | |
at junit.framework.Assert.assertEquals(Assert.java:85) | |
at junit.framework.Assert.assertEquals(Assert.java:91) | |
at org.neo4j.server.plugin.javascript.JSPluginTest.testExecuteScriptLongs(JSPluginTest.java:233) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
at java.lang.reflect.Method.invoke(Method.java:616) | |
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) |
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
[INFO] Dependencies classpath: | |
/home/james/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar:/home/james/.m2/repository/asm/asm/3.1/asm-3.1.jar:/home/james/.m2/repository/asm/asm-analysis/3.2/asm-analysis-3.2.jar:/home/james/.m2/repository/asm/asm-commons/3.2/asm-commons-3.2.jar:/home/james/.m2/repository/asm/asm-tree/3.2/asm-tree-3.2.jar:/home/james/.m2/repository/asm/asm-util/3.2/asm-util-3.2.jar:/home/james/.m2/repository/com/googlecode/json-simple/json-simple/1.1/json-simple-1.1.jar:/home/james/.m2/repository/com/sun/jersey/jersey-client/1.6/jersey-client-1.6.jar:/home/james/.m2/repository/com/sun/jersey/jersey-core/1.6/jersey-core-1.6.jar:/home/james/.m2/repository/com/sun/jersey/jersey-server/1.6/jersey-server-1.6.jar:/home/james/.m2/repository/com/sun/jersey/contribs/jersey-multipart/1.9/jersey-multipart-1.9.jar:/home/james/.m2/repository/com/tinkerpop/gremlin/1.4-SNAPSHOT/gremlin-1.4-SNAPSHOT.jar:/home/james/.m2/repository/com/tinkerpop/pipes/1.0-SNAPSHOT/pipes-1.0-SNAPSHOT.jar:/home/james/.m2/reposito |
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
// Example using the Neo4j Fulltext Index with Gremlin-Groovy | |
// by James Thornton, http://jamesthornton.com | |
import com.tinkerpop.blueprints.pgm.impls.neo4j.util.Neo4jVertexSequence; | |
import com.tinkerpop.blueprints.pgm.impls.neo4j.util.Neo4jEdgeSequence; | |
Graph g = new Neo4jGraph('/tmp/neo4jmovies'); | |
indexManager = g.getRawGraph().index(); | |
indexConfig = ["provider":"lucene", "type":"fulltext"] |
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
from bulbs.config import Config | |
from bulbs.gremlin import Gremlin | |
from bulbs.model import Node, NodeProxy | |
from bulbs.property import String, Integer | |
from bulbs.element import Vertex, VertexProxy, EdgeProxy, Edge | |
from bulbs.neo4jserver import Neo4jResource, NEO4J_URI, \ | |
VertexIndexProxy, EdgeIndexProxy, ExactIndex | |
class Person(Node): |
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
// Gremlin-Groovy Transaction Wrapper | |
// by James Thornton, http://jamesthornton.com | |
def transaction = { final Closure closure -> | |
g.setMaxBufferSize(0); | |
g.startTransaction(); | |
try { | |
results = closure(); | |
g.stopTransaction(TransactionalGraph.Conclusion.SUCCESS); | |
return results; |