使用SPARQL查找Wikidata属性并在同一查询中使用它们(或:使用主语作为谓词)
我试图构造一个Wikidata查询,以查找给定Wikidata项上使用的特定类型的所有属性。具体地说,我想为一个人提供一个指向不同组织机构标识符的链接列表 我首先查找所有属于权限记录的属性,以及它们的标签、链接模式等。这非常有用:使用SPARQL查找Wikidata属性并在同一查询中使用它们(或:使用主语作为谓词),sparql,wikidata,Sparql,Wikidata,我试图构造一个Wikidata查询,以查找给定Wikidata项上使用的特定类型的所有属性。具体地说,我想为一个人提供一个指向不同组织机构标识符的链接列表 我首先查找所有属于权限记录的属性,以及它们的标签、链接模式等。这非常有用: SELECT ?auth ?authLabel ?desc ?linkPattern ?countryLabel ?remoteID WHERE { ?auth wdt:P31 wd:Q19595382; # Properties of type "person a
SELECT ?auth ?authLabel ?desc ?linkPattern ?countryLabel ?remoteID WHERE {
?auth wdt:P31 wd:Q19595382; # Properties of type "person authority"
schema:description ?desc; # Plain-english description
wdt:P1630 ?linkPattern . # Link pattern
OPTIONAL { ?auth wdt:P17 ?country. } # Country of origin, if you have it
FILTER((LANG(?desc)) = "en")
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
这给了我一个维基数据中每个人的权威列表,以及它的辅助信息,这是一个很好的起点。然而,我想要的是这个列表,但只显示特定人员的记录
我认为这是可行的,因为Wikidata SPARQL查询应该能够将变量作为谓词处理:
SELECT ?auth ?authLabel ?desc ?linkPattern ?countryLabel ?remoteID WHERE {
?auth wdt:P31 wd:Q19595382;
schema:description ?desc;
wdt:P1630 ?linkPattern .
wd:Q5145349 ?auth ?remoteID . # <-- Authority record property must appear in person Q5145349 (Colin McCahon)
OPTIONAL { ?auth wdt:P17 ?country. }
FILTER((LANG(?desc)) = "en")
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
选择?身份验证?身份标签?描述?链接模式?国家标签?远程ID在哪里{
?认证wdt:P31 wd:Q195382;
模式:description?desc;
wdt:P1630?链接模式。
wd:Q5145349?auth?remoteID.#类似的东西可能是?选择?auth?authLabel?desc?linkPattern?countryLabel?remoteID在哪里{authItem wdt:P31 wd:Q19595382;模式:description?desc;wdt:P1630?linkPattern.?authItem wikibase:directClaim?auth.wd:Q5145349?auth?remoteID.#通过wikibase:directClaim
谓词获得从wd:
到wd:
的映射。