oracle / pgql-lang

PGQL is an SQL-based query language for property graphs
https://pgql-lang.org/
Other
182 stars 44 forks source link
graph-database graph-queries graphql oracle pgql query-language

PGQL - Property Graph Query Language

PGQL is an SQL-based query language for the property graph data model, bringing graph pattern matching capabilities to SQL and NoSQL users.

See the website for a language specification and any newsworthy updates:

PGQL Home

PGQL Parser and Static Query Validator

This Git repository contains a parser for PGQL with the following features:

Build and Install the Parser

PGQL's parser can be built on Linux, macOS or Window.

First install JDK 1.8 or higher and Maven 3.5.4 or higher. Then, follow these instructions:

On Linux or macOS:

On Windows:

Getting Started

After you have installed the parser like explained above, parse two example queries:

public class Main {

  public static void main(String[] args) throws PgqlException {

    try (Pgql pgql = new Pgql()) {

      // parse query and print graph query
      PgqlResult result1 = pgql.parse("SELECT n FROM MATCH (n:Person) -[e:likes]-> (m:Person) WHERE n.name = 'Dave'");
      System.out.println(result1.getPgqlStatement());

      // parse query with errors and print error messages
      PgqlResult result2 = pgql.parse("SELECT x, y, FROM MATCH (n) -[e]-> (m)");
      System.out.println(result2.getErrorMessages());

    }
  }
}

The AST returned by the parser is a GraphQuery object. This would be the input to your query planner.

Documentation

See the PGQL Specification.

Development

Contributing

This project welcomes contributions from the community. Before submitting a pull request, please review our contribution guide

Security

Please consult the security guide for our responsible security vulnerability disclosure process

License

Copyright (c) 2023 Oracle and/or its affiliates.

Released under the Apache and the Universal Permissive License (UPL) as shown at https://oss.oracle.com/licenses/upl/.