Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-20-2021 02:38 AM
Hello,
I am on page Using WHERE to Filter Queries - Querying with Cypher in Neo4j 4.x. The query I'm executing is
MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
WHERE 'Neo' IN r.roles AND m.title='The Matrix'
RETURN p.name
What I don't understand is where is the roles label in ACTED_IN. I tried looking for it by doing a Call db.schema.visualization() and this is what I get:
{
"identity": -31,
"start": -11,
"end": -12,
"type": "ACTED_IN",
"properties": {}
}
How can I visualise what I can filter on?
Thanks
Solved! Go to Solution.
07-20-2021 04:43 AM
AFAIK db.schema.visualization() only displays available indexes. You could use the APOC schema functions: apoc.meta.relTypeProperties - APOC Documentation
Be aware that APOC only sample the data, so if you need to be 100% sure, you will have to retrieve the properties for the labels and relation type you are interested in like that:
MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
RETURN DISTINCT keys(r) AS properties
07-20-2021 04:43 AM
AFAIK db.schema.visualization() only displays available indexes. You could use the APOC schema functions: apoc.meta.relTypeProperties - APOC Documentation
Be aware that APOC only sample the data, so if you need to be 100% sure, you will have to retrieve the properties for the labels and relation type you are interested in like that:
MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
RETURN DISTINCT keys(r) AS properties
07-20-2021 05:49 AM
Hello @chribonn and welcome to the Community!
In Neo4j Browser, if you hover over the relationships, the roles property should be viewable at the bottom.
You might want to perform this query to see all of the roles for these relationships;
MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
RETURN p.name, r.roles, m.title
Properties are not required for a relationship so there are probably ACTED_IN relationships with no roles property defined,
Elaine
All the sessions of the conference are now available online