neo4j - Not operator in MATCH -
i wanna find nodes not in relation. using while finding nodes in relation current node instance like;
@query(value = "start user=node({self}) match (user)<-[r:knows]-(known) return known") @fetch private iterable<graphuser> knowsme;
but when tried find nodes not knows current node, found solution , like;
@query(value = "start user=node({self}), doesnotknowme=node(*) has(user.userid) , not((user)<-[:knows]-(doesnotknowme)) return doesnotknowme") @fetch private iterable<graphuser> doesnotknowme;
when run neo4j online executor, works well.(http://www.neo4j.org/learn/cypher) sample used on site like;
start m=node:node_auto_index(id="603"), actor=node(*) has (actor.name) , not ((m)<-[:acts_in]-(actor)) return actor
note: result, should put node not in relation movies. if exits, query result added record.
when want run spring-data-neo4j, there problem. not relation([:knows]) not having alias [r:knows].
exception:
caused by: org.neo4j.graphdb.notfoundexception: '__type__' property not found nodeimpl#0. @ org.neo4j.kernel.impl.core.primitive.newpropertynotfoundexception(primitive.java:184) @ org.neo4j.kernel.impl.core.primitive.getproperty(primitive.java:179) @ org.neo4j.kernel.impl.core.nodeimpl.getproperty(nodeimpl.java:52) @ org.neo4j.kernel.impl.core.nodeproxy.getproperty(nodeproxy.java:155) @ org.springframework.data.neo4j.support.typerepresentation.abstractindexingtyperepresentationstrategy.readaliasfrom
but may know, can't define allias in where
clause. can define in match
clause cant use not
operator in match too.
how can use not
operator in match can used in where
. or there way fix spring-data-neo4j
exception somehow.
thank you!
it looks me if exception says different thing you're claiming problem. complains root node (node id = 0) not have __type__ property, believe spring data stores internal info able create objects out of nodes.
check root node represents. delete if don't think should there , try again. alternatively, if represents user in system, have @ user node, take whatever value has __type__ property, , set same thing onto root node.
Comments
Post a Comment