gremwell
gremwell

Reputation: 1457

Is there a way to POST graphML to gremlin/neo4j?

So it looks like the gremlin API requires a url to import a GraphML file to the server (http://docs.neo4j.org/chunked/stable/gremlin-plugin.html#rest-api-load-a-sample-graph). I was hoping there'd be some API where you could just POST the GraphML to it, does something like this exist?

I realise I could write a Neo4j extension to essentially do this, but I was wondering if one already existed...

Upvotes: 0

Views: 121

Answers (2)

RaduK
RaduK

Reputation: 1463

If the graph is not huge, perhaps you can try passing the file as a string to the gremlin extension and use the script in the doc you cited. Therefore your gremlin script expects a String variable that contains your graph and it creates the file (by writing the string graph to the file):

def fos= new FileOutputStream('path_to_my_file.xml')
fos.write(myGraphAsString)

You can then load this file:

g.clear()
g.loadGraphML('file:/path_to_my_file.xml')

Upvotes: 0

Stefan Armbruster
Stefan Armbruster

Reputation: 39925

There a shell extension at https://github.com/jexp/neo4j-shell-tools#graphml-import providing this feature. It should not be too hard to convert that into a server extension.

Upvotes: 1

Related Questions