orientechnologies / orientdb-gremlin Goto Github PK
View Code? Open in Web Editor NEWTinkerPop3 Graph Structure Implementation for OrientDB
License: Apache License 2.0
TinkerPop3 Graph Structure Implementation for OrientDB
License: Apache License 2.0
Hi all,
I am testing the couple orientdb-gremlin and gremlin-scala in production environment and I am experimenting data loss after some time. OrientDB is logging exceptions about unknown sessions :
com.orientechnologies.common.io.OIOException: Found unknown session 6
at com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.onBeforeRequest(ONetworkProtocolBinary.java:240)
at com.orientechnologies.orient.server.network.protocol.binary.OBinaryNetworkProtocolAbstract.execute(OBinaryNetworkProtocolAbstract.java:214)
at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:77)
So what is the best way to manage connection to OrientDB ?
Hi,
sorry for creating a github issue. I was not sure how to approach it.
Is there a roadmap for the project? Are you planning on upgrading to OrientDB 2.2 any time soon?
Thanks
Hi,
I am a bit confused with regards to how orient is handling the tx()
method. Specifically, if I do the following:
OrientGraphFactory factory = new OrientGraphFactory("memory:myGraph");
OrientGraph graph = factory.getNoTx();
graph.createVertexClass("TYPE");
graph.createVertexClass("ANOTHER_TYPE");
graph.commit();
graph = factory.getNoTx();
graph.addVertex("TYPE");
graph.commit();
graph.addVertex("ANOTHER_TYPE");
graph.commit();
Everything appears to work. If I change the second graph = factory.getNoTx();
to graph = factory.getTx();
, then it fails.
Similarly if I make the 2nd to last commit graph.tx().commit();
it fails again. In all cases it fails with this error:
Caused by: com.orientechnologies.orient.core.exception.OSchemaException: Cannot change the schema while a transaction is active. Schema changes are not transactional
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.saveInternal(OSchemaShared.java:1202)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.releaseSchemaWriteLock(OSchemaShared.java:634)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.releaseSchemaWriteLock(OSchemaShared.java:623)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.doCreateClass(OSchemaShared.java:1045)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.createClass(OSchemaShared.java:407)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.createClass(OSchemaShared.java:392)
at com.orientechnologies.orient.core.metadata.schema.OSchemaProxy.createClass(OSchemaProxy.java:100)
at org.apache.tinkerpop.gremlin.orientdb.OrientGraph.createClass(OrientGraph.java:552)
... 37 more
Also it looks like the tx()
method is creating a new transaction. Is this really the case ? For my implementation I need to use the Tinkerpop defined graph.tx().commit()
I can't use the orient specific graph.commit()
.
In essence I would like to be able to do
graph = factory.create();
//Add some vertices and edges
graph.tx().commit();
//Add some more vertices and edges
graph.tx().commit();
Is there anyway to achieve this sort of behaviour using orientdb ?
Hello guys,
thank you for great work on integrating Gremlin with OrientDB!
Any ideas when orientdb-gremlin will support Composite index query?
Give a composite index:
CREATE INDEX simple_composit_index ON Edge (from, to) UNIQUE
Following query failes:
graph.E.hasLabel("Edge").has(Key[String]("from"), fromValue).has(Key[String]("to"), toValue)
With message:
Impossible add as key of a CompositeIndex a value of type class java.lang.String
Stacktrace:
at com.orientechnologies.orient.core.index.OCompositeCollate.transform(OCompositeCollate.java:62) ~[orientdb-core-2.2.8.jar:2.2.8]
at com.orientechnologies.orient.core.index.OIndexAbstract.getCollatingValue(OIndexAbstract.java:919) ~[orientdb-core-2.2.8.jar:2.2.8]
at com.orientechnologies.orient.core.index.OIndexOneValue.get(OIndexOneValue.java:47) ~[orientdb-core-2.2.8.jar:2.2.8]
at com.orientechnologies.orient.core.index.OIndexOneValue.get(OIndexOneValue.java:40) ~[orientdb-core-2.2.8.jar:2.2.8]
at com.orientechnologies.orient.core.index.OIndexAbstractDelegate.get(OIndexAbstractDelegate.java:58) ~[orientdb-core-2.2.8.jar:2.2.8]
at com.orientechnologies.orient.core.index.OIndexTxAwareOneValue.get(OIndexTxAwareOneValue.java:261) ~[orientdb-core-2.2.8.jar:2.2.8]
at com.orientechnologies.orient.core.index.OIndexTxAwareOneValue.get(OIndexTxAwareOneValue.java:41) ~[orientdb-core-2.2.8.jar:2.2.8]
at org.apache.tinkerpop.gremlin.orientdb.OrientGraph.lookupInIndex(OrientGraph.java:295) ~[orientdb-gremlin-3.2.1.1.jar:?]
at org.apache.tinkerpop.gremlin.orientdb.OrientGraph.lambda$null$7(OrientGraph.java:286) ~[orientdb-gremlin-3.2.1.1.jar:?]
at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:267) ~[?:1.8.0_60]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_60]
at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[?:1.8.0_60]
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:1.8.0_60]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_60]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_60]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_60]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_60]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_60]
at org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.elements(OrientGraphStep.java:89) ~[orientdb-gremlin-3.2.1.1.jar:?]
at org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.edges(OrientGraphStep.java:51) ~[orientdb-gremlin-3.2.1.1.jar:?]
at org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.lambda$new$0(OrientGraphStep.java:39) ~[orientdb-gremlin-3.2.1.1.jar:?]
at org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep.processNextStart(GraphStep.java:136) ~[gremlin-core-3.2.1.jar:3.2.1]
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:128) ~[gremlin-core-3.2.1.jar:3.2.1]
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:38) ~[gremlin-core-3.2.1.jar:3.2.1]
at org.apache.tinkerpop.gremlin.process.traversal.Traversal.fill(Traversal.java:146) ~[gremlin-core-3.2.1.jar:3.2.1]
at org.apache.tinkerpop.gremlin.process.traversal.Traversal.toList(Traversal.java:103) ~[gremlin-core-3.2.1.jar:3.2.1]
at gremlin.scala.GremlinScala.toList(GremlinScala.scala:28) ~[gremlin-scala_2.11-3.2.1.0.jar:3.2.1.0]
at gremlin.scala.GremlinScala.headOption(GremlinScala.scala:37) ~[gremlin-scala_2.11-3.2.1.0.jar:3.2.1.0]
at gremlin.scala.GremlinScala.exists(GremlinScala.scala:41) ~[gremlin-scala_2.11-3.2.1.0.jar:3.2.1.0]
Hello Again,
Is there a way to know if a Vertex or Edge has been modified?
For example TitanDB has TitanVertex#isModified()
. Is there anything similar ? I can't find anything in OrientVertex
or OrientElement
.
Can anyone point me as to how I may implement this if needs be?
Thanks,
Filipe
Currently graph.tx()
is not implemented.
I'll take a look at this. I wrote a TP3 wrapper for OrientDB 2.1.x that supports transactions but a wrapper is always a bit slower and very ugly ;)
I wasn't sure whether to open this here or on gremlin-scala, but I think this is specific to orient serialization.
If I have a case class Foo
with a Map[String, String]
field:
case class Foo(m: Map[String, String])
and try to add it to a remote OrientGraph
:
val graph: OrientGraph = GraphHelper.getPersistentGraph() // connect to remote orientdb
graph + Foo(Map("hello" -> "world"))
Orient will spit out a huge stack trace... the relevant bit seems to be
Caused by: com.orientechnologies.orient.core.exception.ODatabaseException: Error on deserialization of Serializable
at com.orientechnologies.orient.core.serialization.serializer.record.binary.OSerializableWrapper.fromStream(OSerializableWrapper.java:47)
at com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializerBinaryV0.readSingleValue(ORecordSerializerBinaryV0.java:384)
... 13 more
Caused by: java.lang.ClassNotFoundException: scala.collection.immutable.Map$Map1
This looks like the orient client lib is serializing the scala Map
to a byte stream, but the remote orient server chokes because it doesn't know about scala...
I can also get it to die client-side if I make a vertex class for Foo
and set the field to be an EMBEDDEDMAP
, although then it fails because the scala map doesn't implement java.util.Map
I've been working around this with a custom gremlin-scala marshaller, where I pull the m
field out of the valueMap
and convert to/from a java.util.HashMap
Is this just a fundamental limitation of orient's serializer, or is there a correct way to do this? The only other workaround I can come up with is just using a java.util.Map
as the field type in my case classes, and providing accessors to convert to/from scala collections.
Thanks, and sorry in advance if this is a problem with orient / scala instead of this driver (which is excellent, btw)
In relation to the gitter conversation, it appears creating an index on T.label
causes vertices to "disappear" from traversals on T.label
.
This is relevant when e.g. using gremlin-scala
to traverse all vertices of a given class.
Example code for reproducing the problem in below:
import com.orientechnologies.orient.core.metadata.schema.OType
import org.apache.commons.configuration.BaseConfiguration
import org.apache.tinkerpop.gremlin.orientdb.OrientGraphFactory
import org.apache.tinkerpop.gremlin.structure.T
object VerticesBGoneApp extends App {
val TestLabel = "Test"
val g = new OrientGraphFactory("plocal:./testdb").getTx
val vertex = g.addVertex(T.label, TestLabel)
println(g.database().browseClass(s"v_$TestLabel").next) //prints raw document
println(g.traversal().V().has(T.label, TestLabel).toList) //prints the labeled vertex
createIndexOnLabel(TestLabel)
println(g.database().browseClass(s"v_$TestLabel").next) //raw document still here
println(g.traversal().V().toList) //this is also non-empty
println(g.traversal().V().has(T.label, TestLabel).toList) //but *this* is now empty
private def createIndexOnLabel(className: String) = {
val key = T.label.getAccessor
val config = new BaseConfiguration()
config.setProperty("keytype", OType.STRING)
if (!g.getVertexIndexedKeys(className).contains()) {
g.createVertexIndex(key, TestLabel, config)
}
}
}
Is case class mapping (like in gremlin-scala) supported / on the roadmap?
The API looks like it's possible, but during compile the following error occures:
Error:(19, 19) not found: value <none>
val v = graph + example
The following test reproduces the behavior (more or less c&p from gremlin-scala readme):
import gremlin.scala._
import org.apache.tinkerpop.gremlin.orientdb.OrientGraphFactory
import org.scalatest.{FlatSpec, Matchers}
class CaseClassSpec extends FlatSpec with Matchers {
"OrientDb-Gremlin" should "be able to Marshall case-classes" in {
case class Example(id: Option[Int],
longValue: Long,
stringValue: Option[String])
val graph = new OrientGraphFactory("memory:test").getNoTx.asScala
val example = Example(None, Long.MaxValue, Some("optional value"))
val v = graph + example
v.toCC[Example] // equal to `example`, but with id set
// find all vertices with the label of the case class `Example`
graph.V.hasLabel[Example]
// modify the vertex like a case class
v.updateAs[Example](_.copy(longValue = 0L))
}
}
A new release is out and we need to catch up
https://github.com/apache/tinkerpop/blob/3.2.3/CHANGELOG.asciidoc#release-3-2-3
The implementation now will fail if the edge is a lightweight edge. Some configuration of a lightweight
flag should be introduced and traverse of edge should take it into consideration.
Some changes below seems work:
// OrientVertex.java, :65
if (fieldValue instanceof ORidBag) {
if (graph.isLightWeightEdge()) { // light weight branch
streamVertices.add(asStream(((ORidBag) fieldValue).rawIterator())
.map(oIdentifiable -> new OrientVertex(graph, oIdentifiable)));
} else { // original
streamVertices.add(asStream(((ORidBag) fieldValue).rawIterator())
.map(oIdentifiable -> new OrientEdge(graph, oIdentifiable.getRecord()))
.map(edge -> edge.vertices(direction.opposite()))
.flatMap(vertices -> asStream(vertices)));
}
}
Any suggestion?
We do need to enable sbt test on travis CI.
Gremlin 3.2.2 introduced graphson v2
https://github.com/apache/tinkerpop/blob/3.2.2/CHANGELOG.asciidoc#release-3-2-2
We need to implement support for this.
Currently the tests that check for it are disabled.
Removing this shall run unit tests for it
https://github.com/mpollmeier/orientdb-gremlin/blob/master/driver/src/test/java/org/apache/tinkerpop/gremlin/orientdb/gremlintest/OrientGraphProvider.java#L55
We are a few releases behind, would be nice to bring the latest and greatest into action.
Hello,
I am trying to build requests for a DB of around 10 millions edges.
I was surprised to see requests such as graph.traversal.E().hasNext() or graph.traversal.E().limit(1).toList() stuck until the memory is saturated: it appears these requests launch a full load of the database.
So my question: am I writing the requests correctly, especially with regards to how many edges or vertices are loaded in memory for a given request, since the DB does not fit in the available memory ?
Any advice helping to solve this issues would be more than welcome :)
Erwan
Would be really nice to have travis CI, shippable, circle CI, appvovey, or anything that build this project upon pull request
I am creating a class and index as follows:
create class V_Entity extends V;
create property V_Entity.entityId STRING;
create property V_Entity.entityType STRING;
create index entity_index ON V_Entity (entityId, entityType) UNIQUE;
Then using the 3.2.3 driver via Gremlin console (connecting to 2.2.17 OrientDB server), I do:
t.addV("Entity").property("entityId", "entity1").property("entityType", "blah")
Doing any of:
t.V().hasLabel("Entity").has("entityId", "entity1")
t.V().has("entityType", "blah")
.V().hasLabel("Entity").has("entityId", "entity1").has("entityType", "blah")
returns the vertex, however:
t.V().hasLabel("Entity").has("entityType", "blah")
t.V().hasLabel("Entity").has("entityType", "blah").has("entityId", "entity1")
does not.
Worse, when running in Java I am getting duplicate record problems, which I think is because the code is not finding the existing vertex due to the above, and is then trying to create rather than update it.
I have discovered that adding an additional index:
create index type_index ON V_Entity (entityType) NOTUNIQUE;
appears to work around the problem, although I'd feel better if I understood why.
Hey @mpollmeier,
What is this getIndexedVertices() do we have any use case for it?
We do have it implemented, but right now is not tested.
Basically we need to remove OrientVertexFeatures.supportsRemoveVertices()
https://github.com/mpollmeier/orientdb-gremlin/blob/master/driver/src/main/java/org/apache/tinkerpop/gremlin/orientdb/ODBFeatures.java#L60
But them, tests enter in an infinite loop!
When executing in a multi-threaded environment I get errors from calls into OrientGraph.getIndexManager()
Adding makeActiveDb() to the method fixed the problem locally for me.
Please update references to "TinkerPop" or "TP3" to include the prefix of "Apache" so as to acknowledge Apache trademarks. I can offer a pull request if you'd like me to help out (simple change to README - just let me know) but the GitHub project description would be something to update on your end obviously.
In OrientGraphStep.findIndex()
, since values iterator is created before class labels loop, it is iterated only for the first label and, for all the others, full index is queried from the DB.
Hi,
I am using your driver via gremlin-scala
, remove
is not implemented. Would you please let me know if there is any other way to delete a vertex?
Thanks
I have several classes in my OrientDB database but using 3 classes for this example (ClassA, ClassB and ClassC), in a tree like relationship. There are 13K vertices in the DB of which 2K are ClassA, 2K are ClassB and 2K ClassC. I want to query for all dependencies of ClassA, so I started by creating the following piece of code:
GraphTraversal<Vertex, Vertex> query = g
.V()
.hasLabel("ClassA")
.in("ClassA_ClassB")
.in("ClassB_ClassC")
;
while (query.hasNext()) {
Object next = query.next();
System.out.println(next);
}
This piece of code prints all the ClassC as expected but it takes quite a long of time. About 3 seconds to return the 2K ClassC vertices. I also get the following message in the logs:
WARNING: scanning through all vertices without using an index for Traversal [OrientGraphStep(vertex,[~label.eq(ClassA)])....
Apparently the query is not hitting any index. I thought the method hasLabel would be able to use @Class to filter down the vertices to hit based on the type. Is this a correct use of the hasLabel() method? Do you have any suggestion about how to improve the performance of such a query?
environment:
OrientDB 2.1.15 (localhost)
gremlin-scala 3.1.2-incubating.0
orientdb-gremlin 3.1.1-incubating.1
When I traverse on indexed properties, got this exception:
java.lang.ClassCastException: com.orientechnologies.orient.core.record.impl.ODocument cannot be cast to com.orientechnologies.orient.core.id.ORecordId
(full stack trace is below)
graphDB.withGraph { graph =>
graph.V.hasLabel("MyLabel")
.has("indexedProperty", "some-value")
.headOption()
everything is fine if I try same query after removing index from "indexedProperty",
What I have to do?
I really want to use scala - gremlin - orientDB stack.
java.lang.ClassCastException: com.orientechnologies.orient.core.record.impl.ODocument cannot be cast to com.orientechnologies.orient.core.id.ORecordId
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1540)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.vertices(OrientGraphStep.java:60)
at org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.lambda$new$0(OrientGraphStep.java:40)
at org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep.processNextStart(GraphStep.java:123)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:140)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(ExpandableStepIterator.java:54)
at org.apache.tinkerpop.gremlin.process.traversal.step.map.MapStep.processNextStart(MapStep.java:36)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:140)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(ExpandableStepIterator.java:54)
at org.apache.tinkerpop.gremlin.process.traversal.step.map.MapStep.processNextStart(MapStep.java:36)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:140)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(ExpandableStepIterator.java:54)
at org.apache.tinkerpop.gremlin.process.traversal.step.map.MapStep.processNextStart(MapStep.java:36)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:126)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:37)
at org.apache.tinkerpop.gremlin.process.traversal.Traversal.fill(Traversal.java:147)
at org.apache.tinkerpop.gremlin.process.traversal.Traversal.toList(Traversal.java:104)
at gremlin.scala.GremlinScala.toList(GremlinScala.scala:28)
at gremlin.scala.GremlinScala.headOption(GremlinScala.scala:37)
at models.dao.PasswordInfoDao$$anonfun$update$1$$anonfun$apply$4.apply(PasswordInfoDao.scala:43)
at models.dao.PasswordInfoDao$$anonfun$update$1$$anonfun$apply$4.apply(PasswordInfoDao.scala:36)
at services.GraphDB.withGraph(GraphDB.scala:57)
at models.dao.PasswordInfoDao$$anonfun$update$1.apply(PasswordInfoDao.scala:36)
at models.dao.PasswordInfoDao$$anonfun$update$1.apply(PasswordInfoDao.scala:33)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:39)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:405)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Hi,
As it is right now, does match step works?
http://tinkerpop.incubator.apache.org/docs/3.0.1-incubating/#match-step
If not, any pointers in case I decide to make it happen?
Thanks,
Marvin
Right now, we are skipping the following GraphTest tests:
shouldNotMixTypesForGettingSpecificEdgesWithStringFirst
shouldNotMixTypesForGettingSpecificEdgesWithEdgeFirst
shouldNotMixTypesForGettingSpecificVerticesWithStringFirst
shouldNotMixTypesForGettingSpecificVerticesWithVertexFirst
We must either handle this or get in touch with gremlin folks and add a new feature for this.
Hi, I notice that there are high cost of first query using OrientGraphFactory.
OrientGraph g = factory.getNoTx();
List<Object> list = g.traversal().V()...toList();
g.close();
First query will exceed 100ms in my test,
getNoTx
cost 517ms
g.traversal().V()...toList()
cost 266ms.
How can I improve the performance?
I'm just getting started with tinkerpop and orientdb. I've been trying to install this plugin using:
:install com.michaelpollmeier orientdb-gremlin 3.2.3.0
in the latest console (3.2.4) and getting dependency conflicts, so I'm guessing I need to downgrade to gremlin 3.2.3?
Hi Guys,
Are there any plans to support createThreadedTx() ?
For my project I need to be able to give one thread multiple transactions and I can't find a way to do this using orientdb.
Thanks
I have several times run into a NullPointerException on OrientEdge:48. The rawDocument comes back null and throws the NPE on rawDocument.getClassName(). I'm not sure what's causing the issue. Inspecting the database shows no issues and the queries will work for a time until suddenly they do not and will consistently throw NPEs until the database is reset.
Version is v3.2.3.0 against OrientDB server v2.2.10.
Probably a mistake from my end, however, I really couldn't find a way to delete an edge between two vertices. Having the two vertices ID's known, it should be trivial to just look into the edge, get it's ID and dropping it. and couldn't find any pointers in the examples for such a process.
Is it just a missing functionality, where I cannot locate an edge with the vertices known? or am I just missing the point here.
Thanks for the help in advance!
Would you please release the new version of this library since the latest gremlin-scala now depends on gremlin 3.2.0 and so is incompatible with orientdb-gremlin 3.1.1.
Hi,
I'm trying to persist a case class containing several other case classes. TinkerGraph tests work alright whereas when switching to OrientGraph causes a
com.orientechnologies.orient.core.exception.ODatabaseException: Error on deserialization of Serializable
...
Caused by: java.lang.ClassNotFoundException: ...
Seems that in org.apache.tinkerpop.gremlin.orientdb.OrientElement#property(java.lang.Object...) the property is passed on as-is to the ODocument without mapping it first to another ODocument.
During import of an entire graph from my old titan based service, incurred into this exception:
java.lang.IllegalArgumentException: com.orientechnologies.orient.core.exception.OSchemaException: Invalid class name found. Character '.' cannot be used in class name 'E_notify.mail'
DB name="sp"
at org.apache.tinkerpop.gremlin.orientdb.OrientGraph.createClass(OrientGraph.java:562)
at org.apache.tinkerpop.gremlin.orientdb.OrientGraph.createClass(OrientGraph.java:551)
at org.apache.tinkerpop.gremlin.orientdb.OrientGraph.createEdgeClass(OrientGraph.java:540)
at org.apache.tinkerpop.gremlin.orientdb.OrientEdge.createRawElement(OrientEdge.java:60)
at org.apache.tinkerpop.gremlin.orientdb.OrientEdge.<init>(OrientEdge.java:36)
at org.apache.tinkerpop.gremlin.orientdb.OrientVertex.addEdge(OrientVertex.java:153)
at org.apache.tinkerpop.gremlin.process.traversal.step.map.AddEdgeStep.map(AddEdgeStep.java:92)
at org.apache.tinkerpop.gremlin.process.traversal.step.map.AddEdgeStep.map(AddEdgeStep.java:47)
at org.apache.tinkerpop.gremlin.process.traversal.step.map.MapStep.processNextStart(MapStep.java:37)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143)
at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.hasNext(DefaultTraversal.java:179)
at org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.handleIterator(AbstractOpProcessor.java:88)
at org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor.lambda$evalOpInternal$4(AbstractEvalOpProcessor.java:248)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$2(GremlinExecutor.java:298)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.orientechnologies.orient.core.exception.OSchemaException: Invalid class name found. Character '.' cannot be used in class name 'E_notify.mail'
DB name="sp"
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.createClass(OSchemaShared.java:370)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.createClass(OSchemaShared.java:363)
at com.orientechnologies.orient.core.metadata.schema.OSchemaProxy.createClass(OSchemaProxy.java:95)
at org.apache.tinkerpop.gremlin.orientdb.OrientGraph.createClass(OrientGraph.java:560)
... 17 more
We are evaluating the use of orientdb as backend of tinkerpop-gremlin-server, so our question is:
can this "limitation" be removed in future versions ?
Moving the whole discussion onto github - here's the email summary so far between @velo @mikkelspring @lvca and myself
On 11/23/2015 10:22 AM, Marvin Froeder wrote:
But then how would I replace the value? I would need to delete it first
and add again?IMHO, having the driver behaving like OrientDB default behavior is more
intuitive.On Sun, Nov 22, 2015 at 4:36 AM, Luca Garulli <[email protected]
mailto:[email protected]> wrote:Hi Marvin, If you call ODocument.field("test", "A"); twice the value is replaced. Thats's why my previous idea to store not the value but a structure that can handle multiple values. See my previous email with a couple of solutions. Best Regards, Luca Garulli Founder & CEO OrientDB <http://orientdb.com/> On 20 November 2015 at 22:31, Marvin Froeder <[email protected] <mailto:[email protected]>> wrote: Hi Michael, Did you prototype anything for (2)? I think we could also tie it to some code generation tooling to create a java class with all functions someone has. For instance I have a few javascript functions that I added that are not part of vanilla OrientDB. On Fri, Nov 20, 2015 at 10:06 AM, Michael Pollmeier <[email protected] <mailto:[email protected]>> wrote: Hi Luca, Thank you. It was awesome to see this evolve from the POC into it's current shape. A lot of the work was done by Marvin (on cc) and some of my colleagues here. Those additional features are the current opt-out areas - as you say they could be supported by Orient, but as none of us had the need, we didn't implement it yet. Variables are just a Map<String, Object> on the graph: http://tinkerpop.incubator.apache.org/docs/3.0.2-incubating/#_graph_variables We currently use Orient only for small scale applications at this stage, but we were thinking about performance quite a bit the last days. Here's our thoughts at this point: 1) Compile the traversal to orient sql. Currently we use the internal api to get documents and fields. How hard do you think that is? Is there already some translation of the internal documents/field to orient sql that we could reuse? 2) Support orient functions so that they can be used natively in the traversal. E.g. we could add the set of standard functions in the driver as a normal java function of type e.g. `(Number, Number) -> Number` for something like `sum`. Users could then just plug them into the traversal. 3) Improve index support - currently it just takes the first index it finds for a given class/field. Thoughts? Cheers Michael On 11/19/2015 06:12 PM, Luca Garulli wrote: Hi Michael, I read your message in TP mailing list. Wow, that's impressive! I was looking at your implementation and I see many features are not supported like the following that can be supported by OrientDB: public boolean supportsRemoveVertices() { return false; } public boolean supportsMultiProperties() { return false; } public boolean supportsMetaProperties() { return false; } public boolean supportsPersistence() { return false; } I missed the concept of Variable. What's that? public static class OrientVariableFeatures implements Features.VariableFeatures{} Last, do you compile the TP query in OrientDB SQL? Best Regards, Luca Garulli Founder & CEO OrientDB <http://orientdb.com/>
Tinkerpop Documentation says a property may have more than one value (http://tinkerpop.apache.org/docs/current/reference/#vertex-properties).
Just as an example: this works on gremlin console:
graph = TinkerGraph.open();
g = graph.traversal();
v = graph.addVertex("User");
v.property("name", "New with list prop");
v.property(list, "prop1", "value 1");
v.property(list, "prop1", "value 2");
g.V().has("prop1", "value 1").has("prop1", "value 2").values("name")
When using orientdb-gremlin it will override "value1" and keep only the last value, invalidating the query.
I tried using v.property("prop1", Arrays.asList("value1", "value2")) and indeed it saved the values in the database, but then you can't query using only one of the values.
Hi, is it possible to make a query that gives back all vertices of specified class?
There is a graph.getVerticesOfClass("xxx")
method availible in current orientd graph api but not in this backend.
Also I have found following snippets:
graph.V.has("@class","xxx")
graph.V.hasLabel("class:xxx")
but they're not working either.
Thanks for help :)
Edit:
Now i see, that I can use hasLabel
stripping first two characters of my class, because of prefixes used by you(V_, E_). Is there any way of configuration, so I can disable these prefixes?
Moreover such call rise a warning
WARNING: scanning through all vertices without using an index for Traversal [OrientGraphStep(vertex,[~label.eq(x)])]
graph.getVerticesOfClass("xxx")
doesn't have such problem. Should I add some index manually?
@mpollmeier ain't time for a new release?
I was thinking of changing the ID type to a String (it's ORecordId at the moment)
My reasoning is that if people decide to have the vertex IDs in their domain classes (which represent a vertex), then Orient's types don't leak into the domain entity (if they are Strings). And it's easy to convert a String back into a ORecordId in the driver.
On the other side, @mourednik remarked (rightly so) that it's a bad idea to use the vertex id inside your domain entity anyway, as they are just technical database ids. Instead you should use your own id for this, which you index and maintain separately.
@velo do you have an opinion on this?
Hello Again,
I have another problem. The following code fails:
final String labelVertex = "VertexLabel";
OrientGraph graph = new OrientGraphFactory("memory:myGraph").getNoTx();
Vertex v1 = graph.addVertex(labelVertex);
graph.tx().commit();
v1 = graph.traversal().V().next();
Vertex v2 = graph.addVertex(labelVertex);
GraphTraversal<Vertex, Edge> traversal =graph.traversal().V(v2.id()).outE().as("edge").otherV().hasId(v2).select("edge");
traversal.hasNext();
but if I change graph.tx().commit();
to graph.commit();
it works.
The reason appears to be that the former approach results in v2
having a temporary negative id of -2
, while the latter approach appears to result in a normal id.
The negative id results in the traversal failing. Is this intentional ? Can someone explain why the one approach assigns temporary negative ids after commit while the other approach doesn't ?
Hi Guys,
I have noticed that in order to create an index you have to do the following:
BaseConfiguration indexConfig = new BaseConfiguration();
indexConfig.setProperty(KEY_TYPE, otype);
indexConfig.setProperty(UNIQUE, "UNIQUE");
graph.createVertexIndex("property", "label1", indexConfig);
graph.createVertexIndex("property", "label2", indexConfig);
This would make the following traversal faster:
graph.traversal().V().hasLabel("label1").has("property", "a thing");
I have the problem that sometimes I don't know my exact label. Ideally I would like to do the following:
graph.traversal().V().hasLabel("label1", "label2").has("property", "a thing");
However, when I do that I see the indices are no longer used. Is there anyway to use the index across multiple labels ? Or can I index something without specifying the label ?
Thanks once again for your help.
2.2.0 has been released a couple of days ago. Are there any plans to upgrade?
Hi guys,
Any chances for getting a release of orient-gremlin with OrientDB 2.1.17?
Thanks!
Hi Guys,
I create indices the following way:
graph.createVertexIndex("prop1", "label1", indexConfig);
graph.createVertexIndex("prop2", "label1", indexConfig);
graph.createVertexIndex("prop1", "label2", indexConfig);
graph.createVertexIndex("prop2", "label2", indexConfig);
The problem is that when I create vertices I am not guaranteed to fill every property for every vertex immediately. For example I could create the following:
Vertex v1 = graph.addVertex("label1");
Vertex v2 = graph.addVertex("label1");
Vertex v3 = graph.addVertex("label1");
v1.property("prop1", "A");
v1.property("prop2", "B");
v2.property("prop1", "C");
v3.property("prop1", "D");
When I try to commit I get the following error:
com.orientechnologies.orient.core.storage.ORecordDuplicatedException: Cannot index record V_label1: found duplicated key 'null' in index 'V_label1.prop2' previously assigned to the record #81:0
If I add the following to the above:
v2.property("prop2", "E");
v3.property("prop2", "F");
It then works.
Is there a way around this limitation? Currently I just prefill all vertex properties with garbage values but this feels odd.
Thanks guys.
Rultor gives on simple means to do releases...
That way, I could create releases as well =D
Hi,
i'm currently trying to import the project (master@d0e14e1c) in my Eclipse IDE (Linux,Neon) but some imports can't be resolved:
import org.apache.tinkerpop.gremlin.structure.FeatureSupportTest.GraphFunctionalityTest;
mvn clean package -DskipTests works fine
I'm not sure why this is not working. Any idea?
I understand that the classes are part of gremlin-test-2.3.2.jar but it seems that the jar is somehow being excluded from the maven eclipse project.
Hi Guys
i've started to work in the develop branch, i'm refactoring the code in order to use
the new MultiModel API that the Core of OrientDB will offer in 3.0. I've stumble upon the current
default labels convention
https://github.com/orientechnologies/orientdb-gremlin#labels-and-classes
I was able to make all the tests works with the new API, but i have to to configure this
CONFIG_LABEL_AS_CLASSNAME
to true
by default, since the new APIs does not work with this conventions.
Can we remove this convention ? i guess everything will blow up :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.