-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nebulagraph matching tag property #5743
Comments
This was due to the NebulaGraph flavor cypher requiring an explicit specific tag of vertex when expressing its prop filter, thus Another hint here is, that
I think this is similar to the first question. MATCH (p:Person)-[r:HAS_EMOTION]->(e:Emotion) WHERE e.Emotion.Name == "Curiosity" AND r.relationship CONTAINS "LLM" RETURN p;
MATCH (p:Person)-[r:HAS_EMOTION]->(e:Emotion) WHERE e.Emotion.Name == "Curiosity" RETURN p; |
Thank you for your answer. However, I can't make it to work. For the first query : This was due to the NebulaGraph flavor cypher requiring an explicit specific tag of vertex when expressing its prop filter, thus res.Resource.Title CONTAINS "Neural Networks" should be the expected expression. I changed it to But the result is the same, still empty table. for the second query, it seems like Emotion.Name =="Curiosity" is necessary relied to a Full text index. Also, for debugging sake I tried simpler query and got an interesting yet incomprehensible result. 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; 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; I don't get it. EDIT : |
We have to specify like
|
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; I don't get it. Aha, another pitfall, sorry for this!! https://docs.nebula-graph.io/3.6.0/8.service-tuning/2.graph-modeling/#about_dangling_edges |
The most ideal graph query(the most graphy one) pattern would be to know the id of starting node(or edge) of the whole graph pattern( But when we need to seek starting vertex or edge of the pattern, similar things could be done like it was in tabular(sql) or elasticsearch(Inverted index). In those cases, we need to explicitly create indexes to ensure guaranteed performance in a distributed graph system. Tag/Edge indexes(towards properties) will enable data sorted based on those props and it's similar to indexes or tabular data in SQL database, it introduced extra write during data mutation but made it possible to find vertex/edge based on indexed props. Similar things are fulltext index, where, indexed data will be sync to elasticsearch with the raft listener configured to enable more flexible search patterns brought by elasticsearch |
And... big welcome to the NeublaGraph community KL! |
OK got it now. So at the very moment i'am creating any TAG and EDGES, I should also create index for each property inside each TAG/EDGE to make them queryable from property content. Thank you very much for your time. everything works now. |
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.
INSERT VERTEX Person(Name, Age, Sexe) VALUES "Alice_Watson":("Alice Watson", "32", "Female");
INSERT VERTEX Resource(Type, Support, Title, Author, Date_access) VALUES "Paper_on_Neural_Networks":("Article", "Online", "In-depth Analysis of Neural Networks", "Dr. Bob Green", "2023-09-22");
INSERT VERTEX Emotion(Name) VALUES "Curiosity":("Curiosity");
INSERT EDGE USES_RESOURCE VALUES "Alice_Watson"->"Paper_on_Neural_Networks":("Alice mentioned this paper during the discussion");
INSERT EDGE HAS_EMOTION VALUES "Alice_Watson"->"Curiosity":("Alice expressed curiosity about LLM");
Why does the following is empty :
MATCH (p:Person)-[r:USES_RESOURCE]->(res:Resource) WHERE id(p) CONTAINS "Alice" AND res.Title CONTAINS "Neural Networks" RETURN res;
Also,
Why does this work:
MATCH (p:Person)-[r:HAS_EMOTION]->(e:Emotion) WHERE r.relationship CONTAINS "LLM" RETURN p;
But not:
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;
Thank you very much in advance,
Cheers,
KL
The text was updated successfully, but these errors were encountered: