Typically we can query property value for something like:
Match (n:Product)
where n.name="iPhone X"
return n
However, in my case, I don't know which property I should match, but I only know the value, in which case the property name becomes a kind of variable. I want something like this:
Match (n:Product)
where n.{name}="iPhone X"
return n
or with relationship variable r:
Match (n:Product)-[{r}]->(c:Color {name:'white'})
In both cases, in my application I know some property or relationship value beforehand, without knowing specifically which property it should match against.
Is this query based on property or relationship values supported in Neo4j or spring-data-neo4j?
Take a look in this example:
Setting Neo4j Browser parameters:
Then querying:
The result:
That is: you can use the property name as a key enclosed in square brackets in the
WHERE
clause.An workaround to query by dynamic relationship types can be using the type() function, this way: