Exclude past locations (P585) from Nearby query

This commit is contained in:
Khushbu 2025-04-13 21:00:08 +05:30
parent 2c41176a6e
commit 3c0e148afb
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}