mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Add categories to Wikidata query
This commit is contained in:
parent
41e11b7f20
commit
e2b54c0478
1 changed files with 4 additions and 4 deletions
|
|
@ -6,6 +6,7 @@ SELECT
|
|||
(SAMPLE(COALESCE(?class_label_preferred_language, ?class_label_any_language, "?")) as ?class_label)
|
||||
(SAMPLE(COALESCE(?icon0, ?icon1)) as ?icon)
|
||||
(SAMPLE(COALESCE(?emoji0, ?emoji1)) as ?emoji)
|
||||
(SAMPLE(?Commons_category) as ?Commons_category)
|
||||
?wikipediaArticle
|
||||
?commonsArticle
|
||||
WHERE {
|
||||
|
|
@ -23,6 +24,9 @@ SELECT
|
|||
OPTIONAL {?item rdfs:label ?item_label_preferred_language. FILTER (lang(?item_label_preferred_language) = "${LANG}")}
|
||||
OPTIONAL {?item rdfs:label ?item_label_any_language}
|
||||
|
||||
# Get Commons category (P373)
|
||||
OPTIONAL { ?item wdt:P373 ?Commons_category. }
|
||||
|
||||
# Get the class label in the preferred language of the user, or any other language if no label is available in that language.
|
||||
OPTIONAL {
|
||||
?item p:P31/ps:P31 ?classId.
|
||||
|
|
@ -35,10 +39,6 @@ SELECT
|
|||
# Get emoji
|
||||
OPTIONAL { ?classId wdt:P487 ?emoji0. }
|
||||
OPTIONAL { ?classId wdt:P279*/wdt:P487 ?emoji1. }
|
||||
OPTIONAL {
|
||||
?sitelink schema:about ?item .
|
||||
?sitelink schema:inLanguage "en"
|
||||
}
|
||||
OPTIONAL {
|
||||
?wikipediaArticle schema:about ?item ;
|
||||
schema:isPartOf <https://en.wikipedia.org/> .
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue