2019-11-08
OrientDb select property together with flatten function
stackoverflow
Question

In an OrientDb graph database, trying to get some information about Vertex, Edge pairs.

For example, consider the following case:

V1 ---E1---> V2
   ---E2---> V3 --E3--> V2

I would like to have as result the following 3 rows;

V1, E1
V1, E2
V3, E3

I've tried the following:

select label, flatten(out.label) from V
select label from (select flatten(out) from V)
select label, flatten(out) from V
select flatten(out) from V
select $current, label from (traverse out from V while $depth <= 1) where $depth = 1

But none of these solutions seem to return what I want. How can I return Vertex, Edge pairs?

Answer
1

The CYPHER syntax, as used in Neo4j finally rescued me.

start n=node(*) MATCH (n)-[left]->(n2)<-[right]-(n3) WHERE n.type? ='myType' AND left.line > right.line - 1 AND left.line < right.line + 1 RETURN n, left, n2, right, n3

The node n is the pivoting element, on wich an filter can be provided, just as on each other step within the path. For me it was important to select a further step depending on an other part of the path.

With OrientDb I couldnt find a way to relate the properties to each other easily.

OrientDb select property together with flatten function
See more ...