Apologies for the cryptic subject line ..pfb the deets
What i want to achieve
when i am inserting triples ( parent node - [ : relation ] -> child node ) i would want the KG to automatically link one child node to another node ( parent or child ). To give a simple example
example triples
( p: Di Caprio ) - [ : acted_in ] -> ( c: the revenant )
( p: the revenant ) - [ : was_directed_by ] -> ( c: some person )
( p: the revenant ) - [ : won_oscars ] -> ( c: academy awards 79 )
so here i would want a subgraph where "Di Caprio" is connected to "the revenant" and it in turn is automatically linked to "some person" and "academy awards 79"
problems i am facing
i am not sure if this happens automatically within neo4j or i need to run some other specific cypher commands ?
what happens if i add properties like embedding vectors ? will all the properties have to match in order for the above to succeed ?
are there any ways to disambiguate the node properties ( textual ) ..for e.g. if a child node is called "mary had a little lamb" and the next triple added has a parent node called "the lambs owner is mary" ..because the properties will never be a perfect match in any enterprise / real world use case scenarios
deeply appreciate your patience for reading this far
i actually spent some more time tinkering around and have a few answers
i am not sure if this happens automatically within neo4j or i need to run some other specific cypher commands ?
ANSWER -> yes it does as long as the nodes are exact replica's including the properties
what happens if i add properties like embedding vectors ? will all the properties have to match in order for the above to succeed ?
ANSWER -> i was able to match on properties like in the query below
qry_ = " CALL db.index.vector.queryNodes('node_vectors2', 10, " + str(qry_emb_) + ")
YIELD node AS Node, score
WHERE score >= 0.6
WITH Node LIMIT 10
WITH COLLECT(Node)[0] as topNode
MATCH ( parentNode )-[ ]->( newChild )
WHERE ( topNode.title=parentNode.title ) OR ( topNode.title CONTAINS parentNode.title )
RETURN topNode.title, parentNode.title, newChild.title "
but my last query still remains .. does neo4j provide any mechanisms to link nodes based on simple / complex matching algorithms ? for e.g. can i match and connect nodes that are semantically similar ? because if we have disparate sub graphs because a word or phrase is different it kinda defeats the purpose of having a graph ( since i would also want all semantically similar nodes to be connected )