OrientDB - 显示边和顶点属性
OrientDB - show both edge and vertex properties
我有顶点 class host 和 属性 hostname 和边 class link 和 属性 ports 这是一个列表。
因此主机通过 link 具有端口相互连接。
我需要找出谁连接到一个特定的 'myhost',例如:
host1.hostname -- link1.ports
host2.hostname -- link2.ports
etc
但是,我只能实现:
host1@rid -- ports1
host2@rid -- ports2
查询如下:
select expand(inE(link).include('ports','out*')) from host where hostname = 'myhost'
或者我可以获得主机名和端口列表,但不是很有用:
[host1.hostname, host2.hostname] -- [link1.ports, link2.ports]
select in('link').hostname,inE('link').ports from host where hostname = 'myhost'
在那个查询中放松也不会做这件事。
有什么正确的方法吗?
你试过 Match 语句吗?
https://orientdb.com/docs/2.2/SQL-Match.html
试试这个
match { class: host, as : host1, where: (hostname = "myhost") }
.inE('link'){as: link}
.outV(){as: host2}
return host1.hostname,link.ports, host2.hostname
我有顶点 class host 和 属性 hostname 和边 class link 和 属性 ports 这是一个列表。
因此主机通过 link 具有端口相互连接。
我需要找出谁连接到一个特定的 'myhost',例如:
host1.hostname -- link1.ports
host2.hostname -- link2.ports
etc
但是,我只能实现:
host1@rid -- ports1
host2@rid -- ports2
查询如下:
select expand(inE(link).include('ports','out*')) from host where hostname = 'myhost'
或者我可以获得主机名和端口列表,但不是很有用:
[host1.hostname, host2.hostname] -- [link1.ports, link2.ports]
select in('link').hostname,inE('link').ports from host where hostname = 'myhost'
在那个查询中放松也不会做这件事。
有什么正确的方法吗?
你试过 Match 语句吗?
https://orientdb.com/docs/2.2/SQL-Match.html
试试这个
match { class: host, as : host1, where: (hostname = "myhost") }
.inE('link'){as: link}
.outV(){as: host2}
return host1.hostname,link.ports, host2.hostname