SlideShare une entreprise Scribd logo
1  sur  117
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
ORACLE
Oracle Spatial and Graph 소개
권철민
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Graph 와 Semantic Web 소개1
2
3
4
5
Oracle Confidential – Internal/Restricted/Highly Restricted 2
RDF
SPARQL 소개 및 실습
Ontology – RDFS , OWL 그리고 추론(Inferencing)
Oracle Semantic Technology 소개 및 실습
6 타 Semantic 솔루션 소개 – TopBraid Composer
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Overview of Graph
 Graph 란?
그래프는 Vertex(노드) 와 Edge(링크)의 연결을 통해 데이터를 표현하는 집합
 Graph의 사용 유형
• Road networks, power grids, biological networks
• Social networks/Social Web (Facebook, Linkedin, Twitter, Baidu, Google+,>)
• Knowledge graphs (RDF, OWL)
– 그래프는 직관적이고 유연하다.
• Easy to navigate, easy to form a path, natural to visualize
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle Graph의 활용 유형
여러 유형의 Application에서 Oracle Graph를 활용.
– Link-node graphs representing physical/logical networks used in transportation,utilities and telco
(Oracle Spatial and Graph Network Data Model (NDM)
– RDF Semantic Graphs modeling data as Triples for social network, linked data and other semantic applications
(Oracle Spatial and Graph)
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Semantic Web 의 정의
데이터와 그 데이터가 뜻하는 Semantic(의미)를 웹 상에서 공유하기 위한 표준들과 Best Practices들의 집합체
Semantic Web
• 표준 데이터 모델 : RDF
• 데이터 의미( Semantic) 표준 명세서 : RDFS/OWL
• 표준 데이터 조회 방법 : SPARQL
보다 스마트 한 Web을 만들기 위한 차세대 Web 규약
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
HTML 시대의 분산 데이터 조회 및 처리
A항공사 html
<table 스케쥴 >
<tr> 출발스케줄 ….
<td> 편명 </td>
……
……
</table>
B항공사 html
<P 항공 스케줄>
<A> 출발시간
…………..
………….
</P>
E항공사 html
또다른 HTML 코드
…….
항공사 좌석조회 Portal
<table 전체 스케쥴 >
<tr> 출발 항공사 스케줄 ….
<td> ….. </td>
……
……
</table>
각 항공사 html에서 스케줄 관련 부분을 가져 온 뒤 적절하게 Parsing 하고
재 조합하여 항공사 좌석조회 Portal에서 표시
만일 B항공사의 Html 이 변경된다면?
프로그램 처리 로직
• 프로그램 처리로직을 다시 변경하여
B항공사의 Contents 맞게 가공 필요
• 항공사가 늘어날 수록 데이터 가공
처리가 더욱 복잡해 짐
• 정확한 데이터의 표현이 어려워짐.
항공사 별로 서로 다른 표시 형식을 가진 웹사이트
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Smart 한 웹 시스템 구축을 위한 구성 요소
•각 Sites에서 표준 Data Format으로 데이터를 제공
•각 데이터들이 데이터에 대한 다양한 속성과 관계를 상세하게 정의한 명세서를 제공
•해당 데이터를 Retrieve 할 수 있는 공통의 Protocol을 제공
HTML은 데이터의 표현을 위한 Tag와 내용이 혼재되어 있음.
어떻게 각 사이트에서 제공하는 정보를 효과적으로 통합하고 활용할 것인가?
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Smart Web 구현을 위한 표준 Infra 구성
A항공사 데이타
< Airline Flight ID = “F01 “>
< Airline name“A” …>
<Dept City = “ 서울”>
< Dept time = 8/1 16:00>
< Vacancy seat= 100 >
……..
A항공사 데이터 명세서
• Flight id 는 편명이고 문자Type의
고유한 값을 가짐.
• Airline name은 항공사 명을 뜻하고
항공연합회에 해당
이름이등재되어 있음.
• Dept time은 날짜/시간이며
yyyymmdd hh24:mi 형으로 되어
있음.
• Dept city , Arrv City 모두 Location
클래스에 등재되어 있으며 서로
대칭관계를 가짐
B 항공사 데이타
< Airline FID= “F01 “>
< name“A” …>
<…….
……..
B항공사 데이터 명세서
• ……….
항공사 좌석조회 Portal
RDF RDF/OWL
Select ?편명 ?출발도시 ?도착도시 ?출발시간
From A항공사 데이터 , B항공사 데이터, C….
프로그램 처리 로직
데이터 공유를 위한 표준 Web Infra 를
각 항공사가 수용한다면 정확하고
실시간으로 Update 되는 데이터를
누구나 이용가능 함.
RDF RDF/OWL
SPARQL
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Semantic Web Component
RDF
( Triple)
Relation Data Model
Ontology
RDFS/OWL
DB 메타데이타
( 컬럼명, 컬럼 Type , pk/fk ,
Constraint 등)
SPARQL SQL
Semantic Web RDB
UML ERD
Semantic Web은 Graph 형태의 데이터 모델인 RDF 와 데이터에 대한 구조 및 명세, 의미를 담은 Ontology 인
RDFS/OWL 그리고 RDF 데이터를 조회하기 위한 SPARQL이 주요 구성 요소임.
Semantic Web 구성 요소 및 RDB와의 비교
Semantic Web의 Component와 RDB 의 Component 들은 상당한 유사성을 가짐.
그러나 Semantic Web 은 RDB보다 광범위하고 이질적인 데이터 들을 효과적으로 연결하고 통합하기 위한 기술에 더욱 집중
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Linked Open Data
어떻게 하면 웹 상에서 모든 데이터를 쉽게 공유할 수 있는 최적의
데이터 인프라를 제공할 수 있을 것인가 ?
Semantic Web의 Component를 이용
RDF , RDFS/OWL,SPARQL
“데이터의 통합성과 연결 유연성을 강화한 데이터 모델 및 명확한 데이터 명세서 , 그리고 이들 데이터를 호출할 수 있는
프로토콜을 각 시스템들이 표준으로 갖춘다면 전세계 어떤 유형의 데이터라도 서로 연결되고 통합될 수 있다. “
- Tim BERNERS-Lee , Maybe
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Semantic Web Component를 통한 Linked Data 구성
Inferencing Query and Update
Web of Data Applications
Browser
Applications
Stand Alone
Applications
Common “Graph”
Format &
Common Vocabularies
“Bridges”
Data on the Web
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Graph 와 Semantic Web 소개1
2
3
4
5
Oracle Confidential – Internal/Restricted/Highly Restricted 12
RDF
SPARQL 소개 및 실습
Ontology – RDFS , OWL 그리고 추론(Inferencing)
Oracle Semantic Technology 소개 및 실습
6 타 Semantic 솔루션 소개 – TopBraid Composer
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Resource Description Framework (RDF)
RDF is a general framework for describing a Web site's metadata, or the
information about the information on the site. It provides interoperability
between applications that exchange machine-understandable information on
the Web.
W3C
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
웹상의 데이터 원격 분산 방안
EMPNO ENAME JOB HIREDATE SAL DEPTNO
7369 SMITH CLERK 1980-12-17 800 20
7499 ALLEN SALESMAN 1981-02-20 1,600 30
7521 WARD SALESMAN 1981-02-22 1,250 30
7566 JONES MANAGER 1981-04-02 2,975 20
7654 MARTIN SALESMAN 1981-09-28 1,250 30
7698 BLAKE MANAGER 1981-05-01 2,850 30
1. Column 단위 (수직 분할)로 데이터를 분할하여 각 원격지 서버로 데이터 분산
2. Record 단위 (수평 분할)로 데이터를 분할하여 각 원격지 서버로 데이터 분산
3. Column 과 Record 결합하여 데이터를 분할하여 각 원격지 서버로 데이터 분산
아래와 같은 데이터 값을 웹상의 여러 대 서버로 분산하기 위한 방안은 ?
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
웹상의 데이터 원격 분산 방안 – Column 레벨 분산
ENAME
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
JOB HIREDATE
CLERK 1980-12-17
SALESMAN 1981-02-20
SALESMAN 1981-02-22
MANAGER 1981-04-02
SALESMAN 1981-09-28
MANAGER 1981-05-01
SAL DEPTNO
800 20
1,600 30
1,250 30
2,975 20
1,250 30
2,850 30
Column 레벨로 분산
• 각 시스템들이 개별적으로 컬럼들을 가짐.
• 각 시스템별로 동일한 Record를 참조하는지 알 수 없음( 한 서버의 세 번째 Record가 다른 서버의 세 번째 Record와 같은
개체를 참조하는가 ? )
• 각 시스템 전체적으로 참조 가능한 Global 식별자가 필요함.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
웹상의 데이터 원격 분산 방안 – Record 레벨 분산
7521 WARD SALESMAN 1981-02-22 1,250 30
7566 JONES MANAGER 1981-04-02 2,975 20
7369 SMITH CLERK 1980-12-17 800 20
7499 ALLEN SALESMAN 1981-02-20 1,600 30
7654 MARTIN SALESMAN 1981-09-28 1,250 30
7698 BLAKE MANAGER 1981-05-01 2,850 30
Record 레벨로 분산
• 각 시스템들이 Record 의 일부만을 분산하여 관리함.
• 여러 Column을 분산될 경우의 문제점 해결되나 각 시스템 별로 컬럼에 대한 정보를 공유해야 함. (한 시스템의 세 번째
컬럼이 다른 시스템의 세 번째 컬럼과 일치하는가 ? )
• 서버들은 전 세계적으로 공통된 방법으로 각 컬럼이 가리키는 속성을 인지 할 수 있어야 함.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
웹상의 데이터 원격 분산 방안 – Cell 레벨로 분산
글로벌 식별자 ENAME
Record 1 SMITH
글로벌 식별자 JOB
Record 5 SALESMAN
글로벌 식별자 HIREDATE
Record 1 1980-12-17
글로벌 식별자 ENAME
Record 3 SMITH
글로벌 식별자 SAL
Record 5 1,250
Cell 레벨로 분산
• 각 시스템은 몇 개의 Cell로 분리하여 관리하여 유연성 증대
• Cell이 세가지의 값으로 표현되어야 함. 즉 Record에 대한 범용적인 참조, 컬럼에 대한 범용적인 참조, Cell 자체의 값
• RDF의 기본 구성단위인 Triple의 표현 형태. 행 식별자는 주어부, 컬럼 식별자는 술어부 , 셀에 있는 값은 목적부임.
• 컬럼의 추가/삭제와 같은 스키마의 변경이 데이터의(Cell) 추가/삭제로 가능하므로 유연한 데이터 모델 구성 가능
글로벌 식별자 Commission
Record 5 500
만일 신규 컬럼이 추가된다면?
Cell 을 추가 생성함.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
여러 데이터 소스로부터 데이터 병합
계약: 11111
자동청구
권철민
월 정기납부
LTE 무한 요금
명의자
청구방법
납부방법
가입 상품
상품:LTE 무한 요금
무선 전용
무한 사용 요금제
유무선 상품 구분
요금제 분류
……..
두개의 다른 영역에 있는 그래프의 노드가 서로 같은 노드임을 규명하는 것이 병합의 핵심
계약 Domain 상품 Domain
같은 노드 인가?
• 트리플 Graph의 가치는 데이터의 병합이 쉽게 이루어 질수 있는 용이성에 있음.
• 정보가 트리플로 간단히 표현되면 두 그래프로부터 병합된 정보는 단순히 개별 그래프의 모든 트리플들을
합하여 하나의 그래프로 만드는 것.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
여러 데이터 소스로부터 데이터 병합 - URI
계약: 11111
자동청구
권철민
월 정기납부
LTE 무한 요금
명의자
청구방법
납부방법
가입 상품
무선 전용
무한 사용 요금제
유무선 상품 구분
요금제 분류
• 각 노드가 서로 같은지를 결정하기 위한 정확한 정보가 필요.
• 각 노드가 고유의 식별자를 가지게 하기 위해 웹 상에서 사용되는 Global
Identifier 를 활용
URI
(Uniform Resource Identifiers)
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
URIs
• URI = Uniform Resource Identifier
• “웹 상의 모든 Resource 를 고유하게 식별할 수 있는(범용 식별자) 표기 체계“
• URI는 URL 표기와 유사하며 RDF에서는 Document의 특정부분을 가리키기 위해 Fragment
identifier와 함께 사용되기도 함
– http://www.somedomain.com/some/path/to/file#fragmentID
• URI는 약어 표현이 가능하며 (qname) , qname으로 표현된 URI는 네임스페이스와 “:”(콜론) 그리고
식별자로 구성됨.
<http://purl.org/dc/elements/1.1/creator>
<http://purl.org/dc/elements/1.1/title>
@prefix dc: <http://purl.org/dc/elements/1.1/> .
dc:creator ……
dc:title ……..
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF란?
RDF는 Web Resource 들과 그들간의 관계를 표현하기 위해 Triple로 구성된 Graph 형태의 데이터 모델
<http://foobar > <produces> <mp3>
Triple
Subject
주어
(식별자)
( Vertex/Node)
Predicate
술어
(속성명/관계명)
( Property/edge)
Object
목적어
(속성값/관계값)
( Vertex/node)
그래프 데이터는 RDF/XML ,N-TRIPLE,N3 형태로 저장되고 표현될 수 있다.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
간단한 RDF 예제 – RDF/XML 형태
<rdf:Description rdf:about="http://…/isbn/2020386682">
<f:title xml:lang="fr">Le palais des mirroirs</f:title>
<f:original rdf:resource="http://…/isbn/000651409X"/>
</rdf:Description>
http://…isbn/2020386682
Le palais des miroirs http://…isbn/000651409X
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Graph 데이터 모델의 장점
•Graph 모델링은 유연하다
- 새로운 Vertex나 Edge를 추가하거나 삭제하는 것이 매우 단순함
- Edge를 추가하는 것은 RDB Table에 컬럼을 추가하는 것과 유사하나 Graph에서는 상대적으로 매우 쉬움
•표준 RDF 설정
- RDF는 W3C에서 정의됨
•Computer가 RDF 그래프의 Semantic을 이해 할 수 있음.
- Hidden Relationship을 자동으로 찾을 수 있음.
동일한 URI는 동일한 Resource를 의미함.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Graph 데이터 모델의 장점
•Graph 모델링은 유연하다
- 새로운 Vertex나 Edge를 추가하거나 삭제하는 것이 매우 단순함
- Edge를 추가하는 것은 RDB Table에 컬럼을 추가하는 것과 유사하나 Graph에서는 상대적으로 매우 쉬움
•표준 RDF 설정
- RDF는 W3C에서 정의됨
•Computer가 RDF 그래프의 Semantic을 이해 할 수 있음.
- Hidden Relationship을 자동으로 찾을 수 있음.
동일한 URI는 동일한 Resource를 의미함. 데이터가 연결되고 확장 가능
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
데이터 모델이란?
데이터
데이터 모델
RDF는 Triple로
Relational Data Model은 Entity의 정의와
그들간의 Relation으로
RDF/XML , N-TRIPLE,
Graph DB
RDBMS데이터 저장, 관리
데이터 모델이란 데이터를 어떠한 시각으로 바라봐야 하는 ‘틀’을 정의
데이터를 바라보는 틀 데이터를 바라보는 틀
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDB 데이터 모델과 Graph 데이터 모델
SELECT p1.Person
FROM Person p1 , PersonFriend pf ON PersonFriend.FriendID = p1.ID
JOIN Person p2 ON PersonFriend.PersonID = p2.ID
WHERE p2.Person = ‘Alice'
Alice의 친구는 누구?
SELECT p1.Person AS PERSON, p2.Person AS FRIEND_OF_FRIEND
FROM PersonFriend pf1 JOIN Person p1
ON pf1.PersonID = p1.ID JOIN PersonFriend pf2
ON pf2.PersonID = pf1.FriendID JOIN Person p2
ON pf2.FriendID = p2.ID
WHERE p1.Person = 'Alice' AND pf2.FriendID <> p1.ID
Alice의 친구의 친구는?
관계도가 깊어질수록 RDB에서는 SQL복잡도가 깊어지고 수행성능이 저하
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle RDBMS에서 Recursive SQL을 통한 계층 관계도 표현
조직
#조직코드
*상위조직코드
조직명
부서장
위치
구성되어
속하여
가져야
구성되어
가져야
구성되어
가져야
구성되어
팀
#* ID
부서
#* ID
본부
#* ID
회사
#* ID
SELECT LPAD(‘ ‘, 2*LEVEL)||COL1. . . .
FROM 조직
WHERE 위치=‘XXX’
CONNECT BY PRIOR 조직코드 = 상위조직코드
START WITH 조직명=‘YYY’ = ‘A’
통합하여 Recursive SQL로 관리각 엔터티별로 관계도가 깊어짐
• 계층관계도가 깊어지는
엔터티들은 모두 통합해야 하는가?
• 서로 상이한 유형의 컬럼을 가지는
엔터티들의 계층 관계도가
깊어지면 어떻게 해야 하는가?
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF 모델의 표현 - 1
Subject
(resource
identifier)
predicate
(property name)
Object
(property value)
richard homeTel (229) 276-5135
richard email richard49@hotmail.com
cindy homeTel (245)646-5488
cindy email cindym@gmail.com
Person명(PK) homeTel Email
richard (229) 276-5135 richard49@hotmail.com
cindy (245)646-5488 cindym@gmail.com
@prefix ab: <http://learningsparql.com/ns/addressbook#> .
ab:richard ab:homeTel "(229) 276-5135" .
ab:richard ab:email "richard49@hotmail.com" .
ab:cindy ab:homeTel "(245) 646-5488" .
ab:cindy ab:email "cindym@gmail.com" .
Relational Data 모델 RDF 모델
•RDBMS의 PK는 RDF에서는 Subject로 , 속성명은
Predicate 로 속성값은 Object로 매핑
•속성의 관계화
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF 모델의 표현 - 2
• Book No : ISBN 006251587X 의 저자는 Tim Berners-Lee
• Book No : ISBN 006251587X 는 “Weaving the Web” 이라는 제목이다.
• Tim Berners-Lee’s 의 직함은 “Director”이다.
Book
: ISBN 006251587X
Author
:Tim Berners-Lee
Weaving the Web
Book no
(PK)
저자
(FK)
제목
ISBN
006251587
Tim Berners-
Lee
Weaving the
Web
Author 명
Tim Berners-
Lee
직함
Director
Book 테이블
저자 테이블Director
저자
제목 직함
RDF 모델 RDBMS 모델
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF 의 저장
• RDF 를 File 로 저장하기
- 3가지 표기법으로 File Serialization : N-Triples , RDF/XML , N3
• RDF 를 Database 로 저장
- 대용량의 RDF의 경우 Database 에 저장하는 것이 가장 효율적
- Database Management System 가 갖춰야 할 기본적인 기능 외에 Semantic Web을 구성하는 Ontology
및 SPARQL에 대한 표준 지원이 가능하여 야 함.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF 의 직렬화 (Serialization) – N-Triples
<urn:isbn:006251587X> <http://purl.org/dc/elements/1.1/creator> <http://www.w3.org/People/Berners-Lee/card#i> .
<urn:isbn:006251587X> < http://purl.org/dc/elements/1.1/title> "Weaving the Web“ .
주어부 술어부 목적부 마침표
•축약되지 않은 URI를 사용하여 리소스 참조
•각 URI는 꺽은 화살표(<>) 안에 사용.
•Subject, Predicate, Object 순으로 표시되며 하나의 Triple 셋 은 “.” (마침표)로 구분한다.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF 의 직렬화 (Serialization) – N3
•Namespace의 qname을 통한 축약 제공
•주어부,술어부,목적부 그리고 마침표(.) 의 순으로 정의
•여러 개의 Triple이 하나의 주어부를 공유할 수 있도록 제공. “;”(세미콜론)을 사용하여 같은 주어부를 사용
하는 트리플이 (술어부와 목적부) 따라온다는 것을 명기함.
•가장 효율적인 표기 가능
@prefix dc: <http://purl.org/dc/elements/1.1/> .
<urn:isbn:006251587X>
dc:creator <http://www.w3.org/People/Berners-Lee/card#i> ;
dc:title "Weaving the Web“ .
주어부
술어부 목적부
세미콜론
(주어부를 공유하는 트리플이 존재)
술어부 목적부 마침표
Namespace (축약)
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF 의 직렬화 (Serialization) – RDF/XML
•RDF를 XML로 표시.
•시작노드 <…..> 종료노드(/….> 를 사용한 xml 표기 방식을 적용.
•표기의 복잡도가 높음
<rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# xmlns:dc="http://purl.org/dc/elements/1.1/
xmlns:v="http://www.w3.org/2006/vcard/">
<rdf:Description rdf:about="urn:isbn:006251587X"> <dc:title>Weaving the Web</dc:title> <v:title>Director</v:title>
</rdf:Description>
</rdf:RDF>
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Graph 와 Semantic Web 소개1
2
3
4
5
Oracle Confidential – Internal/Restricted/Highly Restricted 34
RDF
SPARQL 소개 및 실습
Ontology – RDFS , OWL 그리고 추론(Inferencing)
Oracle Semantic Technology 소개 및 실습
6 타 Semantic 솔루션 소개 – TopBraid Composer
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SPARQL 이란 ?
“SPARQL은 RDF 데이터의 Query Language ( SQL과 유사 )”
SPARQL Spec의 구성
• SPARQL Query Language for RDF : RDF 데이터의 Query Syntax 정의
• SPARQL Protocol for RDF : Application 이 SPARQL 쿼리를 Query 처리 엔진에 전달하고 결과를 받는 Protocol 정의
• SPARQL Query Results for XML ,JSON,CSV,TSV Format : Query 처리 엔진에서 결과를 반환하는 Format 정의
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF와 SPARQL 무작정 시작하기 - 1
@prefix ab: <http://learningsparql.com/ns/addressbook#> .
ab:richard ab:homeTel "(229) 276-5135" .
ab:richard ab:email "richard49@hotmail.com" .
ab:cindy ab:homeTel "(245) 646-5488" .
ab:cindy ab:email "cindym@gmail.com" .
ab:craig ab:homeTel "(194) 966-1505" .
ab:craig ab:email "craigellis@yahoo.com" .
ab:craig ab:email "c.ellis@usairwaysgroup.com" .
RDF 파일
PREFIX ab: <http://learningsparql.com/ns/addressbook#>
SELECT ?craigEmail
WHERE
{ ab:craig ab:email ?craigEmail . }
SPARQL 질의
craigEmail |
================================
| "c.ellis@usairwaysgroup.com" |
| "craigellis@yahoo.com"
SPARQL 질의 결과
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SPARQL의 해석 – where절 S-P-O Triple 및 ?변수기호
PREFIX ab: <http://learningsparql.com/ns/addressbook#>
SELECT ?craigEmail
WHERE
{ ab:craig ab:email ?craigEmail . }
• Where 절의 {} 내부 Syntax는 Subject-Predicate-Object Triple임
• . (Period) 기호는 하나의 S-P-O 패턴이 끝남을 명시 ( AND 와 비슷)
• ? 기호는 변수임을 나타냄과 동시에 Wildcard와 같은 조건으로 사용됨. 즉
Where절의 ?craigEmail 은 email 이 어떤 조건이라도 OK 이며 해당
값들을 ?craigEmail 변수에 담으라는 것임. 이는 다시 Select
절의 ?craigEmail에서 사용됨
• 즉 해당 SPARQL은 craig subject의 모든 email 값을 추출하라는 것임.
• ? 기호를 사용한 변수표시는 Object 뿐만 아니라 모든 Triple 구성요소에
사용 가능
Subject Predicate Object
SPARQL 질의
@prefix ab: <http://learningsparql.com/ns/addressbook#> .
ab:richard ab:homeTel "(229) 276-5135" .
ab:richard ab:email "richard49@hotmail.com" .
ab:cindy ab:homeTel "(245) 646-5488" .
ab:cindy ab:email "cindym@gmail.com" .
ab:craig ab:homeTel "(194) 966-1505" .
ab:craig ab:email "craigellis@yahoo.com" .
ab:craig ab:email "c.ellis@usairwaysgroup.com" .
RDF 파일
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SPARQL의 해석 - ?변수의 활용
PREFIX ab: <http://learningsparql.com/ns/addressbook#>
SELECT ?person
WHERE
{ ?person ab:homeTel "(229) 276-5135" . }
• ?기호는 Subject에도 사용가능
• Predicate homeTel 의 object 값이 (229)276-5136인 모든
Subject를 찾아 ?person 변수에 담고 Select에 표시하라
person
==============
ab:richard
SPARQL 질의
SPARQL 질의 결과
@prefix ab: <http://learningsparql.com/ns/addressbook#> .
ab:richard ab:homeTel "(229) 276-5135" .
ab:richard ab:email "richard49@hotmail.com" .
ab:cindy ab:homeTel "(245) 646-5488" .
ab:cindy ab:email "cindym@gmail.com" .
ab:craig ab:homeTel "(194) 966-1505" .
ab:craig ab:email "craigellis@yahoo.com" .
ab:craig ab:email "c.ellis@usairwaysgroup.com" .
RDF 파일
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SPARQL의 해석 - ?변수의 활용
PREFIX ab: <http://learningsparql.com/ns/addressbook#>
SELECT ?propertyName ?propertyValue
WHERE
{ ab:cindy ?propertyName ?propertyValue . }
• ?변수는 두개 이상도 사용가능 함.
• Subject인 cindy가 가지는 모든 Predicate (Property Name) 과
Object (Property Value) 를 각각 ?propertyName
과 ?propertyValue에 담아 Select에 표시하라
propertyName | propertyValue |
=====================================
| ab:email | "cindym@gmail.com" |
| ab:homeTel | "(245) 646-5488" |
-------------------------------------
SPARQL 질의 SPARQL 질의 결과
@prefix ab: <http://learningsparql.com/ns/addressbook#> .
ab:richard ab:homeTel "(229) 276-5135" .
ab:richard ab:email "richard49@hotmail.com" .
ab:cindy ab:homeTel "(245) 646-5488" .
ab:cindy ab:email "cindym@gmail.com" .
ab:craig ab:homeTel "(194) 966-1505" .
ab:craig ab:email "craigellis@yahoo.com" .
ab:craig ab:email "c.ellis@usairwaysgroup.com" .
RDF 파일
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SPARQL의 해석 – Filter를 이용한 원하는 문자열 찾기
PREFIX ab: http://learningsparql.com/ns/addressbook#
SELECT *
WHERE
{
?s ?p ?o .
FILTER (regex(?o, "yahoo","i"))
}
• Filter 를 이용하여 원하는 문자열 조건을 가지는 triple 검색
• Filter 는 Regular Expression과 함께 사용하여 String 매칭
• Object가 yahoo를 가지는 모든 triple set을 Select절에 표시
| s | p | o
==================================================
=================
| <http://learningsparql.com/ns/data#i8301> | ab:email |
"craigellis@yahoo.com"
---------------------------------------------------------------------------------
SPARQL 질의
SPARQL 질의 결과
@prefix ab: <http://learningsparql.com/ns/addressbook#> .
ab:richard ab:homeTel "(229) 276-5135" .
ab:richard ab:email "richard49@hotmail.com" .
ab:cindy ab:homeTel "(245) 646-5488" .
ab:cindy ab:email "cindym@gmail.com" .
ab:craig ab:homeTel "(194) 966-1505" .
ab:craig ab:email "craigellis@yahoo.com" .
ab:craig ab:email "c.ellis@usairwaysgroup.com" .
RDF 파일
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF와 SPARQL 의 해석 – Optional 조건의 사용
@prefix ab: <http://learningsparql.com/ns/addressbook#> .
@prefix d: <http://learningsparql.com/ns/data#> .
d:i0432 ab:firstName "Richard" .
d:i0432 ab:lastName "Mutt" .
d:i0432 ab:homeTel "(229) 276-5135" .
d:i0432 ab:email "richard49@hotmail.com" .
d:i9771 ab:firstName "Cindy" .
d:i9771 ab:lastName "Marshall" .
d:i9771 ab:homeTel "(245) 646-5488" .
d:i9771 ab:email "cindym@gmail.com" .
d:i8301 ab:firstName "Craig" .
d:i8301 ab:lastName "Ellis" .
d:i8301 ab:email "craigellis@yahoo.com" .
d:i8301 ab:email "c.ellis@usairwaysgroup.com" .
RDF 파일
PREFIX ab: <http://learningsparql.com/ns/addressbook#>
SELECT ?craigEmail ?homeTel
WHERE
{
?person ab:firstName "Craig" .
?person ab:lastName "Ellis" .
?person ab:email ?craigEmail .
?person ab:homeTel ?homeTel .
}
SPARQL 질의
------------------------
| craigEmail | homeTel |
========================
결과 없음
SPARQL 질의 결과
firstName이 Craig , lastName이 Ellis
이며 email 관계를 가지는 모든
object 값과 , homeTel 관계를
가지는 모든 object 값을 출력
Id:18301 subject는 homeTel 관계를
가지지 않음. 만일 homeTel 관계에
무방하게 값을 추출하고 싶다면 ?
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF와 SPARQL 의 해석 – Optional 조건의 사용
@prefix ab: <http://learningsparql.com/ns/addressbook#> .
@prefix d: <http://learningsparql.com/ns/data#> .
d:i0432 ab:firstName "Richard" .
d:i0432 ab:lastName "Mutt" .
d:i0432 ab:homeTel "(229) 276-5135" .
d:i0432 ab:email "richard49@hotmail.com" .
d:i9771 ab:firstName "Cindy" .
d:i9771 ab:lastName "Marshall" .
d:i9771 ab:homeTel "(245) 646-5488" .
d:i9771 ab:email "cindym@gmail.com" .
d:i8301 ab:firstName "Craig" .
d:i8301 ab:lastName "Ellis" .
d:i8301 ab:email "craigellis@yahoo.com" .
d:i8301 ab:email "c.ellis@usairwaysgroup.com" .
RDF 파일
PREFIX ab: <http://learningsparql.com/ns/addressbook#>
SELECT ?craigEmail ?homeTel
WHERE
{
?person ab:firstName "Craig" .
?person ab:lastName "Ellis" .
?person ab:email ?craigEmail .
OPTIONAL
{ ?person ab:homeTel ?homeTel . }
}
SPARQL 질의
------------------------
| craigEmail | homeTel |
========================
"craigellis@yahoo.com"
"c.ellis@usairwaysgroup.com"
SPARQL 질의 결과
firstName이 Craig , lastName이 Ellis
이며 email 관계를 가지는 모든
object 값과 , homeTel 관계를
가지는 모든 object 값을 출력
homeTel 관계는 optional
조건이므로 homeTel 관계가 없어도
주어진 object 값을 출력
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SPARQL - More
• SPARQL 은 RDBMS의 SQL과 유사하게 SELECT에서 Minus, Union all , Exist, Order by , Group by ,
Limit( 오라클의 rownum과 유사)와 같은 구문을 제공
• SPARQL은 SELECT 문 외에 , INSERT,DELETE , UPDATE 문과 같은 DML 및 Drop,Create와 같은 DDL도 제공
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SPARQL을 이용하여 Public Data Source 로 질의
http://dbpedia.org/snorql/
http://dbpedia.org/snorql/ 에 접속한뒤 Text Editor에 SPARQL
쿼리를 입력하면 해당 사이트에서 제공하는 데이터를 추출
가능함
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF와 SPARQL 의 적용 – Remote SPARQL 서비스 호출
PREFIX cat: <http://dbpedia.org/resource/Category:>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?p ?o
WHERE
{
SERVICE <http://DBpedia.org/sparql>
{ SELECT ?p ?o
WHERE
{ <http://dbpedia.org/resource/Joseph_Hocking> ?p ?o . }
}
}
SPARQL 질의 SPARQL 질의 결과
SERVICE 키워드를 사용하여 Dbpedia.org에서
제공하는 SPARQL 서비스를 호출
Subject가 <http://dbpedia.org/resource/Joseph_Hocking> 인 모든
Predicate 와 Object를 추출
-----------------------------------------------------------------|
| p | o |
==================================================|
| owl:sameAs | <http://rdf.freebase.com/ns/guid.9202a8c...> |
| rdfs:comment | "Joseph Hocking (November 7, |
| skos:subject | cat:Cornish_writers |
| skos:subject | cat:English_Methodist_clergy |
| skos:subject | cat:19th-century_Methodist_clergy |
| skos:subject | cat:People_from_St_Stephen-in-Brannel |
| skos:subject | cat:1860_births |
| skos:subject | cat:1937_deaths |
| skos:subject | cat:English_novelists |
| rdfs:label | "Joseph Hocking"@en |
| foaf:page | <http://en.wikipedia.org/wiki/Joseph_Hocking> |
------------------------------------------------------------------
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF와 SPARQL 의 적용 – Multi Remote SPARQL 서비스 호출
PREFIX cat: <http://dbpedia.org/resource/Category:>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX gp: <http://wifo5-04.informatik.unimannheim.de/gutendata/resource/people/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?dbpProperty ?dbpValue ?gutenProperty ?gutenValue
WHERE
{
SERVICE <http://DBpedia.org/sparql>
{
<http://dbpedia.org/resource/Joseph_Hocking> ?dbpProperty ?dbpValue .
}
SERVICE <http://wifo5-04.informatik.uni-mannheim.de/gutendata/sparql>
{
gp:Hocking_Joseph ?gutenProperty ?gutenValue .
}
}
SPARQL 질의 SPARQL 질의 결과
Multi Service 키워드를 사용하여 여러 Remote
SPARQL 서비스를 한번에 호출
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Graph 와 Semantic Web 소개1
2
3
4
5
Oracle Confidential – Internal/Restricted/Highly Restricted 47
RDF
SPARQL 소개 및 실습
Ontology – RDFS , OWL 그리고 추론(Inferencing)
Oracle Semantic Technology 소개 및 실습
6 타 Semantic 솔루션 소개 – TopBraid Composer
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
• Ontology 는 Engineering 관점으로 특정 사물/사상에 대한 개념을 명확하게 정의하기 위한 방안임
– 특정 사물/사상을 기술하기 위해 정해진 용어(Vocabulary/Term)으로 구성
– 해당 용어가 지향하는 의미를 명확하게 정의하기 위한 다양한 요소를 가짐
• Ontology는 특정 domain에 대한 formal한 specification을 기술
– 특정 Domain에 대한 공통적인 이해를 가능하게 함
– 특정 Domain에 대한 formal한 , machine이 처리 가능한 모델을 제시
Ontology in Computer Science
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Domain 별로 상이한 용어 정의
상품 정의
보험 Domain
장기/자동차/화재등의 각 영역에서 고객에게
제공하는 보험상품을 뜻하며 약관에 명시된
계약조건에 따라 보험사에서 지급이 약속된
보상을 제공하는 것을 그 핵심으로 함.
……………………………..
보험상품은 보험사의 파산할 경우 상품에
명기된 보상내역을 지급할 수 없는 경우를
대비해야 하며……
통신 상품은 무선 통신 상품과 유선 통신 상품,
이들을 결합한 결합 상품으로 구분한다.
무선 통신 상품의 경우 데이터와 음성 상품으로
구분하며 특정 상품에 가입할 경우 타 상품으로
가입이 불가능 한 경우가 존재 한다.
…………………
통신상품은 통신 기능 및 서비스가 결합되어
제공되며, 사용량/사용시간 등에 따라 요금이
차등부여 된다.
상품은 실물을 가지는 유형의 상품과 보험이나
통신 등의 서비스에 기반한 무형의 상품으로
분류한다. 고객은 특정 상품을 주문할 경우 반드
시 지정된 택배회사를 통해 최종 전달되어야
하며…….
통신 Domain 유통/쇼핑 Domain
각 Domain 별로 상품에 대한 정의는 서로 다르다
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Object Oriented Model 기반 요소
Class와 Object(Instance)
Inheritance ( 상속 )
- Association
Encapsulation
Polymorphism
OOP (Object Oriented Programming )
주요 개념
• 나는 누구의 자식인가?
• 나만이 가지는 고유한 속성은 무엇인가?
• 나는 타 개체를 어떻게 활용하고 어떤 관계를
맺고 있는가?
개체는 무엇으로 정의될 수 있는가?
Public Class Employee extends Person
{
………………..
}
Person Emp = new Employee();
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Ontology Languages
• “명확한 개념 정의” 를 위해 많은 모델 정의 Language가 사용 가능
• 그 중에 UML(Unified Modeling Language)이 가장 보편적으로 사용됨
• RDF의 Ontology Language는 Object Oriented Programming에 기반한 UML로 부터 많은 영향을 받음
UML 예제 RDF Ontology Diagram 예제
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF Ontology Language
RDFS
RDFS+
OWL
• RDF Ontology Language 는 RDFS, RDFS+,OWL
• 더욱 강력한 Ontology 기능을 보강하기 위해서 RDFS에서 OWL로 발전함
• OWL의 경우 많은 Syntax 및 특성으로 인해 그 복잡도가 매우 큼
• RDFS+ 는 RDFS 보다 기능이 보강되고 OWL의 핵심적이고 간략한 기능으로 축약된 형태(OWL의 복잡도로
인해 새롭게 탄생됨)
•OWL Ver 1: OWL Full , OWL DL , OWL Lite
•OWL Ver 2: OWL2 EL , OWL 2 QL, OWL 2 RL
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF Ontology – RDFS (RDF Schema)
• RDF Schema
– RDF 는 named Property나 value를 사용하여 리소스들에( Triples) 대한 간단한 설명만을 제공하므로 RDF 사
용자는 RDF 를 구성하고 정의하는 용어나 개념에 대해 정의할 수 있는 방안이 별도 필요
– RDFS(RDF Schema)는 해당 리소스의 특정 클래스나 유형, Property 들에 대한 상세 기술방안을 제공
– RDBMS Table이 어떻게 구성되어 있는지 설명하는 메타 속성과 유사( 컬럼명, 데이터 Type, Comment ,
Constraint 등)
– 무엇보다도 OOP(Object Oriented Program) 의 주요 개념과 매우 유사
– 예를 들어 exterms:Tent Class는 exterms:model, exterms:weightInKg, exterms:packedSiz 과 같은 Property로 구
성되어 있음을 표기. (Class와 Class를 구성하는 속성)
– RDFS에서 사용하는 Schema vocabulary 예 :
Class, Property
type, subClassOf, subPropertyOf
range, domain
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDFS의 구성 요소
RDFS
Class Property
rdf:Class rdf:Property …….…….. rdf:subClassOf Rdf:subPropertyOf …….……..
• RDFS 는 크게 Class 와 Property 로 구성
• Class와 Property는 RDFS 구문을 정의하는 세부 요소들로 구성됨.
• RDFS 역시 Subject, Predicate , Object의 Triple 요소로 구문 표현
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDFS 구성 요소 – RDFS Class
RDF Class 명 설명
rdfs:Resource The class resource, everything.
rdfs:Class The class of classes.
rdf:Property The class of RDF properties.
rdfs:Literal The class of literal values, e.g. textual strings and integers.
rdf:langString The class of language-tagged string literal values.
rdf:HTML The class of HTML literal values.
rdf:XMLLiteral The class of XML literal values.
rdfs:Datatype The class of RDF datatypes.
rdf:Statement The class of RDF statements.
rdf:Bag The class of unordered containers.
rdf:Seq The class of ordered containers.
rdf:Alt The class of containers of alternatives.
rdfs:Container The class of RDF containers.
rdfs:ContainerMembershipProperty
The class of container membership properties, rdf:_1, rdf:_2, ..., all of which are su
b-properties of 'member'.
rdf:List The class of RDF Lists.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDFS 구성 요소 – RDF Property
RDF Property 명 설명
rdf:type The subject is an instance of a class.
rdfs:subClassOf The subject is a subclass of a class.
rdfs:subPropertyOf The subject is a subproperty of a property.
rdfs:domain A domain of the subject property.
rdfs:range A range of the subject property.
rdfs:label A human-readable name for the subject.
rdfs:comment A description of the subject resource.
rdfs:member A member of the subject resource.
rdf:first The first item in the subject RDF list.
rdf:rest The rest of the subject RDF list after the first item.
rdfs:seeAlso Further information about the subject resource.
rdfs:isDefinedBy The definition of the subject resource.
rdf:value Idiomatic property used for structured values.
rdf:subject The subject of the subject RDF statement.
rdf:predicate The predicate of the subject RDF statement.
rdf:object The object of the subject RDF statement.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDFS 주요 구문 설명 - 1
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ab: <http://learningsparql.com/ns/addressbook#> .
ab:Aunt rdf:type rdfs:Class .
ab:creator rdf:type rdfs:Property
RDF 파일
RDFS 구문 설명
rdfs:Class  주어진 Subject 가 RDFS에서 정의한 Class 타입임을 나타냄
rdfs:Property  주어진 Subject 가 RDFS에서 정의한 Property 타입임을 나타냄
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDFS 주요 구문 설명 - 2
RDFS 구문 설명
rdfs:subClassOf  특정 클래스의 하위 클래스임을 나타냄.
 :A rdfs:subClassOf :B
rdfs:subPropertyOf  특정 Property의 하위 Property 임을 나타냄.
 :p1 rdfs:subPropertyOf :p2
 :firstAuthor rdfs:subPropertyOf :Author
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix dm: <http://learningsparql.com/ns/demo#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
dm:Person rdf:type rdfs:Class
dm:Artist rdf:type rdfs:Class
Dm:Artist rdfs:subClassOf dm:Person
dm:composer rdfs:subPropertyOf dm:creator .
dm:photographer rdfs:subPropertyOf dm:creator .
dm:file02924 dm:fileName "9894397.mp3" ;
dm:composer "Charles Ives" .
dm:file74395 dm:fileName "884930.mp3" ;
dm:photographer "Eric Satie" .
Artist는 Person의 하위클래스
Composer와 photographer는 creator의 하위 속성
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDFS 주요 구문 설명 - 3
RDFS 구문 설명
rdfs:label  리소스(subject/property/object)에 대한 명칭 (이름)을 부여하여 사용자가 보다 쉽
게 해당 리소스를 이해하게 함.
rdfs:comment  리소스에 대한 상세 설명을 기술
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
dc:creator
rdf:type rdf:Property ;
rdfs:comment "An entity primarily responsible for making the resource.”;
rdfs:label "Creator” .
RDF 파일
dc:creator는 Property 타입
dc:creator에 대한 상세 설명
dc:creator Property를 Creator로 명명
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDFS 주요 구문 설명 - 4
RDFS 구문 설명
rdfs:domain  프로퍼티가 사용될 때 트리플의 Subject가 특정 클래스임을 나타냄
rdfs:range  프로퍼티가 사용될 때 트리플의 Object가 특정 타입임을 나타냄
@prefix ab: <http://learningsparql.com/ns/addressbook#> .
ab:playsInstrument rdf:type rdf:Property .
ab:playsInstrument rdfs:domain ab:Musician .
ab:playsInstrument rdfs:range ab:MusicalInstrument .
ab:i0432 ab:playsInstrument ab:vacuumCleaner .
RDF 파일
Ab:playsInstrument 프로퍼티를 사용하는 Subject는 ab:Musician Class type임.
Ab:playsInstrument 프로퍼티를 사용하는 Object는 ab:Musician
ab:MusicalInstrument type임.
ab:i0432 subject는 Musician Class이며 , vacuumCleaner는
MusicalInstrument 타입임.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
추론(Inferencing) 이란?
• 사전적 의미로 추론이란 기존의 알려진 사실에 기반해 새로운 사실을 추측하거나 결정한다는 것을
뜻함
• RDF에서는 Ontology (RDFS,OWL)에 기술된 Triples 간의 관계 및 구조를 기반으로 새로운 관계 및
구조를 결정하는 것임.
• 추론은 RDF Ontology가 지향하는 매우 강력한 메커니즘이며 Semantic Web을 더욱 스마트하게
구성하는 요소임
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDFS에서의 SubClassOf의 패턴 정의 및 추론
IF
?A rdfs:subClassOf ?B AND ?x rdfs:type ?A.
THEN
?x rdfs:type ?B
만일 클래스 A가 B의 하위 클래스이고 , x 라는 개체가 클래스 A 에 속한다면 x는 또한 클래스 B에도 속한다.
Class A extends B {…}
Class inference_test
{
public static void main(String args[]) {
A x = new A();
if(x instanceof B)
System.out.println(“inference is successful : x is also Class B");
}}
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDFS에서의 rdfs:domain/rdfs:range 패턴 정의 및 추론
IF
P rdfs:domain D.
And
x P y.
THEN
x rdf:type D.
특정 프로퍼티인 P가 D 클래스와 rdfs:domain
관계라면 특정 Subject X가 P 프로퍼티 관계일 경우
X는 D클래스 타입
@prefix ab: <http://learningsparql.com/ns/addressbook#> .
ab:playsInstrument rdf:type rdf:Property .
ab:playsInstrument rdfs:domain ab:Musician .
ab:playsInstrument rdfs:range ab:MusicalInstrument .
ab:i0432 ab:playsInstrument ab:vacuumCleaner .
ab:i0432 subject는 Musician Class이며 , vacuumCleaner는
MusicalInstrument 타입임.
Rdfs:domain 정의 및 추론
IF
P rdfs:range R.
And
x P y.
THEN
y rdf:type R.
Rdfs:range 정의 및 추론
특정 프로퍼티인 P가 R 타입과 rdfs:range 관계라면 특정
Object Y가 P 프로퍼티 관계일 경우 Y는 R 타입
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDFS 추론의 다양한 예
:Surgeon rdfs:subClassOf :Staff
:Surgeon rdfs:subClassOf :Physician
:Kildare rdf:type :Surgeon
RDFS 정의
외과의사(Surgeon)은 Staff(직원)의 하위
클래스이고 Surgeon은 Physician(의사)의 하위
클래스이다.
Kildare는 Surgeon 클래스 타입이다.
추론
:Kildare rdf:type :Staff
:Kildare rdf:type :Physician
Kildare는 Staff 이자 Physician (의사) 이다
:lodgedIn rdfs:subPropertyOF :billedFor
:lodgedIn rdfs:subPropertyOF :assignedTo
:Marcus :lodgedIn :Room101
RDFS 정의
입원(lodgedIn)은 billedFor(비용지불)의 하위
프로퍼티이며 동시에 입원실 배정(assignedTo)의
하위 프로퍼티이다.
Marcus는 Room101에 lodgedIn (입원)
추론
:Marcus :billedFor :Room101
:Marcus :assignedTo :Room101
Marcus는 Room101에 비용을 지불(billedFor)
하였고 Room101에 입원실 배정(assignedTo) 됨
1 2
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Graph 와 Semantic Web 소개1
2
3
4
5
Oracle Confidential – Internal/Restricted/Highly Restricted 65
RDF
SPARQL 소개 및 실습
Ontology – RDFS , OWL 그리고 추론(Inferencing)
Oracle Semantic Technology 소개 및 실습
6 타 Semantic 솔루션 소개 – TopBraid Composer
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle의 Semantic Technology
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF 데이터 관리 시스템으로서의 Oracle DB의 강점
• RAC & Exadata scalability
• Compression & partitioning
• SQL*Loader direct path load
• Parallel load, inference, query
• High Availability
• Triple-level label security
• Choice of SPARQL, SQL, or Java
• Native inference engine
• Enterprise Manager
오라클 DB의 강력한 강점이 RDF 에 그대로 적용
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SPARQL 호환성을 제공하기 위한 Oracle Component
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Jena 와 Jena Adaptor 란 ?
•Jena 는 Semantic Web 과 Linked Data Application을 위한 오픈 소스 Java Framework
•Jena 는 HP에서 시작하였으나 현재는 Apache 재단에서 관리하고 있음.
•Jena는 RDF , SPARQL , Ontology 를 위한 Java API Spec을 정의하고 있으며 Jena Adaptor는 정의된 Spec을
Semantic Web 제품 Vendor들이 각 제품의 특성에 맞게 Java 로 구현한 것임.
( JDBC 와 JDBC Adaptor(Driver) 관계와 유사 )
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Jena Adaptor를 사용한 Sample Code
import oracle.spatial.rdf.client.jena.*;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.graph.*;
import com.hp.hpl.jena.query.*;
public class Test {
public static void main(String[] args) throws Exception
{
String szJdbcURL = args[0];
String szUser = args[1];
String szPasswd = args[2];
String szModelName = args[3];
Oracle oracle = new Oracle(szJdbcURL, szUser, szPasswd);
Model model = ModelOracleSem.createOracleSemModel(oracle, szModelName);
model.getGraph().add(Triple.create(Node.createURI("http://example.com/John"),Node.createURI("http://example.com/fatherOf"),
Node.createURI("http://example.com/Mary")));
Query query = QueryFactory.create( "select ?f ?k WHERE {?f <http://example.com/fatherOf> ?k .}");
QueryExecution qexec = QueryExecutionFactory.create(query, model);
ResultSet results = qexec.execSelect();
ResultSetFormatter.out(System.out, results, query);
model.close();
oracle.dispose();
}
}
Jena 의 SPARQL Interface 는 JDBC 를 사용하는 Java Code와 유사
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SPARQL을 SQL에서 사용 - SEM_MATCH
• SEM_MATCH 를 사용하여 SPARQL 호출을 SQL상에서 수행 가능
• Graph data를 기존의 Relational data에서 유연하게 통합
• Oracle SQL Engine의 모든 Performance 를 가짐
- Optimizer, Compression, Indexes , Parallelism 등
SELECT n1, n2 FROM TABLE(
SEM_MATCH
(
'PREFIX foaf: <http://...>
SELECT ?n1 ?n2 FROM http://g1
WHERE {?p foaf:name ?n1 OPTIONAL {?p foaf:knows ?f . ?f foaf:name ?n2 }
FILTER (REGEX(?n1, "^A")) }
ORDER BY ?n1 ?n2',
SEM_MODELS('M1'),…));
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SEM_MATCH Table Function 구성
SEM_MATCH ( query , models , rulebases , options )
SPARQL 쿼리
'SELECT ?a
WHERE { ?a foaf:name ?b }'
RDF Data가 있는
Semantic Model
RDFS 및 OWL
+
사용자 정의 Rule base
기타 옵션
'ALLOW_DUP=T
STRICT_TERM_COMP=F'
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle SQL Engine의 다양한 기능 결합 – 오라클 Hint 사용 예제
SELECT x, y
FROM TABLE(SEM_MATCH(
'{?x :grandParentOf ?y . ?x rdf:type :Male}',
SEM_Models('family'),
SEM_Rulebases('RDFS','family_rb'),
SEM_Aliases(SEM_ALIAS('','http://www.example.org/family/')),
null,
null,
'HINT0={LEADING(t0 t1) USE_NL(?x ?y) GET_CANON_VALUE(?x ?y)}'));
Oracle SQL Engine의 모든 Performance 를 가짐 (Optimizer, Compression, Indexes , Parallelism 등)
SEM_MATCH를 통한 오라클 SQL Hint 사용 예
• HINT0 구문을 통해 기존의 Oracle SQL HINT에서 사용한 구문을 그대로 사용 가능
• Oracle Optimizer의 최적 성능 구현 가능
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Semantic Data Types, Constructors, and Methods
• 오라클 Graph 에서는 RDF 및 Ontology 데이타들은 모두 Object Type으로 저장되고 관리됨.
• 오라클의 Object 타입은 객체지향의 Class 와 유사하게 속성(컬럼)과 Constructor 그리고 Method로 구성
• Semantic Data를 위해 오라클은 SDO_RDF_TRIPLE 와 SDO_RDF_TRIPLE_S Object 타입을 제공함
• SDO_RDF_TRIPLE타입은Triples 를 Display하는데 사용되며 , SDO_RDF_TRIPLE_S는 DB에 Triple을 저장하는데
사용됨. (_S 는 Storage를 뜻함)
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Semantic Data 의 유형 및 메소드 상세
Semantic Data type 및 Method 상세 내용
SDO_RDF_TRIPLE 오브젝트 구조 SDO_RDF_TRIPLE (
subject VARCHAR2(4000),
property VARCHAR2(4000),
object VARCHAR2(10000))
SDO_RDF_TRIPLE_S 오브젝트 구조 SDO_RDF_TRIPLE_S (
RDF_C_ID NUMBER, -- Canonical object value ID
RDF_M_ID NUMBER, -- Model (or Model-Graph) ID
RDF_S_ID NUMBER, -- Subject value ID
RDF_P_ID NUMBER, -- Property value ID
RDF_O_ID NUMBER) -- Object value ID
SDO_RDF_TRIPLE_S 의 메소드 GET_MODEL() RETURNS VARCHAR2
GET_TRIPLE() RETURNS SDO_RDF_TRIPLE
GET_SUBJECT() RETURNS VARCHAR2
GET_PROPERTY() RETURNS VARCHAR2
GET_OBJECT() RETURNS CLOB
SDO : Spatial Data Option
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SDO_RDF_TRIPLE_S 의 활용
CREATE TABLE articles_rdf_data (id NUMBER, triple SDO_RDF_TRIPLE_S);
INSERT INTO articles_rdf_data VALUES (99,
SDO_RDF_TRIPLE_S ('articles:<http://examples.com/ns#Graph1>',
'<http://nature.example.com/Article101>', '<http://purl.org/dc/elements/1.1/creator>', ‘John Smith'));
Commit;
SELECT a.triple.GET_MODEL() AS model_graph, a.triple.GET_TRIPLE() AS triple
FROM articles_rdf_data a WHERE a.id = 99;
MODEL_GRAPH
--------------------------------------------------------------------------------
TRIPLE(SUBJECT, PROPERTY, OBJECT)
--------------------------------------------------------------------------------
ARTICLES:<http://examples.com/ns#Graph1>
SDO_RDF_TRIPLE('<http://nature.example.com/Article101>', '<http://purl.org/dc/elements/1.1/creator>', '"John Smith"')
SDO_RDF_TRIPLE_S 를
가지는 Table 생성
RDF 데이터를
SDF_RDF_TRIPLE_S
Object를 이용하여 입력
SDF_RDF_TRIPLES_S 의
Method 를 통해 데이터
조회
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF 데이터 입력을 위한 SDO_RDF_TRIPLE_S의 사용
SDO_RDF_TRIPLE_S 생성자 유형 1 SDO_RDF_TRIPLE_S 생성자 유형 2 SDO_RDF_TRIPLE_S 생성자 유형 3
SDO_RDF_TRIPLE_S (
RDF_C_ID NUMBER, -- Canonical object value ID
RDF_M_ID NUMBER, -- Model (or Model-Graph) ID
RDF_S_ID NUMBER, -- Subject value ID
RDF_P_ID NUMBER, -- Property value ID
RDF_O_ID NUMBER) -- Object value ID
SDO_RDF_TRIPLE_S (
model_name VARCHAR2, -- Model name
subject VARCHAR2, -- Subject
property VARCHAR2, -- Property
object VARCHAR2) -- Object
RETURN SELF;
SDO_RDF_TRIPLE_S (
model_name VARCHAR2, -- Model name
subject VARCHAR2, -- Subject
property VARCHAR2, -- Property
object CLOB) -- Object
RETURN SELF;
RDF 데이터 입력 시에 사용( Object 가
VARCHAR2 임)
RDF 데이터 입력 시에 사용 ( Object 가
CLOB 임)
SDO_RDF_TRIPLE_S Object 타입은 다양한 유형의 생성자를 가지고 있으며 이를 이용하여 RDF 데이터를 입력함.
INSERT INTO articles_rdf_data VALUES (2,
SDO_RDF_TRIPLE_S ('articles','<http://nature.example.com/Article1>', '<http://purl.org/dc/elements/1.1/creator>', '"Jane Smith"'));
RDF 데이터 입력을 위해 SDO_RDF_TRIPLE_S 생성자 사용
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle에서 Semantic Data 사용을 위한 Quick Start
순번 수행 사항 상세 설명
1 Semantic Data Network 생성 •NETWORK은 DB당 1개만 가능함. 만일 기존의 NETWORK이 존재하면 추가 생성 불가.
•EXECUTE SEM_APIS.CREATE_SEM_NETWORK('rdf_tblspace');
•tablespace_name을 기본적으로 네트웍이름으로 사용함. 파라미터로 입력한 테이블 스페이스가
기본적으로 네트웍이름으로 사용됨. 해당 테이블 스페이스에 모든 SEMANTIC 관련 데이터 및 모델
이 저장됨.
2 RDF 데이터 저장 테이블 생성 •SDO_RDF_TRIPLS_S Object 를 담을 테이블 생성
•해당 테이블은 SDO_RDF_TRIPLE_S Object를 컬럼으로 가짐.
•CREATE TABLE articles_rdf_data (id NUMBER, triple SDO_RDF_TRIPLE_S);
3 Model 생성 •Model을 생성하여 앞에서 만들어진 Semantic data를 가지는 테이블을 모델과 연결함
•EXECUTE SEM_APIS.CREATE_SEM_MODEL(모델명, RDF테이블 명, SDO_RDF_TRIPLE_S 오브젝트 명 ) ,
-- EXECUTE SEM_APIS.CREATE_SEM_MODEL('articles', 'articles_rdf_data', 'triple');
4 데이터 입력 •INSERT INTO articles_rdf_data VALUES (1,
SDO_RDF_TRIPLE_S ('articles','<http://nature.example.com/Article1>',
'<http://purl.org/dc/elements/1.1/title>','"All about XYZ"'));
5 필요하다면 성능 향상을 위해
Oracle DB Index 등을 생성
•CREATE INDEX articles_sub_idx ON articles_rdf_data (triple.GET_SUBJECT());
•CREATE INDEX articles_prop_idx ON articles_rdf_data (triple.GET_PROPERTY());
•CREATE INDEX articles_obj_idx ON articles_rdf_data (TO_CHAR(triple.GET_OBJECT()));
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle Semantic Technology 를 위한 상세 구성
Sem.Network
• Dictionary 와 data table 을 저장
• Models , OWL/RDFS/user-defined rule bases , rule
indexes (entailments ) 등 Semantic을 위한 Oracle 의
새로운 개체가 Load 됨
SDO_RDF_TRIPLE_S RDF 데이터 저장을 위한 새로운 Object
Application
테이블
Sdo_rdf_triple_s 오브젝트 타입을 컬럼으로 가지는
일반 테이블. RDF 데이터를 로딩, Access 하고 , 보조
값들을 저장하는데 사용됨
Model
Model은 RDF Triple Set 인 RDF Graph를 가지며
application 테이블내의 sdo_rdf_triple_s 컬럼과 연관
시킴
Rulebase 추론(inferencing)에 사용된 rule 집합
Entailments 추론을 통해 파생된 RDF Triples를 저장
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF Graph Use Cases
• Unified content metadata for
federated resources
• Validate semantic and
structural consistency
Social Media
Analysis
 Analyze social relations
using curated metadata
- Blogs, wikis, tweets, video
- Calendars, IM, voice
Semantic
Metadata Layer
 Find related content &
relations by navigating
connected entities
 “Reason” across entities
Text Mining &
Entity Analytics
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Linked Data in Enterprise
Index
Content Mgmt BI Server Data Warehouse
Machine Generated Data
Semantic Graph model
(W3C RDF Metadata Model)
Transaction Systems
Hadoop Appliance
Subscription Services
Human Sourced
InformationSocial Media
Event Server
Data Servers
Data Sources / Types
Access & Presentation Layer
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Eli Lilly and Company
Oracle Spatial and Graph: RDF Graph Metadata Repository
Objectives
 Unified vocabulary for scientific investigation
 Easier, more complete investigations
Solution
 Integrate patient records, chemical structures,
biological sequences & pathways, images,
scientific papers…
 View related data as a graph
 Traverse graphs to discover relationships,
search for a term, or browse ontologies
“[This technology…] provides improved insight into our
business by bringing together related information from
diverse data sources,”
J. Phil Brooks
Information Consultant, Eli Lilly and Company
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Allied Nation Intelligence Service
Oracle Spatial and Graph: Social Analysis
Objectives
 Profile suspects through telephone, email and
social network communications
 Produce “data products” for analysts
Solution
 RDF Graph modeling of the social network:
people, groups and places of interest
 Inferencing & graph analytics discover
relationships among individuals & meaning of
pseudonyms, aliases, codes, terminology
 Standards-based tools: W3C RDF & SPARQL
 Semantic tagging for 600 TB / 10b triples graph
 Top-secret , compartmented security for data
 New discovery on ~100 million triples / month
 Find & label “same-as” relationships
Benefits
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Cisco WebEx Social
Graph for Enterprise Collaboration
Objectives
 Social connectivity and collaboration through
semantic enablement
 Connect knowledge silos
Solution
 Persistent unified graph metadata model
 Concepts tagged with unique meaning
 Find related content & groups by navigating
connected entities, recommendations
 Unifies metadata model - forum, blog, wiki, etc.
 Tagging media documents, pictures, blogs, etc. to
user-defined and/or enterprise vocabularies.
 Validates tag semantic/structural consistency
Benefits
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
주요 실습 내용
• RDF/OWL 데이터 및 Ontology를 저장,로딩,DML
• RDFS , OWL 및 사용자 정의 Rule을 통해 Inference 수행
• SPARQL과 유사한 SQL 쿼리를 이용한 RDF/OWL 활용
• Ontology와 결합된 Relational 데이터에 대한 Query 사용
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
사전 시나리요
1. Nciuser 스키마 유저를 생성
2. Nciuser 유저는 세개의 테이블을 가짐
• NCI_RDF_DATA : Triples를 저장하는 테이블
• STABLE : N-Triple 포맷의 데이터를 Bulk load를 사용하여 Triples를 로딩하는 Staging 테이블
• PATIENTS_DATA: Application에서 Patients 관련 정보를 이용하는 일반 테이블
3. 데이터는 Nci semantic 모델을 통해 nci_rdf_data 테이블로 로딩됨. 사용자는 환자를 simulation한 정보를
만든 뒤 이들 Semantic 모델과 patients 테이블에 Semantic 기능을 결합하여 활용
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
실습을 위한 User 생성 및 관련 Object 생성
1. Graph Network을 위한 tablespace 및 Network 생성
• create tablespace ….
• Create Network
2. RDF 데이터가 저장될 별도 Tablespace 및 Temporary Tablespace 생성
• Sqlplus “/as sysdba”
• rdf_users tablespace 생성
Note: 아래 명령어에서, <user_name> 과 <SID> 를 사용자 작업 환경 및 ORACLE_HOME에 따라 변경
create tablespace rdf_users
datafile 'c:app<user_name>oradata<SID>rdf_users01.dbf' size 128M reuse autoextend on next 64M maxsize unlimitedsegment space
management auto;
• rdf_temp tablespace 생성
Note: 아래 명령어에서, <user_name> 과 <SID> 를 사용자 작업 환경 및 ORACLE_HOME에 따라 변경
create temporary tablespace rdf_temp
tempfile 'c:app<user_name>oradata<SID>rdf_temp01.dbf' size 128M reuse
autoextend on next 32M maxsize unlimited;
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
실습을 위한 User 생성 및 관련 Object 생성
3. 실습을 위한 User를 별도 생성하고 Tablespace 및 Temporary Tablespace 할당 데이터가 저장될 별도 Tablespace 및
Temporary Tablespace 생성
• Create the nciuser and grant the required privileges to the user by entering the following commands on the SQL*Plus prompt:
• create user nciuser identified by nciuser default tablespace rdf_users temporary tablespace rdf_temp;
• grant create session, resource to nciuser;
4. RDF Triple을 저장할 모델 테이블을 생성하고 Semantic 모델을 생성함.
• sqlplus nciuser/nciuser username/password.
• create table nci_rdf_data (id number, triple sdo_rdf_triple_s);
• execute sem_apis.create_sem_model('nci', 'nci_rdf_data', 'triple');
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Text로 된 RDF Data를 Oracle RDF Model Data로 Loading
1. Staging 테이블을 생성하고 SQL Loader를 사용하여 데이타를 로딩함.
• nciuser로 접속하여 staging 테이블 생성
create table stable (
RDF$STC_sub varchar2(4000) not null,
RDF$STC_pred varchar2(4000) not null,
RDF$STC_obj varchar2(4000) not null,
RDF$STC_sub_ext varchar2(64),
RDF$STC_pred_ext varchar2(64),
RDF$STC_obj_ext varchar2(64),
RDF$STC_canon_ext varchar2(64)
);
2. mdsys 유저에게 nci_rdf_data 테이블에 대한 insert Privilege Grant하고 mdsys 유저에게 stable 테이블에 대한
select,update privilege Grant 함.
• grant insert on nci_rdf_data to mdsys;
• grant SELECT, UPDATE(RDF$STC_sub_ext,RDF$STC_pred_ext,RDF$STC_obj_ext,RDF$STC_canon_ext)
on stable to MDSYS;
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Text로 된 RDF Data를 Oracle RDF Model Data로 Loading
3. 실습데이타와 load 명령어가 수록된 nci_z.zip 테이블을 풀고 , nci_z_nt.file을 staging 테이블로 로딩함.
Note: nci_z.zip file 은 here. 디렉토리에서 Download
• 아래 sqlldr 명령에 맞춰서 사용자 환경에 맞는 ORACLE_HOME 설정 디렉토리로 bulkload.ctl 컨트롤 파일이 제대로 있는지 확인.
• 만일 없으면 sample download 필요
sqlldr userid=nciuser/nciuser control=%ORACLE_HOME%mddemonetworkrdf_demosbulkload.ctl data=nci_z.nt direct=true skip=0
load=1000000 discardmax=0 bad=d0.bad discard=d0.rej log=d0.log errors=100000000
• 로딩에 시간이 걸릴 수 있으며 , 완료시 아래와 같은 메시지를 가짐.
Load completed - logical record count 464841.
4. Staging 테이블에 있는 데이타를 Model 로 로딩함.
• sem_apis패키지의 bulk_load_from_staging_table 프로시저를 사용
exec sem_apis.bulk_load_from_staging_table('<model_name>', '<owner of the staging table>', '<staging table name>');
exec sem_apis.bulk_load_from_staging_table('nci','nciuser','stable');
5. 추론 적용을 위한 Rule index 를 생성
execute sem_apis.create_entailment('nci_idx',sem_models('nci'), sem_rulebases('owlprime'),0, null);
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Patients_data 테이블에 로딩
1. PATIENTS_DATA 테이블에 100,000 rows를 입력하는 Procedure를 수행
• 해당 procedure는 mdsys 유저상에서 수행함. build_patients 프로시저를 수행하기 전에 mdsys 로 로그인함. (password는 mdsys로 가정)
connect mdsys/mdsys
set serveroutput on
2. build_patients.zpi 파일에서 build_patients.sql 을 추출하여 수행함. ( build_patients.zip 파일을 여기에 위치)
• 해당 스크립트는 build_patients 프로시저를 먼저 생성함. 스크립트를 로컬 컴퓨터에 저장하고 SQL Prompt상에서 아래와 같이 데이터
입력
@c:<path where you saved the script>build_patients.sql;
3. 만일 procedure가 compile 오류가 발생하였으면 show errors 명령어로 error 내용을 확인. 문제가 없을 경우
build_patients 프로시저에 public으로 execute 권한 Grant.
grant execute on build_patients to public;
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Patients_data 테이블에 로딩
4. nciuser 로 connect 한 뒤 build_patients 프로시저를 수행함.
connect nciuser/nciuser;
exec mdsys.build_patients(100000, 1, 'patients_data');
5. 데이타가 patients_data 테이블에 로딩되었는지 확인.
select count(*) from patients_data;
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Semantic Indexes 생성
1. SEM_RELATED Operator를 사용하기 위해 MDSYS.SEM_INDEXTYPE 타입의 semantic index 를 해당 ontology 대상
컬럼에 생성해야함.
• nciuser 로 connect 하여 patients_data 테이블에 index를 생성
create index nciIndex on patients_data(diagnosis) indextype is mdsys.sem_indextype parameters ('ONTOLOGY_MODEL(NCI),
RULEBASE(owlprime)');
2. 통계 정보 수집 수행.
• execute dbms_stats.gather_index_stats('nciuser','nciIndex');
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Semantic Model에 질의
1. Relational 테이블의 컬럼과 ontology 용어간의 semantic relation에 기반하여 Ontology성 Query를 relational 테이블에
수행 가능. 이를 위해 Semantic Operator 사용
• SEM_RELATED semantic operator는 semantic 관계에 기반한 row들을 추출함.
• SEM_DISTANCE semantic operator는 semantic 관계도의 거리값을 반환함.
• nciuser/nciuser 로 connect하여 아래 SQL을 수행함. SEM_MATCH 함수는 Class type인 모든 Subject를 반환함.
select s
from table(sem_match ('(?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class>)',
sem_models('nci'), null,null, null));
2. 아래 sql은 Finger_Fracture를 subject로 가지는 모든 Triples를 반환함.
select p, o from table(sem_match ( '(<http://www.mindswap.org/2003/nciOncology.owl#Finger_Fracture> ?p ?o )',
sem_models('nci'), null, null, null));
3. 아래 sql은 Finger_Fracture의 subClass인 Object를 모두 추출함. 이 때 owlprime rulebase를 이용하여 추론 수행.
select o from table(sem_match ( ' (<http://www.mindswap.org/2003/nciOncology.owl#Finger_Fracture>
<http://www.w3.org/2000/01/rdf-schema#subClassOf> ?o)', sem_models('nci'), sem_rulebases('owlprime'), null, null));
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Semantic Model에 질의
4. 아래 sql은 SEM_DISTANCE 와 SEM_RELATED 를 사용하여Relational 테이블( PATIENTS_DATA)를 NCI RDF Model과 결합
분석함. PATIENTS_DATA 테이블의 DIAGNOSIS 컬럼을 나타내기 위해 'diagnosis' 변수를 사용하며
Upper_Extremity_Fracture의 Sub Class 인 dianosis를 추출한 뒤 , 관계도 거리에 따라 정렬함
select diagnosis, SEM_DISTANCE(123)
from patients_data where sem_related (diagnosis, '<http://www.w3.org/2000/01/rdf-schema#subClassOf>',
'<http://www.mindswap.org/2003/nciOncology.owl#Upper_Extremity_Fracture>',
sem_models('nci'), sem_rulebases('owlprime'), 123 ) = 1
ORDER BY SEM_DISTANCE(123) asc;
5. 이전 SELECT 문에서는 PATIENTS_DATA의 조건을 만족하는 모든 diagnosis 를 반환하였으며 , 중복을 제거하기 위해서
distinct를 추가하면 됨.
select distinct diagnosis, SEM_DISTANCE(123) from patients_data where sem_related(diagnosis, '<http://www.w3.org/2000/01/rdf-
schema#subClassOf>', '<http://www.mindswap.org/2003/nciOncology.owl#Upper_Extremity_Fracture>', sem_models('nci'),
sem_rulebases('owlprime'), 123) = 1 ORDER BY SEM_DISTANCE(123) asc;
6. 아래 sql은 Connective_Tissue_Disorder 의 subclass인 diagnosis를 가진 patients를 모든 반환함.
select distinct diagnosis, SEM_DISTANCE(123) from patients_data where sem_related(diagnosis, '<http://www.w3.org/2000/01/rdf-
schema#subClassOf>', '<http://www.mindswap.org/2003/nciOncology.owl#Connective_Tissue_Disorder>',
sem_models('nci'), sem_rulebases('owlprime'), 123) = 1 ORDER BY SEM_DISTANCE(123) asc;
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Graph 와 Semantic Web 소개1
2
3
4
5
Oracle Confidential – Internal/Restricted/Highly Restricted 96
RDF
SPARQL 소개 및 실습
Ontology – RDFS , OWL 그리고 추론(Inferencing)
Oracle Semantic Technology 소개 및 실습
6 타 Semantic 솔루션 소개 – TopBraid Composer
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
TopBraid 화면 개요
Navigator :
프로젝트 및 모델을 관리.
Classes:
프로젝트 내 모델을 클릭할 시
RDFS나 OWL에 기재된 Classes를
Tree 구조 형식으로 표시.
모델/Class/Instance 등을 선택할 시 상세한 정보를 표시하는 창
Class Diagram /RDF Graph 등도 볼수 있음.
인스턴스 및 Property, 그리고 SPARQL을 수행 및 결과를 볼수 있음
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Class 화면에서 상/하위 클래스 관계 표시
표시는 하위 클래스가 존재함을 나타냄
Accommodation 클래스를
클릭하면 하위 클래스가
나타남
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
선택된 항목에 대한 상세정보 표시
Form/Brower/Diagram/Graph 형태로 데이터를 표출할 수 있도록
Tab 선택 가능
Classes 창에서 특정 Class를 선택할 경우 Ontology로 기술된
Class에 대한 상세 정보를 나타냄
Class에 대한 comment
자식 클래스들
동급 클래스들
배타 관계 클래스들
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Ontology상의 Class 관계도를 Diagram을 통해 표시
Diagram을 선택할 시 해당 클래스의 상하위 클래스 및 타 클래스와의 관계도가 그려짐
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Http형태의 namespace를 Prefix로 단축
• 메뉴 Resource에서 Assign Prefix and Namespace 선택
• Http형태의 namespace를 Prefix로 단축함
• 아래와 같이 class diagram에서 Prefix가 p1으로 대체됨
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Graph 형태로 데이터를 표현
• Graph를 선택 시 RDF 형태의 Graph로 표시됨
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
특정 Class의 Instance 정보를 표시
• Instances 탭을 클릭하면 선택된 Class에 해당하는 instance들을 표시
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
RDF, Ontology를 위한 다양한 요소를 표시
• Window 메뉴 -> Show View 를 선택하여 여러 다양한 RDF,
Ontology 요소들을 나타낼 수 있음.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
모든 RDF Triple 값들을 표현
• Window 메뉴 -> Show View -> Triples 를 선택하며 모든 RDF
의 Triples 요소 값들을 표시
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SPARQL 을 통한 쿼리 질의 및 결과 출력
• 쿼리 작성 후 Execute 버튼을
클릭하여 SPARQL 질의 결과 출력
• SPARQL 탭을 선택하면 Query Editor에서
쿼리 작성
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle DB에 저장된 RDF Data Access 방법 - 1
File > new > Project 에서 신규 프로젝트 선택
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle DB에 저장된 RDF Data Access 방법 - 2
General 폴더를 Click하면 Project 폴더가 나옴. Project 폴더를 더블 클릭함.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle DB에 저장된 RDF Data Access 방법 - 3
Project name에
tutorial_articles 라고
입력하고 Next 버튼 클릭
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle DB에 저장된 RDF Data Access 방법 - 4
아무것도 선택하지 않고 Finish button 클릭
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle DB에 저장된 RDF Data Access 방법 - 5
신규 생성된 tutorial_articles
프로젝트를 확인
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle DB에 저장된 RDF Data Access 방법 - 6
tutorial_articles Project에서 오른쪽
버튼 클릭한 뒤 ‘New’ 메뉴 ->
RDF/OWL Oracle Database Connection
클릭
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle DB에 저장된 RDF Data Access 방법 - 7
• Connection을 구분하기 위한 file name 및 Base
URI를 임의 입력
• Oracle DB에 만들어진 RDF Model 명을 기재
• Oracle DB접속하기 위한 jdbc 정보 입력
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle In-Database Analytics Platform
Relational OLAP Spatial
Data Layer
RDF Media
Parallel Processing Engine
R
Enterprise
Data
Mining
Graph
Analytics
Spatial
Analytics
Temporal
Analytics
Text
Analytics
XML
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Tools: Statistical Graph Analytics
Oracle R Enterprise
• Open source language
• Statistical computing and chart for graph data
• Produces publication quality plots
• Highly extensible with open source R packages
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Tools: Discovery & Predictive Analysis
Oracle Data Mining
Problem Classification Sample Problem
Anomaly Detection Given demographic data about a set of customers, identify custom
er purchasing behavior that is significantly different from the nor
m
Association Rules Find the items that tend to be purchased together and specify thei
r relationship – market basket analysis
Clustering Segment demographic data into clusters and rank the probability t
hat an individual will belong to a given cluster
Feature Extraction Given demographic data about a set of customers, group the attri
butes into general characteristics of the customers
F1 F2 F3 F4
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Finance Data: Visualizing RDF in OBIEE

Contenu connexe

Tendances

Near Real-Time IoT Analytics of Pumping Stations in PowerBI
Near Real-Time IoT Analytics of Pumping Stations in PowerBINear Real-Time IoT Analytics of Pumping Stations in PowerBI
Near Real-Time IoT Analytics of Pumping Stations in PowerBIMehmet Bakkaloglu
 
Linked Open Data Tutorial
Linked Open Data TutorialLinked Open Data Tutorial
Linked Open Data TutorialMyungjin Lee
 
LODAC 2017 Linked Open Data Workshop
LODAC 2017 Linked Open Data WorkshopLODAC 2017 Linked Open Data Workshop
LODAC 2017 Linked Open Data WorkshopMyungjin Lee
 
Clean architecture with ddd layering in php
Clean architecture with ddd layering in phpClean architecture with ddd layering in php
Clean architecture with ddd layering in phpLeonardo Proietti
 
Linked Data 4 principles
Linked Data 4 principles Linked Data 4 principles
Linked Data 4 principles LiST Inc
 
オンプレ回帰も簡単実現!自由自在なデータベース運用とは
オンプレ回帰も簡単実現!自由自在なデータベース運用とはオンプレ回帰も簡単実現!自由自在なデータベース運用とは
オンプレ回帰も簡単実現!自由自在なデータベース運用とは株式会社クライム
 
Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework OverviewEric Nelson
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeAdriel Café
 
온톨로지 개념 및 표현언어
온톨로지 개념 및 표현언어온톨로지 개념 및 표현언어
온톨로지 개념 및 표현언어Dongbum Kim
 
지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)
지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)
지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)Myungjin Lee
 
Property graph vs. RDF Triplestore comparison in 2020
Property graph vs. RDF Triplestore comparison in 2020Property graph vs. RDF Triplestore comparison in 2020
Property graph vs. RDF Triplestore comparison in 2020Ontotext
 
Banco de Dados - Part01
Banco de Dados - Part01Banco de Dados - Part01
Banco de Dados - Part01Rangel Javier
 
RDBMS to Graph
RDBMS to GraphRDBMS to Graph
RDBMS to GraphNeo4j
 
Intro to Cypher
Intro to CypherIntro to Cypher
Intro to CypherNeo4j
 
The Path To Success With Graph Database and Analytics
The Path To Success With Graph Database and AnalyticsThe Path To Success With Graph Database and Analytics
The Path To Success With Graph Database and AnalyticsNeo4j
 
도서관 Linked Open Data의 필요성
도서관 Linked Open Data의 필요성도서관 Linked Open Data의 필요성
도서관 Linked Open Data의 필요성Hansung University
 

Tendances (20)

Near Real-Time IoT Analytics of Pumping Stations in PowerBI
Near Real-Time IoT Analytics of Pumping Stations in PowerBINear Real-Time IoT Analytics of Pumping Stations in PowerBI
Near Real-Time IoT Analytics of Pumping Stations in PowerBI
 
Linked Open Data Tutorial
Linked Open Data TutorialLinked Open Data Tutorial
Linked Open Data Tutorial
 
LODAC 2017 Linked Open Data Workshop
LODAC 2017 Linked Open Data WorkshopLODAC 2017 Linked Open Data Workshop
LODAC 2017 Linked Open Data Workshop
 
Introdução a React Native
Introdução a React NativeIntrodução a React Native
Introdução a React Native
 
Clean architecture with ddd layering in php
Clean architecture with ddd layering in phpClean architecture with ddd layering in php
Clean architecture with ddd layering in php
 
Linked Data 4 principles
Linked Data 4 principles Linked Data 4 principles
Linked Data 4 principles
 
オンプレ回帰も簡単実現!自由自在なデータベース運用とは
オンプレ回帰も簡単実現!自由自在なデータベース運用とはオンプレ回帰も簡単実現!自由自在なデータベース運用とは
オンプレ回帰も簡単実現!自由自在なデータベース運用とは
 
Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework Overview
 
SQL Server 入門
SQL Server 入門SQL Server 入門
SQL Server 入門
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & Practice
 
온톨로지 개념 및 표현언어
온톨로지 개념 및 표현언어온톨로지 개념 및 표현언어
온톨로지 개념 및 표현언어
 
지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)
지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)
지식그래프 개념과 활용방안 (Knowledge Graph - Introduction and Use Cases)
 
Modelagem de dados
Modelagem de dadosModelagem de dados
Modelagem de dados
 
Property graph vs. RDF Triplestore comparison in 2020
Property graph vs. RDF Triplestore comparison in 2020Property graph vs. RDF Triplestore comparison in 2020
Property graph vs. RDF Triplestore comparison in 2020
 
Banco de Dados - Part01
Banco de Dados - Part01Banco de Dados - Part01
Banco de Dados - Part01
 
RDF and OWL
RDF and OWLRDF and OWL
RDF and OWL
 
RDBMS to Graph
RDBMS to GraphRDBMS to Graph
RDBMS to Graph
 
Intro to Cypher
Intro to CypherIntro to Cypher
Intro to Cypher
 
The Path To Success With Graph Database and Analytics
The Path To Success With Graph Database and AnalyticsThe Path To Success With Graph Database and Analytics
The Path To Success With Graph Database and Analytics
 
도서관 Linked Open Data의 필요성
도서관 Linked Open Data의 필요성도서관 Linked Open Data의 필요성
도서관 Linked Open Data의 필요성
 

Similaire à RDF와 Graph의 이해 및 오라클 Spartial&Graph 소개

On premise db &amp; cloud database
On premise db &amp; cloud databaseOn premise db &amp; cloud database
On premise db &amp; cloud databaseOracle Korea
 
Oracle DB를 AWS로 이관하는 방법들 - 서호석 클라우드 사업부/컨설팅팀 이사, 영우디지탈 :: AWS Summit Seoul 2021
Oracle DB를 AWS로 이관하는 방법들 - 서호석 클라우드 사업부/컨설팅팀 이사, 영우디지탈 :: AWS Summit Seoul 2021Oracle DB를 AWS로 이관하는 방법들 - 서호석 클라우드 사업부/컨설팅팀 이사, 영우디지탈 :: AWS Summit Seoul 2021
Oracle DB를 AWS로 이관하는 방법들 - 서호석 클라우드 사업부/컨설팅팀 이사, 영우디지탈 :: AWS Summit Seoul 2021Amazon Web Services Korea
 
사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...
사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...
사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...Amazon Web Services Korea
 
DMS와 SCT를 활용한 Oracle에서 Open Source DB로의 전환
DMS와 SCT를 활용한 Oracle에서 Open Source DB로의 전환DMS와 SCT를 활용한 Oracle에서 Open Source DB로의 전환
DMS와 SCT를 활용한 Oracle에서 Open Source DB로의 전환Amazon Web Services Korea
 
LOD 구축현황 과 현황
LOD 구축현황 과 현황LOD 구축현황 과 현황
LOD 구축현황 과 현황sbchae
 
MySQL Document Store를 활용한 NoSQL 개발
MySQL Document Store를 활용한 NoSQL 개발MySQL Document Store를 활용한 NoSQL 개발
MySQL Document Store를 활용한 NoSQL 개발Oracle Korea
 
Expanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with TajoExpanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with TajoGruter
 
Expanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with TajoExpanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with TajoMatthew (정재화)
 
Cloudera session seoul - Spark bootcamp
Cloudera session seoul - Spark bootcampCloudera session seoul - Spark bootcamp
Cloudera session seoul - Spark bootcampSang-bae Lim
 
Pg day seoul 2016 session_02_v1.0_ff
Pg day seoul 2016 session_02_v1.0_ffPg day seoul 2016 session_02_v1.0_ff
Pg day seoul 2016 session_02_v1.0_ffPgDay.Seoul
 
[Pgday.Seoul 2019] Advanced FDW
[Pgday.Seoul 2019] Advanced FDW[Pgday.Seoul 2019] Advanced FDW
[Pgday.Seoul 2019] Advanced FDWPgDay.Seoul
 
Swc발표자료2 2(restful)
Swc발표자료2 2(restful)Swc발표자료2 2(restful)
Swc발표자료2 2(restful)마경근 마
 
SK Telecom - 망관리 프로젝트 TANGO의 오픈소스 데이터베이스 전환 여정 - 발표자 : 박승전, Project Manager, ...
SK Telecom - 망관리 프로젝트 TANGO의 오픈소스 데이터베이스 전환 여정 - 발표자 : 박승전, Project Manager, ...SK Telecom - 망관리 프로젝트 TANGO의 오픈소스 데이터베이스 전환 여정 - 발표자 : 박승전, Project Manager, ...
SK Telecom - 망관리 프로젝트 TANGO의 오픈소스 데이터베이스 전환 여정 - 발표자 : 박승전, Project Manager, ...Amazon Web Services Korea
 
MODS와 DC비교 및 변환-비도서자료론
MODS와 DC비교 및 변환-비도서자료론MODS와 DC비교 및 변환-비도서자료론
MODS와 DC비교 및 변환-비도서자료론byunjieun
 
국내 공공데이터 플랫폼 현황과 발전방향
국내 공공데이터 플랫폼 현황과 발전방향국내 공공데이터 플랫폼 현황과 발전방향
국내 공공데이터 플랫폼 현황과 발전방향Haklae Kim
 
Network virtualization for the better understanding of Data Center Network
Network virtualization for the better understanding of Data Center NetworkNetwork virtualization for the better understanding of Data Center Network
Network virtualization for the better understanding of Data Center NetworkInho Kang
 
신규 시장 개척과 클라우드 Offering을 위한 AWS 데이터베이스 서비스 이해 (최유정 데이터베이스 솔루션즈 아키텍트, AWS) :: ...
신규 시장 개척과 클라우드 Offering을 위한 AWS 데이터베이스 서비스 이해 (최유정 데이터베이스 솔루션즈 아키텍트, AWS) :: ...신규 시장 개척과 클라우드 Offering을 위한 AWS 데이터베이스 서비스 이해 (최유정 데이터베이스 솔루션즈 아키텍트, AWS) :: ...
신규 시장 개척과 클라우드 Offering을 위한 AWS 데이터베이스 서비스 이해 (최유정 데이터베이스 솔루션즈 아키텍트, AWS) :: ...Amazon Web Services Korea
 
[HaU] 신입 기술 면접 준비 java
[HaU] 신입 기술 면접 준비 java[HaU] 신입 기술 면접 준비 java
[HaU] 신입 기술 면접 준비 java유리 하
 
데이터 레이크 알아보기(Learn about Data Lake)
데이터 레이크 알아보기(Learn about Data Lake)데이터 레이크 알아보기(Learn about Data Lake)
데이터 레이크 알아보기(Learn about Data Lake)SeungYong Baek
 

Similaire à RDF와 Graph의 이해 및 오라클 Spartial&Graph 소개 (20)

On premise db &amp; cloud database
On premise db &amp; cloud databaseOn premise db &amp; cloud database
On premise db &amp; cloud database
 
Oracle DB를 AWS로 이관하는 방법들 - 서호석 클라우드 사업부/컨설팅팀 이사, 영우디지탈 :: AWS Summit Seoul 2021
Oracle DB를 AWS로 이관하는 방법들 - 서호석 클라우드 사업부/컨설팅팀 이사, 영우디지탈 :: AWS Summit Seoul 2021Oracle DB를 AWS로 이관하는 방법들 - 서호석 클라우드 사업부/컨설팅팀 이사, 영우디지탈 :: AWS Summit Seoul 2021
Oracle DB를 AWS로 이관하는 방법들 - 서호석 클라우드 사업부/컨설팅팀 이사, 영우디지탈 :: AWS Summit Seoul 2021
 
PL/SQL - 10g Release1
PL/SQL - 10g Release1PL/SQL - 10g Release1
PL/SQL - 10g Release1
 
사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...
사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...
사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...
 
DMS와 SCT를 활용한 Oracle에서 Open Source DB로의 전환
DMS와 SCT를 활용한 Oracle에서 Open Source DB로의 전환DMS와 SCT를 활용한 Oracle에서 Open Source DB로의 전환
DMS와 SCT를 활용한 Oracle에서 Open Source DB로의 전환
 
LOD 구축현황 과 현황
LOD 구축현황 과 현황LOD 구축현황 과 현황
LOD 구축현황 과 현황
 
MySQL Document Store를 활용한 NoSQL 개발
MySQL Document Store를 활용한 NoSQL 개발MySQL Document Store를 활용한 NoSQL 개발
MySQL Document Store를 활용한 NoSQL 개발
 
Expanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with TajoExpanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with Tajo
 
Expanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with TajoExpanding Your Data Warehouse with Tajo
Expanding Your Data Warehouse with Tajo
 
Cloudera session seoul - Spark bootcamp
Cloudera session seoul - Spark bootcampCloudera session seoul - Spark bootcamp
Cloudera session seoul - Spark bootcamp
 
Pg day seoul 2016 session_02_v1.0_ff
Pg day seoul 2016 session_02_v1.0_ffPg day seoul 2016 session_02_v1.0_ff
Pg day seoul 2016 session_02_v1.0_ff
 
[Pgday.Seoul 2019] Advanced FDW
[Pgday.Seoul 2019] Advanced FDW[Pgday.Seoul 2019] Advanced FDW
[Pgday.Seoul 2019] Advanced FDW
 
Swc발표자료2 2(restful)
Swc발표자료2 2(restful)Swc발표자료2 2(restful)
Swc발표자료2 2(restful)
 
SK Telecom - 망관리 프로젝트 TANGO의 오픈소스 데이터베이스 전환 여정 - 발표자 : 박승전, Project Manager, ...
SK Telecom - 망관리 프로젝트 TANGO의 오픈소스 데이터베이스 전환 여정 - 발표자 : 박승전, Project Manager, ...SK Telecom - 망관리 프로젝트 TANGO의 오픈소스 데이터베이스 전환 여정 - 발표자 : 박승전, Project Manager, ...
SK Telecom - 망관리 프로젝트 TANGO의 오픈소스 데이터베이스 전환 여정 - 발표자 : 박승전, Project Manager, ...
 
MODS와 DC비교 및 변환-비도서자료론
MODS와 DC비교 및 변환-비도서자료론MODS와 DC비교 및 변환-비도서자료론
MODS와 DC비교 및 변환-비도서자료론
 
국내 공공데이터 플랫폼 현황과 발전방향
국내 공공데이터 플랫폼 현황과 발전방향국내 공공데이터 플랫폼 현황과 발전방향
국내 공공데이터 플랫폼 현황과 발전방향
 
Network virtualization for the better understanding of Data Center Network
Network virtualization for the better understanding of Data Center NetworkNetwork virtualization for the better understanding of Data Center Network
Network virtualization for the better understanding of Data Center Network
 
신규 시장 개척과 클라우드 Offering을 위한 AWS 데이터베이스 서비스 이해 (최유정 데이터베이스 솔루션즈 아키텍트, AWS) :: ...
신규 시장 개척과 클라우드 Offering을 위한 AWS 데이터베이스 서비스 이해 (최유정 데이터베이스 솔루션즈 아키텍트, AWS) :: ...신규 시장 개척과 클라우드 Offering을 위한 AWS 데이터베이스 서비스 이해 (최유정 데이터베이스 솔루션즈 아키텍트, AWS) :: ...
신규 시장 개척과 클라우드 Offering을 위한 AWS 데이터베이스 서비스 이해 (최유정 데이터베이스 솔루션즈 아키텍트, AWS) :: ...
 
[HaU] 신입 기술 면접 준비 java
[HaU] 신입 기술 면접 준비 java[HaU] 신입 기술 면접 준비 java
[HaU] 신입 기술 면접 준비 java
 
데이터 레이크 알아보기(Learn about Data Lake)
데이터 레이크 알아보기(Learn about Data Lake)데이터 레이크 알아보기(Learn about Data Lake)
데이터 레이크 알아보기(Learn about Data Lake)
 

RDF와 Graph의 이해 및 오라클 Spartial&Graph 소개

  • 1. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | ORACLE Oracle Spatial and Graph 소개 권철민
  • 2. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Program Agenda Graph 와 Semantic Web 소개1 2 3 4 5 Oracle Confidential – Internal/Restricted/Highly Restricted 2 RDF SPARQL 소개 및 실습 Ontology – RDFS , OWL 그리고 추론(Inferencing) Oracle Semantic Technology 소개 및 실습 6 타 Semantic 솔루션 소개 – TopBraid Composer
  • 3. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Overview of Graph  Graph 란? 그래프는 Vertex(노드) 와 Edge(링크)의 연결을 통해 데이터를 표현하는 집합  Graph의 사용 유형 • Road networks, power grids, biological networks • Social networks/Social Web (Facebook, Linkedin, Twitter, Baidu, Google+,>) • Knowledge graphs (RDF, OWL) – 그래프는 직관적이고 유연하다. • Easy to navigate, easy to form a path, natural to visualize
  • 4. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle Graph의 활용 유형 여러 유형의 Application에서 Oracle Graph를 활용. – Link-node graphs representing physical/logical networks used in transportation,utilities and telco (Oracle Spatial and Graph Network Data Model (NDM) – RDF Semantic Graphs modeling data as Triples for social network, linked data and other semantic applications (Oracle Spatial and Graph)
  • 5. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Semantic Web 의 정의 데이터와 그 데이터가 뜻하는 Semantic(의미)를 웹 상에서 공유하기 위한 표준들과 Best Practices들의 집합체 Semantic Web • 표준 데이터 모델 : RDF • 데이터 의미( Semantic) 표준 명세서 : RDFS/OWL • 표준 데이터 조회 방법 : SPARQL 보다 스마트 한 Web을 만들기 위한 차세대 Web 규약
  • 6. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | HTML 시대의 분산 데이터 조회 및 처리 A항공사 html <table 스케쥴 > <tr> 출발스케줄 …. <td> 편명 </td> …… …… </table> B항공사 html <P 항공 스케줄> <A> 출발시간 ………….. …………. </P> E항공사 html 또다른 HTML 코드 ……. 항공사 좌석조회 Portal <table 전체 스케쥴 > <tr> 출발 항공사 스케줄 …. <td> ….. </td> …… …… </table> 각 항공사 html에서 스케줄 관련 부분을 가져 온 뒤 적절하게 Parsing 하고 재 조합하여 항공사 좌석조회 Portal에서 표시 만일 B항공사의 Html 이 변경된다면? 프로그램 처리 로직 • 프로그램 처리로직을 다시 변경하여 B항공사의 Contents 맞게 가공 필요 • 항공사가 늘어날 수록 데이터 가공 처리가 더욱 복잡해 짐 • 정확한 데이터의 표현이 어려워짐. 항공사 별로 서로 다른 표시 형식을 가진 웹사이트
  • 7. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Smart 한 웹 시스템 구축을 위한 구성 요소 •각 Sites에서 표준 Data Format으로 데이터를 제공 •각 데이터들이 데이터에 대한 다양한 속성과 관계를 상세하게 정의한 명세서를 제공 •해당 데이터를 Retrieve 할 수 있는 공통의 Protocol을 제공 HTML은 데이터의 표현을 위한 Tag와 내용이 혼재되어 있음. 어떻게 각 사이트에서 제공하는 정보를 효과적으로 통합하고 활용할 것인가?
  • 8. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Smart Web 구현을 위한 표준 Infra 구성 A항공사 데이타 < Airline Flight ID = “F01 “> < Airline name“A” …> <Dept City = “ 서울”> < Dept time = 8/1 16:00> < Vacancy seat= 100 > …….. A항공사 데이터 명세서 • Flight id 는 편명이고 문자Type의 고유한 값을 가짐. • Airline name은 항공사 명을 뜻하고 항공연합회에 해당 이름이등재되어 있음. • Dept time은 날짜/시간이며 yyyymmdd hh24:mi 형으로 되어 있음. • Dept city , Arrv City 모두 Location 클래스에 등재되어 있으며 서로 대칭관계를 가짐 B 항공사 데이타 < Airline FID= “F01 “> < name“A” …> <……. …….. B항공사 데이터 명세서 • ………. 항공사 좌석조회 Portal RDF RDF/OWL Select ?편명 ?출발도시 ?도착도시 ?출발시간 From A항공사 데이터 , B항공사 데이터, C…. 프로그램 처리 로직 데이터 공유를 위한 표준 Web Infra 를 각 항공사가 수용한다면 정확하고 실시간으로 Update 되는 데이터를 누구나 이용가능 함. RDF RDF/OWL SPARQL
  • 9. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Semantic Web Component RDF ( Triple) Relation Data Model Ontology RDFS/OWL DB 메타데이타 ( 컬럼명, 컬럼 Type , pk/fk , Constraint 등) SPARQL SQL Semantic Web RDB UML ERD Semantic Web은 Graph 형태의 데이터 모델인 RDF 와 데이터에 대한 구조 및 명세, 의미를 담은 Ontology 인 RDFS/OWL 그리고 RDF 데이터를 조회하기 위한 SPARQL이 주요 구성 요소임. Semantic Web 구성 요소 및 RDB와의 비교 Semantic Web의 Component와 RDB 의 Component 들은 상당한 유사성을 가짐. 그러나 Semantic Web 은 RDB보다 광범위하고 이질적인 데이터 들을 효과적으로 연결하고 통합하기 위한 기술에 더욱 집중
  • 10. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Linked Open Data 어떻게 하면 웹 상에서 모든 데이터를 쉽게 공유할 수 있는 최적의 데이터 인프라를 제공할 수 있을 것인가 ? Semantic Web의 Component를 이용 RDF , RDFS/OWL,SPARQL “데이터의 통합성과 연결 유연성을 강화한 데이터 모델 및 명확한 데이터 명세서 , 그리고 이들 데이터를 호출할 수 있는 프로토콜을 각 시스템들이 표준으로 갖춘다면 전세계 어떤 유형의 데이터라도 서로 연결되고 통합될 수 있다. “ - Tim BERNERS-Lee , Maybe
  • 11. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Semantic Web Component를 통한 Linked Data 구성 Inferencing Query and Update Web of Data Applications Browser Applications Stand Alone Applications Common “Graph” Format & Common Vocabularies “Bridges” Data on the Web
  • 12. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Program Agenda Graph 와 Semantic Web 소개1 2 3 4 5 Oracle Confidential – Internal/Restricted/Highly Restricted 12 RDF SPARQL 소개 및 실습 Ontology – RDFS , OWL 그리고 추론(Inferencing) Oracle Semantic Technology 소개 및 실습 6 타 Semantic 솔루션 소개 – TopBraid Composer
  • 13. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Resource Description Framework (RDF) RDF is a general framework for describing a Web site's metadata, or the information about the information on the site. It provides interoperability between applications that exchange machine-understandable information on the Web. W3C
  • 14. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 웹상의 데이터 원격 분산 방안 EMPNO ENAME JOB HIREDATE SAL DEPTNO 7369 SMITH CLERK 1980-12-17 800 20 7499 ALLEN SALESMAN 1981-02-20 1,600 30 7521 WARD SALESMAN 1981-02-22 1,250 30 7566 JONES MANAGER 1981-04-02 2,975 20 7654 MARTIN SALESMAN 1981-09-28 1,250 30 7698 BLAKE MANAGER 1981-05-01 2,850 30 1. Column 단위 (수직 분할)로 데이터를 분할하여 각 원격지 서버로 데이터 분산 2. Record 단위 (수평 분할)로 데이터를 분할하여 각 원격지 서버로 데이터 분산 3. Column 과 Record 결합하여 데이터를 분할하여 각 원격지 서버로 데이터 분산 아래와 같은 데이터 값을 웹상의 여러 대 서버로 분산하기 위한 방안은 ?
  • 15. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 웹상의 데이터 원격 분산 방안 – Column 레벨 분산 ENAME SMITH ALLEN WARD JONES MARTIN BLAKE JOB HIREDATE CLERK 1980-12-17 SALESMAN 1981-02-20 SALESMAN 1981-02-22 MANAGER 1981-04-02 SALESMAN 1981-09-28 MANAGER 1981-05-01 SAL DEPTNO 800 20 1,600 30 1,250 30 2,975 20 1,250 30 2,850 30 Column 레벨로 분산 • 각 시스템들이 개별적으로 컬럼들을 가짐. • 각 시스템별로 동일한 Record를 참조하는지 알 수 없음( 한 서버의 세 번째 Record가 다른 서버의 세 번째 Record와 같은 개체를 참조하는가 ? ) • 각 시스템 전체적으로 참조 가능한 Global 식별자가 필요함.
  • 16. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 웹상의 데이터 원격 분산 방안 – Record 레벨 분산 7521 WARD SALESMAN 1981-02-22 1,250 30 7566 JONES MANAGER 1981-04-02 2,975 20 7369 SMITH CLERK 1980-12-17 800 20 7499 ALLEN SALESMAN 1981-02-20 1,600 30 7654 MARTIN SALESMAN 1981-09-28 1,250 30 7698 BLAKE MANAGER 1981-05-01 2,850 30 Record 레벨로 분산 • 각 시스템들이 Record 의 일부만을 분산하여 관리함. • 여러 Column을 분산될 경우의 문제점 해결되나 각 시스템 별로 컬럼에 대한 정보를 공유해야 함. (한 시스템의 세 번째 컬럼이 다른 시스템의 세 번째 컬럼과 일치하는가 ? ) • 서버들은 전 세계적으로 공통된 방법으로 각 컬럼이 가리키는 속성을 인지 할 수 있어야 함.
  • 17. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 웹상의 데이터 원격 분산 방안 – Cell 레벨로 분산 글로벌 식별자 ENAME Record 1 SMITH 글로벌 식별자 JOB Record 5 SALESMAN 글로벌 식별자 HIREDATE Record 1 1980-12-17 글로벌 식별자 ENAME Record 3 SMITH 글로벌 식별자 SAL Record 5 1,250 Cell 레벨로 분산 • 각 시스템은 몇 개의 Cell로 분리하여 관리하여 유연성 증대 • Cell이 세가지의 값으로 표현되어야 함. 즉 Record에 대한 범용적인 참조, 컬럼에 대한 범용적인 참조, Cell 자체의 값 • RDF의 기본 구성단위인 Triple의 표현 형태. 행 식별자는 주어부, 컬럼 식별자는 술어부 , 셀에 있는 값은 목적부임. • 컬럼의 추가/삭제와 같은 스키마의 변경이 데이터의(Cell) 추가/삭제로 가능하므로 유연한 데이터 모델 구성 가능 글로벌 식별자 Commission Record 5 500 만일 신규 컬럼이 추가된다면? Cell 을 추가 생성함.
  • 18. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 여러 데이터 소스로부터 데이터 병합 계약: 11111 자동청구 권철민 월 정기납부 LTE 무한 요금 명의자 청구방법 납부방법 가입 상품 상품:LTE 무한 요금 무선 전용 무한 사용 요금제 유무선 상품 구분 요금제 분류 …….. 두개의 다른 영역에 있는 그래프의 노드가 서로 같은 노드임을 규명하는 것이 병합의 핵심 계약 Domain 상품 Domain 같은 노드 인가? • 트리플 Graph의 가치는 데이터의 병합이 쉽게 이루어 질수 있는 용이성에 있음. • 정보가 트리플로 간단히 표현되면 두 그래프로부터 병합된 정보는 단순히 개별 그래프의 모든 트리플들을 합하여 하나의 그래프로 만드는 것.
  • 19. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 여러 데이터 소스로부터 데이터 병합 - URI 계약: 11111 자동청구 권철민 월 정기납부 LTE 무한 요금 명의자 청구방법 납부방법 가입 상품 무선 전용 무한 사용 요금제 유무선 상품 구분 요금제 분류 • 각 노드가 서로 같은지를 결정하기 위한 정확한 정보가 필요. • 각 노드가 고유의 식별자를 가지게 하기 위해 웹 상에서 사용되는 Global Identifier 를 활용 URI (Uniform Resource Identifiers)
  • 20. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | URIs • URI = Uniform Resource Identifier • “웹 상의 모든 Resource 를 고유하게 식별할 수 있는(범용 식별자) 표기 체계“ • URI는 URL 표기와 유사하며 RDF에서는 Document의 특정부분을 가리키기 위해 Fragment identifier와 함께 사용되기도 함 – http://www.somedomain.com/some/path/to/file#fragmentID • URI는 약어 표현이 가능하며 (qname) , qname으로 표현된 URI는 네임스페이스와 “:”(콜론) 그리고 식별자로 구성됨. <http://purl.org/dc/elements/1.1/creator> <http://purl.org/dc/elements/1.1/title> @prefix dc: <http://purl.org/dc/elements/1.1/> . dc:creator …… dc:title ……..
  • 21. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF란? RDF는 Web Resource 들과 그들간의 관계를 표현하기 위해 Triple로 구성된 Graph 형태의 데이터 모델 <http://foobar > <produces> <mp3> Triple Subject 주어 (식별자) ( Vertex/Node) Predicate 술어 (속성명/관계명) ( Property/edge) Object 목적어 (속성값/관계값) ( Vertex/node) 그래프 데이터는 RDF/XML ,N-TRIPLE,N3 형태로 저장되고 표현될 수 있다.
  • 22. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 간단한 RDF 예제 – RDF/XML 형태 <rdf:Description rdf:about="http://…/isbn/2020386682"> <f:title xml:lang="fr">Le palais des mirroirs</f:title> <f:original rdf:resource="http://…/isbn/000651409X"/> </rdf:Description> http://…isbn/2020386682 Le palais des miroirs http://…isbn/000651409X
  • 23. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Graph 데이터 모델의 장점 •Graph 모델링은 유연하다 - 새로운 Vertex나 Edge를 추가하거나 삭제하는 것이 매우 단순함 - Edge를 추가하는 것은 RDB Table에 컬럼을 추가하는 것과 유사하나 Graph에서는 상대적으로 매우 쉬움 •표준 RDF 설정 - RDF는 W3C에서 정의됨 •Computer가 RDF 그래프의 Semantic을 이해 할 수 있음. - Hidden Relationship을 자동으로 찾을 수 있음. 동일한 URI는 동일한 Resource를 의미함.
  • 24. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Graph 데이터 모델의 장점 •Graph 모델링은 유연하다 - 새로운 Vertex나 Edge를 추가하거나 삭제하는 것이 매우 단순함 - Edge를 추가하는 것은 RDB Table에 컬럼을 추가하는 것과 유사하나 Graph에서는 상대적으로 매우 쉬움 •표준 RDF 설정 - RDF는 W3C에서 정의됨 •Computer가 RDF 그래프의 Semantic을 이해 할 수 있음. - Hidden Relationship을 자동으로 찾을 수 있음. 동일한 URI는 동일한 Resource를 의미함. 데이터가 연결되고 확장 가능
  • 25. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 데이터 모델이란? 데이터 데이터 모델 RDF는 Triple로 Relational Data Model은 Entity의 정의와 그들간의 Relation으로 RDF/XML , N-TRIPLE, Graph DB RDBMS데이터 저장, 관리 데이터 모델이란 데이터를 어떠한 시각으로 바라봐야 하는 ‘틀’을 정의 데이터를 바라보는 틀 데이터를 바라보는 틀
  • 26. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDB 데이터 모델과 Graph 데이터 모델 SELECT p1.Person FROM Person p1 , PersonFriend pf ON PersonFriend.FriendID = p1.ID JOIN Person p2 ON PersonFriend.PersonID = p2.ID WHERE p2.Person = ‘Alice' Alice의 친구는 누구? SELECT p1.Person AS PERSON, p2.Person AS FRIEND_OF_FRIEND FROM PersonFriend pf1 JOIN Person p1 ON pf1.PersonID = p1.ID JOIN PersonFriend pf2 ON pf2.PersonID = pf1.FriendID JOIN Person p2 ON pf2.FriendID = p2.ID WHERE p1.Person = 'Alice' AND pf2.FriendID <> p1.ID Alice의 친구의 친구는? 관계도가 깊어질수록 RDB에서는 SQL복잡도가 깊어지고 수행성능이 저하
  • 27. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle RDBMS에서 Recursive SQL을 통한 계층 관계도 표현 조직 #조직코드 *상위조직코드 조직명 부서장 위치 구성되어 속하여 가져야 구성되어 가져야 구성되어 가져야 구성되어 팀 #* ID 부서 #* ID 본부 #* ID 회사 #* ID SELECT LPAD(‘ ‘, 2*LEVEL)||COL1. . . . FROM 조직 WHERE 위치=‘XXX’ CONNECT BY PRIOR 조직코드 = 상위조직코드 START WITH 조직명=‘YYY’ = ‘A’ 통합하여 Recursive SQL로 관리각 엔터티별로 관계도가 깊어짐 • 계층관계도가 깊어지는 엔터티들은 모두 통합해야 하는가? • 서로 상이한 유형의 컬럼을 가지는 엔터티들의 계층 관계도가 깊어지면 어떻게 해야 하는가?
  • 28. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF 모델의 표현 - 1 Subject (resource identifier) predicate (property name) Object (property value) richard homeTel (229) 276-5135 richard email richard49@hotmail.com cindy homeTel (245)646-5488 cindy email cindym@gmail.com Person명(PK) homeTel Email richard (229) 276-5135 richard49@hotmail.com cindy (245)646-5488 cindym@gmail.com @prefix ab: <http://learningsparql.com/ns/addressbook#> . ab:richard ab:homeTel "(229) 276-5135" . ab:richard ab:email "richard49@hotmail.com" . ab:cindy ab:homeTel "(245) 646-5488" . ab:cindy ab:email "cindym@gmail.com" . Relational Data 모델 RDF 모델 •RDBMS의 PK는 RDF에서는 Subject로 , 속성명은 Predicate 로 속성값은 Object로 매핑 •속성의 관계화
  • 29. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF 모델의 표현 - 2 • Book No : ISBN 006251587X 의 저자는 Tim Berners-Lee • Book No : ISBN 006251587X 는 “Weaving the Web” 이라는 제목이다. • Tim Berners-Lee’s 의 직함은 “Director”이다. Book : ISBN 006251587X Author :Tim Berners-Lee Weaving the Web Book no (PK) 저자 (FK) 제목 ISBN 006251587 Tim Berners- Lee Weaving the Web Author 명 Tim Berners- Lee 직함 Director Book 테이블 저자 테이블Director 저자 제목 직함 RDF 모델 RDBMS 모델
  • 30. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF 의 저장 • RDF 를 File 로 저장하기 - 3가지 표기법으로 File Serialization : N-Triples , RDF/XML , N3 • RDF 를 Database 로 저장 - 대용량의 RDF의 경우 Database 에 저장하는 것이 가장 효율적 - Database Management System 가 갖춰야 할 기본적인 기능 외에 Semantic Web을 구성하는 Ontology 및 SPARQL에 대한 표준 지원이 가능하여 야 함.
  • 31. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF 의 직렬화 (Serialization) – N-Triples <urn:isbn:006251587X> <http://purl.org/dc/elements/1.1/creator> <http://www.w3.org/People/Berners-Lee/card#i> . <urn:isbn:006251587X> < http://purl.org/dc/elements/1.1/title> "Weaving the Web“ . 주어부 술어부 목적부 마침표 •축약되지 않은 URI를 사용하여 리소스 참조 •각 URI는 꺽은 화살표(<>) 안에 사용. •Subject, Predicate, Object 순으로 표시되며 하나의 Triple 셋 은 “.” (마침표)로 구분한다.
  • 32. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF 의 직렬화 (Serialization) – N3 •Namespace의 qname을 통한 축약 제공 •주어부,술어부,목적부 그리고 마침표(.) 의 순으로 정의 •여러 개의 Triple이 하나의 주어부를 공유할 수 있도록 제공. “;”(세미콜론)을 사용하여 같은 주어부를 사용 하는 트리플이 (술어부와 목적부) 따라온다는 것을 명기함. •가장 효율적인 표기 가능 @prefix dc: <http://purl.org/dc/elements/1.1/> . <urn:isbn:006251587X> dc:creator <http://www.w3.org/People/Berners-Lee/card#i> ; dc:title "Weaving the Web“ . 주어부 술어부 목적부 세미콜론 (주어부를 공유하는 트리플이 존재) 술어부 목적부 마침표 Namespace (축약)
  • 33. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF 의 직렬화 (Serialization) – RDF/XML •RDF를 XML로 표시. •시작노드 <…..> 종료노드(/….> 를 사용한 xml 표기 방식을 적용. •표기의 복잡도가 높음 <rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# xmlns:dc="http://purl.org/dc/elements/1.1/ xmlns:v="http://www.w3.org/2006/vcard/"> <rdf:Description rdf:about="urn:isbn:006251587X"> <dc:title>Weaving the Web</dc:title> <v:title>Director</v:title> </rdf:Description> </rdf:RDF>
  • 34. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Program Agenda Graph 와 Semantic Web 소개1 2 3 4 5 Oracle Confidential – Internal/Restricted/Highly Restricted 34 RDF SPARQL 소개 및 실습 Ontology – RDFS , OWL 그리고 추론(Inferencing) Oracle Semantic Technology 소개 및 실습 6 타 Semantic 솔루션 소개 – TopBraid Composer
  • 35. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | SPARQL 이란 ? “SPARQL은 RDF 데이터의 Query Language ( SQL과 유사 )” SPARQL Spec의 구성 • SPARQL Query Language for RDF : RDF 데이터의 Query Syntax 정의 • SPARQL Protocol for RDF : Application 이 SPARQL 쿼리를 Query 처리 엔진에 전달하고 결과를 받는 Protocol 정의 • SPARQL Query Results for XML ,JSON,CSV,TSV Format : Query 처리 엔진에서 결과를 반환하는 Format 정의
  • 36. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF와 SPARQL 무작정 시작하기 - 1 @prefix ab: <http://learningsparql.com/ns/addressbook#> . ab:richard ab:homeTel "(229) 276-5135" . ab:richard ab:email "richard49@hotmail.com" . ab:cindy ab:homeTel "(245) 646-5488" . ab:cindy ab:email "cindym@gmail.com" . ab:craig ab:homeTel "(194) 966-1505" . ab:craig ab:email "craigellis@yahoo.com" . ab:craig ab:email "c.ellis@usairwaysgroup.com" . RDF 파일 PREFIX ab: <http://learningsparql.com/ns/addressbook#> SELECT ?craigEmail WHERE { ab:craig ab:email ?craigEmail . } SPARQL 질의 craigEmail | ================================ | "c.ellis@usairwaysgroup.com" | | "craigellis@yahoo.com" SPARQL 질의 결과
  • 37. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | SPARQL의 해석 – where절 S-P-O Triple 및 ?변수기호 PREFIX ab: <http://learningsparql.com/ns/addressbook#> SELECT ?craigEmail WHERE { ab:craig ab:email ?craigEmail . } • Where 절의 {} 내부 Syntax는 Subject-Predicate-Object Triple임 • . (Period) 기호는 하나의 S-P-O 패턴이 끝남을 명시 ( AND 와 비슷) • ? 기호는 변수임을 나타냄과 동시에 Wildcard와 같은 조건으로 사용됨. 즉 Where절의 ?craigEmail 은 email 이 어떤 조건이라도 OK 이며 해당 값들을 ?craigEmail 변수에 담으라는 것임. 이는 다시 Select 절의 ?craigEmail에서 사용됨 • 즉 해당 SPARQL은 craig subject의 모든 email 값을 추출하라는 것임. • ? 기호를 사용한 변수표시는 Object 뿐만 아니라 모든 Triple 구성요소에 사용 가능 Subject Predicate Object SPARQL 질의 @prefix ab: <http://learningsparql.com/ns/addressbook#> . ab:richard ab:homeTel "(229) 276-5135" . ab:richard ab:email "richard49@hotmail.com" . ab:cindy ab:homeTel "(245) 646-5488" . ab:cindy ab:email "cindym@gmail.com" . ab:craig ab:homeTel "(194) 966-1505" . ab:craig ab:email "craigellis@yahoo.com" . ab:craig ab:email "c.ellis@usairwaysgroup.com" . RDF 파일
  • 38. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | SPARQL의 해석 - ?변수의 활용 PREFIX ab: <http://learningsparql.com/ns/addressbook#> SELECT ?person WHERE { ?person ab:homeTel "(229) 276-5135" . } • ?기호는 Subject에도 사용가능 • Predicate homeTel 의 object 값이 (229)276-5136인 모든 Subject를 찾아 ?person 변수에 담고 Select에 표시하라 person ============== ab:richard SPARQL 질의 SPARQL 질의 결과 @prefix ab: <http://learningsparql.com/ns/addressbook#> . ab:richard ab:homeTel "(229) 276-5135" . ab:richard ab:email "richard49@hotmail.com" . ab:cindy ab:homeTel "(245) 646-5488" . ab:cindy ab:email "cindym@gmail.com" . ab:craig ab:homeTel "(194) 966-1505" . ab:craig ab:email "craigellis@yahoo.com" . ab:craig ab:email "c.ellis@usairwaysgroup.com" . RDF 파일
  • 39. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | SPARQL의 해석 - ?변수의 활용 PREFIX ab: <http://learningsparql.com/ns/addressbook#> SELECT ?propertyName ?propertyValue WHERE { ab:cindy ?propertyName ?propertyValue . } • ?변수는 두개 이상도 사용가능 함. • Subject인 cindy가 가지는 모든 Predicate (Property Name) 과 Object (Property Value) 를 각각 ?propertyName 과 ?propertyValue에 담아 Select에 표시하라 propertyName | propertyValue | ===================================== | ab:email | "cindym@gmail.com" | | ab:homeTel | "(245) 646-5488" | ------------------------------------- SPARQL 질의 SPARQL 질의 결과 @prefix ab: <http://learningsparql.com/ns/addressbook#> . ab:richard ab:homeTel "(229) 276-5135" . ab:richard ab:email "richard49@hotmail.com" . ab:cindy ab:homeTel "(245) 646-5488" . ab:cindy ab:email "cindym@gmail.com" . ab:craig ab:homeTel "(194) 966-1505" . ab:craig ab:email "craigellis@yahoo.com" . ab:craig ab:email "c.ellis@usairwaysgroup.com" . RDF 파일
  • 40. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | SPARQL의 해석 – Filter를 이용한 원하는 문자열 찾기 PREFIX ab: http://learningsparql.com/ns/addressbook# SELECT * WHERE { ?s ?p ?o . FILTER (regex(?o, "yahoo","i")) } • Filter 를 이용하여 원하는 문자열 조건을 가지는 triple 검색 • Filter 는 Regular Expression과 함께 사용하여 String 매칭 • Object가 yahoo를 가지는 모든 triple set을 Select절에 표시 | s | p | o ================================================== ================= | <http://learningsparql.com/ns/data#i8301> | ab:email | "craigellis@yahoo.com" --------------------------------------------------------------------------------- SPARQL 질의 SPARQL 질의 결과 @prefix ab: <http://learningsparql.com/ns/addressbook#> . ab:richard ab:homeTel "(229) 276-5135" . ab:richard ab:email "richard49@hotmail.com" . ab:cindy ab:homeTel "(245) 646-5488" . ab:cindy ab:email "cindym@gmail.com" . ab:craig ab:homeTel "(194) 966-1505" . ab:craig ab:email "craigellis@yahoo.com" . ab:craig ab:email "c.ellis@usairwaysgroup.com" . RDF 파일
  • 41. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF와 SPARQL 의 해석 – Optional 조건의 사용 @prefix ab: <http://learningsparql.com/ns/addressbook#> . @prefix d: <http://learningsparql.com/ns/data#> . d:i0432 ab:firstName "Richard" . d:i0432 ab:lastName "Mutt" . d:i0432 ab:homeTel "(229) 276-5135" . d:i0432 ab:email "richard49@hotmail.com" . d:i9771 ab:firstName "Cindy" . d:i9771 ab:lastName "Marshall" . d:i9771 ab:homeTel "(245) 646-5488" . d:i9771 ab:email "cindym@gmail.com" . d:i8301 ab:firstName "Craig" . d:i8301 ab:lastName "Ellis" . d:i8301 ab:email "craigellis@yahoo.com" . d:i8301 ab:email "c.ellis@usairwaysgroup.com" . RDF 파일 PREFIX ab: <http://learningsparql.com/ns/addressbook#> SELECT ?craigEmail ?homeTel WHERE { ?person ab:firstName "Craig" . ?person ab:lastName "Ellis" . ?person ab:email ?craigEmail . ?person ab:homeTel ?homeTel . } SPARQL 질의 ------------------------ | craigEmail | homeTel | ======================== 결과 없음 SPARQL 질의 결과 firstName이 Craig , lastName이 Ellis 이며 email 관계를 가지는 모든 object 값과 , homeTel 관계를 가지는 모든 object 값을 출력 Id:18301 subject는 homeTel 관계를 가지지 않음. 만일 homeTel 관계에 무방하게 값을 추출하고 싶다면 ?
  • 42. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF와 SPARQL 의 해석 – Optional 조건의 사용 @prefix ab: <http://learningsparql.com/ns/addressbook#> . @prefix d: <http://learningsparql.com/ns/data#> . d:i0432 ab:firstName "Richard" . d:i0432 ab:lastName "Mutt" . d:i0432 ab:homeTel "(229) 276-5135" . d:i0432 ab:email "richard49@hotmail.com" . d:i9771 ab:firstName "Cindy" . d:i9771 ab:lastName "Marshall" . d:i9771 ab:homeTel "(245) 646-5488" . d:i9771 ab:email "cindym@gmail.com" . d:i8301 ab:firstName "Craig" . d:i8301 ab:lastName "Ellis" . d:i8301 ab:email "craigellis@yahoo.com" . d:i8301 ab:email "c.ellis@usairwaysgroup.com" . RDF 파일 PREFIX ab: <http://learningsparql.com/ns/addressbook#> SELECT ?craigEmail ?homeTel WHERE { ?person ab:firstName "Craig" . ?person ab:lastName "Ellis" . ?person ab:email ?craigEmail . OPTIONAL { ?person ab:homeTel ?homeTel . } } SPARQL 질의 ------------------------ | craigEmail | homeTel | ======================== "craigellis@yahoo.com" "c.ellis@usairwaysgroup.com" SPARQL 질의 결과 firstName이 Craig , lastName이 Ellis 이며 email 관계를 가지는 모든 object 값과 , homeTel 관계를 가지는 모든 object 값을 출력 homeTel 관계는 optional 조건이므로 homeTel 관계가 없어도 주어진 object 값을 출력
  • 43. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | SPARQL - More • SPARQL 은 RDBMS의 SQL과 유사하게 SELECT에서 Minus, Union all , Exist, Order by , Group by , Limit( 오라클의 rownum과 유사)와 같은 구문을 제공 • SPARQL은 SELECT 문 외에 , INSERT,DELETE , UPDATE 문과 같은 DML 및 Drop,Create와 같은 DDL도 제공
  • 44. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | SPARQL을 이용하여 Public Data Source 로 질의 http://dbpedia.org/snorql/ http://dbpedia.org/snorql/ 에 접속한뒤 Text Editor에 SPARQL 쿼리를 입력하면 해당 사이트에서 제공하는 데이터를 추출 가능함
  • 45. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF와 SPARQL 의 적용 – Remote SPARQL 서비스 호출 PREFIX cat: <http://dbpedia.org/resource/Category:> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?p ?o WHERE { SERVICE <http://DBpedia.org/sparql> { SELECT ?p ?o WHERE { <http://dbpedia.org/resource/Joseph_Hocking> ?p ?o . } } } SPARQL 질의 SPARQL 질의 결과 SERVICE 키워드를 사용하여 Dbpedia.org에서 제공하는 SPARQL 서비스를 호출 Subject가 <http://dbpedia.org/resource/Joseph_Hocking> 인 모든 Predicate 와 Object를 추출 -----------------------------------------------------------------| | p | o | ==================================================| | owl:sameAs | <http://rdf.freebase.com/ns/guid.9202a8c...> | | rdfs:comment | "Joseph Hocking (November 7, | | skos:subject | cat:Cornish_writers | | skos:subject | cat:English_Methodist_clergy | | skos:subject | cat:19th-century_Methodist_clergy | | skos:subject | cat:People_from_St_Stephen-in-Brannel | | skos:subject | cat:1860_births | | skos:subject | cat:1937_deaths | | skos:subject | cat:English_novelists | | rdfs:label | "Joseph Hocking"@en | | foaf:page | <http://en.wikipedia.org/wiki/Joseph_Hocking> | ------------------------------------------------------------------
  • 46. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF와 SPARQL 의 적용 – Multi Remote SPARQL 서비스 호출 PREFIX cat: <http://dbpedia.org/resource/Category:> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX gp: <http://wifo5-04.informatik.unimannheim.de/gutendata/resource/people/> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> SELECT ?dbpProperty ?dbpValue ?gutenProperty ?gutenValue WHERE { SERVICE <http://DBpedia.org/sparql> { <http://dbpedia.org/resource/Joseph_Hocking> ?dbpProperty ?dbpValue . } SERVICE <http://wifo5-04.informatik.uni-mannheim.de/gutendata/sparql> { gp:Hocking_Joseph ?gutenProperty ?gutenValue . } } SPARQL 질의 SPARQL 질의 결과 Multi Service 키워드를 사용하여 여러 Remote SPARQL 서비스를 한번에 호출
  • 47. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Program Agenda Graph 와 Semantic Web 소개1 2 3 4 5 Oracle Confidential – Internal/Restricted/Highly Restricted 47 RDF SPARQL 소개 및 실습 Ontology – RDFS , OWL 그리고 추론(Inferencing) Oracle Semantic Technology 소개 및 실습 6 타 Semantic 솔루션 소개 – TopBraid Composer
  • 48. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | • Ontology 는 Engineering 관점으로 특정 사물/사상에 대한 개념을 명확하게 정의하기 위한 방안임 – 특정 사물/사상을 기술하기 위해 정해진 용어(Vocabulary/Term)으로 구성 – 해당 용어가 지향하는 의미를 명확하게 정의하기 위한 다양한 요소를 가짐 • Ontology는 특정 domain에 대한 formal한 specification을 기술 – 특정 Domain에 대한 공통적인 이해를 가능하게 함 – 특정 Domain에 대한 formal한 , machine이 처리 가능한 모델을 제시 Ontology in Computer Science
  • 49. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Domain 별로 상이한 용어 정의 상품 정의 보험 Domain 장기/자동차/화재등의 각 영역에서 고객에게 제공하는 보험상품을 뜻하며 약관에 명시된 계약조건에 따라 보험사에서 지급이 약속된 보상을 제공하는 것을 그 핵심으로 함. …………………………….. 보험상품은 보험사의 파산할 경우 상품에 명기된 보상내역을 지급할 수 없는 경우를 대비해야 하며…… 통신 상품은 무선 통신 상품과 유선 통신 상품, 이들을 결합한 결합 상품으로 구분한다. 무선 통신 상품의 경우 데이터와 음성 상품으로 구분하며 특정 상품에 가입할 경우 타 상품으로 가입이 불가능 한 경우가 존재 한다. ………………… 통신상품은 통신 기능 및 서비스가 결합되어 제공되며, 사용량/사용시간 등에 따라 요금이 차등부여 된다. 상품은 실물을 가지는 유형의 상품과 보험이나 통신 등의 서비스에 기반한 무형의 상품으로 분류한다. 고객은 특정 상품을 주문할 경우 반드 시 지정된 택배회사를 통해 최종 전달되어야 하며……. 통신 Domain 유통/쇼핑 Domain 각 Domain 별로 상품에 대한 정의는 서로 다르다
  • 50. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Object Oriented Model 기반 요소 Class와 Object(Instance) Inheritance ( 상속 ) - Association Encapsulation Polymorphism OOP (Object Oriented Programming ) 주요 개념 • 나는 누구의 자식인가? • 나만이 가지는 고유한 속성은 무엇인가? • 나는 타 개체를 어떻게 활용하고 어떤 관계를 맺고 있는가? 개체는 무엇으로 정의될 수 있는가? Public Class Employee extends Person { ……………….. } Person Emp = new Employee();
  • 51. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Ontology Languages • “명확한 개념 정의” 를 위해 많은 모델 정의 Language가 사용 가능 • 그 중에 UML(Unified Modeling Language)이 가장 보편적으로 사용됨 • RDF의 Ontology Language는 Object Oriented Programming에 기반한 UML로 부터 많은 영향을 받음 UML 예제 RDF Ontology Diagram 예제
  • 52. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF Ontology Language RDFS RDFS+ OWL • RDF Ontology Language 는 RDFS, RDFS+,OWL • 더욱 강력한 Ontology 기능을 보강하기 위해서 RDFS에서 OWL로 발전함 • OWL의 경우 많은 Syntax 및 특성으로 인해 그 복잡도가 매우 큼 • RDFS+ 는 RDFS 보다 기능이 보강되고 OWL의 핵심적이고 간략한 기능으로 축약된 형태(OWL의 복잡도로 인해 새롭게 탄생됨) •OWL Ver 1: OWL Full , OWL DL , OWL Lite •OWL Ver 2: OWL2 EL , OWL 2 QL, OWL 2 RL
  • 53. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF Ontology – RDFS (RDF Schema) • RDF Schema – RDF 는 named Property나 value를 사용하여 리소스들에( Triples) 대한 간단한 설명만을 제공하므로 RDF 사 용자는 RDF 를 구성하고 정의하는 용어나 개념에 대해 정의할 수 있는 방안이 별도 필요 – RDFS(RDF Schema)는 해당 리소스의 특정 클래스나 유형, Property 들에 대한 상세 기술방안을 제공 – RDBMS Table이 어떻게 구성되어 있는지 설명하는 메타 속성과 유사( 컬럼명, 데이터 Type, Comment , Constraint 등) – 무엇보다도 OOP(Object Oriented Program) 의 주요 개념과 매우 유사 – 예를 들어 exterms:Tent Class는 exterms:model, exterms:weightInKg, exterms:packedSiz 과 같은 Property로 구 성되어 있음을 표기. (Class와 Class를 구성하는 속성) – RDFS에서 사용하는 Schema vocabulary 예 : Class, Property type, subClassOf, subPropertyOf range, domain
  • 54. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDFS의 구성 요소 RDFS Class Property rdf:Class rdf:Property …….…….. rdf:subClassOf Rdf:subPropertyOf …….…….. • RDFS 는 크게 Class 와 Property 로 구성 • Class와 Property는 RDFS 구문을 정의하는 세부 요소들로 구성됨. • RDFS 역시 Subject, Predicate , Object의 Triple 요소로 구문 표현
  • 55. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDFS 구성 요소 – RDFS Class RDF Class 명 설명 rdfs:Resource The class resource, everything. rdfs:Class The class of classes. rdf:Property The class of RDF properties. rdfs:Literal The class of literal values, e.g. textual strings and integers. rdf:langString The class of language-tagged string literal values. rdf:HTML The class of HTML literal values. rdf:XMLLiteral The class of XML literal values. rdfs:Datatype The class of RDF datatypes. rdf:Statement The class of RDF statements. rdf:Bag The class of unordered containers. rdf:Seq The class of ordered containers. rdf:Alt The class of containers of alternatives. rdfs:Container The class of RDF containers. rdfs:ContainerMembershipProperty The class of container membership properties, rdf:_1, rdf:_2, ..., all of which are su b-properties of 'member'. rdf:List The class of RDF Lists.
  • 56. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDFS 구성 요소 – RDF Property RDF Property 명 설명 rdf:type The subject is an instance of a class. rdfs:subClassOf The subject is a subclass of a class. rdfs:subPropertyOf The subject is a subproperty of a property. rdfs:domain A domain of the subject property. rdfs:range A range of the subject property. rdfs:label A human-readable name for the subject. rdfs:comment A description of the subject resource. rdfs:member A member of the subject resource. rdf:first The first item in the subject RDF list. rdf:rest The rest of the subject RDF list after the first item. rdfs:seeAlso Further information about the subject resource. rdfs:isDefinedBy The definition of the subject resource. rdf:value Idiomatic property used for structured values. rdf:subject The subject of the subject RDF statement. rdf:predicate The predicate of the subject RDF statement. rdf:object The object of the subject RDF statement.
  • 57. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDFS 주요 구문 설명 - 1 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ab: <http://learningsparql.com/ns/addressbook#> . ab:Aunt rdf:type rdfs:Class . ab:creator rdf:type rdfs:Property RDF 파일 RDFS 구문 설명 rdfs:Class  주어진 Subject 가 RDFS에서 정의한 Class 타입임을 나타냄 rdfs:Property  주어진 Subject 가 RDFS에서 정의한 Property 타입임을 나타냄
  • 58. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDFS 주요 구문 설명 - 2 RDFS 구문 설명 rdfs:subClassOf  특정 클래스의 하위 클래스임을 나타냄.  :A rdfs:subClassOf :B rdfs:subPropertyOf  특정 Property의 하위 Property 임을 나타냄.  :p1 rdfs:subPropertyOf :p2  :firstAuthor rdfs:subPropertyOf :Author @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix dm: <http://learningsparql.com/ns/demo#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . dm:Person rdf:type rdfs:Class dm:Artist rdf:type rdfs:Class Dm:Artist rdfs:subClassOf dm:Person dm:composer rdfs:subPropertyOf dm:creator . dm:photographer rdfs:subPropertyOf dm:creator . dm:file02924 dm:fileName "9894397.mp3" ; dm:composer "Charles Ives" . dm:file74395 dm:fileName "884930.mp3" ; dm:photographer "Eric Satie" . Artist는 Person의 하위클래스 Composer와 photographer는 creator의 하위 속성
  • 59. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDFS 주요 구문 설명 - 3 RDFS 구문 설명 rdfs:label  리소스(subject/property/object)에 대한 명칭 (이름)을 부여하여 사용자가 보다 쉽 게 해당 리소스를 이해하게 함. rdfs:comment  리소스에 대한 상세 설명을 기술 @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . dc:creator rdf:type rdf:Property ; rdfs:comment "An entity primarily responsible for making the resource.”; rdfs:label "Creator” . RDF 파일 dc:creator는 Property 타입 dc:creator에 대한 상세 설명 dc:creator Property를 Creator로 명명
  • 60. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDFS 주요 구문 설명 - 4 RDFS 구문 설명 rdfs:domain  프로퍼티가 사용될 때 트리플의 Subject가 특정 클래스임을 나타냄 rdfs:range  프로퍼티가 사용될 때 트리플의 Object가 특정 타입임을 나타냄 @prefix ab: <http://learningsparql.com/ns/addressbook#> . ab:playsInstrument rdf:type rdf:Property . ab:playsInstrument rdfs:domain ab:Musician . ab:playsInstrument rdfs:range ab:MusicalInstrument . ab:i0432 ab:playsInstrument ab:vacuumCleaner . RDF 파일 Ab:playsInstrument 프로퍼티를 사용하는 Subject는 ab:Musician Class type임. Ab:playsInstrument 프로퍼티를 사용하는 Object는 ab:Musician ab:MusicalInstrument type임. ab:i0432 subject는 Musician Class이며 , vacuumCleaner는 MusicalInstrument 타입임.
  • 61. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 추론(Inferencing) 이란? • 사전적 의미로 추론이란 기존의 알려진 사실에 기반해 새로운 사실을 추측하거나 결정한다는 것을 뜻함 • RDF에서는 Ontology (RDFS,OWL)에 기술된 Triples 간의 관계 및 구조를 기반으로 새로운 관계 및 구조를 결정하는 것임. • 추론은 RDF Ontology가 지향하는 매우 강력한 메커니즘이며 Semantic Web을 더욱 스마트하게 구성하는 요소임
  • 62. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDFS에서의 SubClassOf의 패턴 정의 및 추론 IF ?A rdfs:subClassOf ?B AND ?x rdfs:type ?A. THEN ?x rdfs:type ?B 만일 클래스 A가 B의 하위 클래스이고 , x 라는 개체가 클래스 A 에 속한다면 x는 또한 클래스 B에도 속한다. Class A extends B {…} Class inference_test { public static void main(String args[]) { A x = new A(); if(x instanceof B) System.out.println(“inference is successful : x is also Class B"); }}
  • 63. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDFS에서의 rdfs:domain/rdfs:range 패턴 정의 및 추론 IF P rdfs:domain D. And x P y. THEN x rdf:type D. 특정 프로퍼티인 P가 D 클래스와 rdfs:domain 관계라면 특정 Subject X가 P 프로퍼티 관계일 경우 X는 D클래스 타입 @prefix ab: <http://learningsparql.com/ns/addressbook#> . ab:playsInstrument rdf:type rdf:Property . ab:playsInstrument rdfs:domain ab:Musician . ab:playsInstrument rdfs:range ab:MusicalInstrument . ab:i0432 ab:playsInstrument ab:vacuumCleaner . ab:i0432 subject는 Musician Class이며 , vacuumCleaner는 MusicalInstrument 타입임. Rdfs:domain 정의 및 추론 IF P rdfs:range R. And x P y. THEN y rdf:type R. Rdfs:range 정의 및 추론 특정 프로퍼티인 P가 R 타입과 rdfs:range 관계라면 특정 Object Y가 P 프로퍼티 관계일 경우 Y는 R 타입
  • 64. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDFS 추론의 다양한 예 :Surgeon rdfs:subClassOf :Staff :Surgeon rdfs:subClassOf :Physician :Kildare rdf:type :Surgeon RDFS 정의 외과의사(Surgeon)은 Staff(직원)의 하위 클래스이고 Surgeon은 Physician(의사)의 하위 클래스이다. Kildare는 Surgeon 클래스 타입이다. 추론 :Kildare rdf:type :Staff :Kildare rdf:type :Physician Kildare는 Staff 이자 Physician (의사) 이다 :lodgedIn rdfs:subPropertyOF :billedFor :lodgedIn rdfs:subPropertyOF :assignedTo :Marcus :lodgedIn :Room101 RDFS 정의 입원(lodgedIn)은 billedFor(비용지불)의 하위 프로퍼티이며 동시에 입원실 배정(assignedTo)의 하위 프로퍼티이다. Marcus는 Room101에 lodgedIn (입원) 추론 :Marcus :billedFor :Room101 :Marcus :assignedTo :Room101 Marcus는 Room101에 비용을 지불(billedFor) 하였고 Room101에 입원실 배정(assignedTo) 됨 1 2
  • 65. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Program Agenda Graph 와 Semantic Web 소개1 2 3 4 5 Oracle Confidential – Internal/Restricted/Highly Restricted 65 RDF SPARQL 소개 및 실습 Ontology – RDFS , OWL 그리고 추론(Inferencing) Oracle Semantic Technology 소개 및 실습 6 타 Semantic 솔루션 소개 – TopBraid Composer
  • 66. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle의 Semantic Technology
  • 67. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF 데이터 관리 시스템으로서의 Oracle DB의 강점 • RAC & Exadata scalability • Compression & partitioning • SQL*Loader direct path load • Parallel load, inference, query • High Availability • Triple-level label security • Choice of SPARQL, SQL, or Java • Native inference engine • Enterprise Manager 오라클 DB의 강력한 강점이 RDF 에 그대로 적용
  • 68. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | SPARQL 호환성을 제공하기 위한 Oracle Component
  • 69. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Jena 와 Jena Adaptor 란 ? •Jena 는 Semantic Web 과 Linked Data Application을 위한 오픈 소스 Java Framework •Jena 는 HP에서 시작하였으나 현재는 Apache 재단에서 관리하고 있음. •Jena는 RDF , SPARQL , Ontology 를 위한 Java API Spec을 정의하고 있으며 Jena Adaptor는 정의된 Spec을 Semantic Web 제품 Vendor들이 각 제품의 특성에 맞게 Java 로 구현한 것임. ( JDBC 와 JDBC Adaptor(Driver) 관계와 유사 )
  • 70. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Jena Adaptor를 사용한 Sample Code import oracle.spatial.rdf.client.jena.*; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.graph.*; import com.hp.hpl.jena.query.*; public class Test { public static void main(String[] args) throws Exception { String szJdbcURL = args[0]; String szUser = args[1]; String szPasswd = args[2]; String szModelName = args[3]; Oracle oracle = new Oracle(szJdbcURL, szUser, szPasswd); Model model = ModelOracleSem.createOracleSemModel(oracle, szModelName); model.getGraph().add(Triple.create(Node.createURI("http://example.com/John"),Node.createURI("http://example.com/fatherOf"), Node.createURI("http://example.com/Mary"))); Query query = QueryFactory.create( "select ?f ?k WHERE {?f <http://example.com/fatherOf> ?k .}"); QueryExecution qexec = QueryExecutionFactory.create(query, model); ResultSet results = qexec.execSelect(); ResultSetFormatter.out(System.out, results, query); model.close(); oracle.dispose(); } } Jena 의 SPARQL Interface 는 JDBC 를 사용하는 Java Code와 유사
  • 71. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | SPARQL을 SQL에서 사용 - SEM_MATCH • SEM_MATCH 를 사용하여 SPARQL 호출을 SQL상에서 수행 가능 • Graph data를 기존의 Relational data에서 유연하게 통합 • Oracle SQL Engine의 모든 Performance 를 가짐 - Optimizer, Compression, Indexes , Parallelism 등 SELECT n1, n2 FROM TABLE( SEM_MATCH ( 'PREFIX foaf: <http://...> SELECT ?n1 ?n2 FROM http://g1 WHERE {?p foaf:name ?n1 OPTIONAL {?p foaf:knows ?f . ?f foaf:name ?n2 } FILTER (REGEX(?n1, "^A")) } ORDER BY ?n1 ?n2', SEM_MODELS('M1'),…));
  • 72. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | SEM_MATCH Table Function 구성 SEM_MATCH ( query , models , rulebases , options ) SPARQL 쿼리 'SELECT ?a WHERE { ?a foaf:name ?b }' RDF Data가 있는 Semantic Model RDFS 및 OWL + 사용자 정의 Rule base 기타 옵션 'ALLOW_DUP=T STRICT_TERM_COMP=F'
  • 73. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle SQL Engine의 다양한 기능 결합 – 오라클 Hint 사용 예제 SELECT x, y FROM TABLE(SEM_MATCH( '{?x :grandParentOf ?y . ?x rdf:type :Male}', SEM_Models('family'), SEM_Rulebases('RDFS','family_rb'), SEM_Aliases(SEM_ALIAS('','http://www.example.org/family/')), null, null, 'HINT0={LEADING(t0 t1) USE_NL(?x ?y) GET_CANON_VALUE(?x ?y)}')); Oracle SQL Engine의 모든 Performance 를 가짐 (Optimizer, Compression, Indexes , Parallelism 등) SEM_MATCH를 통한 오라클 SQL Hint 사용 예 • HINT0 구문을 통해 기존의 Oracle SQL HINT에서 사용한 구문을 그대로 사용 가능 • Oracle Optimizer의 최적 성능 구현 가능
  • 74. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Semantic Data Types, Constructors, and Methods • 오라클 Graph 에서는 RDF 및 Ontology 데이타들은 모두 Object Type으로 저장되고 관리됨. • 오라클의 Object 타입은 객체지향의 Class 와 유사하게 속성(컬럼)과 Constructor 그리고 Method로 구성 • Semantic Data를 위해 오라클은 SDO_RDF_TRIPLE 와 SDO_RDF_TRIPLE_S Object 타입을 제공함 • SDO_RDF_TRIPLE타입은Triples 를 Display하는데 사용되며 , SDO_RDF_TRIPLE_S는 DB에 Triple을 저장하는데 사용됨. (_S 는 Storage를 뜻함)
  • 75. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Semantic Data 의 유형 및 메소드 상세 Semantic Data type 및 Method 상세 내용 SDO_RDF_TRIPLE 오브젝트 구조 SDO_RDF_TRIPLE ( subject VARCHAR2(4000), property VARCHAR2(4000), object VARCHAR2(10000)) SDO_RDF_TRIPLE_S 오브젝트 구조 SDO_RDF_TRIPLE_S ( RDF_C_ID NUMBER, -- Canonical object value ID RDF_M_ID NUMBER, -- Model (or Model-Graph) ID RDF_S_ID NUMBER, -- Subject value ID RDF_P_ID NUMBER, -- Property value ID RDF_O_ID NUMBER) -- Object value ID SDO_RDF_TRIPLE_S 의 메소드 GET_MODEL() RETURNS VARCHAR2 GET_TRIPLE() RETURNS SDO_RDF_TRIPLE GET_SUBJECT() RETURNS VARCHAR2 GET_PROPERTY() RETURNS VARCHAR2 GET_OBJECT() RETURNS CLOB SDO : Spatial Data Option
  • 76. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | SDO_RDF_TRIPLE_S 의 활용 CREATE TABLE articles_rdf_data (id NUMBER, triple SDO_RDF_TRIPLE_S); INSERT INTO articles_rdf_data VALUES (99, SDO_RDF_TRIPLE_S ('articles:<http://examples.com/ns#Graph1>', '<http://nature.example.com/Article101>', '<http://purl.org/dc/elements/1.1/creator>', ‘John Smith')); Commit; SELECT a.triple.GET_MODEL() AS model_graph, a.triple.GET_TRIPLE() AS triple FROM articles_rdf_data a WHERE a.id = 99; MODEL_GRAPH -------------------------------------------------------------------------------- TRIPLE(SUBJECT, PROPERTY, OBJECT) -------------------------------------------------------------------------------- ARTICLES:<http://examples.com/ns#Graph1> SDO_RDF_TRIPLE('<http://nature.example.com/Article101>', '<http://purl.org/dc/elements/1.1/creator>', '"John Smith"') SDO_RDF_TRIPLE_S 를 가지는 Table 생성 RDF 데이터를 SDF_RDF_TRIPLE_S Object를 이용하여 입력 SDF_RDF_TRIPLES_S 의 Method 를 통해 데이터 조회
  • 77. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF 데이터 입력을 위한 SDO_RDF_TRIPLE_S의 사용 SDO_RDF_TRIPLE_S 생성자 유형 1 SDO_RDF_TRIPLE_S 생성자 유형 2 SDO_RDF_TRIPLE_S 생성자 유형 3 SDO_RDF_TRIPLE_S ( RDF_C_ID NUMBER, -- Canonical object value ID RDF_M_ID NUMBER, -- Model (or Model-Graph) ID RDF_S_ID NUMBER, -- Subject value ID RDF_P_ID NUMBER, -- Property value ID RDF_O_ID NUMBER) -- Object value ID SDO_RDF_TRIPLE_S ( model_name VARCHAR2, -- Model name subject VARCHAR2, -- Subject property VARCHAR2, -- Property object VARCHAR2) -- Object RETURN SELF; SDO_RDF_TRIPLE_S ( model_name VARCHAR2, -- Model name subject VARCHAR2, -- Subject property VARCHAR2, -- Property object CLOB) -- Object RETURN SELF; RDF 데이터 입력 시에 사용( Object 가 VARCHAR2 임) RDF 데이터 입력 시에 사용 ( Object 가 CLOB 임) SDO_RDF_TRIPLE_S Object 타입은 다양한 유형의 생성자를 가지고 있으며 이를 이용하여 RDF 데이터를 입력함. INSERT INTO articles_rdf_data VALUES (2, SDO_RDF_TRIPLE_S ('articles','<http://nature.example.com/Article1>', '<http://purl.org/dc/elements/1.1/creator>', '"Jane Smith"')); RDF 데이터 입력을 위해 SDO_RDF_TRIPLE_S 생성자 사용
  • 78. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle에서 Semantic Data 사용을 위한 Quick Start 순번 수행 사항 상세 설명 1 Semantic Data Network 생성 •NETWORK은 DB당 1개만 가능함. 만일 기존의 NETWORK이 존재하면 추가 생성 불가. •EXECUTE SEM_APIS.CREATE_SEM_NETWORK('rdf_tblspace'); •tablespace_name을 기본적으로 네트웍이름으로 사용함. 파라미터로 입력한 테이블 스페이스가 기본적으로 네트웍이름으로 사용됨. 해당 테이블 스페이스에 모든 SEMANTIC 관련 데이터 및 모델 이 저장됨. 2 RDF 데이터 저장 테이블 생성 •SDO_RDF_TRIPLS_S Object 를 담을 테이블 생성 •해당 테이블은 SDO_RDF_TRIPLE_S Object를 컬럼으로 가짐. •CREATE TABLE articles_rdf_data (id NUMBER, triple SDO_RDF_TRIPLE_S); 3 Model 생성 •Model을 생성하여 앞에서 만들어진 Semantic data를 가지는 테이블을 모델과 연결함 •EXECUTE SEM_APIS.CREATE_SEM_MODEL(모델명, RDF테이블 명, SDO_RDF_TRIPLE_S 오브젝트 명 ) , -- EXECUTE SEM_APIS.CREATE_SEM_MODEL('articles', 'articles_rdf_data', 'triple'); 4 데이터 입력 •INSERT INTO articles_rdf_data VALUES (1, SDO_RDF_TRIPLE_S ('articles','<http://nature.example.com/Article1>', '<http://purl.org/dc/elements/1.1/title>','"All about XYZ"')); 5 필요하다면 성능 향상을 위해 Oracle DB Index 등을 생성 •CREATE INDEX articles_sub_idx ON articles_rdf_data (triple.GET_SUBJECT()); •CREATE INDEX articles_prop_idx ON articles_rdf_data (triple.GET_PROPERTY()); •CREATE INDEX articles_obj_idx ON articles_rdf_data (TO_CHAR(triple.GET_OBJECT()));
  • 79. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle Semantic Technology 를 위한 상세 구성 Sem.Network • Dictionary 와 data table 을 저장 • Models , OWL/RDFS/user-defined rule bases , rule indexes (entailments ) 등 Semantic을 위한 Oracle 의 새로운 개체가 Load 됨 SDO_RDF_TRIPLE_S RDF 데이터 저장을 위한 새로운 Object Application 테이블 Sdo_rdf_triple_s 오브젝트 타입을 컬럼으로 가지는 일반 테이블. RDF 데이터를 로딩, Access 하고 , 보조 값들을 저장하는데 사용됨 Model Model은 RDF Triple Set 인 RDF Graph를 가지며 application 테이블내의 sdo_rdf_triple_s 컬럼과 연관 시킴 Rulebase 추론(inferencing)에 사용된 rule 집합 Entailments 추론을 통해 파생된 RDF Triples를 저장
  • 80. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF Graph Use Cases • Unified content metadata for federated resources • Validate semantic and structural consistency Social Media Analysis  Analyze social relations using curated metadata - Blogs, wikis, tweets, video - Calendars, IM, voice Semantic Metadata Layer  Find related content & relations by navigating connected entities  “Reason” across entities Text Mining & Entity Analytics
  • 81. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Linked Data in Enterprise Index Content Mgmt BI Server Data Warehouse Machine Generated Data Semantic Graph model (W3C RDF Metadata Model) Transaction Systems Hadoop Appliance Subscription Services Human Sourced InformationSocial Media Event Server Data Servers Data Sources / Types Access & Presentation Layer
  • 82. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Eli Lilly and Company Oracle Spatial and Graph: RDF Graph Metadata Repository Objectives  Unified vocabulary for scientific investigation  Easier, more complete investigations Solution  Integrate patient records, chemical structures, biological sequences & pathways, images, scientific papers…  View related data as a graph  Traverse graphs to discover relationships, search for a term, or browse ontologies “[This technology…] provides improved insight into our business by bringing together related information from diverse data sources,” J. Phil Brooks Information Consultant, Eli Lilly and Company
  • 83. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Allied Nation Intelligence Service Oracle Spatial and Graph: Social Analysis Objectives  Profile suspects through telephone, email and social network communications  Produce “data products” for analysts Solution  RDF Graph modeling of the social network: people, groups and places of interest  Inferencing & graph analytics discover relationships among individuals & meaning of pseudonyms, aliases, codes, terminology  Standards-based tools: W3C RDF & SPARQL  Semantic tagging for 600 TB / 10b triples graph  Top-secret , compartmented security for data  New discovery on ~100 million triples / month  Find & label “same-as” relationships Benefits
  • 84. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Cisco WebEx Social Graph for Enterprise Collaboration Objectives  Social connectivity and collaboration through semantic enablement  Connect knowledge silos Solution  Persistent unified graph metadata model  Concepts tagged with unique meaning  Find related content & groups by navigating connected entities, recommendations  Unifies metadata model - forum, blog, wiki, etc.  Tagging media documents, pictures, blogs, etc. to user-defined and/or enterprise vocabularies.  Validates tag semantic/structural consistency Benefits
  • 85. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 주요 실습 내용 • RDF/OWL 데이터 및 Ontology를 저장,로딩,DML • RDFS , OWL 및 사용자 정의 Rule을 통해 Inference 수행 • SPARQL과 유사한 SQL 쿼리를 이용한 RDF/OWL 활용 • Ontology와 결합된 Relational 데이터에 대한 Query 사용
  • 86. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 사전 시나리요 1. Nciuser 스키마 유저를 생성 2. Nciuser 유저는 세개의 테이블을 가짐 • NCI_RDF_DATA : Triples를 저장하는 테이블 • STABLE : N-Triple 포맷의 데이터를 Bulk load를 사용하여 Triples를 로딩하는 Staging 테이블 • PATIENTS_DATA: Application에서 Patients 관련 정보를 이용하는 일반 테이블 3. 데이터는 Nci semantic 모델을 통해 nci_rdf_data 테이블로 로딩됨. 사용자는 환자를 simulation한 정보를 만든 뒤 이들 Semantic 모델과 patients 테이블에 Semantic 기능을 결합하여 활용
  • 87. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 실습을 위한 User 생성 및 관련 Object 생성 1. Graph Network을 위한 tablespace 및 Network 생성 • create tablespace …. • Create Network 2. RDF 데이터가 저장될 별도 Tablespace 및 Temporary Tablespace 생성 • Sqlplus “/as sysdba” • rdf_users tablespace 생성 Note: 아래 명령어에서, <user_name> 과 <SID> 를 사용자 작업 환경 및 ORACLE_HOME에 따라 변경 create tablespace rdf_users datafile 'c:app<user_name>oradata<SID>rdf_users01.dbf' size 128M reuse autoextend on next 64M maxsize unlimitedsegment space management auto; • rdf_temp tablespace 생성 Note: 아래 명령어에서, <user_name> 과 <SID> 를 사용자 작업 환경 및 ORACLE_HOME에 따라 변경 create temporary tablespace rdf_temp tempfile 'c:app<user_name>oradata<SID>rdf_temp01.dbf' size 128M reuse autoextend on next 32M maxsize unlimited;
  • 88. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 실습을 위한 User 생성 및 관련 Object 생성 3. 실습을 위한 User를 별도 생성하고 Tablespace 및 Temporary Tablespace 할당 데이터가 저장될 별도 Tablespace 및 Temporary Tablespace 생성 • Create the nciuser and grant the required privileges to the user by entering the following commands on the SQL*Plus prompt: • create user nciuser identified by nciuser default tablespace rdf_users temporary tablespace rdf_temp; • grant create session, resource to nciuser; 4. RDF Triple을 저장할 모델 테이블을 생성하고 Semantic 모델을 생성함. • sqlplus nciuser/nciuser username/password. • create table nci_rdf_data (id number, triple sdo_rdf_triple_s); • execute sem_apis.create_sem_model('nci', 'nci_rdf_data', 'triple');
  • 89. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Text로 된 RDF Data를 Oracle RDF Model Data로 Loading 1. Staging 테이블을 생성하고 SQL Loader를 사용하여 데이타를 로딩함. • nciuser로 접속하여 staging 테이블 생성 create table stable ( RDF$STC_sub varchar2(4000) not null, RDF$STC_pred varchar2(4000) not null, RDF$STC_obj varchar2(4000) not null, RDF$STC_sub_ext varchar2(64), RDF$STC_pred_ext varchar2(64), RDF$STC_obj_ext varchar2(64), RDF$STC_canon_ext varchar2(64) ); 2. mdsys 유저에게 nci_rdf_data 테이블에 대한 insert Privilege Grant하고 mdsys 유저에게 stable 테이블에 대한 select,update privilege Grant 함. • grant insert on nci_rdf_data to mdsys; • grant SELECT, UPDATE(RDF$STC_sub_ext,RDF$STC_pred_ext,RDF$STC_obj_ext,RDF$STC_canon_ext) on stable to MDSYS;
  • 90. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Text로 된 RDF Data를 Oracle RDF Model Data로 Loading 3. 실습데이타와 load 명령어가 수록된 nci_z.zip 테이블을 풀고 , nci_z_nt.file을 staging 테이블로 로딩함. Note: nci_z.zip file 은 here. 디렉토리에서 Download • 아래 sqlldr 명령에 맞춰서 사용자 환경에 맞는 ORACLE_HOME 설정 디렉토리로 bulkload.ctl 컨트롤 파일이 제대로 있는지 확인. • 만일 없으면 sample download 필요 sqlldr userid=nciuser/nciuser control=%ORACLE_HOME%mddemonetworkrdf_demosbulkload.ctl data=nci_z.nt direct=true skip=0 load=1000000 discardmax=0 bad=d0.bad discard=d0.rej log=d0.log errors=100000000 • 로딩에 시간이 걸릴 수 있으며 , 완료시 아래와 같은 메시지를 가짐. Load completed - logical record count 464841. 4. Staging 테이블에 있는 데이타를 Model 로 로딩함. • sem_apis패키지의 bulk_load_from_staging_table 프로시저를 사용 exec sem_apis.bulk_load_from_staging_table('<model_name>', '<owner of the staging table>', '<staging table name>'); exec sem_apis.bulk_load_from_staging_table('nci','nciuser','stable'); 5. 추론 적용을 위한 Rule index 를 생성 execute sem_apis.create_entailment('nci_idx',sem_models('nci'), sem_rulebases('owlprime'),0, null);
  • 91. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Patients_data 테이블에 로딩 1. PATIENTS_DATA 테이블에 100,000 rows를 입력하는 Procedure를 수행 • 해당 procedure는 mdsys 유저상에서 수행함. build_patients 프로시저를 수행하기 전에 mdsys 로 로그인함. (password는 mdsys로 가정) connect mdsys/mdsys set serveroutput on 2. build_patients.zpi 파일에서 build_patients.sql 을 추출하여 수행함. ( build_patients.zip 파일을 여기에 위치) • 해당 스크립트는 build_patients 프로시저를 먼저 생성함. 스크립트를 로컬 컴퓨터에 저장하고 SQL Prompt상에서 아래와 같이 데이터 입력 @c:<path where you saved the script>build_patients.sql; 3. 만일 procedure가 compile 오류가 발생하였으면 show errors 명령어로 error 내용을 확인. 문제가 없을 경우 build_patients 프로시저에 public으로 execute 권한 Grant. grant execute on build_patients to public;
  • 92. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Patients_data 테이블에 로딩 4. nciuser 로 connect 한 뒤 build_patients 프로시저를 수행함. connect nciuser/nciuser; exec mdsys.build_patients(100000, 1, 'patients_data'); 5. 데이타가 patients_data 테이블에 로딩되었는지 확인. select count(*) from patients_data;
  • 93. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Semantic Indexes 생성 1. SEM_RELATED Operator를 사용하기 위해 MDSYS.SEM_INDEXTYPE 타입의 semantic index 를 해당 ontology 대상 컬럼에 생성해야함. • nciuser 로 connect 하여 patients_data 테이블에 index를 생성 create index nciIndex on patients_data(diagnosis) indextype is mdsys.sem_indextype parameters ('ONTOLOGY_MODEL(NCI), RULEBASE(owlprime)'); 2. 통계 정보 수집 수행. • execute dbms_stats.gather_index_stats('nciuser','nciIndex');
  • 94. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Semantic Model에 질의 1. Relational 테이블의 컬럼과 ontology 용어간의 semantic relation에 기반하여 Ontology성 Query를 relational 테이블에 수행 가능. 이를 위해 Semantic Operator 사용 • SEM_RELATED semantic operator는 semantic 관계에 기반한 row들을 추출함. • SEM_DISTANCE semantic operator는 semantic 관계도의 거리값을 반환함. • nciuser/nciuser 로 connect하여 아래 SQL을 수행함. SEM_MATCH 함수는 Class type인 모든 Subject를 반환함. select s from table(sem_match ('(?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class>)', sem_models('nci'), null,null, null)); 2. 아래 sql은 Finger_Fracture를 subject로 가지는 모든 Triples를 반환함. select p, o from table(sem_match ( '(<http://www.mindswap.org/2003/nciOncology.owl#Finger_Fracture> ?p ?o )', sem_models('nci'), null, null, null)); 3. 아래 sql은 Finger_Fracture의 subClass인 Object를 모두 추출함. 이 때 owlprime rulebase를 이용하여 추론 수행. select o from table(sem_match ( ' (<http://www.mindswap.org/2003/nciOncology.owl#Finger_Fracture> <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?o)', sem_models('nci'), sem_rulebases('owlprime'), null, null));
  • 95. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Semantic Model에 질의 4. 아래 sql은 SEM_DISTANCE 와 SEM_RELATED 를 사용하여Relational 테이블( PATIENTS_DATA)를 NCI RDF Model과 결합 분석함. PATIENTS_DATA 테이블의 DIAGNOSIS 컬럼을 나타내기 위해 'diagnosis' 변수를 사용하며 Upper_Extremity_Fracture의 Sub Class 인 dianosis를 추출한 뒤 , 관계도 거리에 따라 정렬함 select diagnosis, SEM_DISTANCE(123) from patients_data where sem_related (diagnosis, '<http://www.w3.org/2000/01/rdf-schema#subClassOf>', '<http://www.mindswap.org/2003/nciOncology.owl#Upper_Extremity_Fracture>', sem_models('nci'), sem_rulebases('owlprime'), 123 ) = 1 ORDER BY SEM_DISTANCE(123) asc; 5. 이전 SELECT 문에서는 PATIENTS_DATA의 조건을 만족하는 모든 diagnosis 를 반환하였으며 , 중복을 제거하기 위해서 distinct를 추가하면 됨. select distinct diagnosis, SEM_DISTANCE(123) from patients_data where sem_related(diagnosis, '<http://www.w3.org/2000/01/rdf- schema#subClassOf>', '<http://www.mindswap.org/2003/nciOncology.owl#Upper_Extremity_Fracture>', sem_models('nci'), sem_rulebases('owlprime'), 123) = 1 ORDER BY SEM_DISTANCE(123) asc; 6. 아래 sql은 Connective_Tissue_Disorder 의 subclass인 diagnosis를 가진 patients를 모든 반환함. select distinct diagnosis, SEM_DISTANCE(123) from patients_data where sem_related(diagnosis, '<http://www.w3.org/2000/01/rdf- schema#subClassOf>', '<http://www.mindswap.org/2003/nciOncology.owl#Connective_Tissue_Disorder>', sem_models('nci'), sem_rulebases('owlprime'), 123) = 1 ORDER BY SEM_DISTANCE(123) asc;
  • 96. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Program Agenda Graph 와 Semantic Web 소개1 2 3 4 5 Oracle Confidential – Internal/Restricted/Highly Restricted 96 RDF SPARQL 소개 및 실습 Ontology – RDFS , OWL 그리고 추론(Inferencing) Oracle Semantic Technology 소개 및 실습 6 타 Semantic 솔루션 소개 – TopBraid Composer
  • 97. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | TopBraid 화면 개요 Navigator : 프로젝트 및 모델을 관리. Classes: 프로젝트 내 모델을 클릭할 시 RDFS나 OWL에 기재된 Classes를 Tree 구조 형식으로 표시. 모델/Class/Instance 등을 선택할 시 상세한 정보를 표시하는 창 Class Diagram /RDF Graph 등도 볼수 있음. 인스턴스 및 Property, 그리고 SPARQL을 수행 및 결과를 볼수 있음
  • 98. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Class 화면에서 상/하위 클래스 관계 표시 표시는 하위 클래스가 존재함을 나타냄 Accommodation 클래스를 클릭하면 하위 클래스가 나타남
  • 99. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 선택된 항목에 대한 상세정보 표시 Form/Brower/Diagram/Graph 형태로 데이터를 표출할 수 있도록 Tab 선택 가능 Classes 창에서 특정 Class를 선택할 경우 Ontology로 기술된 Class에 대한 상세 정보를 나타냄 Class에 대한 comment 자식 클래스들 동급 클래스들 배타 관계 클래스들
  • 100. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Ontology상의 Class 관계도를 Diagram을 통해 표시 Diagram을 선택할 시 해당 클래스의 상하위 클래스 및 타 클래스와의 관계도가 그려짐
  • 101. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Http형태의 namespace를 Prefix로 단축 • 메뉴 Resource에서 Assign Prefix and Namespace 선택 • Http형태의 namespace를 Prefix로 단축함 • 아래와 같이 class diagram에서 Prefix가 p1으로 대체됨
  • 102. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Graph 형태로 데이터를 표현 • Graph를 선택 시 RDF 형태의 Graph로 표시됨
  • 103. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 특정 Class의 Instance 정보를 표시 • Instances 탭을 클릭하면 선택된 Class에 해당하는 instance들을 표시
  • 104. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | RDF, Ontology를 위한 다양한 요소를 표시 • Window 메뉴 -> Show View 를 선택하여 여러 다양한 RDF, Ontology 요소들을 나타낼 수 있음.
  • 105. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 모든 RDF Triple 값들을 표현 • Window 메뉴 -> Show View -> Triples 를 선택하며 모든 RDF 의 Triples 요소 값들을 표시
  • 106. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | SPARQL 을 통한 쿼리 질의 및 결과 출력 • 쿼리 작성 후 Execute 버튼을 클릭하여 SPARQL 질의 결과 출력 • SPARQL 탭을 선택하면 Query Editor에서 쿼리 작성
  • 107. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle DB에 저장된 RDF Data Access 방법 - 1 File > new > Project 에서 신규 프로젝트 선택
  • 108. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle DB에 저장된 RDF Data Access 방법 - 2 General 폴더를 Click하면 Project 폴더가 나옴. Project 폴더를 더블 클릭함.
  • 109. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle DB에 저장된 RDF Data Access 방법 - 3 Project name에 tutorial_articles 라고 입력하고 Next 버튼 클릭
  • 110. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle DB에 저장된 RDF Data Access 방법 - 4 아무것도 선택하지 않고 Finish button 클릭
  • 111. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle DB에 저장된 RDF Data Access 방법 - 5 신규 생성된 tutorial_articles 프로젝트를 확인
  • 112. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle DB에 저장된 RDF Data Access 방법 - 6 tutorial_articles Project에서 오른쪽 버튼 클릭한 뒤 ‘New’ 메뉴 -> RDF/OWL Oracle Database Connection 클릭
  • 113. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle DB에 저장된 RDF Data Access 방법 - 7 • Connection을 구분하기 위한 file name 및 Base URI를 임의 입력 • Oracle DB에 만들어진 RDF Model 명을 기재 • Oracle DB접속하기 위한 jdbc 정보 입력
  • 114. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle In-Database Analytics Platform Relational OLAP Spatial Data Layer RDF Media Parallel Processing Engine R Enterprise Data Mining Graph Analytics Spatial Analytics Temporal Analytics Text Analytics XML
  • 115. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Tools: Statistical Graph Analytics Oracle R Enterprise • Open source language • Statistical computing and chart for graph data • Produces publication quality plots • Highly extensible with open source R packages
  • 116. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Tools: Discovery & Predictive Analysis Oracle Data Mining Problem Classification Sample Problem Anomaly Detection Given demographic data about a set of customers, identify custom er purchasing behavior that is significantly different from the nor m Association Rules Find the items that tend to be purchased together and specify thei r relationship – market basket analysis Clustering Segment demographic data into clusters and rank the probability t hat an individual will belong to a given cluster Feature Extraction Given demographic data about a set of customers, group the attri butes into general characteristics of the customers F1 F2 F3 F4
  • 117. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Finance Data: Visualizing RDF in OBIEE