{"id":18554395,"url":"https://github.com/oracle/pgql-lang","last_synced_at":"2025-04-09T15:07:07.020Z","repository":{"id":9334197,"uuid":"61662237","full_name":"oracle/pgql-lang","owner":"oracle","description":"PGQL is an SQL-based query language for property graphs","archived":false,"fork":false,"pushed_at":"2025-03-28T19:07:50.000Z","size":14199,"stargazers_count":190,"open_issues_count":2,"forks_count":44,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-09T15:07:02.440Z","etag":null,"topics":["graph-database","graph-queries","graphql","oracle","pgql","query-language"],"latest_commit_sha":null,"homepage":"https://pgql-lang.org/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oracle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-21T19:45:40.000Z","updated_at":"2025-04-05T15:25:40.000Z","dependencies_parsed_at":"2023-01-14T11:54:24.981Z","dependency_job_id":"7dcc58b8-a033-45e5-b271-2105cdfb84e8","html_url":"https://github.com/oracle/pgql-lang","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle%2Fpgql-lang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle%2Fpgql-lang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle%2Fpgql-lang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle%2Fpgql-lang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oracle","download_url":"https://codeload.github.com/oracle/pgql-lang/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055284,"owners_count":21040157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graph-database","graph-queries","graphql","oracle","pgql","query-language"],"created_at":"2024-11-06T21:21:44.549Z","updated_at":"2025-04-09T15:07:06.999Z","avatar_url":"https://github.com/oracle.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PGQL - Property Graph Query Language\n\nPGQL is an SQL-based query language for the [property graph data model](https://pgql-lang.org/spec/latest/#property-graph-data-model), bringing graph pattern matching capabilities to SQL and NoSQL users.\n\nSee the website for a language specification and any newsworthy updates:\n\n[![PGQL Home](pgql_home_screenshot.png)](https://pgql-lang.org/)\n\n## PGQL Parser and Static Query Validator\n\nThis Git repository contains a parser for PGQL with the following features:\n\n - Easy-to-understand IR: Given a query string, the parser returns an easy-to-understand intermediate representation (IR) of the query as a set of Java objects\n    - see [__GraphQuery.java__](graph-query-ir/src/main/java/oracle/pgql/lang/ir/GraphQuery.java)\n - Query validation: built-in to the parser is a static query validator that provides meaningful caret-style (e.g. `^^^`) error messages:\n\n   _Example 1_\n\n   ```sql\n   SELECT n.name, o.name\n     FROM MATCH (n) -[e]-\u003e (m)\n   ```\n\n   ```\n   Error(s) in line 1:\n\n       SELECT n.name, o.name\n                      ^\n       Unresolved variable\n   ```\n\n   _Example 2_\n\n   ```sql\n   SELECT AVG(n.age), n\n     FROM MATCH (n:Person)\n   ```\n\n   ```\n   Error(s) in line 1:\n\n       SELECT AVG(n.age), n\n                          ^\n       Aggregation expected here since SELECT has other aggregation\n   ```\n\n - __Pretty printing__: invoking `GraphQuery.toString()` will \"pretty print\" the graph query, which turns unformatted queries into formatted ones:\n\n   ```sql\n   SELECT n.name FROM MATCH\n   (n:Person) WHERE n.name = 'Anthony'\n   OR n.name = 'James'\n   ```\n\n   ```sql\n   SELECT n.name\n     FROM MATCH (n:person)\n    WHERE n.name = 'Anthony'\n       OR n.name = 'James'\n   ```\n\n - __Code completion__: given a (partial) query string and a cursor position, the parser can suggest a set of code completions, including built-in functions, labels and properties. These completions can for example be used by an interactive web editor.\n   By providing the parser with metadata about the graph (existing properties and labels), the completions will also include label and property suggestions.\n\n## Build and Install the Parser\n\nPGQL's parser can be built on Linux, macOS or Window.\n\nFirst install JDK 1.8 or higher and Maven 3.5.4 or higher.\nThen, follow these instructions:\n\nOn Linux or macOS:\n\n - Build and install to your local Maven repository by running `sh install.sh`\n\nOn Windows:\n\n - Open System Properties and add a new variable `JAVA_OPTS` with value `-Xms512m -Xmx1024m -Xss16m`\n - Build and install to your local Maven repository by running `install_on_windows.bat`\n\n## Getting Started\n\nAfter you have installed the parser like explained above, parse two [example](example/src/main/java/oracle/pgql/lang/example/Main.java) queries:\n - On Linux or macOS execute `cd example; sh run.sh`\n - On Windows execute:\n   ```\n   cd example\n   mvn clean package exec:java -Dexec.mainClass=\"oracle.pgql.lang.example.Main\" -Dexec.cleanupDaemonThreads=false\n   ```\n\n```java\npublic class Main {\n\n  public static void main(String[] args) throws PgqlException {\n\n    try (Pgql pgql = new Pgql()) {\n\n      // parse query and print graph query\n      PgqlResult result1 = pgql.parse(\"SELECT n FROM MATCH (n:Person) -[e:likes]-\u003e (m:Person) WHERE n.name = 'Dave'\");\n      System.out.println(result1.getPgqlStatement());\n\n      // parse query with errors and print error messages\n      PgqlResult result2 = pgql.parse(\"SELECT x, y, FROM MATCH (n) -[e]-\u003e (m)\");\n      System.out.println(result2.getErrorMessages());\n\n    }\n  }\n}\n```\n\nThe AST returned by the parser is a [GraphQuery](graph-query-ir/src/main/java/oracle/pgql/lang/ir/GraphQuery.java) object. This would be the input to your query planner.\n\n## Documentation\n\nSee the [PGQL Specification](https://pgql-lang.org/spec/latest/).\n\n## Development\n\n- Download Eclipse with Spoofax 2.5.18 pre-installed [here](https://spoofax.dev/release/note/2.5.18/)\n- Import the following projects into Eclipse (`File\u003eImport...\u003eMaven\u003eExisting Maven Projects\u003eBrowse...`):\n    - `graph-query-ir`: Java representation of graph queries\n    - `pqgl-spoofax`: Spoofax implementation of PGQL (parser + error checks)\n    - `pgql-lang`: translation of Spoofax AST into `graph-query-ir`\n\n## Contributing\n\nThis project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md)\n\n## Security\n\nPlease consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process\n\n## License\n\nCopyright (c) 2023 Oracle and/or its affiliates.\n\nReleased under the Apache and the Universal Permissive License (UPL) as shown at\n\u003chttps://oss.oracle.com/licenses/upl/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foracle%2Fpgql-lang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foracle%2Fpgql-lang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foracle%2Fpgql-lang/lists"}