Frage

I've discovered recently about OrientDB and I've been playing a little with this tool these past few weeks. However, I noticed today that something seemed to be wrong whenever I added an edge between two vertices. The edge record is not present if I make a query such as SELECT FROM E, this just returns an empty set. In spite of this, it is possible to see the relationship as a property in the nodes, and queries like SELECT IN() FROM V do work.

This poses an issue; if I can't access directly the edge record, I can't modify it with more properties, or even if I could, I wouldn't be able to see the changes made. I thought this could be a design decision for some reason but the GratefulDeadConcerts example database doesn't seem to have this problem.

I'll illustrate my question with an example:

Let's create a graph database in OrientDB from scratch and name it "Test". We'll create a couple of vertices:

CREATE VERTEX SET TEST=123
CREATE VERTEX SET TEST=456

Let's assume the @rid of these nodes are #9:0 and #9:1 respectively, as we haven't changed anything from the default settings. Let's create an edge between them:

CREATE EDGE FROM #9:0 TO #9:1

Now, let's take a look at the output of the query SELECT FROM V:

orientdb {Test}> SELECT FROM V

----+----+----+----+----
#   |@RID|TEST|out_|in_
----+----+----+----+----
0   |#9:0|123 |#9:1|null
1   |#9:1|456 |null|#9:0
----+----+----+----+----

2 item(s) found. Query executed in 0.005 sec(s).

Everything looks right so far. However, the output of the query SELECT FROM E is simply 0 item(s) found. Query executed in 0.016 sec(s).. If we execute SELECT IN() FROM V we get the following:

orientdb {Test}> SELECT IN() FROM V

----+-----+----
#   |@RID |IN
----+-----+----
0   |#-2:1|[0]
1   |#-2:2|[1]
----+-----+----

2 item(s) found. Query executed in 0.005 sec(s).

From this, I assume that the edges are created in cluster number -2, even if the default cluster for the class E is 10, and I haven't added any other clusters. I suspect this has something to do with the problem, but I'm not sure how to fix it. I have tried adding new clusters to the class E and creating the edges in this new cluster, but to no avail, I keep getting the exact same result.

So my question is, how do I make edges records show up in OrientDB?

I'm using OrientDB Community 1.7-RC2 and have tried this in two different machines, one Windows 7 and another one Debian Wheezy.

War es hilfreich?

Lösung

Extracted from https://github.com/orientechnologies/orientdb/wiki/Troubleshooting#why-i-cant-see-all-the-edges:

OrientDB, by default, manages edges as "lightweight" edges if they have no properties. This means that if an edge has no properties, it's not stored as physical record. But don't worry, your edge is still there but encoded in a separate data structure. For this reason if you execute a select from Eno edges or less edges than expected are returned. It's extremely rare the need to have the list of edges, but if this is your case you can disable this feature by issuing this command once (with a slow down and a bigger database size):

alter database custom useLightweightEdges=false
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top