Hamsavardhini
Hamsavardhini

Reputation: 101

neo4j query error "dont know how to compare"

I loaded Neo4j with Pizza.owl file using hermit reasoner and Java. when i pass a simple query:

match (n) where n="name:Pizza" return n;

am getting the following error

 Don't know how to compare that. Left: Node[1]{name:"owl:Thing"} (NodeProxy); Right: "name:Pizza" (String)

Is NodeProxy a datatype? How can I make both of them to be compared. Can I do casting while querying? Any query to change datatype of the entire graph nodes? How to check the type of the node?

Upvotes: 1

Views: 594

Answers (1)

jjaderberg
jjaderberg

Reputation: 9952

You are comparing a node n to a string "name:Pizza", which doesn't make sense. What you want is to compare the property name of node n with the string "Pizza": WHERE n.name = "Pizza". The whole query then looks like this

MATCH (n)
WHERE n.name = "Pizza"
RETURN n

Nodes don't really have types. Take a look at the Neo4j manual to more about nodes, relationships, properties and labels and about Cypher in general, and the WHERE clause in particular.

Upvotes: 5

Related Questions