Hi,
I am running version 1.7RC.
I have a complex query (maybe I have structured the data wrong in the first
please, I'm not sure) where I'm not getting expected results. Rather than
explain I will show you the SQL and comment as I go.
# Classes
insert into attribute (key, translatable) values ('Height', false),
('Manufacturer', true)
insert into item (key, attribute) values ('GSXR600',[{ 'attribute':#9:0,
'value':500 }])
insert into itemCulture (item, culture, name, attribute) values (#10:3,
#12:0, 'GSX-R600', [ { 'attribute':#9:1, 'value':'Suzuki' } ])
# I want to return a union of all the attributes stored in the item and
itemCulture class
select expand($att)
let $att_culture = (select expand(attribute) from itemCulture where
item.key = 'GSXR600' and culture.name = 'en-us'), $att_item = (select
expand(attribute) from item where key = 'GSXR600'), $att =
unionall($att_culture, $att_item)
# Which returns
{"result":[{"@type":"d","@version":0,"value":{"value":"Suzuki","attribute":"#9:1"}},{"@type":"d","@version":0,"value":{"value":500,"attribute":"#9:0"}}]}
# But what I really want is to return the attribute key and value
select value.attribute.key as attribute, value.value from (select
expand($att))
let $att_culture = (select expand(attribute) from itemCulture where
item.key = 'GSXR600' and culture.name = 'en-us'), $att_item = (select
expand(attribute) from item where key = 'GSXR600'), $att =
unionall($att_culture, $att_item)
# Which returns 0 results
As far as I can tell as soon as I wrap the variable in a nested query it
looses its value. Is this expected behavior? Is there something I should be
doing instead?
Whilst I'm posting I have another question. When I run the command:
insert into item (key, attribute) values ('GSXR600',[{ 'attribute':#9:0,
'value':500 }])
What type is the attribute field? For the purpose of manually creating a
property I am not sure which type to select.
Thanks,
Mat
--
---
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/groups/opt_out.