PGX 19.2.1
Documentation

What is New in PGX 19.2.0

Added PGX Algorithm Code to the Documentation

Every built-in algorithm now contains the PGX Algorithm code (in addition to the Green-Marl code).

Extended PGQL Support in Distributed Execution Mode

PGX 19.2.0 extends support of PGQL language features in distributed execution mode.

Added Support for IN Filter Expressions

In distributed execution mode, users can now use an IN filter expression within the WHERE clause of PGQL queries:

SELECT ... MATCH (a:person)-[e:likes]->(b:post) WHERE a.name IN ('Emily', 'Paul', 'Juan')

Added Support for FROM Clause

In distributed execution mode, users can now run PGQL queries on the session, specifying the graph in the FROM clause.

This means that after loading a graph:

graph = session.readGraphWithProperties("graph.elist.json", "my_graph")

one can now execute:

session.queryPgql("SELECT a FROM my_graph MATCH (a)")

in addition to being able to execute PGQL directly on the graph:

graph.queryPgql("SELECT a MATCH (a)")

Added Support for Distinct Aggregations without Group-by

In distributed execution mode, users can now perform distinct aggregations without group-by in PGQL queries:

SELECT SUM(DISTINCT a.age) MATCH (a:person)

Added Support for Constant Literals in Projections

In distributed execution mode, users can now project literals:

graph.queryPgql("SELECT a, 1, 0.1 AS my_double, 'string', true MATCH (a)")

Extended Support for Heterogeneous Graphs

PGX 19.2.0 extends support for heterogeneous graphs with new features.

Heterogeneous Graphs from Homogeneous Data Sources

It is now possible to load homogeneous graphs in the CSV, FLAT_FILE, TWO_TABLES RDBMS and PG formats as heterogeneous graphs based on the vertex labels and edge labels.

Extended Algorithm Support

The following Analyst algorithms can now run on on heterogeneous graphs:

Beta Features in PGX Shared-memory Execution Mode

With 19.2.0, we also introduce some new features in beta mode, for which the syntax and semantics might change in future versions.

Support for MODIFY Queries Through PGQL

Users can now do the following modifications on graphs in PGQL queries: * update value of existing session local properties * insert new vertices and edges into session local graphs * delete vertices and edges from session local graphs

The syntax is modified such that a MODIFY query can contain at most one of each modifications (INSERT/UPDATE/DELETE). A MODIFY query is executed on the matched results with snapshot isolation semantics, thus different DML operations under the same MODIFY clause don't see the result of each other. A MODIFY query returns null.

Updating Properties (change to the Beta API in 19.1.0)

The example MODIFY query for updating the value of property age of every person named John changes to the following

MODIFY/*beta*/ g
    ( UPDATE v SET PROPERTIES ( v.age = 42 ) )
FROM g
    MATCH (v:Person)
    WHERE v.name = 'John'

Multiple updates can be executed following the same semantics as in 19.1.0 using the following syntax

MODIFY/*beta*/ g
    ( UPDATE 
        v SET PROPERTIES ( v.age = 42 ),
        u SET PROPERTIES ( u.weight = 3500 )
    )
FROM g
    MATCH (v:Person) <-[:belongs_to]- (u:Car)
    WHERE v.name = 'John'

Inserting New Entities into the Graph

New vertices can be inserted using the INSERT VERTEX clause.

MODIFY/*beta*/ g
    ( INSERT VERTEX u LABELS ('Male') PROPERTIES ( u.age = 42 ) )
FROM g
    MATCH (v:Person)
    WHERE v.name = 'John'

New edges can be inserted using the INSERT EDGE construct.

MODIFY/*beta*/ g
    ( INSERT EDGE e BETWEEN v AND u LABELS ('has') PROPERTIES ( e.since = DATE '2017-09-21' ) )
FROM g
    MATCH (v:Person), (u: Car)
    WHERE v.name = 'John' AND u.id = 'ABC-123'

Deleting Entities from the Graph

Entities can be deleted by enumerating them under the DELETE construct. For example

MODIFY/*beta*/ g
    ( DELETE e, v )
FROM g
    MATCH (v:Person)-[e]->(u: Car)
    WHERE v.name = 'John' AND u.id = 'ABC-123'

More details on MODIFY queries can be found here