Skip to content

Mark ❌ for closed locations (P3999) in Nearby #6273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
4 changes: 3 additions & 1 deletion app/src/main/java/fr/free/nrw/commons/nearby/Place.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ public static Place from(NearbyResultItem item) {
.build(),
item.getPic().getValue(),
// Checking if the place exists or not
(item.getDestroyed().getValue() == "") && (item.getEndTime().getValue() == ""), entityId);
(item.getDestroyed().getValue() == "") && (item.getEndTime().getValue() == "")
&& (item.getDateOfOfficialClosure().getValue() == ""),
entityId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class NearbyResultItem(
@field:SerializedName("description") private val description: ResultTuple?,
@field:SerializedName("endTime") private val endTime: ResultTuple?,
@field:SerializedName("monument") private val monument: ResultTuple?,
@field:SerializedName("dateOfOfficialClosure") private val dateOfOfficialClosure: ResultTuple?,
) {
fun getItem(): ResultTuple = item ?: ResultTuple()

Expand All @@ -41,11 +42,14 @@ class NearbyResultItem(

fun getDestroyed(): ResultTuple = destroyed ?: ResultTuple()

fun getDateOfOfficialClosure(): ResultTuple = dateOfOfficialClosure ?: ResultTuple()

fun getDescription(): ResultTuple = description ?: ResultTuple()

fun getEndTime(): ResultTuple = endTime ?: ResultTuple()

fun getAddress(): String = address?.value ?: ""

fun getMonument(): ResultTuple? = monument

}
2 changes: 2 additions & 0 deletions app/src/main/resources/queries/query_for_item.rq
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ SELECT
(SAMPLE(?wikipediaArticle) AS ?wikipediaArticle)
(SAMPLE(?commonsArticle) AS ?commonsArticle)
(SAMPLE(?commonsCategory) AS ?commonsCategory)
(SAMPLE(?dateOfOfficialClosure) AS ?dateOfOfficialClosure)
WHERE {
SERVICE <https://query.wikidata.org/sparql> {
values ?item {
Expand Down Expand Up @@ -45,6 +46,7 @@ WHERE {
# Get existence
OPTIONAL {?item wdt:P576 ?destroyed}
OPTIONAL {?item wdt:P582 ?endTime}
OPTIONAL {?item wdt:P3999 ?dateOfOfficialClosure}

# Get Commons category
OPTIONAL {?item wdt:P373 ?commonsCategory}
Expand Down