Exclude past locations (P585) from Nearby query (#6284)
Some checks are pending
Android CI / Run tests and generate APK (push) Waiting to run

This commit is contained in:
Khushbu Khemchandani 2025-04-14 07:24:29 +05:30 committed by GitHub
parent 5b5aeead88
commit 69b3544107
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 1 deletions

View file

@ -154,7 +154,8 @@ public class Place implements Parcelable {
item.getPic().getValue(),
// Checking if the place exists or not
(item.getDestroyed().getValue() == "") && (item.getEndTime().getValue() == "")
&& (item.getDateOfOfficialClosure().getValue() == ""),
&& (item.getDateOfOfficialClosure().getValue() == "")
&& (item.getPointInTime().getValue()==""),
entityId);
}

View file

@ -19,6 +19,7 @@ class NearbyResultItem(
@field:SerializedName("endTime") private val endTime: ResultTuple?,
@field:SerializedName("monument") private val monument: ResultTuple?,
@field:SerializedName("dateOfOfficialClosure") private val dateOfOfficialClosure: ResultTuple?,
@field:SerializedName("pointInTime") private val pointInTime: ResultTuple?,
) {
fun getItem(): ResultTuple = item ?: ResultTuple()
@ -52,4 +53,6 @@ class NearbyResultItem(
fun getMonument(): ResultTuple? = monument
fun getPointInTime(): ResultTuple = pointInTime ?: ResultTuple()
}

View file

@ -11,6 +11,7 @@ SELECT
(SAMPLE(?commonsArticle) AS ?commonsArticle)
(SAMPLE(?commonsCategory) AS ?commonsCategory)
(SAMPLE(?dateOfOfficialClosure) AS ?dateOfOfficialClosure)
(SAMPLE(?pointInTime) AS ?pointInTime)
WHERE {
SERVICE <https://query.wikidata.org/sparql> {
values ?item {
@ -47,6 +48,7 @@ WHERE {
OPTIONAL {?item wdt:P576 ?destroyed}
OPTIONAL {?item wdt:P582 ?endTime}
OPTIONAL {?item wdt:P3999 ?dateOfOfficialClosure}
OPTIONAL {?item wdt:P585 ?pointInTime}
# Get Commons category
OPTIONAL {?item wdt:P373 ?commonsCategory}