Using orientdb-community-2.2-alpha.
We're using the following config for the graph database:
setUseClassForEdgeLabel(false);
setUseVertexFieldsForEdgeLabels(true);
We use this particular configuration because our edge labels are generally not statically defined, and the number of edge labels are dynamic and could be specified by the user resulting in a largish number of edge labels. As a result, it's not feasible for us to create an Edge class for each edge label. The configuration above allows us to use only a single Edge class (the default E) along with a large number of dynamically specified edge labels.
We don't need to create any subclasses of E as we don't care about Edge class inheritance as such, and so the setUseClassForEdgeLabel(false); solution works well.
So as per the above, the following call creates the appropriate Edge
OrientEdge e = g.addEdge(null, outVertex, inVertex, 'someDynamicLabel');
e.setProperty('someProperty', 'val');
This works as expected and I can create a large number edges of the same edge class E but with different labels. This is important for us since we often have a large number of edges going out of a vertex, and the appropriate edge label significantly speeds up traversal since the edges are apparently partitioned by edge label and traversal does not seem to traverse any labels that are not specified in the traversal query.
Now for the question: In other contexts we would like to use the CREATE EDGE Sql command. I would expect that CREATE EDGE is equivalent to g.addEdge(...), but there seems to be no way to use a label with edge class E in CREATE EDGE
So, for example,
CREATE EDGE E set label = 'someDynamicLabel' doesn't work and throws an error. The error makes sense in that I should obviously not be able to set the label property manually since it is reserved by Orient.
However, it seems to me that there should be a way in CREATE EDGE to do what g.addEdge(...) above does. So perhaps, something like:
CREATE EDGE E LABEL = 'someDynamicLabel' SET someProperty = 'val' would probably do the trick.
P.S. If db.addEdge(...) and CREATE EDGE are not meant to be equivalent, it's not clear to me why that would be the case.
Thanks,
--Harish.