PGX 20.2.2
Documentation

What is New in PGX 20.2.0

PGX Python Client

Newly Added Functionality

Support for the following classes and functionality has been added: * Operation * PgxGenericFrameReader * PgxCsvFrameReader * PgxPgbFrameReader * PreparedStatement * GraphChangeSet * VertexModifier * EdgeModifier * GraphMetaData * Graph versioning (via snapshots) and graph updating (via change sets)

Please note that some of these classes might still miss some functions. Please refer to the documentation for an exact api reference.

Bugfixes and Extended Functionality

The following classes have been bugfixed and / or received additional functionality which has been missing until now: * PgxFrame * PgxSession * PgxGraph * DeepWalkModel * Pg2VecModel * GraphConfigFactory

Support for String Functions in Shared-memory Execution Mode

The following string functions are now available in shared-memory execution mode: * UPPER to transform a string to its uppercase version. For example, the following query will uppercase the name of every matched person:

SELECT UPPER(n.name) FROM MATCH (n:Person)        
  • LOWER to transform a string to its lowercase version. For example, the following query will transform the names of all the matched persons to its lowercase version:
SELECT LOWER(n.name) FROM MATCH (n:Person)        
  • LISTAGG to aggregate multiple values into a string. For example, it is possible to aggregate the names of all the matched persons into a comma separated list:
SELECT LISTAGG(n.name, ',') FROM MATCH (n:Person)        
  • SUBSTRING to obtain a portion of a string. For example, this query gets the three first characters in the code of every matched person:
SELECT SUBSTRING(n.code FROM 1 FOR 3) FROM MATCH (n:Person)        
  • Concatenation operator (||) to concatenate strings. For example, the following query gets the full name of every matched person.
SELECT n.firstName || ' ' || n.lastName FROM MATCH (n:Person)        

CREATE PROPERTY GRAPH Support in Shared-memory Execution Mode

PGQL's CREATE PROPERTY GRAPH statement is now available in shared-memory execution.

Statements can be executed in two ways: - PgxSession.executePgql("CREATE PROPERTY GRAPH ..") - PgxSession.preparePgql("CREATE PROPERTY GRAPH ..").execute()

CREATE PROPERTY GRAPH statements can only be executed if a database realm has been configured. Note that this is only possible in remote mode, not embedded mode.

Below is a full CREATE PROPERTY GRAPH example. For a detailed specification and additional examples, please refer to this section of the PGQL specification.

CREATE PROPERTY GRAPH hr
  VERTEX TABLES (
    hr.employees LABEL employee
      PROPERTIES ARE ALL COLUMNS EXCEPT ( job_id, manager_id, department_id ),
    hr.departments LABEL department
      PROPERTIES ( department_id, department_name ),
    hr.jobs LABEL job
      PROPERTIES ARE ALL COLUMNS,
    hr.locations LABEL location
      PROPERTIES ARE ALL COLUMNS EXCEPT ( country_id ),
    hr.countries LABEL country
      PROPERTIES ARE ALL COLUMNS EXCEPT ( region_id ),
    hr.regions LABEL region
  )
  EDGE TABLES (
    hr.employees AS works_for
      SOURCE KEY ( manager_id ) REFERENCES employees
      DESTINATION KEY ( employee_id ) REFERENCES employees
      PROPERTIES ( manager_id, employee_id ),
    hr.employees AS works_at
      SOURCE KEY ( employee_id ) REFERENCES employees
      DESTINATION departments
      PROPERTIES ( employee_id, department_id ),
    hr.employees AS works_as
      SOURCE KEY ( employee_id ) REFERENCES employees
      DESTINATION jobs
      PROPERTIES ( employee_id, job_id ),
    hr.departments AS managed_by
      SOURCE KEY ( department_id ) REFERENCES departments
      DESTINATION employees
      PROPERTIES ( department_id, manager_id ),
    hr.departments AS department_located_in
      SOURCE KEY ( department_id ) REFERENCES departments
      DESTINATION locations
      LABEL has_location
      PROPERTIES ( department_id, location_id ),
    hr.locations AS location_located_in
      SOURCE KEY ( location_id ) REFERENCES locations
      DESTINATION countries
      LABEL in_country
      PROPERTIES ( location_id, country_id ),
    hr.countries AS country_located_in
      SOURCE KEY ( country_id ) REFERENCES countries
      DESTINATION regions
      LABEL in_region
      PROPERTIES ( country_id, region_id )
  )

Extended PGQL Support in Distributed Execution Mode

UPDATE/INSERT/DELETE Statements

In the distributed execution mode, users can now use UPDATE/INSERT/DELETE statements to perform modifications on private transient graphs.

For example,

UPDATE u SET (u.age = 65 - u.age)
DELETE v
FROM MATCH (u:person) -> (v:person)
WHERE u.name = 'John'

updates the age of John and deletes all persons that have an edge from him.

Enabled the executePgql() and PgxPreparedStatement.execute() Endpoints

executePgql() and PgxPreparedStatement#execute() endpoints are now available in distributed execution mode. Users can use these endpoints to execute both pattern matching queries and UPDATE/INSERT/DELETE statements.

Added Full Support for Fine Grained Data Access Control in Distributed Execution Mode

Fine grained data access control is now fully supported in distributed mode. This feature can be used to prevent some of the users of the PGX server to access some parts of the data. As in the shared-memory execution mode, redaction rules can be added either from the graph configuration or using the addRedactionRule method of PgxGraph. Redacted vertices and edges will be invisible in both PGQL queries and API calls. For more information, please refer to the documentation related to Fine grained data access control.

Support for IS NULL/IS NOT NULL Predicates in Distributed Execution Mode

In the distributed execution mode, users can now use IS NULL/IS NOT NULL predicates to test whether the value exists or not.

For example,

SELECT n.name
  FROM MATCH (n)
 WHERE n.name IS NOT NULL

For more information, please refer to the PGQL Specification. Note that NULL values are not supported in the distributed runtime yet, so the IS NULL predicate always returns false.