tinkerpop/gremlin — Issue #268: Feature Request: return vertex ID on loadGraphML()
Author: EddyR
Created: 2011-12-15 06:17:00+00:00
State: open

1 of 2 major issues I have before my little project can continue.

When loading a GraphML file into a pre-existing graph (I use Neo4j for example) it basically gets dumped on it's own as a separate sub-graph with no way to add an edge to it on import.

Say for example I want to give other users the ability to load their own GraphML files. My application can ask for the file and load it but unless the user also specified a vertex property or some other way of identifying the loaded graph then there is no other way to create a edge to place it in the correct location in my "main" graph. Worse, that none of these methods for identifying a vertex in the loaded GraphML file will be unique. A unique ID is required.

What I'm proposing is:

A) Allow a extra field in loadGraphML() for nominating a unique vertex ID provided by the GraphML file. This should then return the new ID generated for that vertex to allow an edge to be created.

For example: addEdge(g.loadGraphML('path/to/graphml.xml', ), g.v(1).out.filter(it.getProperty('label')=='BIN'), 'ATTACH')

B) Same as A) except the ID is specified with in the GraphML file itself. This might even be more flexible. For example you could specify more than 1 ID, etc. I don't know the structure it would take but something like:

C) Something similar or the same as loadGraphML().next() for finding the first loaded GraphML node. I must stress - and despite the conversations I've had on the Gremlin mailing list - I actually find this method extremely useful for structured data. This way the user doesn't have to specify a unique ID anywhere. In my mind this is far more important and useful than the first 2 options.

Thanks
Eddy