How to get the nodes which are not linked to the target node

Hi,

Now I want to get the nodes which are not linked to the target node, with neo4j I can realize it by the following query:

match (persons),(zhangsan{name : "Zhongshan”}) where not (persons) --> (zhangsan) return persons

So how can I realize it with orientdb?

Also another question:

Is there any orientdb query can achieve the same function as the following neo4j query?

match p=(n)-[*1…5]-> (m) return p

Variable length path of between 1 and 5 relationships from n to m.

Another question again:

Why did’t the four queries return the same result?

image image

Hi @Tracy

OrientDB supports negative patterns, see http://orientdb.com/docs/3.0.x/sql/SQL-Match.html#negative-not-patterns

I’d suggest to have a look at the MATCH docs in general, you will find answers to most of your questions

Thanks

Luigi

Thanks for you reply.
However, I’m still confused about the third question… And now I have more confused queries similar with that:
(1) Why do the following queries not all return the same results?

image image
(2) And again, why do the three queries not return the same results?
image image image image

Also, for the second question,I still can’t find the way to implement it. For expample, I want to find all the paths between A and B which the length of the paths under 4, I tried the following query, but it didn’t work.

Query:
match {class:patient,where:(patientName=‘A’)}.bothE().(bothV().bothE()){while:($depth < 3)}.{class:patient,where:((patientName=‘B’)}
return $pathelements