I'm new in OrientDB/grahps and I'm trying to understand it's logic clearly.
Let's say there are vertexes Movies 1:n Genres with SortOf edge. I would like to know other genres that have movies that are 'Comedy'.
After reading docs I'd thought that it should be something like that:
SELECT expand(in('SortOf').out('SortOf')[name<>'Comedy'])
FROM Genre WHERE name = 'Comedy'`
It returns 0 records.
If i remove <>
I get all the list, and even can filter by =
:
SELECT expand(set(in('SortOf').out('SortOf')[name='Drama']))
FROM Genre WHERE name='Comedy'
Returns 1 record. Right now I have result with query below:
SELECT FROM (SELECT expand(set(in('SortOf').out('SortOf')))
FROM Genre WHERE name = 'Comedy')
WHERE name NOT LIKE 'Comedy'`
Again, it returns 0 records if I put name!='Comedy'
instead of LIKE
.
What is the right way for this query? Where should I place count
to see how many movies in each genre?
UPDATE
I've replaced !=
with <>
, so working query is:
SELECT FROM (SELECT expand(set(in('SortOf').out('SortOf')))
FROM Genre WHERE name='Comedy')
WHERE name<>'Comedy'`
But first query still not working. What am I missing? Else.
The operator you're looking for is <>
See this for other operators.
UPDATE In your case: