Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-30-2020 05:35 AM
Hi, I have four nodes Order, Service, Brand, Slot. Brand has Slots and Services. Orders are created according to Slots available for a particular Service. I wanted to run query to check if an Slot exits for a Service and to do that I have to query the Orders to check if Slot is already booked or not for that service, if booked I want to return all the other slots and if not booked I want to return all the slots available for that service. How should I modify this query
MATCH (brand :Brand {id: "1"}) MATCH (slot:Slot)-[:HAS_SLOT]-(brand) MATCH (slot)-[appointment:HAS_APPOINTMENT]-(order:Order) WHERE appointment.serviceId <> "2" AND appointment.date <> DateTime("2011-10-05T14:48:00Z") RETURN slot
07-06-2020 12:39 AM
Can you use this? https://neo4j.com/docs/cypher-manual/current/clauses/where/#property-existence-checking
where clause would become someting like this:
WHERE (NOT exists(appointment.serviceId) AND NOT exists(appointment.date)) OR (appointment.serviceId <> "2" AND appointment.date <> DateTime("2011-10-05T14:48:00Z"))
Not tested so syntax might differ slightly
All the sessions of the conference are now available online