1 of 45

Oracle Cloud で無料の SPARQL エンドポイント構築

LOD Challenge 2021

2 of 45

統計センター様をはじめ国内外の研究機関等で

Oracle Cloud を活用した SPARQL エンドポイントが稼働

2

3 of 45

本資料の内容

無償で使えるAlways Free環境を利用して、

Oracleが提供するRDFグラフのSPARQLエンドポイントからデータロード&クエリ実行を行います。

Copyright © 2021, Oracle and/or its affiliates

3

4 of 45

構成イメージ

Copyright © 2021, Oracle and/or its affiliates

4

トリプルストア

(Autonomous Database)

Compute

※RDFグラフ・サーバーが構成されたComputeのイメージが

マーケットプレイスで提供されているため、今回はそれを利用する

RDFグラフ・サーバー

on Weblogic

参照

Oracle Databaseを

トリプルストアとして

利用可能

Oracleが提供する

RDFグラフのSPARQLエンドポイント

5 of 45

作業の流れ

  1. Autonomous Databaseの作成
  2. ネットワークリソースの作成 ※Compute作成のために必要なリソース
  3. マーケットプライスを使ったRDFグラフ・サーバー構築済Computeの作成
  4. 接続事前準備
  5. RDFグラフ・サーバーセットアップ
  6. RDFデータロード

Copyright © 2021, Oracle and/or its affiliates

5

今回デモを行う部分

6 of 45

(必要に応じて)言語設定

Copyright © 2021, Oracle and/or its affiliates

6

7 of 45

Autonomous Database(トリプルストア)の作成①

Copyright © 2021, Oracle and/or its affiliates

7

8 of 45

Autonomous Database(トリプルストア)の作成②

Copyright © 2021, Oracle and/or its affiliates

8

9 of 45

Autonomous Database(トリプルストア)の作成③

Copyright © 2021, Oracle and/or its affiliates

9

任意の名前(本資料ではTRLSTOREとする)

10 of 45

Autonomous Database(トリプルストア)の作成④

Copyright © 2021, Oracle and/or its affiliates

10

DBのパスワード

※後程利用するため、メモしておく

11 of 45

Autonomous Database(トリプルストア)の作成⑤

Copyright © 2021, Oracle and/or its affiliates

11

数分程度で作成完了

12 of 45

ネットワークリソースの作成①

Copyright © 2021, Oracle and/or its affiliates

12

13 of 45

ネットワークリソースの作成②

Copyright © 2021, Oracle and/or its affiliates

13

14 of 45

ネットワークリソースの作成③

Copyright © 2021, Oracle and/or its affiliates

14

15 of 45

ネットワークリソースの作成④

Copyright © 2021, Oracle and/or its affiliates

15

16 of 45

事前に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

17 of 45

RDFグラフ・サーバー構築済Computeの作成①

Copyright © 2021, Oracle and/or its affiliates

17

18 of 45

RDFグラフ・サーバー構築済Computeの作成②

Copyright © 2021, Oracle and/or its affiliates

18

「Oracle RDF Graph Server and Query UI」で検索

19 of 45

RDFグラフ・サーバー構築済Computeの作成③

Copyright © 2021, Oracle and/or its affiliates

19

20 of 45

RDFグラフ・サーバー構築済Computeの作成④

Copyright © 2021, Oracle and/or its affiliates

20

任意の名前(本資料では「RDFServer」とする)

21 of 45

RDFグラフ・サーバー構築済Computeの作成⑤

Copyright © 2021, Oracle and/or its affiliates

21

事前に作成しておいた

SSHキー・ペアのPublic Keyを選択

22 of 45

RDFグラフ・サーバー構築済Computeの作成⑥

Copyright © 2021, Oracle and/or its affiliates

22

「ネットワークリソースの作成」で

作成したVCNを選択

Public Subnetを選択

23 of 45

RDFグラフ・サーバー構築済Computeの作成⑦

Copyright © 2021, Oracle and/or its affiliates

23

24 of 45

RDFグラフ・サーバー構築済Computeの作成⑧

Copyright © 2021, Oracle and/or its affiliates

24

15分程度で作成完了

25 of 45

作成された環境(Compute)の確認①

