Oracle Graph Server and Client 22.4 is available for download for use with databases in the Cloud (OCI Marketplace image is available) and for databases on-premises. Note that the new features described here are not yet available in Graph Studio, we will update this post when they are available.
Oracle Graph Server and Client version 22.4 has been released and contains a number of feature updates. Graph Server (PGX) now supports a graph loading progress reporting API, subgraph loading enhancements, and synchronization for published graphs. Oracle Graph Server and Client 22.4 is the first release to fully implement PGQL 1.5. You can find this specification here: https://pgql-lang.org/spec/1.5/. These PGQL updates include the ability to use IS as an alternative for a colon, support for scalar subqueries, and support for EXISTS and NOT EXISTS subqueries. This release also includes some packaging enhancements and desupported features, which can be found at the end of this post.
Graph Server (PGX) Features
Graph reading progress reporting API
Oracle Graph Server 22.4 includes a new API added to PgxFuture that retrieves loading progress. This feature works with PG view graphs.
This is an example of how the progress reporting API can be used:
PgxFuture<PgxGraph> future = session.readGraphByNameAsync("MYGRAPH", GraphSource.PG_VIEW)
FutureProgress progress = future.getProgress() // new API
Optional<GraphLoadingProgress> loadingProgress = progress.asGraphLoadingProgress()
long numLoadedVertices = loadingProgress.get().getLoadedVertices()
Subgraph loading enhancements
Previously, a subgraph was given the same name as the PG view plus a number. However, the load() function now accepts a name as a parameter. Additionally, the query for the subgraph now allows for any-directed edge patterns.
This is an example of how these features can be used when creating a subgraph:
PgxGraph subgraph = session.readSubgraph()
.fromPgView("MYGRAPH")
.queryPgql("MATCH (s)-[e]-(d)") // NEW: any-directed pattern
.load("MYSUBGRAPH") // NEW: name the resulting subgraph
Synchronize published graphs
Published graphs in the Graph Server (an application can ‘publish’ graphs to share with other sessions connected to the Graph Server) can now be synchronized with updates in the database. Previously only graphs within a session could be synchronized. This is enabled by using the new API to specify the graph configuration object when creating a synchronizer object.
This is an example of how the graph configuration can be included in the synchronizer call:
Synchronizer synchronizer = new Synchronizer.Builder<FlashbackSynchronizer>()
.setType(FlashbackSynchronizer.class)
.setGraph(graph)
.setGraphConfig(graphConfig) // NEW
.setConnection(connection)
.build()
PGQL Features
IS as an alternative for colon (:)
In previous versions of Oracle Graph, a colon (:) was used to indicate label predicates. To include syntax in the SQL/PGQ standard (the draft ISO standard for SQL to query property graphs), the newest version of Oracle Graph now supports “IS” as a label predicate. However, this feature is additive, and does not remove the ability to use a colon as a label predicate.
This is an example of the label predicate options in 22.4:
//Before
FROM MATCH (s:Friend) -[e:knows]-> (d:Person)
//Starting 22.4 the following is supported
GROM MATCH (s IS Friend) -[e IS knows]-> (d IS Person)
PGQL on PG Views: Scalar Subqueries
Oracle Graph Server and Client 22.4 allows you to use scalar subqueries in PG views. You can use them as part of an expression. A scalar query is a query that returns a scalar value, exactly one row and exactly one column. In this latest release of Oracle Graph, you can use scalar queries as part of an expression in a SELECT, WHERE, GROUP BY, HAVING or ORDER BY clause.
For example, you could write a query such as the following:
SELECT p.name AS name
, ( SELECT SUM(t.amount)
FROM MATCH (a) <-[t:transaction]- (:Account)
) AS sum_incoming
, (SELECT SUM(t.amount)
FROM MATCH (a) -[t:transaction]-> (:Account)
) AS sum_outgoing
, (SELECT COUNT(DISTINCT p2)
FROM MATCH (a) -[t:transaction]-> (:Account) -[:owner]-> (p2:Person)
WHERE p2 <> p
) AS num_persons_transacted_with
, (SELECT COUNT(DISTINCT c)
FROM MATCH (a) -[t:transaction]-> (:Account) -[:owner]-> (c:Company)
) AS num_companies_transacted_with
FROM MATCH (p:Person) <-[:owner]-> (a:Account)
ORDER BY sum_outgoing + sum_incoming DESC
PGQL on PG Views: EXISTS and NOT EXISTS subqueries
EXISTS and NOT EXISTS return true or false depending on whether the subquery produces at least one result, given the bindings obtained from the outer query.
In the following example, we can query to find friends of friends, and for each friend of friend, return the number of common friends. Assuming we have a graph that shows relationships among a group of people, we can do this simply with a NOT EXISTS subquery:
SELECT fof.name, COUNT(friend) AS num_common_friends
FROM MATCH (p:Person) -[knows]-> (friend:Person)
-[knows]-> (fof:Person)
WHERE NOT EXISTS (
SELECT * FROM MATCH (p) -[:knows]-> (fof)
)
Packaging Enhancements
◉ There is a new Oracle Cloud Infrastructure Marketplace image for RDF Server that uses Apache Tomcat. Users can choose between the image that uses Apache Tomcat or the one that uses Oracle WebLogic Server when deploying RDF Server.
◉ The Graph Server RPM now declares libfortran as a dependency. This dependency is required by PGX.ML.
◉ The Graph Server RPM installation now generates a self-signed certificate into /etc/oracle/graph/server_keystore.jks
Source: oracle.com
0 comments:
Post a Comment