mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Made Split to Nearby Query into a fast query for coordinates + a details query for each pin (#5731)
* Splitted the query * Made changes to the query * Improvised query * Improvised query by dividing in the batches * Fixed failing tests * Improved batches * Improved sorting * Fixes issue caused by search this area button * Fixed failing tests * Fixed unnecessary reloads on onResume * Fixed few pins not loading on changing apps * Improved zoom level and fixed the pins not loading from the center * Removed toggle chips and changed pin's color * Fixed wikidata url * Fixed unit tests * Implemented retry with delay of 5000ms * Fixed exception issue and pins issue * Added change color icon to pin * Improved pin clicking * Removed search this area button * Implemented caching of places * Fixed unit test * Factorized methods * Changed primary key from location to entity id * Fixed tests * Fixed conflicts * Fixed unit test * Fixed unit test * Fixed the bug * Fixed issue with pin loading on the first launch * Updated javadocs * Temporary commit - only for testing * Replaced Temporary commit * Temporary commit - Added jcenter * Made minor changes * Fixed unit tests * Fixed unit tests * Fixed minor bug
This commit is contained in:
parent
ba6c8fe8d0
commit
2d63f351ed
39 changed files with 1147 additions and 814 deletions
64
app/src/main/resources/queries/query_for_item.rq
Normal file
64
app/src/main/resources/queries/query_for_item.rq
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
SELECT
|
||||
?item
|
||||
(SAMPLE(?label) AS ?label)
|
||||
(SAMPLE(?class) AS ?class)
|
||||
(SAMPLE(?description) AS ?description)
|
||||
(SAMPLE(?classLabel) AS ?classLabel)
|
||||
(SAMPLE(?pic) AS ?pic)
|
||||
(SAMPLE(?destroyed) AS ?destroyed)
|
||||
(SAMPLE(?endTime) AS ?endTime)
|
||||
(SAMPLE(?wikipediaArticle) AS ?wikipediaArticle)
|
||||
(SAMPLE(?commonsArticle) AS ?commonsArticle)
|
||||
(SAMPLE(?commonsCategory) AS ?commonsCategory)
|
||||
WHERE {
|
||||
SERVICE <https://query.wikidata.org/sparql> {
|
||||
values ?item {
|
||||
${ENTITY}
|
||||
}
|
||||
}
|
||||
|
||||
# Get the label in the preferred language of the user, or any other language if no label is available in that language.
|
||||
OPTIONAL {?item rdfs:label ?itemLabelPreferredLanguage. FILTER (lang(?itemLabelPreferredLanguage) = "en")}
|
||||
OPTIONAL {?item rdfs:label ?itemLabelAnyLanguage}
|
||||
BIND(COALESCE(?itemLabelPreferredLanguage, ?itemLabelAnyLanguage, "?") as ?label)
|
||||
|
||||
# Get the description in the preferred language of the user, or any other language if no description is available in that language.
|
||||
OPTIONAL {?item schema:description ?itemDescriptionPreferredLanguage. FILTER (lang(?itemDescriptionPreferredLanguage) = "${LANG}")}
|
||||
OPTIONAL {?item schema:description ?itemDescriptionAnyLanguage}
|
||||
BIND(COALESCE(?itemDescriptionPreferredLanguage, ?itemDescriptionAnyLanguage, "?") as ?description)
|
||||
|
||||
# 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 ?class.
|
||||
OPTIONAL {?class rdfs:label ?classLabelPreferredLanguage. FILTER (lang(?classLabelPreferredLanguage) = "${LANG}")}
|
||||
OPTIONAL {?class rdfs:label ?classLabelAnyLanguage}
|
||||
BIND(COALESCE(?classLabelPreferredLanguage, ?classLabelAnyLanguage, "?") as ?classLabel)
|
||||
}
|
||||
|
||||
OPTIONAL {
|
||||
?item p:P31/ps:P31 ?class.
|
||||
}
|
||||
|
||||
# Get picture
|
||||
OPTIONAL {?item wdt:P18 ?pic}
|
||||
|
||||
# Get existence
|
||||
OPTIONAL {?item wdt:P576 ?destroyed}
|
||||
OPTIONAL {?item wdt:P582 ?endTime}
|
||||
|
||||
# Get Commons category
|
||||
OPTIONAL {?item wdt:P373 ?commonsCategory}
|
||||
|
||||
# Get Wikipedia article
|
||||
OPTIONAL {
|
||||
?wikipediaArticle schema:about ?item.
|
||||
?wikipediaArticle schema:isPartOf <https://en.wikipedia.org/>. # TODO internationalization
|
||||
}
|
||||
|
||||
# Get Commons article
|
||||
OPTIONAL {
|
||||
?commonsArticle schema:about ?item.
|
||||
?commonsArticle schema:isPartOf <https://commons.wikimedia.org/>.
|
||||
}
|
||||
}
|
||||
GROUP BY ?item
|
||||
Loading…
Add table
Add a link
Reference in a new issue