14
Sheet 11 SPARQL

Sheet 11 SPARQL. Organization Exam next Tuesday 17.07.07 (10-12) --- A9 Register if you have not yet registered Evaluation –Difficult or Too difficult

Embed Size (px)

Citation preview

Page 1: Sheet 11 SPARQL. Organization Exam next Tuesday 17.07.07 (10-12) --- A9 Register if you have not yet registered Evaluation –Difficult or Too difficult

Sheet 11

SPARQL

Page 2: Sheet 11 SPARQL. Organization Exam next Tuesday 17.07.07 (10-12) --- A9 Register if you have not yet registered Evaluation –Difficult or Too difficult

Organization

• Exam next Tuesday 17.07.07 (10-12) --- A9• Register if you have not yet registered• Evaluation

– Difficult or Too difficult (around 70%)– Make sense to have tutorial hours (around 70%)– Exercise helps to understand the lecture (100%)– Tutor explanation clear (ok [30%]-good [60%])– Size of room (not too important)– Other comments:

• Exercises too difficult and take too much time• Group work• Mistakes in exercises• More examples in tutorial• Tutorial with PC

Page 3: Sheet 11 SPARQL. Organization Exam next Tuesday 17.07.07 (10-12) --- A9 Register if you have not yet registered Evaluation –Difficult or Too difficult
Page 4: Sheet 11 SPARQL. Organization Exam next Tuesday 17.07.07 (10-12) --- A9 Register if you have not yet registered Evaluation –Difficult or Too difficult

@prefix xs: <http://www.w3.org/2001/XMLSchema#> .@prefix : <http://www.cgnm.de/rdf/family#> .:Anne :age "45"^^xs:integer; :marriedTo :Bert ; :motherOf :Clara, :Dennis .:Bert :age "49"^^xs:integer; :marriedTo :Anne ; :fatherOf :Clara, :Dennis .:Clara :age "24"^^xs:integer; :marriedTo :Emil; :motherOf :Fred, :Gisa .:Dennis :age "22"^^xs:integer.:Emil :age "27"^^xs:integer; :marriedTo :Clara; :fatherOf :Fred, :Gisa .:Fred :age "2"^^xs:integer.:Gisa :age "1"^^xs:integer.

Page 5: Sheet 11 SPARQL. Organization Exam next Tuesday 17.07.07 (10-12) --- A9 Register if you have not yet registered Evaluation –Difficult or Too difficult

prefix : <http://www.cgnm.de/rdf/family#>select distinct ?xwhere {

{{?x :motherOf ?y . ?x :motherOf ?z }union {?x :fatherOf ?y . ?x :fatherOf ?z }}FILTER (?y != ?z)

}

prefix : <http://www.cgnm.de/rdf/family#>select distinct ?xwhere {{ ?x :fatherOf ?y, ?z }union{ ?x :motherOf ?y, ?z }

----------| x |==========| :Clara || :Anne || :Emil || :Bert |----------

Page 6: Sheet 11 SPARQL. Organization Exam next Tuesday 17.07.07 (10-12) --- A9 Register if you have not yet registered Evaluation –Difficult or Too difficult

prefix : <http://www.cgnm.de/rdf/family#>select distinct ?person where{

?person :age ?ageoptional {?person :fatherOf ?child}optional {?person :motherOf ?child}filter ( !bound(?child) )

}

xsd:boolean   bound (variable var)

Returns true if var is bound to a value. Returns false otherwise. Variables with the value NaN or INF are considered bound.

Page 7: Sheet 11 SPARQL. Organization Exam next Tuesday 17.07.07 (10-12) --- A9 Register if you have not yet registered Evaluation –Difficult or Too difficult
Page 8: Sheet 11 SPARQL. Organization Exam next Tuesday 17.07.07 (10-12) --- A9 Register if you have not yet registered Evaluation –Difficult or Too difficult

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .@prefix xs: <http://www.w3.org/2001/XMLSchema#>@prefix : <http://www.ismll.de/rdf/teaching#>

:ProfLars :teaches :XmlAndSemanticWeb ; :teaches :AdvancedAI ; :teaches :OntologyLearning ; :teaches :PredictiveModeling ; :teaches :RecommenderSystems .

