我有一个地点列表,我希望用geonames的ID来丰富它们。由于geonames默认已嵌入到WikiData中,因此我选择直接通过WikiData端点使用SPARQL进行操作。
我的工作流程:
- I have imported the excel file into OpenRefine and created a new project
In OpenRefine I have created my graph, then I have downloaded it as RDF/XML. Here a snapshot:
<rdf:Description rdf:about="http://localhost:3333/0"> <rdfs:label>Aïre</rdfs:label> <crm:P1_is_identified_by>5A1CE163-105F-4BAF 8BF9</crm:P1_is_identified_by> </rdf:Description>
I have imported then the RDF file into my local graphDB and I runned the federated query:
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT *
WHERE {?place <http://purl.org/NET/cidoc-crm/core#P1_is_identified_by> ?value;
rdfs:label ?label_geo.
SERVICE <https://query.wikidata.org/sparql> {
?value wdt:P31/wdt:P279* wd:Q515;
rdfs:label ?label;
wdt:P1566 ?id_value.
}
}
limit 10
没有结果。
输出应该像这样:
|-----------------------|------------------|---------------|
| Oggetto | Place | GeonamesID |
|-----------------------|------------------|---------------|
|5A1CE163-105F-4BAF 8BF9| Aïre |11048419 |
|-----------------------|------------------|---------------|
建议是什么? 非常感谢。
?value
不是一个字符串文字吗?在你的例子中,我猜它是5A1CE163-105F-4BAF 8BF9
,对吗?那么,在维基数据中哪个 RDF 三元组会是"5A1CE163-105F-4BAF 8BF9" wdt:P31 wd:Q515.
?文字永远不是 RDF 三元组的主语。如果要按标签连接,应该使用相同的标签变量而不是?label
和?label_geo
。而且,你确实应该使用不同的变量来表示?value
。实际上,这可能仍然失败,因为在维基数据中,文字都有语言标记。 - UninformedUser"Aïre"@en
。 - UninformedUser