为什么 DBPedia 对给定维基百科 URL 的查询仅适用于某些 URL?
why DBPedia query for given Wikipedia URLs works works only for some urls?
我有一个维基百科页面的 URL 列表,并在 lod.openlinksw.com endpoint. The code is the same as in this 上查询 dbpedia 数据。
最好理解的是:尽管 dbpedia 页面具有正确的 foaf:isPrimaryTopicOf url,但对于某些 url 它怎么可能不起作用?
此处是对应 dbpedia and wikipedia 页面的简化查询。
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT Distinct ?name ?s ?url WHERE {
?s a foaf:Person .
FILTER NOT EXISTS { ?s rdf:type dbo:FictionalCharacter }.
?s foaf:isPrimaryTopicOf ?url.
?s rdfs:label ?name.
filter(langMatches(lang(?name), "en")).
?s foaf:isPrimaryTopicOf <http://en.wikipedia.org/wiki/Adi_Shankara>.
}
LIMIT 1
从维基百科中提取的约 40 个网址的列表中,我得到约 10 个空响应。首先我认为 url 可能有问题,但大多数看起来都很好。这里有更多 'not working' 个案例:
- 用于查询 >> en.wikipedia.org/wiki/Harald_I_of_Norway,
dbpedia.org/page/Harald_Fairhair >>
en.wikipedia.org/wiki/Harald_Fairhair
- 用于查询 >> en.wikipedia.org/wiki/Ivar_the_Boneless,
dbpedia.org/page/Ivar_the_Boneless >>
en.wikipedia.org/wiki/Ivar_the_Boneless
- 用于查询>> en.wikipedia.org/wiki/Jayarāśi_Bhaṭṭa,
dbpedia.org/page/Jayarāśi_Bhaṭṭa >>
en.wikipedia.org/wiki/Jayarāśi_Bhaṭṭa
- 用于查询 >> en.wikipedia.org/wiki/Kenneth_I_of_Scotland,
dbpedia.org/page/Kenneth_MacAlpin >>
en.wikipedia.org/wiki/Kenneth_MacAlpin
- 用于查询 >> en.wikipedia.org/wiki/Li_Deyu,
dbpedia.org/page/Li_Deyu >>
en.wikipedia.org/wiki/Li_Deyu
在第一个 (Harald_Fairhair) 和第四个 (Kenneth_MacAlpin) 案例中,有不同的 url 指向同一个维基页面,所以我需要找出如何处理这些案例。但我不明白为什么其余的不起作用。任何帮助,将不胜感激。
根据评论线程修改查询
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?name ?s ?url
WHERE {
VALUES ?url { <http://en.wikipedia.org/wiki/Adi_Shankara>
<http://en.wikipedia.org/wiki/Harald_I_of_Norway>
<http://en.wikipedia.org/wiki/Ivar_the_Boneless>
<http://en.wikipedia.org/wiki/Jayarāśi_Bhaṭṭa>
<http://en.wikipedia.org/wiki/Kenneth_I_of_Scotland>
<http://en.wikipedia.org/wiki/Li_Deyu>
}
?s ^dbo:wikiPageRedirects*
/foaf:isPrimaryTopicOf ?url .
FILTER NOT EXISTS { ?s rdf:type dbo:FictionalCharacter }
?s rdfs:label ?name .
FILTER(langMatches(LANG(?name), "en")).
}
原回答
来自 DBpedia 的 this query (and live results 如何为您工作?
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT Distinct ?name ?s ?url WHERE {
VALUES ?url { <http://en.wikipedia.org/wiki/Adi_Shankara>
<http://en.wikipedia.org/wiki/Harald_I_of_Norway>
<http://en.wikipedia.org/wiki/Ivar_the_Boneless>
<http://en.wikipedia.org/wiki/Jayarāśi_Bhaṭṭa>
<http://en.wikipedia.org/wiki/Kenneth_I_of_Scotland>
<http://en.wikipedia.org/wiki/Li_Deyu>
}
?s foaf:isPrimaryTopicOf ?url .
# ?s rdf:type foaf:Person .
FILTER NOT EXISTS { ?s rdf:type dbo:FictionalCharacter }
?s rdfs:label ?name .
FILTER(langMatches(LANG(?name), "en")).
# ?s foaf:isPrimaryTopicOf <http://en.wikipedia.org/wiki/Adi_Shankara>.
}
# LIMIT 10
这些是否有助于您了解之前出现的问题?
我有一个维基百科页面的 URL 列表,并在 lod.openlinksw.com endpoint. The code is the same as in this
此处是对应 dbpedia and wikipedia 页面的简化查询。
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT Distinct ?name ?s ?url WHERE {
?s a foaf:Person .
FILTER NOT EXISTS { ?s rdf:type dbo:FictionalCharacter }.
?s foaf:isPrimaryTopicOf ?url.
?s rdfs:label ?name.
filter(langMatches(lang(?name), "en")).
?s foaf:isPrimaryTopicOf <http://en.wikipedia.org/wiki/Adi_Shankara>.
}
LIMIT 1
从维基百科中提取的约 40 个网址的列表中,我得到约 10 个空响应。首先我认为 url 可能有问题,但大多数看起来都很好。这里有更多 'not working' 个案例:
- 用于查询 >> en.wikipedia.org/wiki/Harald_I_of_Norway,
dbpedia.org/page/Harald_Fairhair >>
en.wikipedia.org/wiki/Harald_Fairhair - 用于查询 >> en.wikipedia.org/wiki/Ivar_the_Boneless,
dbpedia.org/page/Ivar_the_Boneless >>
en.wikipedia.org/wiki/Ivar_the_Boneless - 用于查询>> en.wikipedia.org/wiki/Jayarāśi_Bhaṭṭa,
dbpedia.org/page/Jayarāśi_Bhaṭṭa >>
en.wikipedia.org/wiki/Jayarāśi_Bhaṭṭa - 用于查询 >> en.wikipedia.org/wiki/Kenneth_I_of_Scotland,
dbpedia.org/page/Kenneth_MacAlpin >>
en.wikipedia.org/wiki/Kenneth_MacAlpin - 用于查询 >> en.wikipedia.org/wiki/Li_Deyu,
dbpedia.org/page/Li_Deyu >>
en.wikipedia.org/wiki/Li_Deyu
在第一个 (Harald_Fairhair) 和第四个 (Kenneth_MacAlpin) 案例中,有不同的 url 指向同一个维基页面,所以我需要找出如何处理这些案例。但我不明白为什么其余的不起作用。任何帮助,将不胜感激。
根据评论线程修改查询
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?name ?s ?url
WHERE {
VALUES ?url { <http://en.wikipedia.org/wiki/Adi_Shankara>
<http://en.wikipedia.org/wiki/Harald_I_of_Norway>
<http://en.wikipedia.org/wiki/Ivar_the_Boneless>
<http://en.wikipedia.org/wiki/Jayarāśi_Bhaṭṭa>
<http://en.wikipedia.org/wiki/Kenneth_I_of_Scotland>
<http://en.wikipedia.org/wiki/Li_Deyu>
}
?s ^dbo:wikiPageRedirects*
/foaf:isPrimaryTopicOf ?url .
FILTER NOT EXISTS { ?s rdf:type dbo:FictionalCharacter }
?s rdfs:label ?name .
FILTER(langMatches(LANG(?name), "en")).
}
原回答
来自 DBpedia 的 this query (and live results 如何为您工作?
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT Distinct ?name ?s ?url WHERE {
VALUES ?url { <http://en.wikipedia.org/wiki/Adi_Shankara>
<http://en.wikipedia.org/wiki/Harald_I_of_Norway>
<http://en.wikipedia.org/wiki/Ivar_the_Boneless>
<http://en.wikipedia.org/wiki/Jayarāśi_Bhaṭṭa>
<http://en.wikipedia.org/wiki/Kenneth_I_of_Scotland>
<http://en.wikipedia.org/wiki/Li_Deyu>
}
?s foaf:isPrimaryTopicOf ?url .
# ?s rdf:type foaf:Person .
FILTER NOT EXISTS { ?s rdf:type dbo:FictionalCharacter }
?s rdfs:label ?name .
FILTER(langMatches(LANG(?name), "en")).
# ?s foaf:isPrimaryTopicOf <http://en.wikipedia.org/wiki/Adi_Shankara>.
}
# LIMIT 10
这些是否有助于您了解之前出现的问题?