Splitted the query

This commit is contained in:
Kanahia 2024-05-14 20:36:58 +05:30
parent 7e84a447d4
commit 8be9deb5d0
10 changed files with 230 additions and 179 deletions

View file

@ -397,6 +397,44 @@ public class OkHttpJsonApiClient {
throw new Exception(response.message());
}
/**
* Retrieves place based on Entity Id.
*
* @param entityId Id of Wikidata Entity
* @param language The language for the query.
* @return A nearby place.
* @throws Exception If an error occurs during the retrieval process.
*/
@Nullable
public Place getNearbyPlace(
final String entityId, final String language)
throws Exception {
final String wikidataQuery = FileUtils.readFromResource("/queries/query_for_item.rq");
final String query = wikidataQuery
.replace("${ENTITY}", entityId)
.replace("${LANG}", language);
final HttpUrl.Builder urlBuilder = HttpUrl
.parse(sparqlQueryUrl)
.newBuilder()
.addQueryParameter("query", query)
.addQueryParameter("format", "json");
final Request request = new Request.Builder()
.url(urlBuilder.build())
.build();
final Response response = okHttpClient.newCall(request).execute();
if (response.body() != null && response.isSuccessful()) {
final String json = response.body().string();
final NearbyResponse nearbyResponse = gson.fromJson(json, NearbyResponse.class);
final List<NearbyResultItem> bindings = nearbyResponse.getResults().getBindings();
NearbyResultItem item = bindings.get(0);
final Place placeFromNearbyItem = Place.from(item);
return placeFromNearbyItem;
}
throw new Exception(response.message());
}
/**
* Make API Call to get Places
*

View file

@ -131,6 +131,13 @@ public class NearbyController extends MapController {
);
}
public Place getNearbyPlace(String entity) throws Exception {
return nearbyPlaces.getPlaceFromWikidataQuery(
entity,
Locale.getDefault().getLanguage()
);
}
public static LatLng calculateNorthEast(double latitude, double longitude, double distance) {
double lat1 = Math.toRadians(latitude);
double deltaLat = distance * 0.008;

View file

@ -120,6 +120,20 @@ public class NearbyPlaces {
customQuery);
}
/**
* Retrieves a place from a Wikidata query based on Entity Id
*
* @param entityId Id of Wikidata Entity
* @param lang The language for the query.
* @return A place obtained from the Wikidata query.
* @throws Exception If an error occurs during the retrieval process.
*/
public Place getPlaceFromWikidataQuery(final String entityId,
final String lang) throws Exception {
return okHttpJsonApiClient
.getNearbyPlace(entityId, lang);
}
/**
* Runs the Wikidata query to retrieve the KML String
*

View file

@ -22,7 +22,7 @@ public class Place implements Parcelable {
public final String name;
private final Label label;
private final String longDescription;
public final LatLng location;
public LatLng location;
private final String category;
public final String pic;
// exists boolean will tell whether the place exists or not,

View file

@ -68,7 +68,6 @@ import fr.free.nrw.commons.di.CommonsDaggerSupportFragment;
import fr.free.nrw.commons.kvstore.JsonKvStore;
import fr.free.nrw.commons.location.LocationPermissionsHelper;
import fr.free.nrw.commons.location.LocationPermissionsHelper.LocationPermissionCallback;
import fr.free.nrw.commons.location.LatLng;
import fr.free.nrw.commons.location.LocationServiceManager;
import fr.free.nrw.commons.location.LocationUpdateListener;
import fr.free.nrw.commons.nearby.CheckBoxTriStates;
@ -118,11 +117,9 @@ import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.util.constants.GeoConstants;
import org.osmdroid.views.CustomZoomButtonsController;
import org.osmdroid.views.overlay.ItemizedIconOverlay.OnItemGestureListener;
import org.osmdroid.views.overlay.ItemizedOverlayWithFocus;
import org.osmdroid.views.overlay.MapEventsOverlay;
import org.osmdroid.views.overlay.Marker;
import org.osmdroid.views.overlay.Overlay;
import org.osmdroid.views.overlay.OverlayItem;
import org.osmdroid.views.overlay.ScaleBarOverlay;
import org.osmdroid.views.overlay.ScaleDiskOverlay;
import org.osmdroid.views.overlay.TilesOverlay;
@ -172,8 +169,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
private boolean isDarkTheme;
private boolean isFABsExpanded;
private Place selectedPlace;
private Place clickedMarkerPlace;
private boolean isClickedMarkerBookmarked;
private Marker clickedMarker;
private ProgressDialog progressDialog;
private final double CAMERA_TARGET_SHIFT_FACTOR_PORTRAIT = 0.005;
private final double CAMERA_TARGET_SHIFT_FACTOR_LANDSCAPE = 0.004;
@ -370,9 +366,8 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
binding.map.getOverlays().add(new MapEventsOverlay(new MapEventsReceiver() {
@Override
public boolean singleTapConfirmedHelper(GeoPoint p) {
if (clickedMarkerPlace != null) {
removeMarker(clickedMarkerPlace);
addMarkerToMap(clickedMarkerPlace, isClickedMarkerBookmarked);
if (clickedMarker != null) {
clickedMarker.closeInfoWindow();
} else {
Timber.e("CLICKED MARKER IS NULL");
}
@ -1282,6 +1277,36 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
return Environment.MEDIA_MOUNTED.equals(state);
}
private void getPlaceData(String entity, Place place, Marker marker) {
final Observable<Place> getPlaceObservable = Observable
.fromCallable(() -> nearbyController
.getNearbyPlace(entity));
compositeDisposable.add(getPlaceObservable
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(p -> {
Place updatedPlace = p;
updatedPlace.distance = place.distance;
updatedPlace.location = place.location;
marker.setTitle(updatedPlace.name);
marker.setSnippet(
containsParentheses(updatedPlace.getLongDescription())
? getTextBetweenParentheses(
updatedPlace.getLongDescription()) : updatedPlace.getLongDescription());
marker.showInfoWindow();
binding.bottomSheetDetails.dataCircularProgress.setVisibility(View.GONE);
binding.bottomSheetDetails.icon.setVisibility(View.VISIBLE);
binding.bottomSheetDetails.wikiDataLl.setVisibility(View.VISIBLE);
passInfoToSheet(updatedPlace);
hideBottomSheet();
},
throwable -> {
Timber.d(throwable);
showErrorMessage(getString(R.string.could_not_load_place_data)
+ throwable.getLocalizedMessage());
}));
}
private void populatePlacesForCurrentLocation(
final fr.free.nrw.commons.location.LatLng currentLatLng,
final fr.free.nrw.commons.location.LatLng screenTopRight,
@ -1767,38 +1792,26 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
* @param isBookMarked A Boolean flag indicating whether the place is bookmarked or not.
*/
private void addMarkerToMap(Place place, Boolean isBookMarked) {
ArrayList<OverlayItem> items = new ArrayList<>();
Drawable icon = ContextCompat.getDrawable(getContext(), getIconFor(place, isBookMarked));
GeoPoint point = new GeoPoint(place.location.getLatitude(), place.location.getLongitude());
OverlayItem item = new OverlayItem(place.name,
containsParentheses(place.getLongDescription()) ? getTextBetweenParentheses(
place.getLongDescription()) : place.getLongDescription(), point);
item.setMarker(icon);
items.add(item);
ItemizedOverlayWithFocus overlay = new ItemizedOverlayWithFocus(items,
new OnItemGestureListener<OverlayItem>() {
@Override
public boolean onItemSingleTapUp(int index, OverlayItem item) {
passInfoToSheet(place);
hideBottomSheet();
if (clickedMarkerPlace != null) {
removeMarker(clickedMarkerPlace);
addMarkerToMap(clickedMarkerPlace, isClickedMarkerBookmarked);
}
clickedMarkerPlace = place;
isClickedMarkerBookmarked = isBookMarked;
bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
return true;
}
@Override
public boolean onItemLongPress(int index, OverlayItem item) {
return false;
}
}, getContext());
overlay.setFocusItemsOnTap(true);
binding.map.getOverlays().add(overlay); // Add the overlay to the map
Marker marker = new Marker(binding.map);
marker.setPosition(point);
marker.setIcon(icon);
marker.setTextLabelFontSize(40);
marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_TOP);
marker.setOnMarkerClickListener((marker1, mapView) -> {
if (clickedMarker != null) {
clickedMarker.closeInfoWindow();
}
clickedMarker = marker1;
binding.bottomSheetDetails.dataCircularProgress.setVisibility(View.VISIBLE);
binding.bottomSheetDetails.icon.setVisibility(View.GONE);
binding.bottomSheetDetails.wikiDataLl.setVisibility(View.GONE);
getPlaceData(place.getWikiDataEntityId(), place, marker1);
bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
return true;
});
binding.map.getOverlays().add(marker);
}
/**
@ -1808,46 +1821,35 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
* locations.
*/
private void addMarkersToMap(List<BaseMarker> nearbyBaseMarkers) {
ArrayList<OverlayItem> items = new ArrayList<>();
for (int i = 0; i < nearbyBaseMarkers.size(); i++) {
Drawable icon = ContextCompat.getDrawable(getContext(),
getIconFor(nearbyBaseMarkers.get(i).getPlace(), false));
GeoPoint point = new GeoPoint(
nearbyBaseMarkers.get(i).getPlace().location.getLatitude(),
nearbyBaseMarkers.get(i).getPlace().location.getLongitude());
OverlayItem item = new OverlayItem(nearbyBaseMarkers.get(i).getPlace().name,
containsParentheses(nearbyBaseMarkers.get(i).getPlace().getLongDescription())
? getTextBetweenParentheses(
nearbyBaseMarkers.get(i).getPlace().getLongDescription())
: nearbyBaseMarkers.get(i).getPlace().getLongDescription(),
point);
item.setMarker(icon);
items.add(item);
Marker marker = new Marker(binding.map);
marker.setPosition(point);
marker.setIcon(icon);
marker.setTextLabelFontSize(40);
marker.setId(String.valueOf(i));
marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_TOP);
marker.setOnMarkerClickListener((marker1, mapView) -> {
marker1.showInfoWindow();
if (clickedMarker != null) {
clickedMarker.closeInfoWindow();
}
clickedMarker = marker1;
int index = Integer.parseInt(marker1.getId());
Place place = nearbyBaseMarkers.get(index).getPlace();
binding.bottomSheetDetails.dataCircularProgress.setVisibility(View.VISIBLE);
binding.bottomSheetDetails.icon.setVisibility(View.GONE);
binding.bottomSheetDetails.wikiDataLl.setVisibility(View.GONE);
getPlaceData(place.getWikiDataEntityId(), place, marker1);
bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
return true;
});
binding.map.getOverlays().add(marker);
}
ItemizedOverlayWithFocus overlay = new ItemizedOverlayWithFocus(items,
new OnItemGestureListener<OverlayItem>() {
@Override
public boolean onItemSingleTapUp(int index, OverlayItem item) {
final Place place = nearbyBaseMarkers.get(index).getPlace();
passInfoToSheet(place);
hideBottomSheet();
if (clickedMarkerPlace != null) {
removeMarker(clickedMarkerPlace);
addMarkerToMap(clickedMarkerPlace, isClickedMarkerBookmarked);
}
clickedMarkerPlace = place;
isClickedMarkerBookmarked = false;
bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
return true;
}
@Override
public boolean onItemLongPress(int index, OverlayItem item) {
return false;
}
}, getContext());
overlay.setFocusItemsOnTap(true);
binding.map.getOverlays().add(overlay);
}
/**
@ -1876,22 +1878,6 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
return input.contains("(") || input.contains(")");
}
private void removeMarker(Place place){
List<Overlay> overlays = binding.map.getOverlays();
for (int i = 0; i < overlays.size();i++){
if (overlays.get(i) instanceof ItemizedOverlayWithFocus){
ItemizedOverlayWithFocus item = (ItemizedOverlayWithFocus)overlays.get(i);
OverlayItem overlayItem = item.getItem(0);
fr.free.nrw.commons.location.LatLng diffLatLang = new fr.free.nrw.commons.location.LatLng(overlayItem.getPoint().getLatitude(),overlayItem.getPoint().getLongitude(),100);
if (place.location.getLatitude() == overlayItem.getPoint().getLatitude() && place.location.getLongitude() == overlayItem.getPoint().getLongitude()){
binding.map.getOverlays().remove(i);
binding.map.invalidate();
break;
}
}
}
}
@Override
public void recenterMap(fr.free.nrw.commons.location.LatLng currentLatLng) {
// if user has denied permission twice, then show dialog
@ -2210,9 +2196,8 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
binding.map.getOverlays().add(new MapEventsOverlay(new MapEventsReceiver() {
@Override
public boolean singleTapConfirmedHelper(GeoPoint p) {
if (clickedMarkerPlace != null) {
removeMarker(clickedMarkerPlace);
addMarkerToMap(clickedMarkerPlace, isClickedMarkerBookmarked);
if (clickedMarker != null) {
clickedMarker.closeInfoWindow();
} else {
Timber.e("CLICKED MARKER IS NULL");
}

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
@ -19,34 +20,43 @@
android:gravity="center_vertical"
>
<ProgressBar
android:id="@+id/dataCircularProgress"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageView
android:id="@+id/icon"
android:layout_width="@dimen/dimen_40"
android:layout_height="@dimen/dimen_40"
android:layout_marginLeft="@dimen/standard_gap">
</ImageView>
android:id="@+id/icon"
android:layout_width="@dimen/dimen_40"
android:layout_height="@dimen/dimen_40"
android:layout_marginLeft="@dimen/standard_gap"
android:visibility="gone"></ImageView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="@dimen/standard_gap"
android:layout_marginRight="@dimen/standard_gap">
android:id="@+id/wikiDataLl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/standard_gap"
android:layout_marginRight="@dimen/standard_gap"
android:orientation="vertical"
tools:visibility="gone">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginRight="50dp"
android:maxLines="2"
android:ellipsize="end"
/>
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:ellipsize="end"
android:maxLines="2"
android:textSize="16sp" />
<TextView
android:id="@+id/category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp" />
android:id="@+id/category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<View

View file

@ -818,4 +818,5 @@ Upload your first media by tapping on the add button.</string>
</plurals>
<string name="multiple_files_depiction">Please remember that all images in a multi-upload get the same categories and depictions. If the images do not share depictions and categories, please perform several separate uploads.</string>
<string name="multiple_files_depiction_header">Note about multi-uploads</string>
<string name="could_not_load_place_data">Could not load place data</string>
</resources>

View file

@ -0,0 +1,60 @@
SELECT
?item
(SAMPLE(?label) AS ?label)
(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 {
wd:${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)
}
# 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

View file

@ -1,16 +1,9 @@
SELECT
?item
(SAMPLE(?location) as ?location)
(SAMPLE(?label) AS ?label)
(SAMPLE(?description) AS ?description)
(SAMPLE(?class) AS ?class)
(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 {
# Around given location
SERVICE wikibase:box {
@ -23,34 +16,9 @@ WHERE {
?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://${LANG}.wikipedia.org/>.
}
# Get Commons article
OPTIONAL {
?commonsArticle schema:about ?item.
?commonsArticle schema:isPartOf <https://commons.wikimedia.org/>.
}
# Labels and descriptions
SERVICE wikibase:label {
bd:serviceParam wikibase:language "${LANG},en,fr,de,es,ja,ru,it,zh,pt,ar,fa,pl,nl,id,uk,he,sv,cs,ko,vi,ca,no,fi,hu,tr,th,hi,bn,ceb,ro,sw,kk,da,eo,sr,lt,sk,bg,sl,eu,et,hr,ms,el,arz,ur,ta,te,nn,gl,az,af,bs,be,ml,ka,is,sq,uz,la,br,mk,lv,azb,mr,sh,tl,cy,ckb,ast,be-tarask,zh-yue,hy,pa,as,my,kn,ne,si,tt,ha,war,zh-min-nan,vo,min,lmo,ht,lb,gu,tg,sco,ku,new,bpy,nds,io,pms,su,oc,jv,nap,ba,scn,wa,bar,an,ksh,szl,fy,frr,als,ia,ga,yi,mg,gd,vec,ce,sa,mai,xmf,sd,wuu,mrj,mhr,km,roa-tara,am,roa-rup,map-bms,bh,mnw,shn,bcl,co,cv,dv,nds-nl,fo,hif,fur,gan,glk,hak,ilo,pam,csb,avk,lij,li,gv,mi,mt,nah,nrm,se,nov,qu,os,pi,pag,ps,pdc,rm,bat-smg,sc,to,tk,hsb,fiu-vro,vls,yo,diq,zh-classical,frp,lad,kw,mn,haw,ang,ln,ie,wo,tpi,ty,crh,nv,jbo,ay,pcd,zea,eml,ky,ig,or,cbk-zam,kg,arc,rmy,ab,gn,so,kab,ug,stq,udm,ext,mzn,pap,cu,sah,tet,sn,lo,pnb,iu,na,got,bo,dsb,chr,cdo,om,sm,ee,ti,av,bm,zu,pnt,cr,pih,ss,ve,bi,rw,ch,xh,kl,ik,bug,dz,ts,tn,kv,tum,xal,st,tw,bxr,ak,ny,fj,lbe,za,ks,ff,lg,sg,rn,chy,mwl,lez,bjn,gom,tyv,vep,nso,kbd,ltg,rue,pfl,gag,koi,krc,ace,olo,kaa,mdf,myv,srn,ady,jam,tcy,dty,atj,kbp,din,lfn,gor,inh,sat,hyw,nqo,ban,szy,awa,ary,lld,smn,skr,mad,dag,shi,nia,ki,gcr".
?item rdfs:label ?label.
?item schema:description ?description.
?class rdfs:label ?classLabel.
}
}
GROUP BY ?item

View file

@ -1,16 +1,9 @@
SELECT
?item
(SAMPLE(?location) as ?location)
(SAMPLE(?label) AS ?label)
(SAMPLE(?description) AS ?description)
(SAMPLE(?class) AS ?class)
(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)
(SAMPLE(?monument) AS ?monument)
WHERE {
# Around given location
@ -24,28 +17,10 @@ WHERE {
?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://${LANG}.wikipedia.org/>.
}
# Get Commons article
OPTIONAL {
?commonsArticle schema:about ?item.
?commonsArticle schema:isPartOf <https://commons.wikimedia.org/>.
}
# Wiki Loves Monuments
OPTIONAL {?item p:P1435 ?monument}
OPTIONAL {?item p:P2186 ?monument}
@ -57,12 +32,5 @@ WHERE {
OPTIONAL {?item p:P5694 ?monument}
OPTIONAL {?item p:P3426 ?monument}
# Labels and descriptions
SERVICE wikibase:label {
bd:serviceParam wikibase:language "${LANG},en,fr,de,es,ja,ru,it,zh,pt,ar,fa,pl,nl,id,uk,he,sv,cs,ko,vi,ca,no,fi,hu,tr,th,hi,bn,ceb,ro,sw,kk,da,eo,sr,lt,sk,bg,sl,eu,et,hr,ms,el,arz,ur,ta,te,nn,gl,az,af,bs,be,ml,ka,is,sq,uz,la,br,mk,lv,azb,mr,sh,tl,cy,ckb,ast,be-tarask,zh-yue,hy,pa,as,my,kn,ne,si,tt,ha,war,zh-min-nan,vo,min,lmo,ht,lb,gu,tg,sco,ku,new,bpy,nds,io,pms,su,oc,jv,nap,ba,scn,wa,bar,an,ksh,szl,fy,frr,als,ia,ga,yi,mg,gd,vec,ce,sa,mai,xmf,sd,wuu,mrj,mhr,km,roa-tara,am,roa-rup,map-bms,bh,mnw,shn,bcl,co,cv,dv,nds-nl,fo,hif,fur,gan,glk,hak,ilo,pam,csb,avk,lij,li,gv,mi,mt,nah,nrm,se,nov,qu,os,pi,pag,ps,pdc,rm,bat-smg,sc,to,tk,hsb,fiu-vro,vls,yo,diq,zh-classical,frp,lad,kw,mn,haw,ang,ln,ie,wo,tpi,ty,crh,nv,jbo,ay,pcd,zea,eml,ky,ig,or,cbk-zam,kg,arc,rmy,ab,gn,so,kab,ug,stq,udm,ext,mzn,pap,cu,sah,tet,sn,lo,pnb,iu,na,got,bo,dsb,chr,cdo,om,sm,ee,ti,av,bm,zu,pnt,cr,pih,ss,ve,bi,rw,ch,xh,kl,ik,bug,dz,ts,tn,kv,tum,xal,st,tw,bxr,ak,ny,fj,lbe,za,ks,ff,lg,sg,rn,chy,mwl,lez,bjn,gom,tyv,vep,nso,kbd,ltg,rue,pfl,gag,koi,krc,ace,olo,kaa,mdf,myv,srn,ady,jam,tcy,dty,atj,kbp,din,lfn,gor,inh,sat,hyw,nqo,ban,szy,awa,ary,lld,smn,skr,mad,dag,shi,nia,ki,gcr".
?item rdfs:label ?label.
?item schema:description ?description.
?class rdfs:label ?classLabel.
}
}
GROUP BY ?item