有没有办法 'get' 所有连接的实体及其属性连接到实体的特定实例?

Is there a way to 'get' all connected entities and their attributes connected to a specific instance of an entity?

我想显示实体的特定实例的所有数据点。

我了解如何以特定形式编写查询,但我希望它更通用、更简洁。

这是我目前拥有的:

match 
$t isa technology, has version "v9.5";
$as isa app-server, has database-server $ds, has dot-net-network $dnn, has XXXXXX $x1, has XXXXXX $x2;
$ds isa database-server, has XXXXXX $x3, has XXXXXX $x4;
$r1(container: $t, containee: $as);
$r2(container: $t, containee: $ds);
get; offset 0; limit 30;

还有几个实体连接到我的 container

一般来说,在 Graql 中,我们可以通过在查询中提供较少的约束或将约束更改为更宽松的约束来进行歧义查询。

在您的情况下,我相信您想问一个专门关于实体实例的问题,由这种模式描述:$t isa technology, has version "v9.5";。你想找到它通过关系连接到的实体。然后您希望找到这些连接实体的所有属性,但没有指定这些实体根据模式可能拥有的所有属性类型。

获取相关概念的最通用方法是:

match 
$t isa technology, has version "v9.5";
$r($t, $e);
get $e;

如果您只想连接 实体

match 
$t isa technology, has version "v9.5";
$r($t, $e);
$e isa entity;
get $e;

这是因为您所有的用户定义实体都继承自 entity。您可以对 relationattributething 执行相同的操作,这是所有三个的超类型。

获得一个概念的所有属性的完整答案,是使用相同的主体,给出基本类型attribute:

match 
$t isa technology, has version "v9.5";
$r($t, $e);
$e isa entity, has attribute $a;
get $e, $a;

奖金 然后您可以找到两种模式共有的属性,在本例中是两个 technology 实例:

match
$t1 isa technology, has version "v9.5";
$e1 isa entity, has attribute $a;
$r1($t1, $e1);
$t2 isa technology, has version "v9.6";
$e2 isa entity, has attribute $e;
$r2($t2, $x2);
get $a;