:XmlAndSemanticWeb rdf:type :Course ; :title "XML & Semantic Web" .:AdvancedAI rdf:type :Course ; :title "Advanced Artificial Intelligence" .:OntologyLearning rdf:type :Seminar ; :title "Ontology Learning" .:PredictiveModeling rdf:type :Seminar ; :title "Predictive Modeling" .:RecommenderSystems rdf:type :Seminar ; :title "Recommender Systems" .

Page 9: Sheet 11 SPARQL. Organization Exam next Tuesday 17.07.07 (10-12) --- A9 Register if you have not yet registered Evaluation –Difficult or Too difficult

:xml :assignmentOf :XmlAndSemanticWeb .:rdf :assignmentOf :XmlAndSemanticWeb .:owl :assignmentOf :XmlAndSemanticWeb .:XmlAndSemanticWeb :assignmentNumber 3 .:textClassification :assignmentOf :OntologyLearning .:WordNet :assignmentOf :OntologyLearning .:OntologyLearning :assignmentNumber 2 .

:Karen :attends :XmlAndSemanticWeb .:Leandro :attends :OntologyLearning .:Mary :attends :PredictiveModeling .

:ProfLars :supervises :Karen, :Leandro, :John.

Page 10: Sheet 11 SPARQL. Organization Exam next Tuesday 17.07.07 (10-12) --- A9 Register if you have not yet registered Evaluation –Difficult or Too difficult

prefix : <http://www.ismll.de/rdf/teaching#>prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>select ?x ?zwhere { :ProfLars :teaches ?x .

?x rdf:type ?z}

prefix : < http://www.ismll.de/rdf/teaching#>prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>select ?module ?numberwhere { ?module :assignmentNumber ?number }

Page 11: Sheet 11 SPARQL. Organization Exam next Tuesday 17.07.07 (10-12) --- A9 Register if you have not yet registered Evaluation –Difficult or Too difficult

prefix : <http://www.ismll.de/rdf/teaching#> prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>select ?y ?xwhere {

{?y :attends ?z . ?x :assignmentOf ?z}FILTER (?y = :Karen || ?y = :Leandro || ?y = :Mary)

}

prefix : < http://www.ismll.de/rdf/teaching#>prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>select ?student where {

{ :ProfLars :supervises ?student . ?student :attends ?module . ?module rdf:type :Seminar}

UNION {:ProfLars :supervises ?student . ?student :attends ?module . ?module rdf:type :Course}}

Page 12: Sheet 11 SPARQL. Organization Exam next Tuesday 17.07.07 (10-12) --- A9 Register if you have not yet registered Evaluation –Difficult or Too difficult
Page 13: Sheet 11 SPARQL. Organization Exam next Tuesday 17.07.07 (10-12) --- A9 Register if you have not yet registered Evaluation –Difficult or Too difficult

prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>prefix xs: <http://www.w3.org/2001/XMLSchema#>prefix : <http://www.cgnm.de/spreadsheet#> CONSTRUCT{

?table :hasColumnName ?rowName .

:hasRow :hasRowName ?columnName . :hasColumn :containsData ?Data.?Data ?contains ?value;

}WHERE { ?table :hasRow ?Row . ?Row :hasRowName ?rowName .?Row :containsData ?Data.?Data ?contains ?value.

?table :hasColumnNames ?n.?n ?p ?columnName.}

Page 14: Sheet 11 SPARQL. Organization Exam next Tuesday 17.07.07 (10-12) --- A9 Register if you have not yet registered Evaluation –Difficult or Too difficult

prefix : <http://www.cgnm.de/spreadsheet#>select ?_ ?2004 ?2005 ?2006where { ?x1 :hasColumnNames ?y1 . ?y1 ?r ?_ . ?x2 :hasRowName "2004" { ?x2 :containsData ?y2 { ?y2 ?r ?2004 } } }{ ?x3 :hasRowName "2005" { ?x3 :containsData ?y3 { ?y3 ?r ?2005 } } }{ ?x4 :hasRowName "2006" { ?x4 :containsData ?y4 { ?y4 ?r ?2006 } } } }