PGQL (PGX) Interpreter

You can run PGQL queries that are supported in the graph server (PGX) in your notebook paragraphs.

See the PGQL Specification for more information on PGQL queries.

PGQL (PGX) paragraphs start with %pgql-pgx and accept PGQL queries supported in the graph server(PGX) as input.

Tip:

You can hover over the bottom part of a notebook paragraph and click the PGQL_icon Add PGQL-PGX Paragraph icon to open a PGQL (PGX) paragraph instantly in the notebook.

The following is an example of a PGQL(PGX) paragraph:

%pgql-pgx
SELECT v, e FROM MATCH (v)-[e]->() ON MY_FIRST_GRAPH

Internally, the PGQL-PGX interpreter operates on the same PGX session as the Java (PGX) interpreter or the Python (PGX) interpreter. So, any analysis results computed in Java (PGX) paragraphs or Python (PGX) paragraphs are available for querying in the subsequent PGQL (PGX) paragraphs.

For example, the vertex ranking computed for each vertex using the Vertex Betweenness Centrality algorithm in the Java (PGX) paragraph is used for querying in the following PGQL (PGX) paragraph:

%java-pgx
var g = session.getGraph("MY_FIRST_GRAPH")
session.createAnalyst().approximateVertexBetweennessCentrality(g, 3)
%pgql-pgx
SELECT city, e
FROM MATCH (city) -[e] -> () ON MY_FIRST_GRAPH
ORDER BY city.approx_betweenness