+ All Categories
Home > Documents > “ Declarative Updates for RDF Graphs: A n Introduction t o the Language RUL ”

“ Declarative Updates for RDF Graphs: A n Introduction t o the Language RUL ”

Date post: 05-Jan-2016
Category:
Upload: oke
View: 17 times
Download: 0 times
Share this document with a friend
Description:
Paper Presentation. “ Declarative Updates for RDF Graphs: A n Introduction t o the Language RUL ”. Kllapi Herald (M945) Nomikos Vangelis (M917) 01/03/2008. Query Languages for RDF/RDFS. SPARQL ( W3C Recommendation ) ICS-FORTH RQL (RDFSuite, Atlas) SeRQL (Sesame) RDQL others…. - PowerPoint PPT Presentation
37
“Declarative Updates for RDF Graphs: An Introduction to the Language RUL” Kllapi Herald (M945) Nomikos Vangelis (M917) 01/03/2008 Paper Presentation
Transcript
Page 1: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

“Declarative Updates for RDF Graphs: An Introduction to the Language RUL”

Kllapi Herald (M945)Nomikos Vangelis (M917)

01/03/2008

Paper Presentation

Page 2: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

Query Languages for RDF/RDFS

• SPARQL (W3C Recommendation)

• ICS-FORTH RQL (RDFSuite, Atlas)

• SeRQL (Sesame)

• RDQL

• others….

Page 3: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

RQL - A Brief Introduction• declarative query language for RDF/RDFS

• relies on a typed data model!!!– literal, resource, class, property, meta-class, bag, seq, alt types– for error detection and safety– for performance (e.g better storage)

• follows a functional approach– (e.g subclassof(), superclassof(), leafclass, domain(), range())

• separation of three layers:– meta-schema (e.g. meta-classes such as rdfs:Class)– schema– data

Why???

Page 4: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

University RDF Schema – An Example

Module

Person

Staff

Economics Maths

Student

AcademicStaff NonAcademicStaff GraduateStudent

TeachingAssistant

UnderGraduateStudent

takes

teaches

assistsWith

Literal

foaf:name

Page 5: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

RQL vs SPARQL - Schema Querying

• Example 1: “Which classes can appear as domain and range of the property teaches?”

• SPARQLPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> .SELECT ?X, ?YWHERE { ?X teaches ?Y .

?X rdf:type rdfs:Class . ?Y rdf:type rdfs:Class . }

• RQL

SELECT $X, $Y FROM {$X}teaches{$Y}

$X, $Y are variables bound to schema classes

Page 6: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

RQL vs SPARQL - Schema Querying

• Example 2: “Find all properties that have range Module.”

• SPARQL

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> .SELECT ?PWHERE { ?P rdf:type rdf:Property .

?P rdfs:range Module . }

• RQL

SELECT @PFROM @P{;Module}

@P is a variable bound to property

Page 7: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

RQL vs SPARQL - Basic Data Queries

• Example 3: “Find all GraduateStudents.”

• SPARQLPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . SELECT ?XWHERE { ?X rdf:type GraduateStudent . }

• RQLa) GraduateStudent

b) SELECT X FROM GraduateStudent{X}

Equivalent queries

Page 8: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

RQL vs SPARQL - Basic Data Queries• Example 4: “Find all modules and their classes that Koubarakis teaches.”

• SPARQLPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .SELECT ?X , ?ZWHERE { ?X rdf:type Person .

?X teaches ?Y .?Y rdf:type ?Z .?X foaf:name ?N .FILTER(regex(?N, “Koubarakis”) . }

• RQLSELECT Y , $ZFROM {X;Person}teaches{Y;$Z} , {X;Person}foaf:name{N}WHERE N = “Koubarakis”USING NAMESPACE foaf = &http://xmlns.com/foaf/0.1/

Y;$Z retrieves the

class of resource Y

Page 9: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

RQL - More Complex Queries• Example 5: “Find all UnderGraduateStudents and the number of modules they

take.”SELECT X, CFROM UnderGraduateStudent{X}WHERE C = COUNT( SELECT Y

FROM {X}takes{Y;Module} )

• Example 6: “Find the persons who are NonAcademicStaff but not TeachingAssistants.”( SELECT X FROM NonAcademicStaff{X} ) minus ( SELECT Y FROM TeachingAssistant{Y} )

• Example 7: “Find the TeachingAssistant resources which have also been classified under UnderGraduateStudent.”SELECT XFROM TeachingAssistant{X} WHERE exists Y in UnderGraduateStudent SUCH THAT X=Y

Page 10: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

RQLvs SPARQL – A ComparisonFeatures SPARQL RQL

Negation NO YES

Aggregate Functions

(i.e min, max, sum, avg, count)

NO YES

Nested SubQueries NO YES

Optional YES NO

Quantifiers

(i.e exists,forall)

NO YES

Graph Construction YES NO

Set Based Queries NO YES

RQL has some very interesting features that are not present at SPARQL yet!!!

Page 11: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

Do we need more?

• We presented one more query language!

• Are we happy only with SELECT and ASK queries?

• Is it useful to have a way to update RDF data?– dynamic environments (e.g Grid Metadata)

Page 12: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

RUL – A companion for RQL

• a declarative update language for RDF

• relies on RQL and on its typed data model (ICS-FORTH )

• each RUL operation always result in a consistent state of the updated graph(i.e effects and side-effects of each RUL operation)

• does not deal with – schema updates - blank nodes– containers - collections

• we will present the semantics of RUL in an informal way by a series of examples.

Page 13: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

INSERT for Class Instances

• Goal– insert new class instances and classify them– insert new classification links for existing class instances

• SyntaxINSERT QualClassExp(ResourceExp)[FROM VariableBinding][WHERE Filtering][USING NAMESPACE NamespaceDefs]

• Example: “Make the resource with URI http://www.di.uoa.gr/Koubarakis an instance of the class AcademicStaff.”

INSERT AcademicStaff(&http://www.di.uoa.gr/Koubarakis)

Page 14: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

INSERT for Class Instances

A

C

BD

1. INSERT A(&r4)

2. INSERT D(&r1)

&r1 &r2 &r3&r4

3. INSERT A(&r1)

4. INSERT B(&r1)

5. INSERT C(&r2)

No changes

Page 15: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

DELETE for Class Instances• Goal

– delete a class instance – delete classification links

• SyntaxDELETE QualClassExp(ResourceExp)[FROM VariableBinding][WHERE Filtering][USING NAMESPACE NamespaceDefs]

• Example: “Delete all instances of class Person except for the resources with URIs http://www.di.uoa.gr/Koubarakis and http://www.di.uoa.gr/Zoi.”

DELETE $C(X)FROM $C{X}WHERE $C=Person AND ( X != &http://www.di.uoa.gr/Koubarakis AND

X != &http://www.di.uoa.gr/Zoi )

Page 16: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

DELETE for Class InstancesA

C

B

L

M

K

N

Literal

Literal

P1

P2

&r4&r1

&r2

&r3

&r5

“str1”

P1

“str2”

“str3”

P2

P1

“str4”

P1

1. DELETE B(&r1)2. DELETE B(&r3)3. DELETE C(&r2)4. DELETE M(&r4)

5. DELETE L(&r5)P1

Page 17: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

REPLACE for Class Instances• Goal

- replace an existing class instance with a new one

• SyntaxREPLACE QualClassExp (OldResourceExp NewResourceExp)[FROM VariableBinding][WHERE Filtering][USING NAMESPACE NamespaceDefs]

• Example: “The information that Manolis is academic staff is incorrect. The correct information is that Koubarakis is academic staff.”

REPLACE AcademicStaff(&http://www.di.uoa.gr/Manolis &http://www.di.uoa.gr/Koubarakis )

Page 18: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

Replace for Class Instances

A

C B

“str1”

“str2”

Literal

&r4

&r1

&r2

&r3

P1

P1

1. REPLACE A(&r1 r1_new)

&r1_new

2. REPLACE B(&r2 &r4)

P1

3. REPLACE A(&r3 &r3_new)

&r3_new

REPLACE is not equivalent to a DELETE followed by an INSERT

Page 19: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

A

B LiteralP1

“str1”&r1

P1

REPLACE B(&r1 &r2)

A

B LiteralP1

“str1”&r1

P1

DELETE B(&r1)

INSERT B(&r2)

&r2

&r2

Page 20: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

REPLACE classification for Class Instances

• Goal– modify the classification of a class instance

• Syntax

REPLACE OldQualClassExp NewQualClassExp (ResourceExp)[FROM VariableBinding][WHERE Filtering][USING NAMESPACE NamespaceDefs]

• Example: “KT finished! We want to reclassify Zoi as instance of class GraduateStudent.”

REPLACE TeachingAssistant GraduateStudent(&http://www.di.uoa.gr/Zoi)

Page 21: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

REPLACE classification for Class Instances

A

C

B

D

K

Literal

Literal

“str2”

“str1”

P1

P2

P1P2&r1

&r3

&r2

1. REPLACE A D(&r1)

2. REPLACE B K(&r2)

3. REPLACE B K(&r3)

No changes!

Page 22: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

INSERT for Property Instances• Goal

– insert new property instances to existing resources

• SyntaxINSERT QualPropertyExp(SubjectExp, ObjectExp)[FROM VariableBinding][WHERE Filtering][USING NAMESPACE NamespaceDefs]

• Example: “Make the resource http://www.di.uoa.gr/Koubarakis teach the resource http://www.di.uoa.gr/KT.”

INSERT teaches(&http://www.di.uoa.gr/Koubarakis, &http://www.di.uoa.gr/KT)

Page 23: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

INSERT for Property Instances

A B

C

P1

P2

&r3

&r1

&r2

&r4

P1P1

1. INSERT P2(&r3, &r4)

P2

2. INSERT P2(&r2, &r4)

P2

3. INSERT P2(&r1, &r4)

No changes!

Page 24: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

DELETE for Property Instances• Goal

– remove instatiation links

• SyntaxDELETE QualPropertyExp(SubjectExp, ObjectExp)[FROM VariableBinding][WHERE Filtering][USING NAMESPACE NamespaceDefs]

• Example: “Delete the resource http://ww.di.uoa.gr/Koubarakis as teacher of KT.”

DELETE teaches(&http://www.di.uoa.gr/Koubarakis, &http://ww.di.uoa.gr/KT)

Page 25: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

DELETE for property instances

A

B C

DP1

P2

P1

P2

P2

&r1

&r2

&r3

&r4

&r5 &r6

1. DELETE P1(&r1, &r3)

2. DELETE P2(&r2, &r4)

P1

3. DELETE P1(&r5, &r6)

Page 26: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

REPLACE for Property Instances

• Goal– replace the subject or the object of a property instance

• SyntaxREPLACE QualPropertyExp (OldSubjectExp[<-NewSubjectExp], OldObjectExp[<-NewObjectExp])[FROM VariableBinding][WHERE Filtering][USING NAMESPACE NamespaceDefs]

• Example: “Make Zoi teach KT instead of Koubarakis.”

REPLACE teaches(&http://www.di.uoa.gr/Koubarakis&http://www.di.uoa.gr/Zoi,

&http://www.di.uoa.gr/KT)

Page 27: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

REPLACE for Property Instances

A

B

C

D Literal

Literal

Literal

P1

P2

P3

&r1 &r2

&r3

&r4“str2”

“str1”

P2

P3

1. REPLACE P2(&r2 &r3, "str1")

P2

2. REPLACE P2(&r2 &r1, "str1")

3. REPLACE P3(&r4, “str2“ “str3”)

“str3”

No changes!

Page 28: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

REPLACE classication for Property Instances• Goal

– modify the classification of one or more property instances

• Syntax

REPLACE OldQualPropertyExp NewQualPropertyExp(SubjectExp, ObjectExp)[FROM VariableBinding][WHERE Filtering][USING NAMESPACE NamespaceDefs]

• Example: “Make Koubarakis not teach KT! Koubarakis takes KT! ”

REPLACE teaches takes(&http://www.di.uoa.gr/Koubarakis, &http://www.di.uoa.gr/KT)

Page 29: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

REPLACE classication for Property Instances

A B

C D

Literal

&r1

&r3

&r2&r4

&r5

“str1”

P3

P3

P1

P2 P4

P5

P4

P5

P1

P2

1. REPLACE P2 P1(&r1, &r3)

P1

2. REPLACE P3 P1(&r2, “str1”)

3. REPLACE P1 P2(&r1, &r2)

4. REPLACE P4 P5(&r3, &r4)

P5

5. REPLACE P5 P4(&r3, &r5)

P4 No changes!

Page 30: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

Update Sequences

• The easy way– we can express sequences of updates by writing multiple RUL

statements one after the other

• The RUL way– sequences of primitive updates inside a single RUL statement

• Sequences of Updates – 2 types– of the same kind (e.g. a lot of insertions)– of different kinds (multiple INSERT, DELETE or REPLACE

clauses before the FROM clause of an update statement)

Page 31: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

Update Sequences Examples

• Example: “Insert the resource with URI http://www.di.uoa.gr/KT as instance of the class Module and make resource Koubarakis its teacher.”

INSERT Module(&http://www.di.uoa.gr/KT) , teaches(&http://www.di.uoa.gr/Koubarakis ,

&http://www.di.uoa.gr/KT)

• Example: “All TeachingAssistants who assistsWith KT must take the lesson as UnderGraduateStudent.”

DELETE assistsWith(X,&http://www.di.uoa.gr/KT )REPLACE TeachingAssistantUnderGraduateStudent(X)INSERT takes(X, &http://www.di.uoa.gr/KT )FROM TeachingAssistant{X}WHERE {X} assistWith {&http://www.di.uoa.gr/KT }

order of execution does matter

Page 32: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

SPARQL/Update (SPARUL)• supported by Hewlett-Packard

• it uses a syntax derived from SPARQL

• express updates to an RDF store

• SPARQL/Update provides the following facilities:– Insert new triples to an RDF graph – Delete triples from an RDF graph – Perform a group of update operations as a single action– Add a new RDF Graph to a Graph Store– Remove an RDF graph from a Graph Store

Page 33: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

SPARQL Update - Examples• Example 1: “Make the resource with URI http://www.di.uoa.gr/Koubarakis an

instance of the class AcademicStaff.”

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .INSERT { <http://www.di.uoa.gr/Koubarakis> rdf:type AcademicStaff }

• Example 2: “Delete all UnderGraduate Students who takes KT.”

DELETE FROM <http://www.di.uoa.gr/Students> { ?X rdf:type UnderGraduateStudent}

WHERE { ?X takes <http://www.di.uoa.gr/KT> }

graph

Page 34: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

Remarks

It supports Graph Management and inherits all the advantages (and disadvatages) of SPARQL

But…

It lacks formal/informal semantics!!!

Page 35: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

Conclusion

• A lot of effort on Query Languages for RDF data retrieval

• No W3C Reccomendation for RDF Updates

• Each system has its own way

So…

We are waiting for W3C recommendation!!!

Page 37: “ Declarative Updates for RDF Graphs:  A n Introduction  t o the Language RUL ”

Links• RQL: http://139.91.183.30:9090/RDF/RQL/

• Sesame RQL: http://www.openrdf.org/doc/rql-tutorial.html

• RUL: http://139.91.183.30:3026/RULdemo/demo/

• SPARQL: http://www.w3.org/TR/rdf-sparql-query/

• SPARQL/Update: http://jena.hpl.hp.com/~afs/SPARQL-Update.html


Recommended