Skip to content

Instantly share code, notes, and snippets.

@chupman
chupman / socialLoad.groovy
Created June 13, 2019 22:11
socialLoad.groovy
FILENAME = args[0]
PROPERTIES = args[1]
graph = JanusGraphFactory.open(PROPERTIES)
// Create graph schema and indexes, if they haven't already been created
mgmt = graph.openManagement()
if (mgmt.getPropertyKey('user') == null) {
USER = mgmt.makePropertyKey('user').dataType(String.class).cardinality(Cardinality.SINGLE).make();
START_DATE = mgmt.makePropertyKey('start_date').dataType(Date.class).cardinality(Cardinality.SINGLE).make();
PLATFORM = mgmt.makePropertyKey('PLATFORM').dataType(String.class).cardinality(Cardinality.SINGLE).make();
@chupman
chupman / example.csv
Created June 13, 2019 22:09
example.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 5 columns, instead of 1. in line 2.
user1, user2, relationship, start_date, platform
@chupman, @pluradj, following, 1528149066, twitter
...
@chupman
chupman / quickstart.groovy
Created June 13, 2019 22:09
quickstart.groovy CGF
:remote connect tinkerpop.server conf/remote.yaml session
:remote console
graph = ConfiguredGraphFactory.open("airroutes")
g = graph.traversal()
@chupman
chupman / quickstart.groovy
Created June 13, 2019 22:08
quickstart.groovy remote
:remote connect tinkerpop.server conf/remote.yaml session
:remote console
g = graph.traversal()
@chupman
chupman / quickstart.groovy
Created June 13, 2019 22:08
quickstart.groovy
graph = JanusGraphFactory.open("conf/janusgraph-cassandra-es.properties")
g = graph.traversal()
@chupman
chupman / gremlin-server.yaml
Created June 13, 2019 22:07
gremlin-server.yaml
host: 0.0.0.0
port: 8182
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
graph: conf/janusgraph.properties
}
plugins:
- janusgraph.imports
scriptEngines: {
@chupman
chupman / janusgraph.groovy
Created June 13, 2019 22:04
scripts/janusgraph.groovy
def globals = [:]
globals << [g : graph.traversal()]
@chupman
chupman / historyClear.groovy
Created June 13, 2019 22:03
historyClear.groovy
gremlin> :history
...
513 g.V()
514 :help
515 :history
gremlin> :history recall 514
No such property: g for class: groovysh_evaluate
Type ':help' or ':h' for help.
@chupman
chupman / clearShell.groovy
Created June 13, 2019 22:02
clearShell.groovy
gremlin> g.V().has('code', "SFO')
......1> :clear
gremlin>
@chupman
chupman / GraphsonImport.groovy
Created June 13, 2019 22:00
GraphsonImport.groovy
graph.io(graphson()).readGraph('/tmp/airroutes_us.json');