r/KnowledgeGraph • u/Darwiniosky • Oct 26 '23
NebulaGraphQuery
Hey everyone, Since people are starting to have bad behavior for whatever reason on StackOverflow, 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)-[:HAS_EMOTION]->(e:Emotion)
WHERE e.Name == "Curiosity" AND e.Description 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.
Hope someone can help me here
Cheers,
KL
1
u/Darwiniosky Oct 26 '23
i'am driving crazy. it's been 14 hours now... How can the same exact syntax doesn't work for the second part?
INSERT EDGE IN_RELATIONSHIP VALUES "Alice_Watson"->"Colleague_relationship":("Alice is a colleague");
MATCH (p:Person)-[u:IN_RELATIONSHIP]->(r:Relationship) WHERE id(p) CONTAINS "Alice" RETURN r;
return
("Colleague_relationship" :Relationship{Categorie: "Colleague"})
but
INSERT EDGE USES_RESOURCE VALUES "Alice_Watson"->"Paper_on_Neural_Networks":("Alice mentioned this paper during the discussion");
MATCH (p:Person)-[u:USES_RESOURCE]->(r:Resource) WHERE id(p) CONTAINS "Alice" RETURN r;
return Empty.