Property Graph Query Language (PGQL) support has been added to Oracle Database 12.2.0.1!

Great news! Oracle just released a patch that adds Property Graph Query Language (PGQL) support to the existing property graph functions in Oracle Spatial and Graph in Oracle Database 12c Release 2 (12.2.0.1.).

At a high level, PGQL is a SQL-like declarative language that allows a user to express a graph query pattern that consists of vertices and edges, and constraints on the properties of the vertices and edges.

Once this patch is applied to your database instance, you can run the following quick test, Groovy/Java based, to see how it works.

cd $ORACLE_HOME/md/property_graph/dal/groovy
$ sh ./gremlin-opg-rdbms.sh

--------------------------------

opg-oracledb> // It is very likely that you need to customize JdbcURL, Username, and Password in the following graph config setting.
opg-oracledb> //
opg-oracledb> cfg = GraphConfigBuilder.forPropertyGraphRdbms().setJdbcUrl("jdbc:oracle:thin:@127.0.0.1:1521:orcl") .setUsername("scott").setPassword("tiger")  .setName("connections") .setMaxNumConnections(8) .setLoadEdgeLabel(false) .addVertexProperty("name", PropertyType.STRING, "default_name")  .addEdgeProperty("cost", PropertyType.DOUBLE, "1000000")  .build();


opg-oracledb> opg = OraclePropertyGraph.getInstance(cfg);


opg-oracledb> opg.clearRepository();     // start from scratch

opg-oracledb> opgdl=OraclePropertyGraphDataLoader.getInstance();

opg-oracledb> vfile="../../data/connections.opv"  // vertex flat file
==>../../data/connections.opv
opg-oracledb> efile="../../data/connections.ope"  // edge flat file
==>../../data/connections.ope
opg-oracledb> opgdl.loadData(opg, vfile, efile, 2, 10000, true, null);
==>null

opg-oracledb> opg.countVertices()
==>78
opg-oracledb> opg.countEdges()
==>164

opg-oracledb> // Create an in memory analytics session and analyst


opg-oracledb> session=Pgx.createSession("session_ID_1");

opg-oracledb> analyst=session.createAnalyst();

opg-oracledb>
opg-oracledb> // Read graph data from database into memory

opg-oracledb> pgxGraph = session.readGraphWithProperties(opg.getConfig());
==>PgxGraph[name=connections,N=78,E=164,created=1488415009543]

opg-oracledb> pgxResultSet = pgxGraph.queryPgql("SELECT n,m WHERE (n) -> (m)")
==>PgqlResultSetImpl[graph=connections,numResults=164]

opg-oracledb> pgxResultSet.print(10);

+------------------------------------+
| n                | m               |
+------------------------------------+
| PgxVertex[ID=2]  | PgxVertex[ID=1] |
| PgxVertex[ID=3]  | PgxVertex[ID=1] |
| PgxVertex[ID=6]  | PgxVertex[ID=1] |
| PgxVertex[ID=7]  | PgxVertex[ID=1] |
| PgxVertex[ID=8]  | PgxVertex[ID=1] |
| PgxVertex[ID=9]  | PgxVertex[ID=1] |
| PgxVertex[ID=10] | PgxVertex[ID=1] |
| PgxVertex[ID=11] | PgxVertex[ID=1] |
| PgxVertex[ID=12] | PgxVertex[ID=1] |
| PgxVertex[ID=19] | PgxVertex[ID=1] |
+------------------------------------+


Cheers,

[1] http://aru.us.oracle.com:8080/ARU/ViewPatchRequest/process_form?aru=21094382

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

The official blog for Oracle Spatial and Graph, an option of Oracle Database - brought to you by the product managers and developers. Get technical tips, product information, and the latest news here. Visit our official product website at http://www.oracle.com/technetwork/database/options/spatialandgraph/.

Search


Archives
« March 2017
SunMonTueWedThuFriSat
   
3
4
5
6
7
8
9
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
       
Today