Salavat2
Salavat2

Reputation: 63

select as an array an OrientDb tree subgraph specific out relations

Exploring OrientDB, I am stuck with the following query: I've a set of classes Package, Library, Application, each with a name as attribute. I've also a class Person with name and email as attributes.

Relations are defined as classes 'require' or 'writtenBy' from E.

Applications vertices may have 'require' edges to one or more Librarys. Librarys vertices may have 'require' edges to one or more Packages. Packages vertices also may have 'require' edges to one or more Packages !

Applications , Librarys, Packages have 'writtenBy' edges to 1 Person; one Person may write several Packages/Library/Application

Given a specific Application/Library or Package rid, I would like to select, as an array, all Persons (name and email) writing its constituents (identified by the 'require' edges) .

I've tried different strategies in OrientDB Studio but can't find a solution. Thanks for any help !

Upvotes: 1

Views: 316

Answers (1)

Salavat2
Salavat2

Reputation: 63

Found it. Traverse is the way to go: the solution is something like:

select expand(writtenBy) from (traverse out('require') from #rid )

Upvotes: 1

Related Questions