Frank Mensah
Frank Mensah

Reputation: 73

Writing Query result to .ttl file format

Any ideas on how to save the results of this SPARQL query into a TURTLE format?

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dbo: <http://dbpedia.org/ontology/>

select distinct ?city ?labelEn{
?city a dbo:City.
?city rdfs:label ?labelEn.
filter(lang(?labelEn) = 'en').
}
LIMIT 10

Upvotes: 1

Views: 1054

Answers (1)

TallTed
TallTed

Reputation: 9434

One way is to just ask the DBpedia endpoint to do so. Of course, you may not be expecting the reification that results there.

Later comments suggest what you really want is rather different from your original question... More like --

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX dbo: <http://dbpedia.org/ontology/> 

CONSTRUCT
 { ?city           a  dbo:City . 
   ?city  rdfs:label  ?labelEn . 
 } 
WHERE
 { ?city a dbo:City . 
   ?city rdfs:label ?labelEn . 
   FILTER(lang(?labelEn) = 'en') 
 }

-- which again you can ask the endpoint to serialize as Turtle.

Upvotes: 2

Related Questions