Jump to content

Cypher

From NeoWiki

This page demonstrates the cypher_raw parser function for executing Cypher queries against the Neo4j graph database.

This is a demo feature for the NeoWiki proof of concept demo. It will not be present as-is in a production version.

Query Companies[edit]

<syntaxhighlight lang="cypher"> MATCH (n:Company) RETURN n.name, n.id </syntaxhighlight>


[
    {
        "n.name": "ACME Corp",
        "n.id": "sEpxjmz2M1fQbs1"
    },
    {
        "n.name": "Professional Wiki GmbH",
        "n.id": "s1demo5sssssss1"
    },
    {
        "n.name": "ACME Inc.",
        "n.id": "s1demo1aaaaaaa1"
    }
]

Query Products[edit]

<syntaxhighlight lang="cypher"> MATCH (n:Product) RETURN n.name, n.id </syntaxhighlight>


[
    {
        "n.name": "Rocket Skates",
        "n.id": "sEpxjoaGMffXotq"
    },
    {
        "n.name": "NeoWiki",
        "n.id": "s1demo4sssssss1"
    },
    {
        "n.name": "ProWiki",
        "n.id": "s1demo6sssssss1"
    },
    {
        "n.name": "Foo",
        "n.id": "s1demo1aaaaaaa2"
    },
    {
        "n.name": "Bar",
        "n.id": "s1demo1aaaaaaa3"
    },
    {
        "n.name": "Baz",
        "n.id": "s1demo1aaaaaaa4"
    }
]

Query Relations[edit]

<syntaxhighlight lang="cypher"> MATCH (source:Company)-[r]->(target) RETURN source.name, type(r), target.name LIMIT 10 </syntaxhighlight>


[
    {
        "source.name": "ACME Corp",
        "type(r)": "Makes product",
        "target.name": "Rocket Skates"
    },
    {
        "source.name": "ACME Corp",
        "type(r)": "Has CEO",
        "target.name": "Jane Doe"
    },
    {
        "source.name": "Professional Wiki GmbH",
        "type(r)": "Has product",
        "target.name": "ProWiki"
    },
    {
        "source.name": "Professional Wiki GmbH",
        "type(r)": "Has product",
        "target.name": "NeoWiki"
    },
    {
        "source.name": "ACME Inc.",
        "type(r)": "Has product",
        "target.name": "Baz"
    },
    {
        "source.name": "ACME Inc.",
        "type(r)": "Has product",
        "target.name": "Bar"
    },
    {
        "source.name": "ACME Inc.",
        "type(r)": "Has product",
        "target.name": "Foo"
    }
]

Notes[edit]

  • Only read-only queries are allowed. Write operations like CREATE, SET, DELETE are rejected.
  • Query results are displayed as formatted JSON.