简体   繁体   English

Edge记录未显示在OrientDB中

[英]Edges records not showing up in OrientDB

I've discovered recently about OrientDB and I've been playing a little with this tool these past few weeks. 我最近发现了有关OrientDB的信息,最近几周来我一直在使用此工具。 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. 如果执行诸如SELECT FROM E类的查询,则边缘记录不存在,这只会返回一个空集。 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. 尽管如此,仍可以将关系视为节点中的属性,并且像SELECT IN() FROM V这样的查询也可以工作。

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. 我以为出于某些原因这可能是一个设计决定,但是GratefulDeadConcerts示例数据库似乎没有这个问题。

I'll illustrate my question with an example: 我将通过一个例子来说明我的问题:

Let's create a graph database in OrientDB from scratch and name it "Test". 让我们从头开始在OrientDB中创建一个图形数据库,并将其命名为“ 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. 假设这些节点的@rid分别为#9:0和#9:1,因为我们没有更改默认设置。 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 : 现在,让我们看一下查询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). 但是,查询SELECT FROM E的输出仅0 item(s) found. Query executed in 0.016 sec(s). 0 item(s) found. Query executed in 0.016 sec(s). . If we execute SELECT IN() FROM V we get the following: 如果我们SELECT IN() FROM V执行SELECT IN() FROM V得到以下信息:

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. 因此,即使E类的默认群集为10,我也假定在群集编号-2中创建了边,并且我没有添加任何其他群集。 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. 我尝试将新的群集添加到E类并在此新群集中创建边缘,但无济于事,我一直得到完全相同的结果。

So my question is, how do I make edges records show up in OrientDB? 所以我的问题是,如何使边缘记录显示在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. 我正在使用OrientDB Community 1.7-RC2,并已在两台不同的计算机上进行了尝试,一台Windows 7和另一台Debian Wheezy。

Extracted from https://github.com/orientechnologies/orientdb/wiki/Troubleshooting#why-i-cant-see-all-the-edges : 摘自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. 如果没有属性,OrientDB默认情况下会将边缘管理为“轻量级”边缘。 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. 因此,如果您从Eno边执行选择,则返回的边或少于预期的边。 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM