Muhammad Uzair
Muhammad Uzair

Reputation: 99

how can i get the result in sparql query of the following?

2.5) List the people and their names who are born in Jönköping before 1900. 2.6) Are there musical artists who were born in Jönköping? (use an ASK query). 2.7) Find 10 people (URI and place of death) who were born in Jönköping, but died elsewhere.

I am using dbpedia to run queries and fetch data SELECT DISTINCT * WHERE {?x ?y "Jönköping"@en }

This is the URI Which is retrived DESCRIBE http://dbpedia.org/resource/Jönköping

Upvotes: 1

Views: 242

Answers (1)

Slybot
Slybot

Reputation: 598

You can solve as following;

2.5) List the people and their names who are born in Jönköping before 1900

PREFIX db: <http://dbpedia.org/resource/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/> 
PREFIX dbo: <http://dbpedia.org/ontology/> 
    
SELECT ?name ?birth
    WHERE
    {      
      ?person dbo:birthPlace db:Jönköping . 
      ?person dbo:birthDate ?birth .   
      ?person foaf:name ?name .      
      FILTER (?birth < "1900-01-01"^^xsd:date) . 
    } 
ORDER BY ?birth

2.6) Are there musical artists who were born in Jönköping? (use an ASK query)

PREFIX db: <http://dbpedia.org/resource/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/> 
PREFIX dbo: <http://dbpedia.org/ontology/> 

ASK WHERE{SELECT ?person WHERE{      
 ?person a dbo:MusicalArtist .
 ?person dbo:birthPlace db:Jönköping .       
}}

2.7)Find 10 people (URI and place of death) who were born in Jönköping, but died elsewhere

PREFIX db: <http://dbpedia.org/resource/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/> 
PREFIX dbo: <http://dbpedia.org/ontology/> 

SELECT DISTINCT ?name ?person
WHERE
{      
  ?person dbo:birthPlace db:Jönköping . 
  ?person dbo:deathPlace ?deathPlace. 
  ?person foaf:name ?name . 
  FILTER (?deathPlace != db:Jönköping) .  
} ORDER BY ?name LIMIT 10 

Upvotes: 1

Related Questions