forked from thinkaurelius/titan
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'titan09' of https://github.com/thinkaurelius/titan into…
… titan09
- Loading branch information
Showing
7 changed files
with
123 additions
and
68 deletions.
There are no files selected for viewing
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
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
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
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
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
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
40 changes: 40 additions & 0 deletions
40
titan-dist/src/assembly/static/data/legacy-graphson-script-input.groovy
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* legacy-graphson-script-input.groovy | ||
* | ||
* Can be used as a script file for ScriptInputFormat to read/load | ||
* GraphSON exports from older Titan versions (<= 0.5.x). | ||
*/ | ||
def parse(line, factory) { | ||
def slurper = new JsonSlurper() | ||
def properties = slurper.parseText(line) | ||
def outE = properties.remove("_outE") | ||
def inE = properties.remove("_inE") | ||
def vid = properties.remove("_id") | ||
def vlabel = properties.remove("_label") ?: Vertex.DEFAULT_LABEL | ||
def vertex = factory.vertex(vid, vlabel) | ||
properties.each { def key, def value -> | ||
vertex.property(key, value) | ||
} | ||
if (outE != null) { | ||
outE.each { def e -> | ||
def eid = e.remove("_id") | ||
def elabel = e.remove("_label") ?: Edge.DEFAULT_LABEL | ||
def inV = factory.vertex(e.remove("_inV")) | ||
edge = factory.edge(vertex, inV, elabel) | ||
e.each { def key, def value -> | ||
edge.property(key, value) | ||
} | ||
} | ||
} | ||
if (inE != null) { | ||
inE.each { def e -> | ||
def eid = e.remove("_id") | ||
def elabel = e.remove("_label") | ||
def outV = factory.vertex(e.remove("_outV")) | ||
edge = factory.edge(outV, vertex, elabel) | ||
e.each { def key, def value -> | ||
edge.property(key, value) | ||
} | ||
} | ||
} | ||
return vertex | ||
} |