Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sparql Examples.

Similar presentations


Presentation on theme: "Sparql Examples."— Presentation transcript:

1 Sparql Examples

2 Q1: Querying Berners-Lee’s FOAF data
Redland Rasqal RDF Query Demonstration Data: Query: PREFIX foaf: < SELECT ?name WHERE { ?person foaf:name ?name . }

3 Q2: Querying Berners-Lee’s FOAF data
Redland Rasqal RDF Query Demonstration Data: Query: PREFIX foaf: < SELECT * WHERE { ?person foaf:name ?name . ?person foaf:mbox ? . }

4 Q3: Querying Berners-Lee’s FOAF data
Redland Rasqal RDF Query Demonstration Data: Query: PREFIX foaf: < PREFIX card: < SELECT ?homepage WHERE { card:i foaf:knows ?known . ?known foaf:homepage ?homepage . }

5 Q4: DBPedia http://dbpedia.org/snorql/ Prefix:
PREFIX owl: < PREFIX xsd: < PREFIX rdfs: < PREFIX rdf: < PREFIX foaf: < PREFIX dc: < PREFIX : < PREFIX dbpedia2: < PREFIX dbpedia: < PREFIX skos: <

6 Q4: People who were born in Berlin before 1900
Query: SELECT ?name ?birth ?death ?person WHERE { ?person dbo:birthPlace :Berlin . ?person dbo:birthDate ?birth . ?person foaf:name ?name . ?person dbo:deathDate ?death . FILTER (?birth < " "^^xsd:date) . } ORDER BY ?name

7 Q5: German musicians with German and English descriptions
Query: SELECT ?name ?description_en ?description_de ?musician WHERE {?musician foaf:name ?name . OPTIONAL { ?musician rdfs:comment ?description_en . FILTER (LANG(?description_en) = 'en') } OPTIONAL { ?musician rdfs:comment ?description_de . FILTER (LANG(?description_de) = 'de') } }

8 Q6: German musicians who were born in Berlin
Query: SELECT ?name ?birth ?description ?person WHERE { ?person a dbo:MusicalArtist . ?person dbo:birthPlace :Berlin . ?person dbo:birthDate ?birth . ?person foaf:name ?name . ?person rdfs:comment ?description . FILTER (LANG(?description) = 'en') . } ORDER BY ?name

9 Q7: Soccer players who are born in a country with more than 10 million inhabitants, who played as goalkeeper for a club that has a stadium with more than 30,000 seats and the club country is different from the birth country Query: SELECT distinct ?soccerplayer ?countryOfBirth ?team ?countryOfTeam ?stadiumcapacity { ?soccerplayer a dbo:SoccerPlayer ; dbo:position|dbp:position < ; dbo:birthPlace/dbo:country* ?countryOfBirth ; #dbo:number 13 ; dbo:team ?team . ?team dbo:capacity ?stadiumcapacity ; dbo:ground ?countryOfTeam . ?countryOfBirth a dbo:Country ; dbo:populationTotal ?population . ?countryOfTeam a dbo:Country . FILTER (?countryOfTeam != ?countryOfBirth) FILTER (?stadiumcapacity > 30000) FILTER (?population > ) } order by ?soccerplayer

10 Q8: Is Amazon river longer than Nile
Sparql Endpoint: Data: Query: PREFIX prop: < ASK { < prop:length ?amazon . < prop:length ?nile . FILTER(?amazon > ?nile) . }

11


Download ppt "Sparql Examples."

Similar presentations


Ads by Google