Oracle Cloud で無料の SPARQL エンドポイント構築
LOD Challenge 2021
統計センター様をはじめ国内外の研究機関等で
Oracle Cloud を活用した SPARQL エンドポイントが稼働
2
本資料の内容
無償で使えるAlways Free環境を利用して、
Oracleが提供するRDFグラフのSPARQLエンドポイントからデータロード&クエリ実行を行います。
Copyright © 2021, Oracle and/or its affiliates
3
構成イメージ
Copyright © 2021, Oracle and/or its affiliates
4
トリプルストア
(Autonomous Database)
Compute
※RDFグラフ・サーバーが構成されたComputeのイメージが
マーケットプレイスで提供されているため、今回はそれを利用する
RDFグラフ・サーバー
on Weblogic
参照
Oracle Databaseを
トリプルストアとして
利用可能
Oracleが提供する
RDFグラフのSPARQLエンドポイント
作業の流れ
Copyright © 2021, Oracle and/or its affiliates
5
今回デモを行う部分
(必要に応じて)言語設定
Copyright © 2021, Oracle and/or its affiliates
6
Autonomous Database(トリプルストア)の作成①
Copyright © 2021, Oracle and/or its affiliates
7
Autonomous Database(トリプルストア)の作成②
Copyright © 2021, Oracle and/or its affiliates
8
Autonomous Database(トリプルストア)の作成③
Copyright © 2021, Oracle and/or its affiliates
9
任意の名前(本資料ではTRLSTOREとする)
Autonomous Database(トリプルストア)の作成④
Copyright © 2021, Oracle and/or its affiliates
10
DBのパスワード
※後程利用するため、メモしておく
Autonomous Database(トリプルストア)の作成⑤
Copyright © 2021, Oracle and/or its affiliates
11
数分程度で作成完了
ネットワークリソースの作成①
Copyright © 2021, Oracle and/or its affiliates
12
ネットワークリソースの作成②
Copyright © 2021, Oracle and/or its affiliates
13
ネットワークリソースの作成③
Copyright © 2021, Oracle and/or its affiliates
14
ネットワークリソースの作成④
Copyright © 2021, Oracle and/or its affiliates
15
事前にSSHキー・ペアを作成する
以下のドキュメントを参考に、Compute作成時に必要となるSSHキー・ペアを作成しておきます。�
Oracle Cloud Infrastructureドキュメント >キー・ペアの作成�https://docs.oracle.com/ja-jp/iaas/Content/GSG/Tasks/creatingkeys.htm
Copyright © 2021, Oracle and/or its affiliates
16
RDFグラフ・サーバー構築済Computeの作成①
Copyright © 2021, Oracle and/or its affiliates
17
RDFグラフ・サーバー構築済Computeの作成②
Copyright © 2021, Oracle and/or its affiliates
18
「Oracle RDF Graph Server and Query UI」で検索
RDFグラフ・サーバー構築済Computeの作成③
Copyright © 2021, Oracle and/or its affiliates
19
RDFグラフ・サーバー構築済Computeの作成④
Copyright © 2021, Oracle and/or its affiliates
20
任意の名前(本資料では「RDFServer」とする)
RDFグラフ・サーバー構築済Computeの作成⑤
Copyright © 2021, Oracle and/or its affiliates
21
事前に作成しておいた
SSHキー・ペアのPublic Keyを選択
RDFグラフ・サーバー構築済Computeの作成⑥
Copyright © 2021, Oracle and/or its affiliates
22
「ネットワークリソースの作成」で
作成したVCNを選択
Public Subnetを選択
RDFグラフ・サーバー構築済Computeの作成⑦
Copyright © 2021, Oracle and/or its affiliates
23
RDFグラフ・サーバー構築済Computeの作成⑧
Copyright © 2021, Oracle and/or its affiliates
24
15分程度で作成完了
作成された環境(Compute)の確認①
Copyright © 2021, Oracle and/or its affiliates
25
作成された環境(Compute)の確認②
Copyright © 2021, Oracle and/or its affiliates
26
アクセス時に使用する
パブリックIPアドレスをメモしておく
ネットワークセキュリティリストの編集①
デフォルトでは22番ポートでのアクセスしか許可されていないため、�RDFグラフ・サーバー用のポート(8001)へのアクセスを許可するようにセキュリティリストを更新します。
> 前ページのComputeインスタンス名をクリック
Copyright © 2021, Oracle and/or its affiliates
27
ネットワークセキュリティリストの編集②
Copyright © 2021, Oracle and/or its affiliates
28
ネットワークセキュリティリストの編集③
Copyright © 2021, Oracle and/or its affiliates
29
Autonomous DatabaseのWalletダウンロード
Copyright © 2021, Oracle and/or its affiliates
30
Walletのパスワードを入力
※後程利用するため、メモしておく
Computeへアクセス(Teratermを使用する場合の例)
Copyright © 2021, Oracle and/or its affiliates
31
「作成された環境(Compute)の確認②」
で確認したComputeのPublic IPアドレス
Compute作成時に指定した
SSHキー・ペアのPrivate Keyファイルを指定
RDFグラフ・サーバーとDBの接続で利用するWalletファイルの編集
Copyright © 2021, Oracle and/or its affiliates
32
-- SCPやTeraterm等のファイル転送機能を利用してファイルをComputeに転送
-- 今回の例では「/tmp」配下に配置
[opc@orardf-server-instance ~]$ ls -l /tmp/Wallet_<DB名>.zip
--データベース・ログイン資格証明を追加したWalletファイルの作成
[opc@orardf-server-instance ~]$ mkdir ~/wallet
[opc@orardf-server-instance ~]$ cd ~/wallet/
[opc@orardf-server-instance wallet]$ unzip /tmp/Wallet_TRLSTORE.zip
[opc@orardf-server-instance wallet]$ export JAVA_HOME=/usr/local/java/jdk1.8.0_221
[opc@orardf-server-instance wallet]$ /u01/app/oracle/middleware/wls12214/oracle_common/bin/mkstore
-wrl /home/opc/wallet -createCredential <DB名>_high ADMIN <DBのパスワード>
> Enter wallet password: <Walletのパスワード>
[opc@orardf-server-instance wallet]$ zip ../wallet_with_cred.zip *
[opc@orardf-server-instance wallet]$ ls -l ../
total 28
drwxrwx---. 6 opc opc 64 Aug 3 17:52 oraInventory
drwxrwxr-x. 2 opc opc 4096 Oct 26 10:33 wallet
-rw-rw-r--. 1 opc opc 22983 Oct 26 10:45 wallet_with_cred.zip
本資料の場合の例。紙面の都合上改行しているが、
実際には一行で入力する
/u01/app/oracle/middleware/wls12214/oracle_common/bin/mkstore
-wrl /home/opc/wallet -createCredential trlstore_high ADMIN passwd01
本資料では「Wallet_TRLSTORE.zip」
本ファイルをダウンロードしておく
RDFグラフ・サーバー起動確認
Copyright © 2021, Oracle and/or its affiliates
33
[opc@orardf-server-instance ~]$ sudo systemctl status wls_orardf
● wls_orardf.service - RDF Domain WebLogic Servers startup
Loaded: loaded (/etc/systemd/system/wls_orardf.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2021-10-26 11:13:50 GMT; 16s ago
Process: 11699 ExecStart=/u01/app/oracle/domains/orardfDomain/startRdfServerDomain.sh (code=exited, status=0/SUCCESS)
Memory: 259.0M
CGroup: /system.slice/wls_orardf.service
├─11700 /bin/sh /u01/app/oracle/domains/orardfDomain/bin/startNodeManager.sh
├─11701 /bin/sh /u01/app/oracle/domains/orardfDomain/bin/startWebLogic.sh
├─11702 /bin/sh /u01/app/oracle/domains/orardfDomain/bin/startManagedWebLogic.sh ms_1
├─11703 /bin/sh /u01/app/oracle/domains/orardfDomain/bin/startWebLogic.sh nodebug noderby
├─11704 /bin/sh /u01/app/oracle/middleware/wls12214/wlserver/server/bin/startNodeManager.sh
├─11843 /usr/local/java/jdk1.8.0_221/bin/java -server -Xms256m -Xmx512m -cp /u01/app/oracle/middleware/wls12214/wlserver/server/lib/weblogic-launc...
├─11849 /usr/local/java/jdk1.8.0_221/bin/java -Djava.security.manager -Djava.security.policy=/u01/app/oracle/middleware/wls12214/wlserver/common/d...
├─11850 /usr/local/java/jdk1.8.0_221/bin/java -server -Xms32m -Xmx200m -Djdk.tls.ephemeralDHKeySize=2048 -Dcoherence.home=/u01/app/oracle/middlewa...
└─11851 /usr/local/java/jdk1.8.0_221/bin/java -server -Xms256m -Xmx512m -cp /u01/app/oracle/middleware/wls12214/wlserver/server/lib/weblogic-launc...
Oct 26 11:13:50 orardf-server-instance systemd[1]: Starting RDF Domain WebLogic Servers startup...
Oct 26 11:13:50 orardf-server-instance systemd[1]: Started RDF Domain WebLogic Servers startup.
-- 起動していない場合は以下の通り再起動する
[opc@orardf-server-instance ~]$ sudo systemctl stop wls_orardf
[opc@orardf-server-instance ~]$ sudo systemctl start wls_orardf
起動していることを確認する
RDFグラフ・サーバーへアクセス
https://<「作成された環境(Compute)の確認②」で確認したComputeのPublic IPアドレス>:8001/orardf
Copyright © 2021, Oracle and/or its affiliates
34
weblogic
welcome1
Autonomous Databaseへアクセスするためのデータソース設定
Copyright © 2021, Oracle and/or its affiliates
35
「RDFグラフ・サーバーとDBの接続で利用するWalletファイルの編集」で
作成したWalletファイル「wallet_with_cred.zip」を選択
RDFデータロードの流れ
Copyright © 2021, Oracle and/or its affiliates
36
トリプルストア
(Autonomous Database)
Semantic Network:
SEMNET01
Semantic Network:
SEMNET02
MODEL: EXAMPLE1
MODEL: EXAMPLE2
MODEL: EXAMPLE3
1. Semantic Networkの作成
Copyright © 2021, Oracle and/or its affiliates
37
「Autonomous Databaseへアクセスするためのデータソース設定」で
作成したデータソースを指定
2. Modelの作成
Copyright © 2021, Oracle and/or its affiliates
38
作成したSemantic Networkを指定
3. ファイルをステージング表にアップロード
Copyright © 2021, Oracle and/or its affiliates
39
任意の名前を指定
RDFデータファイルを
選択
【参考】今回ロードしたTurtleファイル
以下のドキュメントに例示されていたTurtleファイルをロードしています。
> W3c RDF 1.1 Turtle: https://www.w3.org/TR/turtle/
Copyright © 2021, Oracle and/or its affiliates
40
@base <http://example.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rel: <http://www.perceive.net/schemas/relationship/> .
<#green-goblin>
rel:enemyOf <#spiderman> ;
a foaf:Person ; # in the context of the Marvel universe
foaf:name "Green Goblin" .
<#spiderman>
rel:enemyOf <#green-goblin> ;
a foaf:Person ;
foaf:name "Spiderman", "Человек-паук"@ru .
EXAMPLE1.ttl
4.バルクロードでRDFデータとして取り込み
Copyright © 2021, Oracle and/or its affiliates
41
RDFデータに
4000byte以上の文字列が
含まれる場合は
「<ステージング表>_CLOB」も
同様の手順でバルクロードする必要がある
先ほど作成したModelを指定
5. クエリ実行
Copyright © 2021, Oracle and/or its affiliates
42
可視化も可能
参考資料
Copyright © 2021, Oracle and/or its affiliates
43
問合せ先
公共営業統括
クラウド営業本部 第一営業部
松井 雄介 (yusuke.matsui@oracle.com)
お客様の所属されている組織によっては、別の担当者をご紹介させていただくことがございます。
ご了承ください。
44