Is it able to query node w/ label name by known label value?

As the title, for instance I create some node w/ properties & labels (e.g. official demo)

CREATE (JoeVersustheVolcano:Movie {title:'Joe Versus the Volcano', released:1990, tagline:'A story of love, lava and burning desire.'})

and my require is to reverse query the label name by known value e.g. (the following query must raise error message)

match (x:Movie) where y(x) = "Joe Versus the Volcano" return x,y

it's like i want to find out a/some movie which holding a label of "Joe Versus the Volcano", and I want to know which of them and what the label name of it.

JoeVersustheVolcano is an alias and the label of the created node is 'Movie'. These alias names are not stored.

match (x:Movie) where x.title = "Joe Versus the Volcano" return x.title

thx for answer, maybe it's my mistake here? the what does the [title] here stand for? property name? label name? attribute name?

the question is something like i know the type(or label) of node, i know the value of the property, and i want to know which node contains this property and the name of this property which matches the known value.

of cuz this query works,
match (x:Movie) where x.title = "Joe Versus the Volcano" return x.title

but what i need is
match (x:Movie) where x.${y} = "Joe Versus the Volcano" return x and the name of y

If I'm undertanding well, you should try:

MATCH (n:Movie) 
WHERE  n[$prop]="Joe Versus the Volcano" 

you can also run

MATCH (n:Movie) return properties(n) ;

which would return all nodes with a label of ':Movies' and then return all of the properties of said nodes.

If you know that 'Joe Versus the Volcano' is associated with the title property of the :Movie nodes then

match (n:Movie) where n.title='Joe Versus the Volcano` return n;

cheers @sylvainroussy

but, if the [$prop] a internal keyword in neo4j or something? cuz i've tried this query lines but the error message appeared
Neo.ClientError.Statement.ParameterMissing: Expected parameter(s): prop

i suspect $prop is in reference to a past parameter, for example in the Neo4j browser running :help param will provide more details of the syntax.

cheers @dana.canzano

these commands looks better, but I've got the problem is, the things i've know is node's label and the value against the property
n node which has been marked by Movie label, and one of its properties' value is 'Joe Versus the Volcano'

it looks like i must do the following steps:

  1. MATCH (n:Movie) return properties(n) ; to get all the properties names belongs to the nodes marked by [Movie]
  2. loop the Movie nodes and a nested loop for their properties to find out if any property matches the value [Joe Versus the Volcano]
  3. cache the target node(s) and the target property name and return them as my result

so basically return any :Movie nodes which has a property, could be 1 or more properties, which has the value of Joe Versus the Volcano ? A bit odd? Is there a reason we would check for example a property named 'year_of_release' which presumably is a numeric? A reason to check a property named 'gross_receipts' etc?

yeah, sort of

a little bit like, for instance the demo
CREATE (TheMatrix:Movie {title:'The Matrix', released:1999, tagline:'Welcome to the Real World'})

then, i know it's a Movie, and it has some property e.g. 1999, then i want to get the node [TheMatrix:Movie] which it matches [released:1999]

yeah, i were considered if i can do the similar query from matching property to relationship, but the problem might changed from loop properties into looping relationships :nauseated_face:

sure whether its a node or relationship you can look to the properties, but still a bit odd that we would check every property of a node for a value. This would negate any opportunity for index usage (provided you created indexes in said label and property). But also, somewhere you will have some context that 'Joe Versus the Volcano` is a title of a :Movie and not a date_of_release?

yeah, of cuz this is very likely happened.

the 'Joe Versus the Volcano' is the title of node1, and it also the director of node2, and maybe, date_of_release of node3 and other stuffs of nodeX...

This issue was blocking me is because we are building a system like a search engine which is not only giving the things our users were searching, and also something unexpected for them and help them to discovery.

In this case, the user may search, for instance, a 1999 Movie, well, we return the movie [The Matrix] because of its date_of_release is 1999, and also, we can return another move [1999] because the query matches its title is the 1999, or maybe a move [odds and ends], because of the nick name of its director is 1999.

unless the user has been specifically defined movie released 1999, then we may only give him [The Matrix]

You have to declare parameter prop. In the web console, you need to do this to initialise parameters:
:params {prop:"title"}

To add another parameter enter this:
:param key => value

To list parameters: