0

我在 pyorient ogm 中创建了类

class Movie(Node):
    element_plural = "Movies"
    title = String(mandatory=True,indexed=True)
    rating = Short()
class Person(Node):
    element_plural = "Person"
    name = String(mandatory=True,indexed=True)
class ACTS_IN(Relationship):
    element_plural = "ACTS"
    name = String()
    out_ = Link(linked_to=Person,mandatory=True)
    in_ = Link(linked_to=Movie,mandatory=True)
class PRODUCED(Relationship):
    element_plural = "Producers"
    out_ = Link(linked_to=Person,mandatory=True)
    in_ = Link(linked_to=Movie,mandatory=True)

如何向演员和制片人返回特定电影的所有详细信息。我应该调用多个查询来获取电影、演员和制片人的详细信息吗?

Select * from Movie where title='Test'

select expand(ine()).in() from Movie where title = 'Test'

它不会像外键一样工作吗?

4

2 回答 2

0

如果您使用的是 orient DB 3.0 或更高版本,请使用以下查询来获取顶点和连接顶点的详细信息

select *, ACTS_IN:{*} as actorDetails, PRODUCED:{*} as producerDetailss from Movie where title= "Test"
于 2018-11-23T06:57:16.270 回答
0

尝试这个:

select title, in("ACTS_IN").name as actors, in("PRODUCED").name as producers from Movie where title= "Test"


希望能帮助到你

问候

于 2018-11-14T23:11:59.313 回答