Copyright © 2021, Oracle and/or its affiliates

25

26 of 45

作成された環境(Compute)の確認②

Copyright © 2021, Oracle and/or its affiliates

26

アクセス時に使用する

パブリックIPアドレスをメモしておく

27 of 45

ネットワークセキュリティリストの編集①

デフォルトでは22番ポートでのアクセスしか許可されていないため、�RDFグラフ・サーバー用のポート(8001)へのアクセスを許可するようにセキュリティリストを更新します。

> 前ページのComputeインスタンス名をクリック

Copyright © 2021, Oracle and/or its affiliates

27

28 of 45

ネットワークセキュリティリストの編集②

Copyright © 2021, Oracle and/or its affiliates

28

29 of 45

ネットワークセキュリティリストの編集③

Copyright © 2021, Oracle and/or its affiliates

29

30 of 45

Autonomous DatabaseのWalletダウンロード

Copyright © 2021, Oracle and/or its affiliates

30

Walletのパスワードを入力

※後程利用するため、メモしておく

31 of 45

Computeへアクセス(Teratermを使用する場合の例)

Copyright © 2021, Oracle and/or its affiliates

31

「作成された環境(Compute)の確認②」

で確認したComputeのPublic IPアドレス

Compute作成時に指定した

SSHキー・ペアのPrivate Keyファイルを指定

32 of 45

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」

本ファイルをダウンロードしておく

33 of 45

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

起動していることを確認する

34 of 45

RDFグラフ・サーバーへアクセス

https://<「作成された環境(Compute)の確認②」で確認したComputeのPublic IPアドレス>:8001/orardf

Copyright © 2021, Oracle and/or its affiliates

34

weblogic

welcome1

35 of 45

Autonomous Databaseへアクセスするためのデータソース設定

Copyright © 2021, Oracle and/or its affiliates

35

「RDFグラフ・サーバーとDBの接続で利用するWalletファイルの編集」で

作成したWalletファイル「wallet_with_cred.zip」を選択

36 of 45

RDFデータロードの流れ

  1. Semantic Network(RDF network)の作成
    • Semantic Network:�RDFデータ管理のために必要な表やビューのセット
  2. Modelの作成
    • Model:Oracle Database特有のトリプルの管理単位
  3. ファイルをステージング表にアップロード
  4. バルクロードでRDFデータとして取り込み
  5. クエリ実行

Copyright © 2021, Oracle and/or its affiliates

36

トリプルストア

(Autonomous Database)

Semantic Network:

SEMNET01

Semantic Network:

SEMNET02

MODEL: EXAMPLE1

MODEL: EXAMPLE2

MODEL: EXAMPLE3

37 of 45

1. Semantic Networkの作成

Copyright © 2021, Oracle and/or its affiliates

37

「Autonomous Databaseへアクセスするためのデータソース設定」で

作成したデータソースを指定

38 of 45

2. Modelの作成

Copyright © 2021, Oracle and/or its affiliates

38

作成したSemantic Networkを指定

39 of 45

3. ファイルをステージング表にアップロード

Copyright © 2021, Oracle and/or its affiliates

39

任意の名前を指定

RDFデータファイルを

選択

40 of 45

【参考】今回ロードした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

41 of 45

4.バルクロードでRDFデータとして取り込み

Copyright © 2021, Oracle and/or its affiliates

41

RDFデータに

4000byte以上の文字列が

含まれる場合は

「<ステージング表>_CLOB」も

同様の手順でバルクロードする必要がある

先ほど作成したModelを指定

42 of 45

5. クエリ実行

Copyright © 2021, Oracle and/or its affiliates

42

可視化も可能

43 of 45

参考資料

  • Setup RDF Graph Server with Autonomous Database
  • Oracle® Database RDFグラフのグラフ開発者ガイド 21c F37759-02(原本部品番号:F31379-06)�> 第II部 RDFグラフ・サーバーおよび問合せUI

Copyright © 2021, Oracle and/or its affiliates

43

44 of 45

問合せ先

公共営業統括

クラウド営業本部 第一営業部

松井 雄介 (yusuke.matsui@oracle.com

お客様の所属されている組織によっては、別の担当者をご紹介させていただくことがございます。

ご了承ください。

44

45 of 45