6.9.2.1 PGQL Features Supported in Property Graph Views

The following PGQL features are supported in property graph views:

  • Recursive queries are supported for the following variable-length path finding goals:
    • Reachability
    • ANY
    • ANY SHORTEST
    • TOP k SHORTEST
  • Recursive queries are supported for the following horizontal aggregations:
    • LISTAGG
      SELECT LISTAGG(src.first_name || ' ' || src.last_name, ',')
      FROM MATCH TOP 2 SHORTEST ( (n:Person) ((src)-[e:knows]->)* (m:Person) )
      WHERE n.id = 1234
    • SUM
      SELECT SUM(e.weight + 3)
      FROM MATCH TOP 2 SHORTEST ( (n:Person) -[e:knows]->* (m:Person) )
      WHERE n.id = 1234
    • COUNT
      SELECT COUNT(e)
      FROM MATCH TOP 2 SHORTEST ( (n:Person) -[e:knows]->* (m:Person) )
      WHERE n.id = 1234
    • AVG
      SELECT AVG(dst.age)
      FROM MATCH TOP 2 SHORTEST ( (n:Person) (-[e:knows]->(dst))* (m:Person) )
      WHERE n.id = 1234
    • MIN (Only for property value or CAST expressions)
      SELECT MIN(CAST(dst.age + 5 AS INTEGER))
      FROM MATCH TOP 2 SHORTEST ( (n:Person) (-[e:knows]->(dst))* (m:Person) )
      WHERE n.id = 1234
    • MAX (Only for property value or CAST expressions)
      SELECT MAX(dst.birthday)
      FROM MATCH TOP 2 SHORTEST ( (n:Person) (-[e:knows]->(dst))* (m:Person) )
      WHERE n.id = 1234
  • Both built-in Oracle Database functions and user defined functions (UDFs) are supported.

    For example:

    • Assuming a table has a JSON column with values such as, {"name":"John", "age": 43}:
      SELECT JSON_VALUE(p.attributes, '$.name') AS name
      FROM MATCH (p:Person)
      WHERE JSON_VALUE(p.attributes, '$.age') > 35
    • Assuming an Oracle Text index exists on a text column in a table:
      SELECT n.text
      FROM MATCH (n)
      WHERE CONTAINS(n.text, 'cat', 1) > 0
    • Assuming a UDF updated_id is registered with the graph server (PGX):
      SELECT my.updated_id(n.ID) FROM MATCH(n) LIMIT 10
The following are a few PGQL features which are not supported:
  • PGQL UPDATE queries are not supported for property graph views.
  • The following PGQL SELECT features are not supported:
    • The only quantifier supported for recursive queries is *.

      If you attempt to use a different quantifier, it will result in an error as shown:

      opg4j> String s = "SELECT id(a) FROM MATCH ANY SHORTEST ((a) -[e]->+ (b))";
      s ==> "SELECT id(a) FROM MATCH ANY SHORTEST ((a) -[e]->+ (b))"
       
      opg4j> PgqlStatement stmt = pgqlConn.createStatement();
      stmt ==> oracle.pg.rdbms.pgql.PgqlExecution@27b9d5b7
       
      opg4j> stmt.execute(s);
      |  Exception java.lang.UnsupportedOperationException: Only zero (0) or more path quantifier is supported
    • Use of bind variables in path expressions.

      If you attempt to use a bind variable, it will result in an error as shown:

      opg4j> String s = "SELECT id(a) FROM MATCH ANY SHORTEST (a) -[e]->* (b) WHERE id(a) = ?";
      s ==> "SELECT id(a) FROM MATCH ANY SHORTEST (a) -[e]->* (b) WHERE id(a) = ?"
       
      opg4j> PgqlPreparedStatement ps = pgqlConn.prepareStatement(s);
      ps ==> oracle.pg.rdbms.pgql.PgqlExecution@7806db3f
       
      opg4j> ps.setString(1, "PERSON(3)");
       
      opg4j> ps.executeQuery();
      |  Exception java.lang.UnsupportedOperationException: Use of bind variables for path queries is not supported
    • Using subqueries.
    • in_degree and out_degree functions.

Note: