如何在orientDb中查询带边的类?
How to query classes with edges in orient Db?
我的问题是,如何查询“聊天”table 以检索个人资料 Table 中的人员详细信息。
ParticipatinIn
edge 从 Person 开始聊天。
HasProfile
Edge 开始了个人资料。
请帮我解决这个问题..
谢谢
使用此架构:
试试这个:
select name, in('HasProfile').name as Person, in('HasProfile').out('ParticipatingIn').name as Chat from Profile
这是输出:
如果您不喜欢看到括号,可以使用展开命令:
select name, in('HasProfile').name as Person, in('HasProfile').out('ParticipatingIn').name as Chat from Profile unwind Person,Chat
这是输出:
更新
select name, in('ParticipatingIn').name as Person, in('ParticipatingIn').out('HasProfile').name as Profile from Chat
更新 2
traverse * from Chat
希望对您有所帮助
此致。
我用过这个结构
您可以使用这样的查询:
select name, person.name, person.out("hasProfile").name as profile from (select name, in('ParticipatinIn') as person from Chat unwind person) unwind profile
如果你使用遍历,如果一个人是两个不同聊天的一部分,你只会得到那个人一次。
希望对您有所帮助。
我的问题是,如何查询“聊天”table 以检索个人资料 Table 中的人员详细信息。
ParticipatinIn
edge 从 Person 开始聊天。
HasProfile
Edge 开始了个人资料。
请帮我解决这个问题..
谢谢
使用此架构:
试试这个:
select name, in('HasProfile').name as Person, in('HasProfile').out('ParticipatingIn').name as Chat from Profile
这是输出:
如果您不喜欢看到括号,可以使用展开命令:
select name, in('HasProfile').name as Person, in('HasProfile').out('ParticipatingIn').name as Chat from Profile unwind Person,Chat
这是输出:
更新
select name, in('ParticipatingIn').name as Person, in('ParticipatingIn').out('HasProfile').name as Profile from Chat
更新 2
traverse * from Chat
希望对您有所帮助
此致。
我用过这个结构
您可以使用这样的查询:
select name, person.name, person.out("hasProfile").name as profile from (select name, in('ParticipatinIn') as person from Chat unwind person) unwind profile
如果你使用遍历,如果一个人是两个不同聊天的一部分,你只会得到那个人一次。
希望对您有所帮助。