Hi,
I have a problem in the subquery to extract a list of location related to 
each customer.
My graph structure is the following:
create class Customer extends V
create class Location extends V
create class Situated extends E

create vertex Customer set Name = 'Marco'
create vertex Customer set Name = 'Fabio'

create vertex Location set City = 'Genova'
create vertex Location set City = 'Milano'
create vertex Location set City = 'Roma'

create edge Situated from (select from Customer where Name = 'Fabio') to 
(select from Location where City = 'Genova') set Label = 'operational 
headquarters'
create edge Situated from (select from Customer where Name = 'Fabio') to 
(select from Location where City = 'Milano') set Label = 'legal 
headquarters'
create edge Situated from (select from Customer where Name = 'Marco') to 
(select from Location where City = 'Roma') set Label = 'operational 
headquarters'

Using this query:
select Name, $l as Location from Customer let l = (select in_Situated.Label 
as Label, City from Location where in_Situated.out = $parent.$current)

I expect to have a result similar to:
[{
Name: 'Marco',
Location: [
{Label: 'operational headquarters', City: 'Roma'}
]
},
{
Name: 'Fabio',
Location: [
{Label: 'operational headquarters', City: 'Genova'},
{Label: 'legal headquarters', City: 'Milano'}
]
}]

Instead the Location field is repeated for each Customer with the content 
related to a last Customer:
[{
Name: 'Marco',
Location: [
{Label: 'operational headquarters', City: 'Genova'},
{Label: 'legal headquarters', City: 'Milano'}
]
},
{
Name: 'Fabio',
Location: [
{Label: 'operational headquarters', City: 'Genova'},
{Label: 'legal headquarters', City: 'Milano'}
]
}]

Can you help me to understand my syntax error?

My best reguards,
Fabio

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to