Skip to content

Commit a0d2210

Browse files
authored
Merge branch 'main' into NicolaCimitile-patch-5
2 parents 4b1fdbe + 656a7b0 commit a0d2210

File tree

62 files changed

+10288
-70
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+10288
-70
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
target/
3+
!.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**/target/
5+
!**/src/test/**/target/
6+
7+
### IntelliJ IDEA ###
8+
.idea/modules.xml
9+
.idea/jarRepositories.xml
10+
.idea/compiler.xml
11+
.idea/libraries/
12+
*.iws
13+
*.iml
14+
*.ipr
15+
16+
### Eclipse ###
17+
.apt_generated
18+
.classpath
19+
.factorypath
20+
.project
21+
.settings
22+
.springBeans
23+
.sts4-cache
24+
25+
### NetBeans ###
26+
/nbproject/private/
27+
/nbbuild/
28+
/dist/
29+
/nbdist/
30+
/.nb-gradle/
31+
build/
32+
!**/src/main/**/build/
33+
!**/src/test/**/build/
34+
35+
### VS Code ###
36+
.vscode/
37+
38+
### Mac OS ###
39+
.DS_Store
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Property Graph demo
2+
this code demonstrates:
3+
1. integration of Property Graph with SQL in Oracle Database 23c
4+
2. Java API for Property Graph Server
5+
It uses demonstration tables described in the following LiveLabs Workshop:
6+
"Analyze, Query, and Visualize Property Graphs with Oracle Database"
7+
https://apexapps.oracle.com/pls/apex/r/dbpm/livelabs/run-workshop?p210_wid=686&p210_wec=&session=108772142407826
8+
Requirements:
9+
1. Oracle Database 23c
10+
2. Database user account ( <username> ) with the privileges described in the mentioned LiveLabs Workshop
11+
3. Tables used in this workshop created in the mentioned schema
12+
4. Oracle Property Graph Server installation using user account
13+
14+
# License
15+
16+
Copyright (c) 2024 Oracle and/or its affiliates.
17+
18+
Licensed under the Universal Permissive License (UPL), Version 1.0.
19+
20+
See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>pg.oracle</groupId>
8+
<artifactId>PGJava</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.source>18</maven.compiler.source>
13+
<maven.compiler.target>18</maven.compiler.target>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
<repositories>
17+
<repository>
18+
<id>spoofax</id>
19+
<url>https://artifacts.metaborg.org/content/repositories/releases</url>
20+
</repository>
21+
</repositories>
22+
<dependencies>
23+
<dependency>
24+
<groupId>com.oracle.database.jdbc</groupId>
25+
<artifactId>ojdbc11</artifactId>
26+
<version>23.3.0.23.09</version>
27+
</dependency>
28+
<dependency>
29+
<groupId>com.oracle.database.graph</groupId>
30+
<artifactId>opg-client</artifactId>
31+
<version>24.1.0</version>
32+
</dependency>
33+
</dependencies>
34+
<dependency>
35+
<groupId>com.oracle.database.security</groupId>
36+
<artifactId>oraclepki</artifactId>
37+
<version>23.3.0.23.09</version>
38+
</dependency>
39+
<dependency>
40+
<groupId>com.oracle.database.graph</groupId>
41+
<artifactId>pgx-api</artifactId>
42+
<version>24.1.0</version>
43+
</dependency>
44+
<dependency>
45+
<groupId>com.oracle.database.graph</groupId>
46+
<artifactId>graph-query-ir</artifactId>
47+
<version>2.0.8.2</version>
48+
</dependency>
49+
</project>
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
package pg.oracle;
2+
3+
/* property graph demo
4+
this code demonstrates:
5+
1. integration of Property Graph with SQL in Oracle Database 23c
6+
2. Java API for Property Graph Server
7+
It uses demonstration tables described in the following LiveLabs Workshop:
8+
"Analyze, Query, and Visualize Property Graphs with Oracle Database"
9+
https://apexapps.oracle.com/pls/apex/r/dbpm/livelabs/run-workshop?p210_wid=686&p210_wec=&session=108772142407826
10+
Requirements:
11+
1. Oracle Database 23c
12+
2. Database user account ( <username> ) with the privileges described in the mentioned LiveLabs Workshop
13+
3. Tables used in this workshop created in the mentioned schema
14+
4. Oracle Property Graph Server installation using user account
15+
*/
16+
17+
18+
import java.sql.*;
19+
import oracle.jdbc.pool.OracleDataSource;
20+
import oracle.pg.rdbms.GraphServer;
21+
import oracle.pgx.api.*;
22+
23+
public class Main {
24+
private static String dbHost = "<database_hostname_or_op>";
25+
private static String pgxHost = "<graph_server_hostname_or_ip>";
26+
private static int dbPort = <listener_port_number_ususally_1521>;
27+
private static int pgxPort = <graph_server_port_number_usually_7007>;
28+
private static String dbService = "<database_service_name>";
29+
private static String username = "<username>";
30+
private static String password = "<password>";
31+
private static String pgName = "CUSTOMER_GRAPH";
32+
public static void SQLPGDemo() {
33+
try {
34+
OracleDataSource ds = new OracleDataSource();
35+
ds.setDriverType("thin");
36+
ds.setServerName(dbHost);
37+
ds.setServiceName(dbService);
38+
ds.setPortNumber(dbPort);
39+
ds.setUser(username);
40+
ds.setPassword(password);
41+
Connection con = ds.getConnection();
42+
System.out.println("Connected to the database");
43+
System.out.println("(Re)creating property graph "+pgName);
44+
Statement stmt = con.createStatement();
45+
stmt.execute("CREATE OR REPLACE PROPERTY GRAPH "+pgName+" VERTEX TABLES (\n" +
46+
" customer\n" +
47+
" , account\n" +
48+
" , merchant\n" +
49+
" )\n" +
50+
" EDGE TABLES (\n" +
51+
" account as account_edge\n" +
52+
" SOURCE KEY(id) REFERENCES account (id)\n" +
53+
" DESTINATION KEY(customer_id) REFERENCES customer (id)\n" +
54+
" LABEL owned_by PROPERTIES (id)\n" +
55+
" , parent_of as parent_of_edge \n" +
56+
" SOURCE KEY(customer_id_parent) REFERENCES customer (id)\n" +
57+
" DESTINATION KEY(customer_id_child) REFERENCES customer (id)\n" +
58+
" , purchased as puchased_edge \n" +
59+
" SOURCE KEY(account_id) REFERENCES account (id)\n" +
60+
" DESTINATION KEY(merchant_id) REFERENCES merchant (id)\n" +
61+
" , transfer as transfer_edge \n" +
62+
" SOURCE KEY(account_id_from) REFERENCES account (id)\n" +
63+
" DESTINATION KEY(account_id_to) REFERENCES account (id)\n" +
64+
" ) ");
65+
System.out.println("Graph (re)created succesfully.");
66+
ResultSet rset = stmt.executeQuery("SELECT account_no\n" +
67+
"FROM GRAPH_TABLE ( CUSTOMER_GRAPH MATCH (v1)-[transfer_edge]->{1,2}(v1)\n" +
68+
"columns (v1.account_no as account_no))");
69+
while (rset.next()) {
70+
System.out.println(rset.getString(1));
71+
}
72+
con.close();
73+
}
74+
catch (Exception e) {e.printStackTrace();}
75+
}
76+
77+
public static void PGXDemo() {
78+
try {
79+
ServerInstance si = GraphServer.getInstance("https://"+pgxHost+":"+pgxPort,username,password.toCharArray());
80+
PgxSession ses = si.createSession("my-session");
81+
System.out.println("Connected to graph server");
82+
PgxGraph graph = ses.readGraphByName(username.toUpperCase(), pgName, GraphSource.PG_SQL);
83+
System.out.println("Graph loaded into Property Graph Server");
84+
PgqlResultSet rset = graph.queryPgql("SELECT a1.account_no AS a1_account\n" +
85+
" , t1.transfer_date AS t1_date\n" +
86+
" , t1.amount AS t1_amount\n" +
87+
" , a2.account_no AS a2_account\n" +
88+
" , t2.transfer_date AS t2_date\n" +
89+
" , t2.amount AS t2_amount\n" +
90+
"FROM MATCH (a1)-[t1:transfer_edge]->(a2)-[t2:transfer_edge]->(a1)\n" +
91+
"WHERE t1.transfer_date < t2.transfer_date");
92+
while (rset.next()) {
93+
System.out.println(rset.getString(1));
94+
}
95+
}
96+
catch (Exception e) {e.printStackTrace();}
97+
}
98+
public static void main(String[] args) {
99+
SQLPGDemo();
100+
PGXDemo();
101+
}
102+
}

data-platform/data-science-and-ml/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Data Science and Machine Learning
22

3+
The Data Science and Machine Learning section covers the tools and services under the broader Oracle Artificial Intelligence / Machine Learning / Data Science platform targeted at Data Science personas.
4+
5+
Reviewed: 2024.03.08
6+
7+
38
# License
49

510
Copyright (c) 2024 Oracle and/or its affiliates.

data-platform/data-science-and-ml/art-of-possible-demos/assets-by-demo/README.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)