140 likes | 237 Vues
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 (around 70%) Make sense to have tutorial hours (around 70%) Exercise helps to understand the lecture (100%)
E N D
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 (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
@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.
prefix : <http://www.cgnm.de/rdf/family#> select distinct ?x where { { ?x :fatherOf ?y, ?z } union { ?x :motherOf ?y, ?z } ---------- | x | ========== | :Clara | | :Anne | | :Emil | | :Bert | ---------- prefix : <http://www.cgnm.de/rdf/family#> select distinct ?x where { { {?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 ?person where { ?person :age ?age optional {?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.
@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" .
: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.
prefix : <http://www.ismll.de/rdf/teaching#> prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> select ?x ?z where { :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 ?number where { ?module :assignmentNumber ?number }
prefix : <http://www.ismll.de/rdf/teaching#> prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> select ?y ?x where { {?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} }
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. }
prefix : <http://www.cgnm.de/spreadsheet#> select ?_ ?2004 ?2005 ?2006 where { ?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 } } } }