Filter based on list and if it doesnt exist in list, ignore it

Is there a way to filter based on what is in the list. Example code

UNWIND [{component_id:'1001', assembly_id:'1001'}] as row
MATCH (a:Assembly)-[:RECIPE]->(c:Component)
WHERE a.id = row.assembly_id AND c.id = row.component_id and c.name = row.component_name
RETURN c

My problem is that this codes assumes that in the list I will have all the properties sent to me and will return empty if all properties arent in the list. However the user can filter for one or any combination of the properties from the components (except for assembly_id 'This will always be in the list'). I dont know how to query this, i.e. to ignore those that are not in the list.

Variable 'row' does not have component_name and also just for sending values UNWIND operation is not necessary when you can simply insert those values in the WHERE condition.

If you have the Component node with multiple c.name values for one selected c.id value then you should add the c.name condition. Otherwise c.id filter will fetch you one component node

Try this:


MATCH (a:Assembly)-[:RECIPE]->(c:Component)
WHERE a.id = '1001' AND c.id = '1001' and c.name = 'abc'
RETURN c

I believe you are misinterpretating. I use UNWIND cause I get data that is sent in from a user. As such the user can choose which property he/she can filter by or can use any combination of properties of the component to filter (i.e. RETURN c)

UNWIND $data as row
MATCH (a:Assembly)-[:RECIPE]->(c:Component)
WHERE a.id = row.assembly_id AND c.id = row.component_id AND c.name = row.component_name
RETURN c
Q: Did you get any result from you query:

UNWIND $data as row
MATCH (a:Assembly)-[:RECIPE]->(c:Component)
WHERE a.id = row.assembly_id AND c.id = row.component_id AND c.name = row.component_name
RETURN c

If you did not get any result then selected  Assembly node  does not have a relationship with selected Component node.

Do you have a blank space in c.name value?
I answered this question before.

Q: user can choose which property he/she can filter by or can use any combination of properties of the component to filter 

Then your MATCH statement  changes with the selected filters by the user?

1st Q:
My assembly node does have a relationship to the component. Each component has the same properties, only different values for each property (sometimes these value can be similar)

2nd Q:
Yea so my match statement would have to change based on what the user specifies.
This is why there will be missing properties in $data as such my original query will just return an empty result. Would this mean I have to create a query for each possible case (If so this isnt very efficient). I am looking for a single query that will handle all of this.