If you are using the graph database you can do the following:
create class person extends V
create class animal extends V
create class animals extends E
create vertex animal set name='Max',species='dog'
create vertex animal set name='Lulu',species='cat'
create vertex animal set name='zigzag',species='snake'
create vertex person set name="John"
create edge animals from ( select from person ) to ( select from animal
where name in ["Max","Lulu"] )
select @rid as animal_rid, in('animals')[0].name, name from animal
----+-----+----------+----+------
# |@RID |animal_rid|in |name
----+-----+----------+----+------
0 |#-2:1|#13:1 |John|Max
1 |#-2:2|#13:2 |John|Lulu
The @RID is not a real rid but you can get it from the @rid field.
in('animals') is a function that follows the in_animals property on the
record and results in a collection. You can get the first item in the
collection using [0] (note the "first" function should also work but
unfortunately using it limits the results to one record instead of just the
first item of the collection field... I think that's a bug).
For the "cross join" if you are using it like an inner join then it's the
same as above. If it's a real cross join, I'm not sure how to do that.
To add an edge using the graph database:
create edge animals from ( select from person where name = 'John' ) to (
select from animal where name='zigzag' )
--
---
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.