Search matching nodes using the relation connecting nodes

Blockquote
CREATE ( a:Tool { deets: 'Washington group short set on functioning', designed_at: 'Washington' } )-[r:TABLE_CONT { prop: ['WG-SS Details It has six items on difficulties with a few activities'] }]->(d:Details {name: 'It has six items on difficulties with a few activities. Seeing, Hearing, Walking or Climbing steps, Remembering, Washing all over', created_by : 'FDD1' })
RETURN a, d, r

Blockquote

Hi folks, the neo4j version neo4j=1:5.19.0 installed on ubuntu. I want to create a graph where i am adding entities from a document but the relation between these entities CANT be simply described by a simple tag like ( RELATED_TO, PART_OF etc ). I tried a phrase and the cypher query errored out. So i tried the next best thing by sticking to a simple tag and putting all the details in the property "prop". I am planning to MATCH this node by using "prop" .. would it be even possible ? this is very critical for me since simple tags to explain relation between entities is a limiting factor for my graph usage.

if that is your question, you can indeed MATCH on relations property values
like

MATCH (a:Tool)-[r:TABLE_CONT]-(d:Details) where r.prop CONTAINS "difficulties"
RETURN a,d

if query response time is too long, make sure to create an INDEX on used properties Create, show, and delete indexes - Cypher Manual

1 Like

thanks a ton for the response :slight_smile: ..would it be possible to use a vector instead of a string to store the property of the relation ? the reason i ask this is because in today's use case scenario's where its essential to get an exact match , typical workflows would like to match not only on key words BUT also include semantic matches ( ala RAG ) which use vector similarity metrics and hence the need for vectors..deeply appreciate any pointers

yes you can Vector search indexes - Cypher Manual

wow .. cant thank you enough for taking the time out ..appreciate it :pray:

:+1: if your question is answered, don't forget to mark it as solved