NebulaGraph Using Match with Where and Contains

86 views Asked by At

I'am asking my "Newbie" question here.

I'am going into NebulaGraph and I have some trouble with querying, I may be stupid but I also don't get the documentation (either syntax or example, and I can't found a way to match my need)

SO. Admiting I got the following Vertice and Edge.

Tag : Person(Name string, Age string, Sexe string);'
Emotion(Name string);'
Edge : HAS_EMOTION (relationship string)'# Person to Emotion

Inserted with
INSERT VERTEX Person(Name, Age, Sexe) VALUES "Alice_Watson":("Alice Watson", "32", "Female");
INSERT VERTEX Emotion(Name) VALUES "Curiosity":("Curiosity");
INSERT EDGE HAS_EMOTION VALUES "Alice_Watson"->"Curiosity":("Alice expressed curiosity about LLM");

I want to do something like :

MATCH (p:Person)-[r:HAS_EMOTION]->(e:Emotion) WHERE e.Name == "Curiosity" AND r.relationship  CONTAINS "LLM" RETURN p.Name;

But it return

Empty table.

However,

FETCH PROP ON HAS_EMOTION "Alice_Watson" -> "Curiosity" YIELD properties(edge)

return

{relationship: "Alice expressed curiosity about LLM"}

So the Edge does exist.

MATCH (p:Person)-[r:HAS_EMOTION]->(e:Emotion) WHERE r.relationship  CONTAINS "LLM" RETURN p;

return

("Alice_Watson" :Person{Age: "32", Name: "Alice Watson", Sexe: "Female"})

AND BOTH

MATCH (p:Person)-[r:HAS_EMOTION]->(e:Emotion) WHERE e.Name == "Curiosity" AND r.relationship CONTAINS "LLM" RETURN p;
MATCH (p:Person)-[r:HAS_EMOTION]->(e:Emotion) WHERE e.Name == "Curiosity" RETURN p;

return

empty table

QUESTION: I don't get why p.Name return empty but p doesn't. I don't get why I can't exact match "Curiosity" since the node exist.

Hope someone can help me here Cheers, KL

0

There are 0 answers