Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

How to write this Graph Query? #10

@dnpavankumar

Description

@dnpavankumar

Hi,

We need your help to write one query using MATCH clause.

We have the following data definitions.

Person node table has three edge properties
Name (NodeID)
LivesIn (Edge) to Country node table
Reads (Edge) to Book node table
Rides (Edge) to Car node table

Country node table
Name (NodeID)
Book node table
Name (NodeID)
Car node table
Name (NodeID)

We would like to use MATCH clause for traversing and filtering results.

Query :

Return Persons (Person name) and their details (Reads - Book name, Rides - Car name) who Lives in US.

Some persons who lives in US has no edges for Reads or Rides.
We would like to list such persons with NULL value in Book name and Car name columns.

How do we accomplish this in Graph queries using Match clause.

The below query does not list the persons who DOES NOT have edges to Book and Car. I think MATCH internally maps to INNER JOIN.

SELECT X.NAME AS [PERSON NAME], Y.NAME AS [BOOK NAME], Z.NAME AS [CAR NAME]
FROM PERSON X, BOOK Y, CAR Z, COUNTRY A
MATCH X-[LivesIn]->A, X-[Reads]->Y, X-[Rides]->Z
WHERE A.NAME = 'US';

We can use LEFT JOIN in the FROM clause, but as a user, we do not know the structure of the node table.

Can you please let us know how to achieve this functionality.

Kind Regards,
Pavan Kumar D.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions