SlideShare a Scribd company logo
Web 3.0
                                                      SPARQL / XML Query

Presenter Um Dae jin (mrumx@naver.com)
Internet Technology
Graduate school of information & Telecommunications in KONKUK University
Agenda

Introduction
RDF & SPARQL
SPAR Query Language
Get the Knowledge
  Term | Syntax | Pattern | Constraint
Simple protocol
SPARQL 1.1
Introduction
RDF, SPARQL
RDF(Resource Description Framework)



    Resource Description Framework
  어떤것을 기술하기 위한 구조(틀)일 뿐!!!

 Resource : URI를 갖는 모든것(웹페이지,이미지,동영상 등)

 Description : Resource들의 속성, 특성, 관계 기술

 Framework : 위의 것들을 기술하기 위한 모델, 언어, 문법
RDF(Resource Description Framework)

     Subject     Predicate       Object



    주어               술어             목적어
(Resource) (Property, Relation) (Resource, Literal)

URI                   URI              URI
Blank Node                             Literal

       This is the Framework!!!
RDF(Resource Description Framework)

 우리는 그 틀에 맞취 어떤것들을 기술만 할뿐~!!!



          웹상에서 표현될 수 있는 개념들

블로그(Blog), 온라인 매체(RSS), 사람, 친구(FOAF) …etc ~!!!
PingtheSemanticWeb.com is a repository for RDF documents.                      http://pingthesemanticweb.com/




            RDF(Resource Description Framework)
                   These namespaces are used to describe entities in X number of documents




                                                  2009.11.23




           2008.7.16                              2008.11.04                         2009.1.8
Picture
           Music
                                                  Person

                                                        Dictionary
        Region

                                               SPARQL
GRDDL(Gleaning Resource Descriptions from Dialects of Languages)
SPARQL
Simple Protocol And
          RDF Query Language
Simple Protocol
http://semantic.lab.konkuk.ac.kr/rdf/endpoint/sparql?select …
                                                   RDF
                                                   <sparql …>
SELECT ?email                                       <head>
                                                     <variable name=“x”/>
WHERE {                                              <variable name=“mbox”/>
                                                    </head>
  ?user :email ?email.
  ?user :name “umdaejin”;                          <results>
                                                    <result>
}                                                    <binding name=“x”>
                                                       <bnode> r2</bnode>
                                                     </binding>
                                                     <binding name=“mbox”>
                                                       <uri>mailto:bob@work.example.com</uri>
                                                      </binding>
                                                     </result>
&                                                   <results>
                                                   </sparql>




RDF Query Language
RDF Query language is the pattern matched SPO(Subject, Predicate, Object) in Graph
SPARQL is
    Query Language and
a protocol for accessing RDF
SPA RDF Query Language
Query Language
SQL vs. SPARQL
SELECT name
FROM users
WHERE contact=„010-3333-7777‟;

SELECT ?name            Return Variables
WHERE {
?user rdf:type :User.
?user :name ?name.                       SPO Pattern
?user :contact “010-3333-7777”.
}
FROM <http://semantic/users.rdf>            Graph Source
Graph > Query Language > Binding > Protocol

               rdf:type                     SELECT ?name
_person                       foaf:Person
                                            WHERE {
                                            ?user rdf:type :foaf:Person.
                 :contact
                                            ?user :contact “010-3333-7777”.
      :name            “010-3333-7777”
                                            ?user :name ?name.
                                            }
                                            FROM <http://semantic/users.rdf>
          “umdaejin”                        RDF
                                            <sparql xmlns=“http://www.w3.org…”>
                                             <head>
                                              <variable name=“name”/>
                                            </head>

                                            <results>
    ?name = “umdaejin”                       <result>
                                              <binding name=“name”>
                                               <literal> umdaejin</literal>
                                              </binding>
                                            </result>
                                             <results>
                                            </sparql>
SPARQL
BASE <http://example.org/>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf:<http://xmlns.com/foaf/0.1/>
PREFIX ex:<properties/1.0#>
SELECT DISTINCT $person ?name $age
FROM <http://rdf.example.org/personA.rdf>
FROM <http://rdf.example.org/personB.rdf>
WHERE
{
   $person a foaf:Person;
                foaf:name ?name.
   OPTIONAL {$person ex:age $age }.
   FILTER (!REGEX(?name, “Bob”))
}
ORDER BY ASC(?name) LIMIT 10 OFFSET 20

                                 * SPARQL RDF Query Language Reference V1.8 by Dave Beckett.
Get the Knowledge




TERMS         Syntax        Pattern
Terms
IRI : URI reference within an RDF graph
    <http://www.w3.org>
    <http://semantic.konkuk.ac.kr/#Movie>
    <abc.rdf> //base URI에 의졲
    foaf:name //prefix이용해 URI표현, PREFIX 정의
    #x00 (X) //UNICODE문자 내에 허용

Datatype IRI : datatype URI
    <http://www.w3.org/2001/XMLSchema#string>
    <http://www.w3.org/2001/XMLSchema#integer>

Plain Literal : lexical form, optionally language tag, @ko
    “Semantic web” , “엄대진”@ko

Typed Literal : lexical form, datatype URI
    “30”^^xsd:integer
    “daejin”^^http://www.w3.org/2001/XMLSchema#string

Blank node : dummy node, node들간의 연결표현용, 무작위생성
    _:a, _n06968595988
Terms
NameSpace : Vocabulary가 있는 URI
    http://www.w3.org/1999/02/22-rdf-syntax-ns#
    http://purl.org/dc/elements/1.1/
    http://xmlns.com/foaf/0.1/


Prefix : URI의 경로를 대표하는 접두어
    rdf, dc, foaf


RDF Graph : A Set of RDF Triples

RDF Triple : S-P-O
    Subject : URI, Qname, Blank Node, Literal, Variable
    Predicate : URI, Qname, Blank node, Variable
    Object : URI, Qname, Blank node, Literal, Variable
Terms
Match
  : Graph내 SPO가 Query Pattern에 Match되는 상황

Solutions : Match되어 반환된 결과들
   ?x = “엄대진”

