将查询结果写入 .ttl 文件格式

Writing Query result to .ttl file format

关于如何将此 SPARQL 查询的结果保存为 TURTLE 格式的任何想法?

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

一种方法是 ask the DBpedia endpoint to do so. Of course, you may not be expecting the reification that results there.

后来的评论表明您真正想要的与您最初的问题有很大不同......更像是 --

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') 
 }

-- 你又可以 ask the endpoint to serialize as Turtle.