如何查询维基数据以获取标签包含单词的所有项目?我尝试了这个,但没有奏效; 它什么也没找到.
SELECT ?item ?itemLabel WHERE {
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en".
?item rdfs:label ?itemLabel.
}
FILTER(CONTAINS(LCASE(?itemLabel), "keyword"))
}
LIMIT 1000
Run Code Online (Sandbox Code Playgroud)
小智 6
根据您的问题和提供的有用评论,我最终得到了这个查询
SELECT ?item ?itemLabel
WHERE {
?item rdfs:label ?itemLabel.
FILTER(CONTAINS(LCASE(?itemLabel), "city"@en)).
} limit 10
Run Code Online (Sandbox Code Playgroud)
我得到了那些结果
item itemLabel
wd:Q515 city
wd:Q7930989 city
wd:Q15253706 city
wd:Q532039 The Eternal City
wd:Q1969820 The Eternal City
wd:Q3986838 The Eternal City
wd:Q7732543 The Eternal City
wd:Q7737016 The Golden City
wd:Q5119 capital city
wd:Q1555 Guatemala City
Run Code Online (Sandbox Code Playgroud)
是的,您可以按标签搜索,例如:
SELECT distinct ?item ?itemLabel ?itemDescription WHERE{
?item ?label "Something"@en.
?article schema:about ?item .
?article schema:inLanguage "en" .
?article schema:isPartOf <https://en.wikipedia.org/>.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Run Code Online (Sandbox Code Playgroud)
在查询页面上看到它.