diff --git a/app/src/main/resources/queries/monuments_query.rq b/app/src/main/resources/queries/monuments_query.rq deleted file mode 100644 index f7b7621fa..000000000 --- a/app/src/main/resources/queries/monuments_query.rq +++ /dev/null @@ -1,60 +0,0 @@ -SELECT - (SAMPLE(?location) as ?location) - ?item - (SAMPLE(COALESCE(?itemLabelPreferredLanguage, ?itemLabelAnyLanguage)) as ?label) - (SAMPLE(COALESCE(?itemDescriptionPreferredLanguage, ?itemDescriptionAnyLanguage, "?")) as ?description) - (SAMPLE(?classId) as ?class) - (SAMPLE(COALESCE(?classLabelPreferredLanguage, ?classLabelAnyLanguage, "?")) as ?classLabel) - (SAMPLE(COALESCE(?icon0, ?icon1)) as ?icon) - ?wikipediaArticle - ?commonsArticle - (SAMPLE(?commonsCategory) as ?commonsCategory) - (SAMPLE(?pic) as ?pic) - WHERE { - # Around given location... - SERVICE wikibase:around { - ?item wdt:P625 ?location. - bd:serviceParam wikibase:center "Point(${LONG} ${LAT})"^^geo:wktLiteral. - bd:serviceParam wikibase:radius "${RAD}" . # Radius in kilometers. - } - - { ?item p:P1435 ?monument } UNION { ?item p:P2186 ?monument } UNION { ?item p:P1459 ?monument } UNION { ?item p:P1460 ?monument } UNION { ?item p:P1216 ?monument } UNION { ?item p:P709 ?monument } UNION { ?item p:P718 ?monument } UNION { ?item p:P5694 ?monument } - - # Get Commons category (P373) - OPTIONAL { ?item wdt:P373 ?commonsCategory. } - - # Get (P18) - OPTIONAL { ?item wdt:P18 ?pic. } - - # 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) = "${LANG}")} - OPTIONAL {?item rdfs:label ?itemLabelAnyLanguage} - - # 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 } - - # 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 ?classId. - OPTIONAL {?classId rdfs:label ?classLabelPreferredLanguage. FILTER (lang(?classLabelPreferredLanguage) = "")} - OPTIONAL {?classId rdfs:label ?classLabelAnyLanguage} - - OPTIONAL { - ?wikipediaArticle schema:about ?item ; - schema:isPartOf . - } - OPTIONAL { - ?wikipediaArticle schema:about ?item ; - schema:isPartOf . - SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } - } - - OPTIONAL { - ?commonsArticle schema:about ?item ; - schema:isPartOf . - SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } - } - } - } - GROUP BY ?item ?wikipediaArticle ?commonsArticle \ No newline at end of file diff --git a/app/src/main/resources/queries/nearby_query.rq b/app/src/main/resources/queries/nearby_query.rq index e9648d20e..36da97374 100644 --- a/app/src/main/resources/queries/nearby_query.rq +++ b/app/src/main/resources/queries/nearby_query.rq @@ -1,66 +1,56 @@ SELECT - (SAMPLE(?location) as ?location) - ?item - (SAMPLE(COALESCE(?itemLabelPreferredLanguage, ?itemLabelAnyLanguage)) as ?label) - (SAMPLE(COALESCE(?itemDescriptionPreferredLanguage, ?itemDescriptionAnyLanguage, "?")) as ?description) - (SAMPLE(?classId) as ?class) - (SAMPLE(COALESCE(?classLabelPreferredLanguage, ?classLabelAnyLanguage, "?")) as ?classLabel) - (SAMPLE(COALESCE(?icon0, ?icon1)) as ?icon) - ?wikipediaArticle - ?commonsArticle - (SAMPLE(?commonsCategory) as ?commonsCategory) - (SAMPLE(?pic) as ?pic) - (SAMPLE(?destroyed) as ?destroyed) - (SAMPLE(?endTime) as ?endTime) - WHERE { - # Around given location... - SERVICE wikibase:around { - ?item wdt:P625 ?location. - bd:serviceParam wikibase:center "Point(${LONG} ${LAT})"^^geo:wktLiteral. - bd:serviceParam wikibase:radius "${RAD}" . # Radius in kilometers. - } + ?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:around { + ?item wdt:P625 ?location. + bd:serviceParam wikibase:center "Point(${LONG} ${LAT})"^^geo:wktLiteral. # Longitude latitude + bd:serviceParam wikibase:radius "${RAD}". # Radius in kilometers. + } - # 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) = "${LANG}")} - OPTIONAL {?item rdfs:label ?itemLabelAnyLanguage} + OPTIONAL { + ?item p:P31/ps:P31 ?class. + } - # 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 } + # Get picture + OPTIONAL {?item wdt:P18 ?pic} - # Get Commons category (P373) - OPTIONAL { ?item wdt:P373 ?commonsCategory. } + # Get existence + OPTIONAL {?item wdt:P576 ?destroyed} + OPTIONAL {?item wdt:P582 ?endTime} - # Get (P18) - OPTIONAL { ?item wdt:P18 ?pic. } + # Get Commons category + OPTIONAL {?item wdt:P373 ?commonsCategory} - # Get (P576) - OPTIONAL { ?item wdt:P576 ?destroyed. } + # Get Wikipedia article + OPTIONAL { + ?wikipediaArticle schema:about ?item. + ?wikipediaArticle schema:isPartOf . + } - # Get (P582) - OPTIONAL { ?item wdt:P582 ?endTime. } + # Get Commons article + OPTIONAL { + ?commonsArticle schema:about ?item. + ?commonsArticle schema:isPartOf . + } - # 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 ?classId. - OPTIONAL {?classId rdfs:label ?classLabelPreferredLanguage. FILTER (lang(?classLabelPreferredLanguage) = "${LANG}")} - OPTIONAL {?classId rdfs:label ?classLabelAnyLanguage} - - OPTIONAL { - ?wikipediaArticle schema:about ?item ; - schema:isPartOf . - } - OPTIONAL { - ?wikipediaArticle schema:about ?item ; - schema:isPartOf . - SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } - } - - OPTIONAL { - ?commonsArticle schema:about ?item ; - schema:isPartOf . - SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } - } - } - } - GROUP BY ?item ?wikipediaArticle ?commonsArticle \ No newline at end of file + # 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 \ No newline at end of file diff --git a/app/src/main/resources/queries/nearby_query_monuments.rq b/app/src/main/resources/queries/nearby_query_monuments.rq index 420d23591..aca8116a8 100644 --- a/app/src/main/resources/queries/nearby_query_monuments.rq +++ b/app/src/main/resources/queries/nearby_query_monuments.rq @@ -1,71 +1,67 @@ SELECT - (SAMPLE(?location) as ?location) - ?item - (SAMPLE(COALESCE(?itemLabelPreferredLanguage, ?itemLabelAnyLanguage)) as ?label) - (SAMPLE(COALESCE(?itemDescriptionPreferredLanguage, ?itemDescriptionAnyLanguage, "?")) as ?description) - (SAMPLE(?classId) as ?class) - (SAMPLE(COALESCE(?classLabelPreferredLanguage, ?classLabelAnyLanguage, "?")) as ?classLabel) - (SAMPLE(COALESCE(?icon0, ?icon1)) as ?icon) - ?wikipediaArticle - ?commonsArticle - (SAMPLE(?commonsCategory) as ?commonsCategory) - (SAMPLE(?pic) as ?pic) - (SAMPLE(?destroyed) as ?destroyed) - (SAMPLE(?endTime) as ?endTime) - (SAMPLE(?monument) as ?monument) - WHERE { - # Around given location... - SERVICE wikibase:around { - ?item wdt:P625 ?location. - bd:serviceParam wikibase:center "Point(${LONG} ${LAT})"^^geo:wktLiteral. - bd:serviceParam wikibase:radius "${RAD}" . # Radius in kilometers. - } + ?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 + SERVICE wikibase:around { + ?item wdt:P625 ?location. + bd:serviceParam wikibase:center "Point(${LONG} ${LAT})"^^geo:wktLiteral. # Longitude latitude + bd:serviceParam wikibase:radius "${RAD}". # Radius in kilometers. + } - OPTIONAL { - { ?item p:P1435 ?monument } UNION { ?item p:P2186 ?monument } UNION { ?item p:P1459 ?monument } UNION { ?item p:P1460 ?monument } UNION { ?item p:P1216 ?monument } UNION { ?item p:P709 ?monument } UNION { ?item p:P718 ?monument } UNION { ?item p:P5694 ?monument } - } + OPTIONAL { + ?item p:P31/ps:P31 ?class. + } - # 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) = "${LANG}")} - OPTIONAL {?item rdfs:label ?itemLabelAnyLanguage} + # Get picture + OPTIONAL {?item wdt:P18 ?pic} - # 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 } + # Get existence + OPTIONAL {?item wdt:P576 ?destroyed} + OPTIONAL {?item wdt:P582 ?endTime} - # Get Commons category (P373) - OPTIONAL { ?item wdt:P373 ?commonsCategory. } + # Get Commons category + OPTIONAL {?item wdt:P373 ?commonsCategory} - # Get (P18) - OPTIONAL { ?item wdt:P18 ?pic. } + # Get Wikipedia article + OPTIONAL { + ?wikipediaArticle schema:about ?item. + ?wikipediaArticle schema:isPartOf . + } - # Get (P576) - OPTIONAL { ?item wdt:P576 ?destroyed. } + # Get Commons article + OPTIONAL { + ?commonsArticle schema:about ?item. + ?commonsArticle schema:isPartOf . + } - # Get (P582) - OPTIONAL { ?item wdt:P582 ?endTime. } + # Wiki Loves Monuments + OPTIONAL {?item p:P1435 ?monument} + OPTIONAL {?item p:P2186 ?monument} + OPTIONAL {?item p:P1459 ?monument} + OPTIONAL {?item p:P1460 ?monument} + OPTIONAL {?item p:P1216 ?monument} + OPTIONAL {?item p:P709 ?monument} + OPTIONAL {?item p:P718 ?monument} + OPTIONAL {?item p:P5694 ?monument} - # 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 ?classId. - OPTIONAL {?classId rdfs:label ?classLabelPreferredLanguage. FILTER (lang(?classLabelPreferredLanguage) = "${LANG}")} - OPTIONAL {?classId rdfs:label ?classLabelAnyLanguage} - - OPTIONAL { - ?wikipediaArticle schema:about ?item ; - schema:isPartOf . - } - OPTIONAL { - ?wikipediaArticle schema:about ?item ; - schema:isPartOf . - SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } - } - - OPTIONAL { - ?commonsArticle schema:about ?item ; - schema:isPartOf . - SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } - } - } - } - GROUP BY ?item ?wikipediaArticle ?commonsArticle \ No newline at end of file + # 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 \ No newline at end of file