Query Variable : Solutions을 바인딩하기 위한 변수
  ?x or $name
Play#
          “umdaejin”이란 사람의 “email”은?



               :email
_person                 mrumx@naver.com




      :name
                                      SELECT ?email
                                      WHERE {
                                      ?person :email ?email.
          “umdaejin”
                                      ?person :name “umdaejin”;
                                      }
Syntax - RDF Term Syntax
Literals

“Hi Korea”   //”Hi Korea”


“Hi Korea”@en //영어임을 명시

“Hi Korea”^^xsd:string //문자열임을 명시 etc. integer, boolean



1 == “1”^^xsd:integer

true == “true”^^xsd:boolean

1.3 == “1.3”^^xsd:decimal
Play #
 umdaejin의 영문이름을 가진 사람의 email은?




               :email
_person                 mrumx@naver.com




      :name


                              SELECT ?email
          umdaejin@en
                              WHERE {
                              ?person :name “umdaejin”@en.
                              ?person :email ?email.
                              }
Syntax - RDF Term Syntax
IRI

<http://example.org/book/book1>

BASE <http://example.org/book/>
<book1>

PREFIX book: <http://example.org/book/>
book:book1
Syntax -Triple Pattern Syntax
PREFIX, BASE
PREFIX dc: <http://purl.org/dc/elements/purl.org/>
SELECT ?title
WHERE { <http://example.org/book/book> dc:title ?title }

PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX : <http://example.org/book/>
SELECT $title
WHERE { :book1 dc:title $title }

BASE <http://example.org/book/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT $title
WHERE { <book1> dc:title $title }
Play #
daejin의 영문이름을 가진 사람의 책제목은?
                  :like
    _person                  Book:book_3



                  :name                    book:name


              “daejin@en”                    “ANT”




        BASE <http://RDFTutorial.net/2009/>
        PREFIX book:http://example.org/book/>
        SELECT ?book_name
        WHERE {
            ?person :like book:book_3.
            book:book_3 book:name ?book_name.
        }
Syntax - RDF Term Syntax
Query Var
?var or $var

Blank
[ :p “v”]. == [] :p “v”.

Unique Blank - 다른 IRI과 연결용
_b57 :p “v”. //기본 예

[ foaf:name ?name ;
foaf:mbox <mailto:ss@c.com>] / / 확장 예

_b11 foaf:name ?name               ;은 S에 PO를 연속해서 붙일 수 있다.
_b11 foaf:mbox <mailto:ss@c.com>
Play #
foaf:name이 umdaejin사람이 사랑하는 사람 name?

                     :love
        _a                      _b



foaf:name                                name


        “umdaejin”                       “sunyoung”




    PREFIX foaf: <http://xmlns.com/foaf/0.1/>.
    PREFIX : <http://RDFTutorial.net/2009/>.
    SELECT $name
    WHERE {
        ?_a foaf:name “umdaejin”.
        ?_a :love $_b.
        $_b <http://RDFTutorial.net/2009/name> $name.
    }
Syntax ; ,
?people foaf:name ?name ;
        foaf:mbox ?mbox .
우린 같아요~
?people foaf:name ?name .
?people foaf:mbox ?mbox .




?people foaf:nick "Alice" , "Alice_" .
우린 같아요~
?people foaf:nick "Alice" .
?people foaf:nick "Alice_" .
Play #
이름이 umdaejin이고 별명이 “무름스”인 사람이 아는 사람의 이름?


                            foaf:knows
                _a                            _b


foaf:nickname        foaf:name                        foaf:name


“무름스”                    “umdaejin”                “SangWon”




         PREFIX foaf: <http://xmlns.com/foaf/0.1/>.
         SELECT ?name
         WHERE {
             ?_a foaf:nickname “무름스”;
                  foaf:name “umdaejin”.
             ?_a foaf:knows ?_b.
             ?_b foaf:name ?name.
         }
Pattern
Basic Graph Pattern
{?people foaf:name “umdaejin".}

Group Graph Pattern
{
    {?people foaf:name “umdaejin".}
    {?people foaf:email “umdaejin@gmail.com".}
} //두 패턴이 모두 만족해야

Filter
{
    ?people foaf:name ?name.
    FILTER regex (?name, “um”)
}
Pattern

Optional Graph Pattern
    _:a rdf:type foaf:Person .
    _:a foaf:name "Alice" .
    _:a foaf:mbox <mailto:alice@example.com> .
    _:a foaf:mbox <mailto:alice@work.example> .
    _:b rdf:type foaf:Person .
    _:b foaf:name "Bob" .


SELECT ?name ?mbox
WHERE {
    ?people foaf:name ?name .
    OPTIONAL { ?people foaf:mbox ?mbox }
}
Pattern
Optional Graph Pattern + FILTER
   SELECT ?people ?mbox
   WHERE {
       ?people foaf:name ?name .
       OPTIONAL { ?people foaf:mbox ?mbox .
       FILTER regex(?mbox, “@gmail”)}
   } //OPTIONAL을 여러개 추가 가능


Alternative Graph Pattern
   SELECT ?people ?mbox
                                       {?people foaf:name ?name . ?people foaf:knows ?name}
   WHERE {                             UNION
       {?people foaf:name ?name .}     {? people naver:name ?name. ?people naver:knows ?name}
       UNION
       {?people naver:name ?name .}
   }//UNON대상 여러가 추가 가능
Constraint
String Value Constraint
    SELECT ?people, ?name
    WHERE {
        ?people :name ?name
        FILTER regex(?name, “^um”, “i”)
    } //이름이 um으로 시작하는 사람


Numeric Value Constraint
    SELECT ?people, ?age
    WHERE {
        ?people :age ?age.
        FILTER (?age > 30)
    } //나이가 30 이상인 사람
Play #
나이 35세 이상인 사람이 아는 35세 이하의 사람?
                          foaf:knows
             _a                                   _b


 :age             foaf:name                :age        foaf:name


36                Dongbum                 35             “SangWon”

     PREFIX foaf: <http://xmlns.com/foaf/0.1/>.
     PREFIX : <http://RDFTutorial.net/2009/>.
     SELECT ?name
     WHERE {
         ?_a :age ?age.                ?_a :age ?age.
         FILTER ( ?age >= 35 )         ?_a foaf:knows ?_b.
         ?_a foaf:knows ?_b.           ?_b :age ?b_age;
         ?_b :age ?b_age;                  foaf:name ?name.
              foaf:name ?name.         FILTER ( ?age >= 35 )
         FILTER ( ?b_age <= 35)        FILTER ( ?b_age <= 35)
     }
Solution Sequences and Modifiers
Order
SELECT ?people, ?name
WHERE {
   ?people :name ?name
}
ORDER BY ?name //기본 오름차순 A-Z, DESC(?name)



SELECT ?s ?p ?o
WHERE {
   ?s ?p ?o
} //모든 SPO반환
ORDER BY ?o
Play #
                       나이순으로 정렬?

_a              _b                _c               _d


     :age            :age              :age             :age


        21              33                26               45




             PREFIX : <http://RDFTutorial.net/2009/>.
             SELECT ?user
             WHERE {
             ?user :age ?age.
             }
             ORDER BY ?age.
Solution Sequences and Modifiers
Offset
   SELECT ?s ?p ?o
   WHERE {
     ?s ?p ?o.
   }
   OFFSET 10 //11번째 부터 solutions 반환


LIMIT
   SELECT ?s ?p ?o                    SELECT ?s ?p ?o
   WHERE {                            WHERE {
                                      ?s ?p ?o.
   ?s ?p ?o.
                                      }
   }                                  LIMIT 5
   LIMIT 10 //10개 solutions 반환        OFFSET 10 //함께 사용 가능
Play #
             나이순으로 정렬후, 결과 2개?
_a              _b               _c                _d


     :age            :age             :age              :age


        21              33               26                45




             PREFIX : <http://RDFTutorial.net/2009/>.
             SELECT ?user
             WHERE {
             ?user :age ?age.
             }
             ORDER BY ?age.
             LIMIT 2 .
Query Form
ASK
      PREFIX foaf: <http://xmlns.com/foaf/0.1/>
      ASK {
         ?x foaf:name "Alice";
            :age ?age.
      FILTER ( ?age > 20)
      }


DESCRIBE
      PREFIX ent: <http://org.example.com/employees#>
      DESCRIBE ?x
      WHERE { ?x ent:employeeId "1234" }
Simple Protocol ARQL
Simple Protocol & RDF Endpoint

                                   사람들
                            HTTP
                            SOAP
                            ...



                 Endpoint




                                   우리팀
                                   너네팀
                                   옆팀
Simple Protocol
Request
GET /sparql/?query=EncodedQuery HTTP/1.1                                          * HTTP Binding
Host: www.example                                                                 * SOAP Binding
User-agent: my-sparql-client/0.1

Response
<sparql ...>
    <head>
          <variable name="x"/>
          <variable name="mbox"/>
    </head>

<results>
    <result>
            <binding name="x">
                       <bnode>r2</bnode>
            </binding>
            <binding name="mbox">
                       <uri>mailto:bob@work.example.org</uri>
            </binding>
    </result>
</results>
</sparql>

                                                        * http://www.w3.org/TR/rdf-sparql-protocol/
Simple Protocol
Request
<?xml version="1.0" encoding="UTF-8"?>
     <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope/"                  * HTTP Binding
     xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/
     XMLSchema-instance">                                                                        * SOAP Binding
      <soapenv:Body>
          <query-request xmlns="http://www.w3.org/2005/09/sparql-protocol-types/#">
             <query>SELECT ?z {?x ?y ?z . FILTER regex(?z, 'Harry')}</query>
          </query-request>
      </soapenv:Body>
</soapenv:Envelope>

Response
<sparql ...>
 <head>
  <variable name="x"/>
  <variable name="mbox"/>
</head>

<results>
 <result>
  <binding name="x">
   <bnode>r2</bnode>
  </binding>
  <binding name="mbox">
    <uri>mailto:bob@work.example.org</uri>
  </binding>
 </result>
</results>
</sparql>



                                                                                      * http://www.w3.org/TR/rdf-sparql-protocol/
Semantic Web(Web 3.0) SPARQL
SPARQL 1.1
SPARQL 1.1
         Aggregate Functions
              Subqueries
               Negation
        Projection Expressions
       Query Language Syntax
            Property paths
    Commonly used SPARQL functions
        Basic federated query



* WG에서 스팩 조정중이며, 변경될 수 있습니다.
Aggregate functions
Ex. COUNT, MAX, MIN, SUM, AVG

SELECT COUNT(?person) AS ?alices
WHERE {
   ?person :name “Alice” .
}


Existing implementation.
Garlik‟s JXT, Dave Beckett‟s Redland, ARQ, Open Anzo‟s Glitter, Virtuoso, ARC




Status. Required
Subqueries
Ex.
SELECT ?person ?name WHERE {
     :Alice foaf:name ?person .
     {
         SELECT ?name WHERE {
            ?person foaf:name ?name .
         } LIMIT 1
     }
}


Existing implementation.
    ARQ, Virtuoso


Status. Required
Negation (1/2)
Ex.
ex) Identify the name of people who do not know anyone.
SELECT ?name
WHERE {
    ?x foaf:givenName ?name .
    OPTION { ?x foaf:knows ?who } .
    FILTER (!BOUND(?who))
}


Existing implementation.
RDF::QUERY (unsaid keyword), SeRQL (MINUS keyword), ARQ (NOT EXIST keyword), SQL


Status. Required
Negation (2/2)
SeRQL (MINUS)
SELECT x
   FROM {x} foaf:givenName {name}
MINUS
SELECT x
   FROM {x} foaf:givenName {name} ;
         foaf:knows {who}
USING NAMESPACE foaf = <http://xmlns.com/foaf/0.1/>


UNSAID
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?x
WHERE {
    ?x foaf:givenName ?name
    UNSAID { ?x foaf:knows ?who }
}
Project Expressions
Ex.
SELECT ?name (?age > 18) AS over 18
WHERE {
   ?person :name ?name ;
        :age ?age .
}


Existing implementation.
Garlik‟s JXT, Dave Beckett‟s Redland, ARQ, Virtuoso, Open Anzo‟s Glitter SPARQL
Engine, XSPARQL


Status. Required
Update
Ex.
INSERT DATA
{
    :book1 dc:title “new book”;
          dc:creator “someone”.
}

DELETE { ?book ?p ?v }
WHERE
{ ?book dc:date ?date .
    FILTER ( ?date < “2001-01-01T00:00:00^^xsd:dateTime )
    ?book ?p ?v.
}

Existing implementation.
ARQ, Virtuoso
Status.    Required
                                Update with HTTP PUT, DELETE
Existing implementation.
Garlik‟s JXT, IBM‟s Jazz Foundation
Aggregate Functions           Garlik‟s JXT
      Subqueries         Dave Beckett‟s Redland
       Negation                    ARQ
Projection Expressions     Open Anzo‟s Glitter
  Service description            Virtuoso
    Update (REST)                  ARC
                                  SeRQL
                               RDF::Query
                                   SQL
                                 XSPARQL
                          IBM‟s Jazz Foundation




                              * WG에서 스팩 조정중이며, 변경될 수 있습니다.
Links
http://groups.google.com/group/semanticwebstudy?hl=ko

http://delicious.com/kwangsub.kim/bundle:RDFTutorial2009

SPARQL 이해(IBM DevWorks) :
http://www.ibm.com/developerworks/kr/library/tutorial/x-sparql/

SPARQL Working Group :
http://www.w3.org/2009/sparql/wiki/Main_Page
Thanks

More Related Content

What's hot (20)

PPTX
"RDFa - what, why and how?" by Mike Hewett and Shamod Lacoul
Shamod Lacoul
 
PPT
Rdf
Imran Babar
 
PPT
Introduction To RDF and RDFS
Nilesh Wagmare
 
PDF
Linked (Open) Data
Bernhard Haslhofer
 
PDF
RDFa: introduction, comparison with microdata and microformats and how to use it
Jose Luis Lopez Pino
 
PPT
Data in RDF
Emanuele Della Valle
 
PDF
Two graph data models : RDF and Property Graphs
andyseaborne
 
PPTX
RDF Data Model
Jose Emilio Labra Gayo
 
PPTX
RDFa Tutorial
Ivan Herman
 
PPTX
Hacia la Internet del Futuro: Web Semántica y Open Linked Data, Parte 2
Diego López-de-Ipiña González-de-Artaza
 
PDF
An introduction to Semantic Web and Linked Data
Fabien Gandon
 
PPTX
SWT Lecture Session 2 - RDF
Mariano Rodriguez-Muro
 
PPT
Ontologies in RDF-S/OWL
Emanuele Della Valle
 
PPT
Ist16-04 An introduction to RDF
Emanuele Della Valle
 
PPTX
Saveface - Save your Facebook content as RDF data
Fuming Shih
 
PPT
SemanticWeb Nuts 'n Bolts
Rinke Hoekstra
 
PPTX
Name That Graph !
Fabien Gandon
 
PPT
Introduction to RDF
Narni Rajesh
 
PDF
An Introduction to RDF and the Web of Data
Olaf Hartig
 
PPTX
SWT Lecture Session 3 - SPARQL
Mariano Rodriguez-Muro
 
"RDFa - what, why and how?" by Mike Hewett and Shamod Lacoul
Shamod Lacoul
 
Introduction To RDF and RDFS
Nilesh Wagmare
 
Linked (Open) Data
Bernhard Haslhofer
 
RDFa: introduction, comparison with microdata and microformats and how to use it
Jose Luis Lopez Pino
 
Two graph data models : RDF and Property Graphs
andyseaborne
 
RDF Data Model
Jose Emilio Labra Gayo
 
RDFa Tutorial
Ivan Herman
 
Hacia la Internet del Futuro: Web Semántica y Open Linked Data, Parte 2
Diego López-de-Ipiña González-de-Artaza
 
An introduction to Semantic Web and Linked Data
Fabien Gandon
 
SWT Lecture Session 2 - RDF
Mariano Rodriguez-Muro
 
Ontologies in RDF-S/OWL
Emanuele Della Valle
 
Ist16-04 An introduction to RDF
Emanuele Della Valle
 
Saveface - Save your Facebook content as RDF data
Fuming Shih
 
SemanticWeb Nuts 'n Bolts
Rinke Hoekstra
 
Name That Graph !
Fabien Gandon
 
Introduction to RDF
Narni Rajesh
 
An Introduction to RDF and the Web of Data
Olaf Hartig
 
SWT Lecture Session 3 - SPARQL
Mariano Rodriguez-Muro
 

Viewers also liked (20)

PPT
Presentatie henk van den berg
Stichting Voedingscentrum Nederland
 
PDF
Sap erp-best-practices-para-pymes
Oreka IT
 
PDF
2015 Meet taiipei大會手冊
Flosa Chen
 
DOC
Ti 38f52b9
rsliders
 
PDF
Acxiom - email mobile rendering and why it matters
Acxiom Corporation
 
PDF
Evangelist Journey 2015
智治 長沢
 
PPTX
Honor Code of the Prepa Tec Group 61, Mundialista.
Richard Huett
 
PDF
Streaming Topic Maps API
tmra
 
PPS
SDL Campaign Management & Rich Media
wmaagdenberg
 
PPT
The traveling card
D. Andronova
 
PPT
эстетика з.о. 2012
Таня Быстрова
 
PDF
Онлайн видео - медийно-эффективная альтернатива ТВ
i-Guru digital agency
 
PPTX
Primavera saa s
EuroCloud
 
PDF
Ag - Chem 847 rogator liquid system
PartCatalogs Net
 
PPTX
Anemo 2015-27-Astuto- Preparazione preoperatoria di un bambino anemico
anemo_site
 
PPTX
OSS and R&D
Minsuk Lee
 
PPTX
Work meetings
D. Andronova
 
PPT
Мультимедийный проект ид«букъвица»
ГО "Інститут розвитку регіональної преси"
 
PDF
速度——敏捷开发的丹田之气(2011敏捷中国大会)
Yi Xu
 
DOCX
5 ideas for baby shower gifts
Anthony Adcox
 
Presentatie henk van den berg
Stichting Voedingscentrum Nederland
 
Sap erp-best-practices-para-pymes
Oreka IT
 
2015 Meet taiipei大會手冊
Flosa Chen
 
Ti 38f52b9
rsliders
 
Acxiom - email mobile rendering and why it matters
Acxiom Corporation
 
Evangelist Journey 2015
智治 長沢
 
Honor Code of the Prepa Tec Group 61, Mundialista.
Richard Huett
 
Streaming Topic Maps API
tmra
 
SDL Campaign Management & Rich Media
wmaagdenberg
 
The traveling card
D. Andronova
 
эстетика з.о. 2012
Таня Быстрова
 
Онлайн видео - медийно-эффективная альтернатива ТВ
i-Guru digital agency
 
Primavera saa s
EuroCloud
 
Ag - Chem 847 rogator liquid system
PartCatalogs Net
 
Anemo 2015-27-Astuto- Preparazione preoperatoria di un bambino anemico
anemo_site
 
OSS and R&D
Minsuk Lee
 
Work meetings
D. Andronova
 
Мультимедийный проект ид«букъвица»
ГО "Інститут розвитку регіональної преси"
 
速度——敏捷开发的丹田之气(2011敏捷中国大会)
Yi Xu
 
5 ideas for baby shower gifts
Anthony Adcox
 
Ad

Similar to Semantic Web(Web 3.0) SPARQL (20)

PPTX
Sparql
Tamrat Amare
 
ODP
SPARQL 1.1 Update (2013-03-05)
andyseaborne
 
PDF
Sparq lreference 1.8-us
Ajay Ohri
 
PPTX
SPARQL
Raji Ghawi
 
PPTX
SPARQL introduction and training (130+ slides with exercices)
Thomas Francart
 
PDF
A Hands On Overview Of The Semantic Web
Shamod Lacoul
 
ODP
Semantic Web introduction
Graphity
 
PPTX
The Semantic Web #10 - SPARQL
Myungjin Lee
 
KEY
Creating web applications with LODSPeaKr
Alvaro Graves
 
PDF
SPARQL and Linked Data
Fulvio Corno
 
PDF
XSPARQL Tutorial
net2-project
 
PDF
SPARQL and the Open Linked Data initiative
Fulvio Corno
 
PPT
Sparql
Serge Garlatti
 
PPTX
Infromation Reprentation, Structured Data and Semantics
Yogendra Tamang
 
PPT
SPARQL Query Forms
Leigh Dodds
 
PDF
W3C Tutorial on Semantic Web and Linked Data at WWW 2013
Fabien Gandon
 
PDF
An introduction to Semantic Web and Linked Data
Gabriela Agustini
 
PDF
An introduction to Semantic Web and Linked Data
Gabriela Agustini
 
KEY
Linked data: spreading data over the web
shellac
 
KEY
Ruby semweb 2011-12-06
Gregg Kellogg
 
Sparql
Tamrat Amare
 
SPARQL 1.1 Update (2013-03-05)
andyseaborne
 
Sparq lreference 1.8-us
Ajay Ohri
 
SPARQL
Raji Ghawi
 
SPARQL introduction and training (130+ slides with exercices)
Thomas Francart
 
A Hands On Overview Of The Semantic Web
Shamod Lacoul
 
Semantic Web introduction
Graphity
 
The Semantic Web #10 - SPARQL
Myungjin Lee
 
Creating web applications with LODSPeaKr
Alvaro Graves
 
SPARQL and Linked Data
Fulvio Corno
 
XSPARQL Tutorial
net2-project
 
SPARQL and the Open Linked Data initiative
Fulvio Corno
 
Infromation Reprentation, Structured Data and Semantics
Yogendra Tamang
 
SPARQL Query Forms
Leigh Dodds
 
W3C Tutorial on Semantic Web and Linked Data at WWW 2013
Fabien Gandon
 
An introduction to Semantic Web and Linked Data
Gabriela Agustini
 
An introduction to Semantic Web and Linked Data
Gabriela Agustini
 
Linked data: spreading data over the web
shellac
 
Ruby semweb 2011-12-06
Gregg Kellogg
 
Ad

More from Daniel D.J. UM (6)

PDF
Socialplatform opportunities&threats-허진호
Daniel D.J. UM
 
PDF
Social Commerce Part 3(KAIST)
Daniel D.J. UM
 
PDF
Social Media Part 2(KAIST)
Daniel D.J. UM
 
PDF
Social Computing Part 1(KAIST)
Daniel D.J. UM
 
PDF
Object Parameters Ws Yjj
Daniel D.J. UM
 
Socialplatform opportunities&threats-허진호
Daniel D.J. UM
 
Social Commerce Part 3(KAIST)
Daniel D.J. UM
 
Social Media Part 2(KAIST)
Daniel D.J. UM
 
Social Computing Part 1(KAIST)
Daniel D.J. UM
 
Object Parameters Ws Yjj
Daniel D.J. UM
 

Recently uploaded (20)

PDF
Evolution: How True AI is Redefining Safety in Industry 4.0
vikaassingh4433
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PPTX
Securing Model Context Protocol with Keycloak: AuthN/AuthZ for MCP Servers
Hitachi, Ltd. OSS Solution Center.
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pdf
ghjghvhjgc
 
PPTX
Role_of_Artificial_Intelligence_in_Livestock_Extension_Services.pptx
DrRajdeepMadavi
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPTX
Wondershare Filmora Crack Free Download 2025
josanj305
 
PDF
Survival Models: Proper Scoring Rule and Stochastic Optimization with Competi...
Paris Women in Machine Learning and Data Science
 
PPTX
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Evolution: How True AI is Redefining Safety in Industry 4.0
vikaassingh4433
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
Securing Model Context Protocol with Keycloak: AuthN/AuthZ for MCP Servers
Hitachi, Ltd. OSS Solution Center.
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pdf
ghjghvhjgc
 
Role_of_Artificial_Intelligence_in_Livestock_Extension_Services.pptx
DrRajdeepMadavi
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Wondershare Filmora Crack Free Download 2025
josanj305
 
Survival Models: Proper Scoring Rule and Stochastic Optimization with Competi...
Paris Women in Machine Learning and Data Science
 
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 

Semantic Web(Web 3.0) SPARQL

  • 1. Web 3.0 SPARQL / XML Query Presenter Um Dae jin ([email protected]) Internet Technology Graduate school of information & Telecommunications in KONKUK University
  • 2. Agenda Introduction RDF & SPARQL SPAR Query Language Get the Knowledge Term | Syntax | Pattern | Constraint Simple protocol SPARQL 1.1
  • 5. RDF(Resource Description Framework) Resource Description Framework 어떤것을 기술하기 위한 구조(틀)일 뿐!!!  Resource : URI를 갖는 모든것(웹페이지,이미지,동영상 등)  Description : Resource들의 속성, 특성, 관계 기술  Framework : 위의 것들을 기술하기 위한 모델, 언어, 문법
  • 6. RDF(Resource Description Framework) Subject Predicate Object 주어 술어 목적어 (Resource) (Property, Relation) (Resource, Literal) URI URI URI Blank Node Literal This is the Framework!!!
  • 7. RDF(Resource Description Framework) 우리는 그 틀에 맞취 어떤것들을 기술만 할뿐~!!! 웹상에서 표현될 수 있는 개념들 블로그(Blog), 온라인 매체(RSS), 사람, 친구(FOAF) …etc ~!!!
  • 8. PingtheSemanticWeb.com is a repository for RDF documents. http://pingthesemanticweb.com/ RDF(Resource Description Framework) These namespaces are used to describe entities in X number of documents 2009.11.23 2008.7.16 2008.11.04 2009.1.8
  • 9. Picture Music Person Dictionary Region SPARQL GRDDL(Gleaning Resource Descriptions from Dialects of Languages)
  • 10. SPARQL Simple Protocol And RDF Query Language
  • 11. Simple Protocol http://semantic.lab.konkuk.ac.kr/rdf/endpoint/sparql?select … RDF <sparql …> SELECT ?email <head> <variable name=“x”/> WHERE { <variable name=“mbox”/> </head> ?user :email ?email. ?user :name “umdaejin”; <results> <result> } <binding name=“x”> <bnode> r2</bnode> </binding> <binding name=“mbox”> <uri>mailto:[email protected]</uri> </binding> </result> & <results> </sparql> RDF Query Language RDF Query language is the pattern matched SPO(Subject, Predicate, Object) in Graph
  • 12. SPARQL is Query Language and a protocol for accessing RDF
  • 13. SPA RDF Query Language
  • 15. SQL vs. SPARQL SELECT name FROM users WHERE contact=„010-3333-7777‟; SELECT ?name Return Variables WHERE { ?user rdf:type :User. ?user :name ?name. SPO Pattern ?user :contact “010-3333-7777”. } FROM <http://semantic/users.rdf> Graph Source
  • 16. Graph > Query Language > Binding > Protocol rdf:type SELECT ?name _person foaf:Person WHERE { ?user rdf:type :foaf:Person. :contact ?user :contact “010-3333-7777”. :name “010-3333-7777” ?user :name ?name. } FROM <http://semantic/users.rdf> “umdaejin” RDF <sparql xmlns=“http://www.w3.org…”> <head> <variable name=“name”/> </head> <results> ?name = “umdaejin” <result> <binding name=“name”> <literal> umdaejin</literal> </binding> </result> <results> </sparql>
  • 17. SPARQL BASE <http://example.org/> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX foaf:<http://xmlns.com/foaf/0.1/> PREFIX ex:<properties/1.0#> SELECT DISTINCT $person ?name $age FROM <http://rdf.example.org/personA.rdf> FROM <http://rdf.example.org/personB.rdf> WHERE { $person a foaf:Person; foaf:name ?name. OPTIONAL {$person ex:age $age }. FILTER (!REGEX(?name, “Bob”)) } ORDER BY ASC(?name) LIMIT 10 OFFSET 20 * SPARQL RDF Query Language Reference V1.8 by Dave Beckett.
  • 18. Get the Knowledge TERMS Syntax Pattern
  • 19. Terms IRI : URI reference within an RDF graph <http://www.w3.org> <http://semantic.konkuk.ac.kr/#Movie> <abc.rdf> //base URI에 의졲 foaf:name //prefix이용해 URI표현, PREFIX 정의 #x00 (X) //UNICODE문자 내에 허용 Datatype IRI : datatype URI <http://www.w3.org/2001/XMLSchema#string> <http://www.w3.org/2001/XMLSchema#integer> Plain Literal : lexical form, optionally language tag, @ko “Semantic web” , “엄대진”@ko Typed Literal : lexical form, datatype URI “30”^^xsd:integer “daejin”^^http://www.w3.org/2001/XMLSchema#string Blank node : dummy node, node들간의 연결표현용, 무작위생성 _:a, _n06968595988
  • 20. Terms NameSpace : Vocabulary가 있는 URI http://www.w3.org/1999/02/22-rdf-syntax-ns# http://purl.org/dc/elements/1.1/ http://xmlns.com/foaf/0.1/ Prefix : URI의 경로를 대표하는 접두어 rdf, dc, foaf RDF Graph : A Set of RDF Triples RDF Triple : S-P-O Subject : URI, Qname, Blank Node, Literal, Variable Predicate : URI, Qname, Blank node, Variable Object : URI, Qname, Blank node, Literal, Variable
  • 21. Terms Match : Graph내 SPO가 Query Pattern에 Match되는 상황 Solutions : Match되어 반환된 결과들 ?x = “엄대진” Query Variable : Solutions을 바인딩하기 위한 변수 ?x or $name
  • 22. Play# “umdaejin”이란 사람의 “email”은? :email _person [email protected] :name SELECT ?email WHERE { ?person :email ?email. “umdaejin” ?person :name “umdaejin”; }
  • 23. Syntax - RDF Term Syntax Literals “Hi Korea” //”Hi Korea” “Hi Korea”@en //영어임을 명시 “Hi Korea”^^xsd:string //문자열임을 명시 etc. integer, boolean 1 == “1”^^xsd:integer true == “true”^^xsd:boolean 1.3 == “1.3”^^xsd:decimal
  • 24. Play # umdaejin의 영문이름을 가진 사람의 email은? :email _person [email protected] :name SELECT ?email umdaejin@en WHERE { ?person :name “umdaejin”@en. ?person :email ?email. }
  • 25. Syntax - RDF Term Syntax IRI <http://example.org/book/book1> BASE <http://example.org/book/> <book1> PREFIX book: <http://example.org/book/> book:book1
  • 26. Syntax -Triple Pattern Syntax PREFIX, BASE PREFIX dc: <http://purl.org/dc/elements/purl.org/> SELECT ?title WHERE { <http://example.org/book/book> dc:title ?title } PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX : <http://example.org/book/> SELECT $title WHERE { :book1 dc:title $title } BASE <http://example.org/book/> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT $title WHERE { <book1> dc:title $title }
  • 27. Play # daejin의 영문이름을 가진 사람의 책제목은? :like _person Book:book_3 :name book:name “daejin@en” “ANT” BASE <http://RDFTutorial.net/2009/> PREFIX book:http://example.org/book/> SELECT ?book_name WHERE { ?person :like book:book_3. book:book_3 book:name ?book_name. }
  • 28. Syntax - RDF Term Syntax Query Var ?var or $var Blank [ :p “v”]. == [] :p “v”. Unique Blank - 다른 IRI과 연결용 _b57 :p “v”. //기본 예 [ foaf:name ?name ; foaf:mbox <mailto:[email protected]>] / / 확장 예 _b11 foaf:name ?name ;은 S에 PO를 연속해서 붙일 수 있다. _b11 foaf:mbox <mailto:[email protected]>
  • 29. Play # foaf:name이 umdaejin사람이 사랑하는 사람 name? :love _a _b foaf:name name “umdaejin” “sunyoung” PREFIX foaf: <http://xmlns.com/foaf/0.1/>. PREFIX : <http://RDFTutorial.net/2009/>. SELECT $name WHERE { ?_a foaf:name “umdaejin”. ?_a :love $_b. $_b <http://RDFTutorial.net/2009/name> $name. }
  • 30. Syntax ; , ?people foaf:name ?name ; foaf:mbox ?mbox . 우린 같아요~ ?people foaf:name ?name . ?people foaf:mbox ?mbox . ?people foaf:nick "Alice" , "Alice_" . 우린 같아요~ ?people foaf:nick "Alice" . ?people foaf:nick "Alice_" .
  • 31. Play # 이름이 umdaejin이고 별명이 “무름스”인 사람이 아는 사람의 이름? foaf:knows _a _b foaf:nickname foaf:name foaf:name “무름스” “umdaejin” “SangWon” PREFIX foaf: <http://xmlns.com/foaf/0.1/>. SELECT ?name WHERE { ?_a foaf:nickname “무름스”; foaf:name “umdaejin”. ?_a foaf:knows ?_b. ?_b foaf:name ?name. }
  • 32. Pattern Basic Graph Pattern {?people foaf:name “umdaejin".} Group Graph Pattern { {?people foaf:name “umdaejin".} {?people foaf:email “[email protected]".} } //두 패턴이 모두 만족해야 Filter { ?people foaf:name ?name. FILTER regex (?name, “um”) }
  • 33. Pattern Optional Graph Pattern _:a rdf:type foaf:Person . _:a foaf:name "Alice" . _:a foaf:mbox <mailto:[email protected]> . _:a foaf:mbox <mailto:[email protected]> . _:b rdf:type foaf:Person . _:b foaf:name "Bob" . SELECT ?name ?mbox WHERE { ?people foaf:name ?name . OPTIONAL { ?people foaf:mbox ?mbox } }
  • 34. Pattern Optional Graph Pattern + FILTER SELECT ?people ?mbox WHERE { ?people foaf:name ?name . OPTIONAL { ?people foaf:mbox ?mbox . FILTER regex(?mbox, “@gmail”)} } //OPTIONAL을 여러개 추가 가능 Alternative Graph Pattern SELECT ?people ?mbox {?people foaf:name ?name . ?people foaf:knows ?name} WHERE { UNION {?people foaf:name ?name .} {? people naver:name ?name. ?people naver:knows ?name} UNION {?people naver:name ?name .} }//UNON대상 여러가 추가 가능
  • 35. Constraint String Value Constraint SELECT ?people, ?name WHERE { ?people :name ?name FILTER regex(?name, “^um”, “i”) } //이름이 um으로 시작하는 사람 Numeric Value Constraint SELECT ?people, ?age WHERE { ?people :age ?age. FILTER (?age > 30) } //나이가 30 이상인 사람
  • 36. Play # 나이 35세 이상인 사람이 아는 35세 이하의 사람? foaf:knows _a _b :age foaf:name :age foaf:name 36 Dongbum 35 “SangWon” PREFIX foaf: <http://xmlns.com/foaf/0.1/>. PREFIX : <http://RDFTutorial.net/2009/>. SELECT ?name WHERE { ?_a :age ?age. ?_a :age ?age. FILTER ( ?age >= 35 ) ?_a foaf:knows ?_b. ?_a foaf:knows ?_b. ?_b :age ?b_age; ?_b :age ?b_age; foaf:name ?name. foaf:name ?name. FILTER ( ?age >= 35 ) FILTER ( ?b_age <= 35) FILTER ( ?b_age <= 35) }
  • 37. Solution Sequences and Modifiers Order SELECT ?people, ?name WHERE { ?people :name ?name } ORDER BY ?name //기본 오름차순 A-Z, DESC(?name) SELECT ?s ?p ?o WHERE { ?s ?p ?o } //모든 SPO반환 ORDER BY ?o
  • 38. Play # 나이순으로 정렬? _a _b _c _d :age :age :age :age 21 33 26 45 PREFIX : <http://RDFTutorial.net/2009/>. SELECT ?user WHERE { ?user :age ?age. } ORDER BY ?age.
  • 39. Solution Sequences and Modifiers Offset SELECT ?s ?p ?o WHERE { ?s ?p ?o. } OFFSET 10 //11번째 부터 solutions 반환 LIMIT SELECT ?s ?p ?o SELECT ?s ?p ?o WHERE { WHERE { ?s ?p ?o. ?s ?p ?o. } } LIMIT 5 LIMIT 10 //10개 solutions 반환 OFFSET 10 //함께 사용 가능
  • 40. Play # 나이순으로 정렬후, 결과 2개? _a _b _c _d :age :age :age :age 21 33 26 45 PREFIX : <http://RDFTutorial.net/2009/>. SELECT ?user WHERE { ?user :age ?age. } ORDER BY ?age. LIMIT 2 .
  • 41. Query Form ASK PREFIX foaf: <http://xmlns.com/foaf/0.1/> ASK { ?x foaf:name "Alice"; :age ?age. FILTER ( ?age > 20) } DESCRIBE PREFIX ent: <http://org.example.com/employees#> DESCRIBE ?x WHERE { ?x ent:employeeId "1234" }
  • 43. Simple Protocol & RDF Endpoint 사람들 HTTP SOAP ... Endpoint 우리팀 너네팀 옆팀
  • 44. Simple Protocol Request GET /sparql/?query=EncodedQuery HTTP/1.1 * HTTP Binding Host: www.example * SOAP Binding User-agent: my-sparql-client/0.1 Response <sparql ...> <head> <variable name="x"/> <variable name="mbox"/> </head> <results> <result> <binding name="x"> <bnode>r2</bnode> </binding> <binding name="mbox"> <uri>mailto:[email protected]</uri> </binding> </result> </results> </sparql> * http://www.w3.org/TR/rdf-sparql-protocol/
  • 45. Simple Protocol Request <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope/" * HTTP Binding xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/ XMLSchema-instance"> * SOAP Binding <soapenv:Body> <query-request xmlns="http://www.w3.org/2005/09/sparql-protocol-types/#"> <query>SELECT ?z {?x ?y ?z . FILTER regex(?z, 'Harry')}</query> </query-request> </soapenv:Body> </soapenv:Envelope> Response <sparql ...> <head> <variable name="x"/> <variable name="mbox"/> </head> <results> <result> <binding name="x"> <bnode>r2</bnode> </binding> <binding name="mbox"> <uri>mailto:[email protected]</uri> </binding> </result> </results> </sparql> * http://www.w3.org/TR/rdf-sparql-protocol/
  • 48. SPARQL 1.1 Aggregate Functions Subqueries Negation Projection Expressions Query Language Syntax Property paths Commonly used SPARQL functions Basic federated query * WG에서 스팩 조정중이며, 변경될 수 있습니다.
  • 49. Aggregate functions Ex. COUNT, MAX, MIN, SUM, AVG SELECT COUNT(?person) AS ?alices WHERE { ?person :name “Alice” . } Existing implementation. Garlik‟s JXT, Dave Beckett‟s Redland, ARQ, Open Anzo‟s Glitter, Virtuoso, ARC Status. Required
  • 50. Subqueries Ex. SELECT ?person ?name WHERE { :Alice foaf:name ?person . { SELECT ?name WHERE { ?person foaf:name ?name . } LIMIT 1 } } Existing implementation. ARQ, Virtuoso Status. Required
  • 51. Negation (1/2) Ex. ex) Identify the name of people who do not know anyone. SELECT ?name WHERE { ?x foaf:givenName ?name . OPTION { ?x foaf:knows ?who } . FILTER (!BOUND(?who)) } Existing implementation. RDF::QUERY (unsaid keyword), SeRQL (MINUS keyword), ARQ (NOT EXIST keyword), SQL Status. Required
  • 52. Negation (2/2) SeRQL (MINUS) SELECT x FROM {x} foaf:givenName {name} MINUS SELECT x FROM {x} foaf:givenName {name} ; foaf:knows {who} USING NAMESPACE foaf = <http://xmlns.com/foaf/0.1/> UNSAID PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?x WHERE { ?x foaf:givenName ?name UNSAID { ?x foaf:knows ?who } }
  • 53. Project Expressions Ex. SELECT ?name (?age > 18) AS over 18 WHERE { ?person :name ?name ; :age ?age . } Existing implementation. Garlik‟s JXT, Dave Beckett‟s Redland, ARQ, Virtuoso, Open Anzo‟s Glitter SPARQL Engine, XSPARQL Status. Required
  • 54. Update Ex. INSERT DATA { :book1 dc:title “new book”; dc:creator “someone”. } DELETE { ?book ?p ?v } WHERE { ?book dc:date ?date . FILTER ( ?date < “2001-01-01T00:00:00^^xsd:dateTime ) ?book ?p ?v. } Existing implementation. ARQ, Virtuoso Status. Required Update with HTTP PUT, DELETE Existing implementation. Garlik‟s JXT, IBM‟s Jazz Foundation
  • 55. Aggregate Functions Garlik‟s JXT Subqueries Dave Beckett‟s Redland Negation ARQ Projection Expressions Open Anzo‟s Glitter Service description Virtuoso Update (REST) ARC SeRQL RDF::Query SQL XSPARQL IBM‟s Jazz Foundation * WG에서 스팩 조정중이며, 변경될 수 있습니다.
  • 56. Links http://groups.google.com/group/semanticwebstudy?hl=ko http://delicious.com/kwangsub.kim/bundle:RDFTutorial2009 SPARQL 이해(IBM DevWorks) : http://www.ibm.com/developerworks/kr/library/tutorial/x-sparql/ SPARQL Working Group : http://www.w3.org/2009/sparql/wiki/Main_Page