Mark for closed locations (P3999) in Nearby (#6273)
Some checks failed
Android CI / Run tests and generate APK (push) Has been cancelled

* Exclude closed locations (P3999) from Nearby query

* feat: Show  for P3999 items (official closure)

* revert changes

* Add P3999 (date of closure) support for non-existent places

* Typo fixing

* fix-typo

* .

---------

Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
This commit is contained in:
Sonal Yadav 2025-04-11 14:30:47 +05:30 committed by GitHub
parent e3dd00bcfa
commit 2c41176a6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 1 deletions

View file

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

View file

@ -18,6 +18,7 @@ class NearbyResultItem(
@field:SerializedName("description") private val description: ResultTuple?, @field:SerializedName("description") private val description: ResultTuple?,
@field:SerializedName("endTime") private val endTime: ResultTuple?, @field:SerializedName("endTime") private val endTime: ResultTuple?,
@field:SerializedName("monument") private val monument: ResultTuple?, @field:SerializedName("monument") private val monument: ResultTuple?,
@field:SerializedName("dateOfOfficialClosure") private val dateOfOfficialClosure: ResultTuple?,
) { ) {
fun getItem(): ResultTuple = item ?: ResultTuple() fun getItem(): ResultTuple = item ?: ResultTuple()
@ -41,6 +42,8 @@ class NearbyResultItem(
fun getDestroyed(): ResultTuple = destroyed ?: ResultTuple() fun getDestroyed(): ResultTuple = destroyed ?: ResultTuple()
fun getDateOfOfficialClosure(): ResultTuple = dateOfOfficialClosure ?: ResultTuple()
fun getDescription(): ResultTuple = description ?: ResultTuple() fun getDescription(): ResultTuple = description ?: ResultTuple()
fun getEndTime(): ResultTuple = endTime ?: ResultTuple() fun getEndTime(): ResultTuple = endTime ?: ResultTuple()
@ -48,4 +51,5 @@ class NearbyResultItem(
fun getAddress(): String = address?.value ?: "" fun getAddress(): String = address?.value ?: ""
fun getMonument(): ResultTuple? = monument fun getMonument(): ResultTuple? = monument
} }

View file

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