User:Pere prlpz

From Wikidata
Jump to navigation Jump to search
# tipus de municipis
SELECT ?tipus ?tipusLabel WHERE {
  ?tipus wdt:P279* wd:Q15284.
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en" } .
}
Try it!
# gengants
SELECT ?item ?itemLabel ?lloc ?llocLabel ?estatLabel ?imatge ?representa ?representaLabel ?massa {
  {
    SELECT * {
      ?item wdt:P31 wd:Q340069 .
      OPTIONAL {?item wdt:P131 ?lloc}
      OPTIONAL {?item wdt:P17 ?estat}
      OPTIONAL {?item wdt:P180 ?representa}
      OPTIONAL {?item wdt:P18 ?imatge}
      OPTIONAL {?item wdt:P2067 ?massa}
    } 
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "ca,en,de,fr,ja,es,ru,pt,it,zh,fa,ar,pl,nl,uk,tr,id,he,cs,sv,hu,fi,vi,ko,el,hi,bn,no,ca,ro,th,da,sr,bg,az,ms,et,uz,hr,sk,eu,hy,sl,lt,eo,ta,kk,lv,be,kn,sq,ur,mk" .
  }
}
Try it!
# mamífers amb article
SELECT DISTINCT ?sitelink ?itemLabel ?distincioLabel WHERE {
  ?item wdt:P31 wd:Q16521.
  ?item wdt:P171* wd:Q7377.
  ?sitelink schema:isPartOf <https://ca.wikipedia.org/>;
     schema:about ?item.
OPTIONAL {?sitelink wikibase:badge ?distincio.} # Sitelink is badged 
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca" } .
} ORDER BY ?itemLabel
Try it!
# mamífers segons classificació de l'article
SELECT DISTINCT ?distincioLabel (COUNT(DISTINCT(?sitelink)) AS ?numArticles)  WHERE {
  ?item wdt:P31 wd:Q16521.
  ?item wdt:P171* wd:Q7377.
  ?sitelink schema:isPartOf <https://ca.wikipedia.org/>;
     schema:about ?item.
OPTIONAL {?sitelink wikibase:badge ?distincio.} # Sitelink is badged 
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca" } .
} 
GROUP BY ?distincioLabel
Try it!
# Municipis catalans més banyats
SELECT ?lloc ?llocLabel (COUNT(DISTINCT(?aigua)) AS ?totaigua) WHERE {
  ?lloc wdt:P31 wd:Q33146843.
?lloc wdt:P206 ?aigua .
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr".}   
}
GROUP BY ?lloc ?llocLabel
ORDER BY DESC(?totaigua) ?llocLabel
Try it!
# Coses que banyen més municipis catalans
SELECT ?aigua ?aiguaLabel (COUNT(DISTINCT(?lloc)) AS ?totllocs) WHERE {
  ?lloc wdt:P31 wd:Q33146843.
?lloc wdt:P206 ?aigua .
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr".}   
}
GROUP BY ?aigua ?aiguaLabel
ORDER BY DESC(?totllocs) ?aiguaLabel
Try it!
# Esportistes per nombre de sitelinks
SELECT DISTINCT ?person ?personLabel ?sitelinks
WITH {
  SELECT *
  WHERE {
    ?person wdt:P31 wd:Q5.
    ?person wdt:P106/wdt:P279* wd:Q2066131.
    ?person wikibase:sitelinks ?sitelinks.
    #FILTER (?sitelinks  > 110)
  }
  ORDER BY desc(?sitelinks)
  LIMIT 100
} AS %i
WHERE {
  INCLUDE %i
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}
ORDER BY desc(?sitelinks)
Try it!
# Municipis banyats
SELECT ?mun ?munLabel ?layer ?layerLabel ?coord WHERE {
  ?mun wdt:P31 wd:Q33146843.
  OPTIONAL {?mun wdt:P206 ?layer.}
  ?mun wdt:P625 ?coord.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ca" }
}
#defaultView:Map
Try it!
# xarxa de subclasses de centre educatiu a monestirs
SELECT DISTINCT ?classe ?classeLabel ?classepare ?classepareLabel
WITH { SELECT ?classe WHERE { ?classe wdt:P279* wd:Q5341295 . } } AS %1
WITH { SELECT ?classe WHERE { wd:Q44613 wdt:P279* ?classe. } } AS %2
WHERE {
  INCLUDE %1
  INCLUDE %2
  ?classe wdt:P279 ?classepare.
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,an,eu" .
  }
}
#defaultView:Graph
Try it!
#prototipus de la query de les llistes de topònims amb UNION (topònims que són al Papiol o que banyen el Papiol)
SELECT ?item ?itemLabel WHERE {   
  {
  ?item wdt:P17 wd:Q29.
  ?item wdt:P131+ wd:Q15631.
  }
  UNION
  {wd:Q15631 wdt:P206 ?item}
  MINUS { ?item wdt:P31/wdt:P279* wd:Q7075. }
  MINUS { ?item wdt:P31/wdt:P279* wd:Q5341295. 
         MINUS {?item wdt:P31/wdt:P279* wd:Q811979}
        }
    SERVICE wikibase:label {bd:serviceParam wikibase:language "ca".}
  }
Try it!
# coses de Chicago amb l'altura convertida a metres
SELECT ?item ?itemLabel ?inst ?instLabel ?altura ?N_value ?N_unitLabel ?data 
WHERE {
  ?item wdt:P131 wd:Q1297.
  ?item wdt:P31 ?inst.
  ?item wdt:P2048 ?altura.
    ?item p:P2048 ?statement . # height statement

  ?statement psv:P2048 ?statement2 . # values as entered
  ?statement2 wikibase:quantityAmount ?value .
  ?statement2 wikibase:quantityUnit ?unit .
  
  ?statement psn:P2048 ?statement3 . # normalised values
  ?statement3 wikibase:quantityAmount ?N_value .
  ?statement3 wikibase:quantityUnit ?N_unit .

  OPTIONAL {?item wdt:P571 ?data}
    SERVICE wikibase:label { bd:serviceParam wikibase:language "ca, en, fr, ceb" }
}
Try it!
# tots els valors d'ocupació d'un personatge, inclosos tots els rangs
SELECT ?item ?itemLabel WHERE {
  wd:Q42025 p:P106 ?st.
  ?st ps:P106 ?item.
  SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it,ca,en,es,an,eu,pl,sv,ceb" .
}        
}
Try it!
# substitut local per Wikishootme
SELECT ?place ?placeLabel ?location ?layerLabel ?foto 
WHERE
{
  wd:Q15385 wdt:P625 ?loc . #lloc central
  SERVICE wikibase:around {
      ?place wdt:P625 ?location .
      bd:serviceParam wikibase:center ?loc .
      bd:serviceParam wikibase:radius "26" .
  }
  OPTIONAL {    ?place wdt:P31 ?layer  }
  OPTIONAL {    ?place wdt:P18 ?foto  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ca, en, fr, ceb" }
} 
#defaultView:Map
Try it!
# lakes in Italy without P131
SELECT ?item ?itemLabel ?coord
WHERE {
?item wdt:P17 wd:Q38.
  ?item wdt:P625 ?coord .
  ?item wdt:P31/wdt:P279* wd:Q23397.
  MINUS {?item wdt:P131 []}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it,ca,en,es,an,eu,pl,sv,ceb" .
}
}
#defaultView:Map
Try it!
#cementiris i fars de Catalunya (mostra innecessàriament redundant de UNION i ?layer)
SELECT DISTINCT ?item ?municipi ?itemLabel ?municipiLabel ?coord ?layer
  WHERE {
    {?item wdt:P17 wd:Q29.
    ?item wdt:P31/wdt:P279* wd:Q39614.
    ?item wdt:P131* ?municipi.
    ?municipi wdt:P31 wd:Q33146843.
    OPTIONAL {?item wdt:P625 ?coord}
    VALUES ?layer {"1"}
    }
    UNION
    {?item wdt:P17 wd:Q29.
    ?item wdt:P31/wdt:P279* wd:Q39715.
    ?item wdt:P131* ?municipi.
    ?municipi wdt:P31 wd:Q33146843.
    OPTIONAL {?item wdt:P625 ?coord}
    VALUES ?layer {"2"}
    }
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "ca" .
        }
  }
#defaultView:Map
Try it!
#cementiris de Catalunya
SELECT DISTINCT ?item ?municipi ?itemLabel ?municipiLabel?coord
  WHERE {
    ?item wdt:P17 wd:Q29.
    ?item wdt:P31/wdt:P279* wd:Q39614.
    ?item wdt:P131* ?municipi.
    ?municipi wdt:P31 wd:Q33146843.
    OPTIONAL {?item wdt:P625 ?coord}
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "ca" .
        }
  }
Try it!
# items a 25km de Kasterlee amb article i però sense foto
SELECT DISTINCT ?place ?placeLabel ?location ?dist ?article
WHERE
{
  wd:Q725029 wdt:P625 ?loc . #lloc central
  SERVICE wikibase:around {
      ?place wdt:P625 ?location .
      bd:serviceParam wikibase:center ?loc .
      bd:serviceParam wikibase:radius "25" .
  }
 ?article schema:about ?place.
  MINUS {?place wdt:P18 []}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ca, nl, en" }
  BIND(geof:distance(?loc, ?location) as ?dist)
} ORDER BY ?dist
Try it!
#Al voltant d'un punt amb coordenades explícites
SELECT ?item ?itemLabel  ?coord WHERE {
  ?item wdt:P17 wd:Q29.
  ?item wdt:P625 ?coord.
  FILTER(geof:distance(?coord, "Point(1.5 41.5)"^^geo:wktLiteral) < 15).   
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" . 
  }
}
#defaultView:Map
Try it!
#Centres educatius de Catalunya segons si tenen foto
SELECT ?item ?itemLabel ?tipusLabel ?coor ?layerLabel ?imatge WHERE {
  VALUES ?tipus { 
   wd:Q111236457 
   wd:Q50359544 
    wd:Q111244857 
   wd:Q111594067 
  }
  ?item wdt:P31 ?tipus.
         
  ?item wdt:P625 ?coor.
  OPTIONAL {?item wdt:P18 ?imatge}
  BIND(BOUND(?imatge) as ?layer)
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
#defaultView:Map
Try it!
#Coses representades a les meves fotos
SELECT DISTINCT ?item ?itemLabel ?layer ?coord ?alias
WHERE {
  ?file (p:P170/pq:P4174) "Pere prlpz".
  ?file wdt:P180 ?item.
    SERVICE <https://query.wikidata.org/sparql> {
      ?item wdt:P31 ?layer.
      ?item wdt:P625 ?coord .
      OPTIONAL{?item rdfs:label ?itemLabel.
              FILTER(LANG(?itemLabel) = "ca").}
      OPTIONAL{?layer rdfs:label ?layerLabel.
              FILTER(LANG(?layerLabel) = "ca").}
    }
}
#defaultView:Map
Try it!
# algunes coses de Barcelona sense barri (o districte)
SELECT DISTINCT  ?item ?itemLabel  ?layer ?layerLabel ?coord WHERE {
  VALUES ?layer {wd:Q721747 wd:Q22808403 wd:Q2175765 wd:Q928830 wd:Q174782 wd:Q79007 wd:Q787113}
  ?item wdt:P31 ?layer.
  ?item wdt:P131+ wd:Q1492.
  ?item wdt:P625 ?coord.
    OPTIONAL {
    ?item wdt:P131+ ?div.
    ?div wdt:P31 wd:Q790344 # barri Q75135432, districte Q790344.
  }
  FILTER (!BOUND(?div))
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" . 
  }
}
#defaultView:Map
Try it!
# coes amb catàleg de l'Ajuntament sense IPAC
SELECT DISTINCT ?item ?itemLabel ?article ?ccat WHERE {
  ?item wdt:P11557 [].
  MINUS {?item wdt:P1600 [].}
  OPTIONAL {
  ?article schema:about ?item.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
}
   OPTIONAL {
     ?item wdt:P373 ?ccat.
   }
   SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de".}
}
Try it!
# coses de Barcelona sense barri (o districte)
SELECT DISTINCT  ?item ?itemLabel  ?layer ?layerLabel ?coord WHERE {
  ?item wdt:P31 ?layer.
  ?item wdt:P131+ wd:Q1492.
  ?item wdt:P625 ?coord.
    OPTIONAL {
    ?item wdt:P131+ ?div.
    ?div wdt:P31 wd:Q75135432 # barri Q75135432, districte Q790344.
  }
  FILTER (!BOUND(?div))
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" . 
  }
}
#defaultView:Map
Try it!
# coses en una el·lipse per posar barri o districte 
SELECT?item ?itemLabel  ?layer ?layerLabel ?coord WHERE {
  ?item wdt:P17 wd:Q29.
  ?item wdt:P131+ wd:Q1492.
  ?item wdt:P31 ?layer.
  ?item wdt:P625 ?coord.
  MINUS {?item wdt:P31 wd:Q15079663}
  MINUS {?item wdt:P31 wd:Q75135432}
  wd:Q30269827 wdt:P625 ?focus1.
  wd:Q113138252 wdt:P625 ?focus2.
  BIND (geof:distance(?coord, ?focus1)+geof:distance(?coord, ?focus2) as ?d).
  FILTER(?d < 1.85).
    OPTIONAL {
    ?item wdt:P131+ ?div.
    ?div wdt:P31 wd:Q75135432 # barri Q75135432, districte Q790344.
  }
  FILTER (!BOUND(?div))
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" . 
  }
}
#defaultView:Map
Try it!
# Hotels d'Espanya amb coordenades sense P131
SELECT ?hotel ?hotelLabel ?coord WHERE {
  ?hotel wdt:P31 wd:Q27686.
  ?hotel wdt:P17 wd:Q29.
  ?hotel wdt:P625 ?coord.
  MINUS {?hotel wdt:P131 []}
    SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" . 
  }
}
#defaultView:Map
Try it!
# coses de Barcelona sense barri ni districte, agrupades per instància
SELECT DISTINCT  ?inst ?instLabel (COUNT(DISTINCT(?item)) AS ?nitems) WHERE {
  ?item wdt:P31 ?inst.
  ?item wdt:P131+ wd:Q1492.
  ?item wdt:P625 ?coord.
    OPTIONAL {
    ?item wdt:P131+ ?districte.
    ?districte wdt:P31 wd:Q790344.
  }
    OPTIONAL {
    ?item wdt:P131+ ?barri.
    ?barri wdt:P31 wd:Q75135432.
  }
  BIND (COALESCE (?barri, ?districte) AS ?div).
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" . 
  }
  FILTER (!BOUND(?div))
}
GROUP BY ?inst ?instLabel
ORDER BY DESC(?nitems) ?instLabel
Try it!
# coses de Barcelona sense barri ni districte
SELECT DISTINCT  ?item ?itemLabel  ?layer ?layerLabel ?coord WHERE {
  ?item wdt:P31 ?layer.
  ?item wdt:P131+ wd:Q1492.
  ?item wdt:P625 ?coord.
    OPTIONAL {
    ?item wdt:P131+ ?districte.
    ?districte wdt:P31 wd:Q790344.
  }
    OPTIONAL {
    ?item wdt:P131+ ?barri.
    ?barri wdt:P31 wd:Q75135432.
  }
  BIND (COALESCE (?barri, ?districte) AS ?div).
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" . 
  }
  FILTER (!BOUND(?div))
}
#defaultView:Map
Try it!
# coses de Barcelona segons el barri o districte
SELECT DISTINCT ?instLabel ?item ?itemLabel  ?layer ?layerLabel ?coord WHERE {
  ?item wdt:P31 ?inst.
  ?item wdt:P131+ wd:Q1492.
  ?item wdt:P625 ?coord.
    OPTIONAL {
    ?item wdt:P131+ ?districte.
    ?districte wdt:P31 wd:Q790344.
  }
    OPTIONAL {
    ?item wdt:P131+ ?barri.
    ?barri wdt:P31 wd:Q75135432.
  }
  BIND (COALESCE (?barri, ?districte) AS ?layer). 
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" . 
  }
}
#defaultView:Map
Try it!
# llistes de llocs de Barcelona
SELECT ?llista ?llistaLabel ?lloc ?llocLabel ?article WHERE {
  ?llista wdt:P31 wd:Q13406463.
  ?llista p:P360 ?statement.
  ?statement pq:P131 ?lloc.
  ?lloc wdt:P131+ wd:Q1492.
  ?article schema:about ?llista.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" . 
  }
}
Try it!
# municipis vandalitzats (Medinyà fals positiu conegut)
SELECT ?municipi ?municipiLabel WHERE {
  ?municipi wdt:P4335 [].
  MINUS {?municipi wdt:P31 wd:Q33146843}
  MINUS {?municipi wdt:P31 wd:Q937876}
  MINUS {?municipi wdt:P31 wd:Q19920968}
  MINUS {?municipi wdt:P31 wd:Q6554043}
   SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" . 
  }
}
Try it!
# monuments de Barcelona segons el districte (Q75135432 pel barri)
SELECT ?instLabel ?item ?itemLabel  ?layer ?layerLabel ?coord WHERE {
  ?item wdt:P1435 [].
  ?item wdt:P31 ?inst.
  ?item wdt:P131+ wd:Q1492.
  ?item wdt:P625 ?coord.
  OPTIONAL {
    ?item wdt:P131+ ?layer.
    ?layer wdt:P31 wd:Q790344.
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" . 
  }
}
#defaultView:Map
Try it!
# coses segons el municipi
SELECT ?instLabel ?item ?itemLabel  ?layer ?layerLabel ?coord WHERE {
  ?item wdt:P17 wd:Q29.
  ?item wdt:P625 ?coord.
  wd:Q85692793 wdt:P625 ?centre.
  FILTER(geof:distance(?coord, ?centre) < 15).
  OPTIONAL {
    ?item wdt:P31 ?inst.
  }
  OPTIONAL {
    ?item wdt:P131* ?layer.
    ?layer wdt:P31 wd:Q33146843.
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" . 
  }
}
#defaultView:Map
Try it!

Posar coses del barrri amb el·lipse: https://petscan.wmflabs.org/?psid=23869488&al_commands=P131%3AQ377070

Per copiar a PetScan, \u002b en comptes de +.

# coses en una el·lipse per posar barri o municipi (però no va al petscan)
SELECT ?inst ?instLabel ?item ?itemLabel  ?layer ?layerLabel ?coord WHERE {
  VALUES ?inst {wd:Q41176 wd:Q16917 wd:Q24354 wd:Q860861 wd:Q11707 wd:Q721747 wd:Q928830 wd:Q1107656 
                          wd:Q3947 wd:Q12317349 wd:Q111594067 wd:Q27686 wd:Q16970 wd:Q35112127 
                          wd:Q1273818 wd:Q41253 wd:Q111236457 wd:Q50359544 wd:Q200764 wd:Q1088552 
                          wd:Q7075 wd:Q483453 wd:Q1007870}.
  ?item wdt:P31 ?inst.
  ?item wdt:P625 ?coord.
  wd:Q99509385 wdt:P625 ?focus1.
  wd:Q113663833 wdt:P625 ?focus2.
  BIND (geof:distance(?coord, ?focus1)+geof:distance(?coord, ?focus2) as ?d).
  FILTER(?d < 2.54).
  OPTIONAL {
    ?item wdt:P131 ?layer.
    ?layer wdt:P31 wd:Q75135432.
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" . 
  }
}
#defaultView:Map
Try it!

Posar barri a partir de punt central: https://petscan.wmflabs.org/?psid=23847296&al_commands=P131%3AQ2442135

# coses centrades per posar barri o municipi
SELECT ?inst ?instLabel ?item ?itemLabel  ?layer ?layerLabel ?coord WHERE {
  VALUES ?inst {wd:Q41176 wd:Q16917 wd:Q24354 wd:Q860861 wd:Q11707 wd:Q721747 wd:Q928830 wd:Q1107656 
                          wd:Q3947 wd:Q12317349 wd:Q111594067 wd:Q27686 wd:Q16970 wd:Q35112127 
                          wd:Q1273818 wd:Q41253 wd:Q111236457 wd:Q50359544 wd:Q200764 wd:Q1088552 
                          wd:Q7075 wd:Q483453 wd:Q1007870}
  ?item wdt:P31 ?inst.
  ?item wdt:P625 ?coord.
  wd:Q85692793 wdt:P625 ?centre.
  FILTER(geof:distance(?coord, ?centre) < .370).
  OPTIONAL {
    ?item wdt:P131 ?layer.
    ?layer wdt:P31 wd:Q75135432.
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" . 
  }
}
#defaultView:Map
Try it!
# coses de Barcelona segons el barri
SELECT ?instLabel ?item ?itemLabel  ?layer ?layerLabel ?coord WHERE {
  ?item wdt:P31 ?inst.
  ?item wdt:P131+ wd:Q1492.
  ?item wdt:P625 ?coord.
  OPTIONAL {
    ?item wdt:P131 ?layer.
    ?layer wdt:P31 wd:Q75135432.
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,de" . 
  }
}
#defaultView:Map
Try it!
# coses amb referències als mapes de patrimoni cultural
SELECT DISTINCT ?item  ?url
WHERE {
  ?item wdt:P17 wd:Q29.
  ?item wdt:P131* ?mun.
  ?mun wdt:P4335 ?idescat.
  ?item p:P131 ?stlloc.
  ?stlloc prov:wasDerivedFrom ?ref.
  ?ref pr:P854 ?url.
  FILTER regex(STR(?url), "patrimonicultural\\.diba\\.cat")
}
Try it!
#muntanyes de Catalunya amb municipi i comarca
SELECT DISTINCT ?item ?municipi ?itemLabel ?municipiLabel ?comarca ?comarcaLabel ?ulls ?llum ?longitud ?any ?coord
  WHERE {
    VALUES ?tipus {wd:Q8502 wd:Q207326}
    VALUES ?tipuscom {wd:Q937876 wd:Q19920968}
    ?item wdt:P17 wd:Q29.
    ?item wdt:P31 ?tipus.
    ?item wdt:P131 ?municipi.
    ?municipi wdt:P31 wd:Q33146843.
    ?municipi wdt:P131 ?comarca.
    ?comarca wdt:P31 ?tipuscom.
    ?comarca wdt:P131* wd:Q5705.
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "ca" .
        }
  }
Try it!
#etiquetes i descripcions ca i en d'items de Catalunya que tenen coordenades
SELECT DISTINCT ?item ?nameca ?nameen ?descca ?descen
WHERE {
  ?item wdt:P17 wd:Q29.
  ?item wdt:P131* wd:Q5705.
  ?item wdt:P625 [].
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca" .
?item rdfs:label ?nameca.
?item schema:description ?descca.
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en".
?item rdfs:label ?nameen.
?item schema:description ?descen.
}
}
#ORDER BY ASC (?name)
#defaultView:Table
Try it!
#Ponts de Catalunya amb algunes dades
SELECT DISTINCT ?item ?municipi ?itemLabel ?municipiLabel ?comarca ?comarcaLabel ?ulls ?llum ?longitud ?any ?coord
  WHERE {
    VALUES ?tipus {wd:Q12280}
    VALUES ?tipuscom {wd:Q937876 wd:Q19920968}
    ?item wdt:P17 wd:Q29.
    ?item wdt:P31/wdt:P279* ?tipus.
    ?item wdt:P131* ?municipi.
    ?municipi wdt:P31 wd:Q33146843.
    ?municipi wdt:P131 ?comarca.
    ?comarca wdt:P31 ?tipuscom.
    ?comarca wdt:P131* wd:Q5705.
    OPTIONAL {?item wdt:P2787 ?llum}
    OPTIONAL {?item wdt:P1314 ?ulls}
    OPTIONAL {?item wdt:P2043 ?longitud}
    OPTIONAL {?item wdt:P571 ?any}
    OPTIONAL {?item wdt:P625 ?coord}
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "ca" .
        }
  }
#defaultView:Map
Try it!
#Les meves imatges de març de 2015
SELECT ?file ?image ?data
WHERE {
  ?file (p:P170/pq:P4174) "Pere prlpz".
  ?file wdt:P571 ?data.
  FILTER("2015-03-01"^^xsd:dateTime <= ?data && ?data < "2015-04-01"^^xsd:dateTime).
  ?file schema:url ?image.
}
ORDER BY ?data
#defaultView:ImageGrid
Try it!
# ponts amb referències amb url
SELECT ?item ?itemLabel ?tipus ?tipusLabel ?mun ?munLabel ?idescat ?url
WHERE {
  VALUES ?tipuspont {wd:Q12280 wd:Q474}
  ?item wdt:P17 wd:Q29.
  ?item wdt:P31 ?tipus.
  ?tipus wdt:P279* ?tipuspont.
  ?item wdt:P131* ?mun.
  ?mun wdt:P4335 ?idescat.
  ?item p:P131 ?stlloc.
  ?stlloc prov:wasDerivedFrom ?ref.
  ?ref pr:P854 ?url.
SERVICE wikibase:label {
bd:serviceParam wikibase:language 'ca,oc,en,es,pl,sv,ceb'.
}
}
Try it!
# ponts amb referències als mapes de patrimoni cultural
SELECT ?item ?itemLabel ?tipus ?tipusLabel 
WHERE {
  VALUES ?tipuspont {wd:Q12280 wd:Q474}
  ?item wdt:P17 wd:Q29.
  ?item wdt:P31 ?tipus.
  ?tipus wdt:P279* ?tipuspont.
  ?item p:P131 ?stlloc.
  ?stlloc prov:wasDerivedFrom ?ref.
  ?ref pr:P248 wd:Q9028374
SERVICE wikibase:label {
bd:serviceParam wikibase:language 'ca,oc,en,es,pl,sv,ceb'.
}
}
Try it!
#coordenades de muntanyes dels Pirineus Orientals
SELECT DISTINCT ?muntanya ?muntanyaLabel ?lat ?lon ?altitud ?coord
WHERE {
  ?muntanya wdt:P31 wd:Q8502.
  ?muntanya wdt:P131* wd:Q12709.
  ?muntanya p:P625 ?coordinate .
  ?muntanya wdt:P625 ?coord.
?coordinate psv:P625 ?coordinate_node .
?coordinate_node wikibase:geoLatitude ?lat .
?coordinate_node wikibase:geoLongitude ?lon .
OPTIONAL {?muntanya wdt:P2044 ?altitud.}
  SERVICE wikibase:label {
bd:serviceParam wikibase:language 'ca' . } 
}
#defaultView:Map
Try it!
# centres educatius de Catalunya per tipus
SELECT DISTINCT ?centre ?centreLabel ?coordinate ?layer ?layerLabel
WITH {
  SELECT ?centre 
WHERE {
  ?centre wdt:P131* wd:Q5705.
 } } AS %1
WHERE {
  INCLUDE %1.
  ?centre wdt:P31/wdt:P279* wd:Q5341295.
  ?centre wdt:P625 ?coordinate.
  ?centre wdt:P31 ?layer
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca,en,es" .
}
}
#defaultView:Map
Try it!
# centres educatius de Barcelona
SELECT DISTINCT ?centre ?centreLabel ?coordinate
WITH {
  SELECT ?centre 
WHERE {
  ?centre wdt:P131* wd:Q1492.
 } } AS %1
WHERE {
  INCLUDE %1.
  ?centre wdt:P31/wdt:P279* wd:Q5341295.
  ?centre wdt:P625 ?coordinate.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca,en,es" .
}
}
#defaultView:Map
Try it!
#Ponts del Túria (nou i vell) amb article
SELECT DISTINCT ?pont ?pontLabel ?article WHERE {
  VALUES ?turia {wd:Q20118 wd:Q2713406}
  ?pont wdt:P31/wdt:P279* wd:Q12280.
  ?pont wdt:P177 ?turia.
  ?article schema:about ?pont.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr".}      
}
Try it!
#Ponts del Duero amb article
SELECT DISTINCT ?pont ?pontLabel ?article WHERE {
  ?pont wdt:P31/wdt:P279* wd:Q12280.
  ?pont wdt:P177 wd:Q14299.
  ?article schema:about ?pont.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr".}      
}
Try it!
#Rius del Llobregat amb article
SELECT ?item ?itemLabel ?desemboca ?article
WHERE {
  ?item wdt:P403* wd:Q31424.
  ?article schema:about ?item.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,an,eu,pl,sv,ceb" .
?item rdfs:label ?itemLabel
}
OPTIONAL {?item wdt:P403 ?desemboca}
}
Try it!
#llista arbitrària de municipis i àrea amb unitats
SELECT ?mun ?munLabel ?stateLabel ?area ?unitLabel WHERE {
  ?mun wdt:P31/wdt:P279 wd:Q15284.
  ?mun wdt:P17 ?state.
  ?mun p:P2046 ?p_area.
  ?p_area psv:P2046 ?psv_area.
  ?psv_area wikibase:quantityAmount ?area.
  ?psv_area wikibase:quantityUnit ?unit . 
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
LIMIT 3000
Try it!
# Persones amb gènere i article
SELECT DISTINCT ?persona ?article ?genere 
WHERE {
  ?persona wdt:P31 wd:Q5.
  ?persona wdt:P21 ?genere.
  ?article schema:about ?persona.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
}
Try it!
# Dones amb article
SELECT DISTINCT ?persona ?personaLabel ?article 
WHERE {
  ?persona wdt:P31 wd:Q5.
  ?persona wdt:P21 wd:Q6581072.
  ?article schema:about ?persona.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ca,oc,en,es,fr". }
}
Try it!
# Navarresos i llocs d'origen, amb article
SELECT DISTINCT ?persona ?personaLabel ?article ?provincia ?provinciaLabel
WHERE {
  ?persona wdt:P31 wd:Q5.
  ?persona wdt:P27 wd:Q29.
  ?lloc wdt:P17 wd:Q29.
  ?provincia wdt:P17 wd:Q29.
  ?provincia wdt:P131* wd:Q4018.
  ?persona wdt:P19 ?lloc.
  ?lloc wdt:P131* ?provincia.
  ?article schema:about ?persona.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ca,oc,en,es,fr". }
}
Try it!
# ponts del País Valencià
SELECT DISTINCT ?edifici ?edificiLabel 
WITH {
  SELECT ?edifici 
WHERE {
  ?edifici wdt:P17 wd:Q29.
  ?edifici wdt:P131* wd:Q5720.
 } } AS %1
WHERE {
  INCLUDE %1.
  ?edifici wdt:P31/wdt:P279* wd:Q12280.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca" .
}
}
Try it!
# Categories de nascuts o relacionats (províncies de la Xina)
SELECT DISTINCT ?lloc ?llocLabel ?cat1 ?categoria1 ?cat2 ?categoria2
WHERE {
    ?lloc wdt:P31 wd:Q1615742.
  OPTIONAL {
    ?lloc wdt:P1464 ?cat1.
    ?lloc wdt:P1792 ?cat2.
  OPTIONAL {
    ?categoria1 schema:about ?cat1.
    ?categoria1 schema:isPartOf <https://ca.wikipedia.org/>.
  }
  OPTIONAL {
    ?categoria2 schema:about ?cat2.
    ?categoria2 schema:isPartOf <https://ca.wikipedia.org/>.
  }
  }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } 
}
ORDER BY ?llocLabel
Try it!
# Llocs d'origen dels indis amb article
SELECT DISTINCT ?persona ?personaLabel ?article ?provincia ?provinciaLabel
WHERE {
  ?persona wdt:P31 wd:Q5.
  ?persona wdt:P27 wd:Q668.
  ?persona wdt:P19 ?lloc.
  ?lloc wdt:P131* ?provincia.
  ?provincia wdt:P17 wd:Q668.
  ?article schema:about ?persona.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ca,oc,en,es,fr". }
}
Try it!
# Nascuts a la Xina per origen, amb article
SELECT DISTINCT ?persona ?personaLabel ?article ?provincia ?provinciaLabel
WHERE {
  ?persona wdt:P31 wd:Q5.
  ?persona wdt:P19 ?lloc.
  ?lloc wdt:P131* ?provincia.
  ?provincia wdt:P17 wd:Q148.
  ?article schema:about ?persona.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ca,oc,en,es,fr". }
}
Try it!
# Francesos nascuts a l'Argèlia francesa, amb article
SELECT DISTINCT ?persona ?personaLabel ?data ?article
WHERE {
  ?persona wdt:P31 wd:Q5.
  ?persona wdt:P27 wd:Q142.
  ?persona wdt:P19 ?lloc.
  ?lloc wdt:P17 wd:Q262.
  ?persona wdt:P569 ?data.
  ?article schema:about ?persona.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ca,oc,en,es,fr". }
  FILTER("1831-01-01"^^xsd:dateTime <= ?data && ?data < "1962-07-03"^^xsd:dateTime).
}
Try it!
# categories de persones
SELECT DISTINCT ?cat ?categoria WHERE {
  ?cat wdt:P31 wd:Q4167836.
  ?cat wdt:P4224 wd:Q5.
  ?categoria schema:about ?cat.
  ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
}
Try it!
# categories principals d'una persona
SELECT ?item ?cat ?categoria WHERE {
  ?item wdt:P31 wd:Q5.
  ?item wdt:P910 ?cat.
  ?categoria schema:about ?cat.
  ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
}
Try it!
# Coses travessades per més ponts
SELECT ?travessa ?travessaLabel (COUNT(DISTINCT(?pont)) AS ?totponts) WHERE {
?pont wdt:P31/wdt:P279* wd:Q12280.
?pont wdt:P177 ?travessa.
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr".}   
}
GROUP BY ?travessa ?travessaLabel
ORDER BY DESC(?totponts) ?travessaLabel
Try it!
# Ponts segons què hi passa
SELECT ?item ?itemLabel ?coord ?layer ?layerLabel WHERE {
VALUES ?catalunya {wd:Q5705 wd:Q12709}
?item wdt:P31/wdt:P279* wd:Q12280.
?item wdt:P131* ?catalunya.
  ?item wdt:P625 ?coord.
  OPTIONAL {?item wdt:P2505 ?layer.}
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr".}   
}
#defaultView:Map
Try it!
# Ponts segons què travessen
SELECT ?item ?itemLabel ?coord ?layer ?layerLabel WHERE {
VALUES ?catalunya {wd:Q5705 wd:Q12709}
?item wdt:P31/wdt:P279* wd:Q12280.
?item wdt:P131* ?catalunya.
  ?item wdt:P625 ?coord.
  OPTIONAL {?item wdt:P177 ?layer.}
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr".}   
}
#defaultView:Map
Try it!
#articles i etiquetes diferents de coses de Barcelona ignorant majúscules i minúscules
SELECT DISTINCT ?item ?article ?label ?titol WHERE {
  ?item wdt:P131 wd:Q1492. # coses de Barcelona (canvieu-ho aquí per altres temes)
  ?article schema:about ?item;
    schema:isPartOf <https://ca.wikipedia.org/>.
  ?article schema:name ?titol.
  ?item rdfs:label ?label.
  FILTER(LANG(?label) = "ca").
  FILTER(UCASE(?label) != UCASE(?titol)).
}
Try it!
#articles i etiquetes de coses de Barcelona
SELECT DISTINCT ?item ?article ?itemLabel ?titol WHERE {
  ?item wdt:P131 wd:Q1492.
  ?article schema:about ?item;
    schema:isPartOf <https://ca.wikipedia.org/>.
  ?article schema:name ?titol.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ca" }
}
Try it!
#llista arbitrària de municipis
SELECT ?municipiLabel ?estatLabel ?poblacio WHERE {
  ?municipi wdt:P31/wdt:P279 wd:Q15284.
  ?municipi wdt:P17 ?estat.
  ?municipi wdt:P1082 ?poblacio.
  ?estat wdt:P31 wd:Q3624078.
 SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
LIMIT 60000
Try it!
# items a 2km de Poblet
SELECT ?place ?placeLabel ?location ?instanceLabel ?dist
WHERE
{
  wd:Q43127815 wdt:P625 ?loc . #lloc central
  SERVICE wikibase:around {
      ?place wdt:P625 ?location .
      bd:serviceParam wikibase:center ?loc .
      bd:serviceParam wikibase:radius "2" .
  }
  OPTIONAL {    ?place wdt:P31 ?instance  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ca, en" }
  BIND(geof:distance(?loc, ?location) as ?dist)
} ORDER BY ?dist
Try it!
#Les meves imatges geolocalitzades
SELECT ?file ?coord ?image
WHERE {
  ?file (p:P170/pq:P4174) "Pere prlpz".
  ?file wdt:P1259 ?coord.
  ?file schema:url ?image.
}
#defaultView:Map
Try it!
# esglésies de Catalunya
SELECT ?edifici ?edificiLabel 
WITH {
  SELECT ?edifici 
WHERE {
  ?edifici wdt:P17 wd:Q29.
  ?edifici wdt:P131* wd:Q5705.
 } } AS %1
WHERE {
  INCLUDE %1.
  ?edifici wdt:P31/wdt:P279* wd:Q16970.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca" .
}
}
Try it!
#BCIN amb precisió
SELECT DISTINCT ?lloc ?llocLabel  ?lat ?lon ?coord ?prec
WHERE {
  ?lloc wdt:P1435 wd:Q1019352.
  ?lloc p:P625 ?coordinate .
  ?lloc wdt:P625 ?coord.
?coordinate psv:P625 ?coordinate_node .
?coordinate_node wikibase:geoLatitude ?lat .
?coordinate_node wikibase:geoLongitude ?lon .
  ?coordinate_node wikibase:geoPrecision ?prec.
  SERVICE wikibase:label {
bd:serviceParam wikibase:language 'ca' . } 
}
ORDER BY DESC(?prec)
Try it!
# edificis de Barcelona
SELECT ?edifici ?edificiLabel
WITH {
  SELECT ?edifici 
WHERE {
  ?edifici wdt:P131* wd:Q1492.
 } } AS %1
WHERE {
  INCLUDE %1.
  ?edifici wdt:P31/wdt:P279* wd:Q41176.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca" .
}
}
Try it!
#articles de peixos i foto de la infotaula
SELECT DISTINCT ?article ?imatge WHERE {
  ?animal (wdt:P171*) wd:Q134681.
  ?article schema:about ?animal;
    schema:isPartOf <https://ca.wikipedia.org/>.
  ?animal wdt:P18 ?imatge.
}
Try it!
#torres de telegrafia òptica
SELECT ?lloc ?llocLabel ?coordinate ?layer
WHERE {
  ?lloc wdt:P31/wdt:P279* wd:Q107128089.
  ?lloc wdt:P625 ?coordinate .
  OPTIONAL{?lloc wdt:P31 ?layer.}
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr".}   
}
#defaultView:Map
Try it!
#escuts que caldria traduir
SELECT ?lloc ?escut ?art ?llocLabel
WHERE {
  ?lloc wdt:P237 ?escut.
 FILTER(NOT EXISTS {
   ?escut rdfs:label ?lang_label.
   FILTER(LANG(?lang_label) = "ca")
 })
    ?art schema:about ?lloc.
    ?art schema:isPartOf <https://ca.wikipedia.org/>.
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es".} 
}
Try it!
# coses de Cervera marcant els monuments, per buscar duplicats
SELECT ?lloc ?llocLabel ?coordinate ?layer
WHERE {
  ?lloc wdt:P131+ wd:Q847011.
           ?lloc wdt:P625 ?coordinate .
  OPTIONAL{?lloc wdt:P1435 ?layer.}
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es".}   
}
#defaultView:Map
Try it!
#Autors de fitxers de Commons que representen alguna masia
SELECT ?file ?username
WITH
{
  SELECT ?item 
  WHERE
  {
    SERVICE <https://query.wikidata.org/sparql>
    {
        ?item wdt:P31 wd:Q585956.
     } 
  }
} AS %get_items
WHERE {
  INCLUDE %get_items
  ?file wdt:P180 ?item.
  ?file (p:P170/pq:P4174) ?username.
}
LIMIT 1000
Try it!
#Fitxers de Commons que representen alguna masia
SELECT ?file
WITH
{
  SELECT ?item 
  WHERE
  {
    SERVICE <https://query.wikidata.org/sparql>
    {
        ?item wdt:P31 wd:Q585956.
     } 
  }
} AS %get_items
WHERE {
  INCLUDE %get_items
  ?file wdt:P180 ?item.
}
LIMIT 1000
Try it!
# Categories d'ocupacions
SELECT DISTINCT ?ocupacio ?ocupacioLabel ?cat ?categoria ?conte ?conteLabel
WHERE {
  ?ocupacio wdt:P31 wd:Q28640.
  ?ocupacio wdt:P910 ?cat.
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
  OPTIONAL{?cat wdt:P4224 ?conte}
  SERVICE wikibase:label {bd:serviceParam wikibase:language "ca" . } 
}
Try it!
# Categories per lloc de mort de llocs d'Espanya i nombre d'articles (1 nivell P131)
SELECT DISTINCT ?lloc ?llocLabel ?cat ?categoria (COUNT(DISTINCT(?persona)) AS ?totpers)
    WHERE {
      ?persona wdt:P20/wdt:P131? ?lloc.
      ?lloc wdt:P17 wd:Q29.
    ?art schema:about ?persona.
    ?art schema:isPartOf <https://ca.wikipedia.org/>.
  OPTIONAL {
    ?lloc wdt:P1465 ?cat.
  OPTIONAL {
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
  }
    }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } 
      }
GROUP BY ?lloc ?cat ?llocLabel ?categoria
ORDER BY DESC(?totpers) ?llocLabel
Try it!
#Mapa de municipis de Catalunya (sense la Vall d'Aran)
SELECT DISTINCT ?municipi ?municipiLabel ?layer ?layerLabel ?lat ?lon ?coord
WHERE {
  ?municipi wdt:P31 wd:Q33146843.
  ?municipi wdt:P131* ?layer.
  ?layer wdt:P31 wd:Q937876.
  ?municipi p:P625 ?coordinate .
  ?municipi wdt:P625 ?coord.
?coordinate psv:P625 ?coordinate_node .
?coordinate_node wikibase:geoLatitude ?lat .
?coordinate_node wikibase:geoLongitude ?lon .
  SERVICE wikibase:label {
bd:serviceParam wikibase:language 'ca' . } 
}
#defaultView:Map
Try it!
#Items amb categoria principal amb categoria de Commons però sense commonscat
SELECT DISTINCT ?lloc ?cat 
WHERE {
  ?lloc wdt:P17 wd:Q29.
  ?lloc wdt:P131* wd:Q5705.
  ?lloc wdt:P910 ?catpral.
  ?cat schema:about ?catpral.
  ?cat schema:isPartOf <https://commons.wikimedia.org/>.
  MINUS {?lloc wdt:P373 []}
}
Try it!
#Coses de Catalunya amb sitelink de Commons però sense Commonscat
SELECT DISTINCT ?lloc ?cat 
WHERE {
  ?lloc wdt:P17 wd:Q29.
  ?lloc wdt:P131* wd:Q5705.
  ?cat schema:about ?lloc.
  ?cat schema:isPartOf <https://commons.wikimedia.org/>.
  MINUS {?lloc wdt:P373 []}
}
Try it!
# Categories per origen de llocs d'Austràlia i nombre d'articles (1 nivell P131)
SELECT DISTINCT ?lloc ?llocLabel ?cat ?categoria ?catnat ?categorianat (COUNT(DISTINCT(?persona)) AS ?totpers)
    WHERE {
      ?persona wdt:P19/wdt:P131? ?lloc.
      ?lloc wdt:P17 wd:Q408.
    ?art schema:about ?persona.
    ?art schema:isPartOf <https://ca.wikipedia.org/>.
  OPTIONAL {
    ?lloc wdt:P1464 ?catnat.
  OPTIONAL {
    ?categorianat schema:about ?catnat.
    ?categorianat schema:isPartOf <https://ca.wikipedia.org/>.
  }
    }
  OPTIONAL {
    ?lloc wdt:P1792 ?cat.
  OPTIONAL {
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
  }
    }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } 
      }
GROUP BY ?lloc ?cat ?llocLabel ?categoria ?catnat ?categorianat
ORDER BY DESC(?totpers) ?llocLabel
Try it!

Vegeu també ca:Tema:W48u5is760hbv1u5 per consultes equivalent per territori.

# Persones amb article per nombre de llocs de mort
SELECT ?persona ?personaLabel ?article (COUNT(?lloc) AS ?numllocs) 
WHERE {
  ?persona wdt:P20 ?lloc.
    ?article schema:about ?persona.
    ?article schema:isPartOf <https://ca.wikipedia.org/>.
}
GROUP BY ?persona ?personaLabel ?article
HAVING (COUNT(?lloc)>1)
ORDER BY DESC(?numllocs)
Try it!
# Categories per mort de llocs de Turquia i nombre d'articles
SELECT DISTINCT ?lloc ?llocLabel ?cat ?categoria (COUNT(?persona) AS ?totpers)
    WHERE {
      ?persona wdt:P20 ?lloc.
      ?lloc wdt:P17 wd:Q43.
    ?art schema:about ?persona.
    ?art schema:isPartOf <https://ca.wikipedia.org/>.
  OPTIONAL {
    ?lloc wdt:P1465 ?cat.
  OPTIONAL {
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
  }
    }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } 
      }
GROUP BY ?lloc ?cat ?llocLabel ?categoria
ORDER BY DESC(?totpers) ?llocLabel
Try it!
#Cantons acolorits segons si tenen les mateixes coordenades de la capital
SELECT ?canto ?capital ?cantoCoor ?capitalCoor ?cantoLabel ?capitalLabel ?layer
WHERE {
  ?canto wdt:P31 wd:Q184188.
  ?canto wdt:P625 ?cantoCoor.
  ?canto wdt:P36 ?capital.
  ?capital wdt:P625 ?capitalCoor.
  BIND(?cantoCoor=?capitalCoor as ?layer)
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,oc,eu,br,fr,en".}   
}
#defaultView:Map
Try it!
SELECT DISTINCT ?persona ?personaLabel ?articleforaster 
WHERE {
  ?persona wdt:P31 wd:Q5.
  ?persona wdt:P21 wd:Q6581072.
  ?persona wdt:P106/wdt:P279* wd:Q3391743.#artistes visuals
    ?articleforaster schema:about ?persona.
    ?articleforaster schema:isPartOf <https://fr.wikipedia.org/>.#canviar llengua aquí
OPTIONAL{
    ?articleca schema:about ?persona.
    ?articleca schema:isPartOf <https://ca.wikipedia.org/>.
  }
FILTER (!bound(?articleca))  
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr" . } 
}
Try it!
# coordenades subdivisions d'un cantó
SELECT ?lloc ?llocLabel ?coordinate ?layer
WHERE {
  ?lloc wdt:P131? wd:Q1724100.
           ?lloc wdt:P625 ?coordinate .
  ?lloc wdt:P31 ?layer.
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es".}   
}
#defaultView:Map
Try it!
# embassaments d'Espanya
SELECT ?panta ?pantaLabel ?data
WHERE {
  ?panta wdt:P17 wd:Q29.
  ?panta wdt:P31 wd:Q131681.
  OPTIONAL {
    ?panta wdt:P571 ?data
  }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca, eu, es, en, gl, sv" .
}
}
Try it!
# BCIN i BCIL de Barcelona
SELECT ?monument ?monumentLabel ?prot ?protLabel 
WITH {
  SELECT ?monument 
WHERE {
  ?monument wdt:P131* wd:Q1492.
 } } AS %1
WHERE {
  INCLUDE %1.
  VALUES ?prot {wd:Q1019352 wd:Q11910250}
  ?monument wdt:P1435 ?prot.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca" .
}
}
Try it!
#Quadres d'alguns museus barcelonins
SELECT DISTINCT ?obra ?obraLabel ?museu ?museuLabel ?pintor ?pintorLabel
WHERE {
  VALUES ?museu {wd:Q867072 wd:Q1050032 wd:Q1753029 wd:Q1067140 wd:Q15735772 wd:Q861252}
  ?obra wdt:P276|wd:P195 ?museu.
  ?obra wdt:P31/wdt:P279* wd:Q3305213.
  OPTIONAL {?obra wdt:P170 ?pintor.}
    SERVICE wikibase:label {
    bd:serviceParam wikibase:language "ca, en, es" .
    }
}
ORDER BY ?museuLabel ?pintorLabel ?obraLabel
Try it!
#Exemple operació aritmètica, de dues maneres diferents
SELECT DISTINCT ?mun ?munLabel ?hab (2*xsd:float(?hab) AS ?h2) ?h3
    WHERE {
        ?mun wdt:P31 wd:Q33146843.
      ?mun wdt:P1082 ?hab.
      BIND(3*xsd:float(?hab) AS ?h3)
        SERVICE wikibase:label {
        bd:serviceParam wikibase:language "ca" .
        }
    }
Try it!
#Fars de les Balears
#PREFIX ofn: <http://www.ontotext.com/sparql/functions/>
SELECT DISTINCT ?item ?municipiLabel ?illa ?illaLabel ?lat ?lon ?lat_illa ?lon_illa ?atan2
  WHERE {
    ?item wdt:P17 wd:Q29.
    ?item wdt:P31/wdt:P279* wd:Q39715.
    ?item wdt:P131* ?municipi.
    ?municipi wdt:P31 wd:Q2074737.
    ?municipi wdt:P131* wd:Q5765.
    ?item wdt:P131* ?illa.
    ?illa wdt:P31 wd:Q23442.
    ?illa p:P625 ?coord_illa.
          ?coord_illa psv:P625 ?coord_illa_node .
          ?coord_illa_node wikibase:geoLatitude ?lat_illa .
          ?coord_illa_node wikibase:geoLongitude ?lon_illa .
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "ca" .
        }
  OPTIONAL{?item p:P625 ?coordinate .
          ?coordinate psv:P625 ?coordinate_node .
          ?coordinate_node wikibase:geoLatitude ?lat .
          ?coordinate_node wikibase:geoLongitude ?lon .
           #BIND (ofn:atan2(?lon - ?lon_illa, ?lat - ?lat_illa) AS ?atan2)
          }
  }
#ORDER BY DESC(?atan2)
Try it!
#espècies d'ocells amb nom científic i família
SELECT ?esp ?espLabel ?binomial ?famLabel 
WHERE {
  ?esp wdt:P31 wd:Q16521.
  ?esp wdt:P105 wd:Q7432.
  ?esp wdt:P171* wd:Q5113.
  ?esp wdt:P225 ?binomial. 
  ?esp wdt:P171* ?fam.
  ?fam wdt:P105 wd:Q35409.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } 
}
Try it!
# Barcelonins històrics (aprox)
SELECT ?item
WHERE {
?item wdt:P19/wdt:P131* wd:Q1492.
?item wdt:P570 ?datadef.
  FILTER(?datadef <= "1654-00-00"^^xsd:dateTime)
}
Try it!
# Categories amb temes associats.
SELECT DISTINCT ?cat ?categoria ?tema ?temaLabel
WHERE {
  ?cat wdt:P31 wd:Q4167836.
  ?cat wdt:P971 ?tema.
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } 
}
ORDER BY ?cat
Try it!
#Descendents del papa Borja ascendents de Felip I de Bèlgica
SELECT DISTINCT ?persona ?personaLabel ?pares ?paresLabel
WITH { SELECT ?persona WHERE { ?persona wdt:P40* wd:Q155004 . } } AS %1
WITH { SELECT ?persona WHERE { wd:Q108316 wdt:P40* ?persona. } } AS %2
WHERE {
  INCLUDE %1
  INCLUDE %2
  ?persona wdt:P22|wdt:P25 ?pares
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,an,eu" .
  }
}
Try it!
# Articles de botànics amb abreviacio d'autor
SELECT DISTINCT ?persona ?article ?abreviacio
WHERE {
  ?persona wdt:P428 ?abreviacio.
    ?article schema:about ?persona.
    ?article schema:isPartOf <https://ca.wikipedia.org/>.
}
Try it!
# Articles de zoòlegs amb abreviacio d'autor
SELECT DISTINCT ?persona ?article ?abreviacio
WHERE {
  ?persona wdt:P835 ?abreviacio.
    ?article schema:about ?persona.
    ?article schema:isPartOf <https://ca.wikipedia.org/>.
}
Try it!
# Articles de premiats i categories de premis (cat premiats)
SELECT DISTINCT ?persona ?article ?premi ?cat ?categoria
WHERE {
  ?persona wdt:P166 ?premi.
  ?premi wdt:P2517 ?cat.
    ?article schema:about ?persona.
    ?article schema:isPartOf <https://ca.wikipedia.org/>.
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
}
Try it!
# Articles de premiats i categories de premis (cat principal)
SELECT DISTINCT ?persona ?article ?premi ?cat ?categoria
WHERE {
  ?persona wdt:P166 ?premi.
  ?premi wdt:P910 ?cat.
    ?article schema:about ?persona.
    ?article schema:isPartOf <https://ca.wikipedia.org/>.
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
}
Try it!
# Categories de premis per nombre de premiats a Wikidata
SELECT DISTINCT ?premi ?catpral ?categoriapral ?catpremiats ?categoriapremiats (COUNT(?persona) AS ?numpers)
WHERE {
  ?persona wdt:P31 wd:Q5.
  ?persona wdt:P166 ?premi.
  ?premi wdt:P910|wdt:P2517 ?cat.
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
  OPTIONAL {
    ?premi wdt:P910 ?catpral.
  OPTIONAL {
    ?categoriapral schema:about ?catpral.
    ?categoriapral schema:isPartOf <https://ca.wikipedia.org/>.
  }
    }
  OPTIONAL {
    ?premi wdt:P2517 ?catpremiats.
  OPTIONAL {
    ?categoriapremiats schema:about ?catpremiats.
    ?categoriapremiats schema:isPartOf <https://ca.wikipedia.org/>.
  }
    }
}
GROUP BY ?premi ?catpral ?categoriapral ?catpremiats ?categoriapremiats
ORDER BY DESC(?numpers)
Try it!
# Categories de premis
SELECT DISTINCT ?premi ?catpral ?categoriapral ?catpremiats ?categoriapremiats
WHERE {
  ?persona wdt:P166 ?premi.
  ?premi wdt:P910|wdt:P2517 ?cat.
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
  OPTIONAL {
    ?premi wdt:P910 ?catpral.
  OPTIONAL {
    ?categoriapral schema:about ?catpral.
    ?categoriapral schema:isPartOf <https://ca.wikipedia.org/>.
  }
    }
  OPTIONAL {
    ?premi wdt:P2517 ?catpremiats.
  OPTIONAL {
    ?categoriapremiats schema:about ?catpremiats.
    ?categoriapremiats schema:isPartOf <https://ca.wikipedia.org/>.
  }
    }
}
Try it!
# Categories de guanyadors per premis
SELECT DISTINCT ?premi ?premiLabel ?cat ?categoria
WHERE {
  ?premi wdt:P31/wdt:P279* wd:Q21142755.
  ?premi wdt:P2517 ?cat.
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } 
}
Try it!
# Categories principals per premis
SELECT DISTINCT ?premi ?premiLabel ?cat ?categoria
WHERE {
  ?premi wdt:P31/wdt:P279* wd:Q21142755.
  ?premi wdt:P910 ?cat.
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } 
}
Try it!
# Categories per origen de llocs d'Espanya i nombre d'articles
SELECT DISTINCT ?lloc ?llocLabel ?cat ?categoria ?catnat ?categorianat (COUNT(?persona) AS ?totpers)
    WHERE {
      ?persona wdt:P19 ?lloc.
      ?lloc wdt:P17 wd:Q29.
    ?art schema:about ?persona.
    ?art schema:isPartOf <https://ca.wikipedia.org/>.
  OPTIONAL {
    ?lloc wdt:P1464 ?catnat.
  OPTIONAL {
    ?categorianat schema:about ?catnat.
    ?categorianat schema:isPartOf <https://ca.wikipedia.org/>.
  }
    }
  OPTIONAL {
    ?lloc wdt:P1792 ?cat.
  OPTIONAL {
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
  }
    }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } 
      }
GROUP BY ?lloc ?cat ?llocLabel ?categoria ?catnat ?categorianat
ORDER BY DESC(?totpers) ?llocLabel
Try it!
# Categories per origen de llocs d'Espanya i nombre d'articles (versió millorable)
SELECT DISTINCT ?lloc ?llocLabel ?cat ?categoria  (COUNT(?persona) AS ?totpers)
    WHERE {
      ?persona wdt:P19 ?lloc.
      ?lloc wdt:P17 wd:Q29.
    ?art schema:about ?persona.
    ?art schema:isPartOf <https://ca.wikipedia.org/>.
  OPTIONAL {
    ?lloc wdt:P1464|wdt:P1792 ?cat.
  OPTIONAL {
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
  }
    }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } 
      }
GROUP BY ?lloc ?cat ?llocLabel ?categoria
ORDER BY DESC(?totpers) ?llocLabel
Try it!
# Persones del Racó d'Ademús (amb article)
SELECT DISTINCT ?persona ?personaLabel ?article
WHERE {
  ?persona wdt:P19 ?lloc.
  ?lloc wdt:P131* wd:Q1432274.
    ?article schema:about ?persona.
    ?article schema:isPartOf <https://ca.wikipedia.org/>.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } 
}
Try it!
# Persones de les Seychelles amb article
SELECT DISTINCT ?persona ?personaLabel ?article
WHERE {
  ?persona wdt:P27 wd:Q1042.
    ?article schema:about ?persona.
    ?article schema:isPartOf <https://ca.wikipedia.org/>.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } 
}
Try it!
# Categories de nascuts o relacionats amb comarques, estats, comunitats, províncies, etc.
# Només agafa una selecció de llocs que se suposa que majoritàriament hem de tenir.
SELECT DISTINCT ?tipus ?tipusLabel ?lloc ?llocLabel ?cat ?categoria
WHERE {
    VALUES ?tipus {wd:Q937876 wd:Q766277 wd:Q15089 wd:Q6465 wd:Q5107 wd:Q3624078 wd:Q10742 wd:Q35657 wd:Q1221156 wd:Q697390}
    ?lloc wdt:P31 ?tipus.
  OPTIONAL {
    ?lloc wdt:P1464|wdt:P1792 ?cat.
  OPTIONAL {
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
  }
  }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } 
}
ORDER BY ?tipusLabel ?llocLabel
Try it!
# persones relacionades (productors) amb article
SELECT DISTINCT ?tema ?item ?article ?nameca ?nameor
WHERE {
  ?tema wdt:P162 ?item.
  ?item wdt:P27 wd:Q30.
  ?article schema:about ?tema.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca" .
?item rdfs:label ?nameca
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en".
?item rdfs:label ?nameor
}
}
Try it!
#etiquetes entitats de població frisones
SELECT DISTINCT ?item ?nameca ?nameor
WHERE {
  ?item wdt:P31 wd:Q1852859.
  ?item wdt:P131* wd:Q770.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca" .
?item rdfs:label ?nameca
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "fy".
?item rdfs:label ?nameor
}
}
Try it!
# articles d'estudiants de centres educatius sense categoria per centre educatiu
SELECT DISTINCT ?persona ?personaLabel ?uni ?uniLabel ?article ?cat
WHERE {
  ?persona wdt:P69 ?uni.
  ?article schema:about ?persona.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
  OPTIONAL {
    ?uni wdt:P3876 ?cat.
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
  } FILTER (!bound(?categoria))
}
Try it!
# categories de nascuts o relacionats amb estats, comunitats, etc.
SELECT DISTINCT ?lloc ?cat ?categoria
WHERE {
    VALUES ?grans {wd:Q5107 wd:Q3624078 wd:Q10742 wd:Q35657}
    ?lloc wdt:P31 ?grans.
    ?lloc wdt:P1464|wdt:P1792 ?cat.
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
}
Try it!
# categories persones per lloc
SELECT DISTINCT ?lloc ?cat ?categoria
WHERE {
    ?lloc wdt:P1464|wdt:P1792 ?cat.
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
}
Try it!
# articles i categories per persones relacionades (no lloc de naixement); canadencs
SELECT DISTINCT ?persona ?lloc ?article ?cat ?categoria
WHERE {
  ?persona wdt:P27 wd:Q16.
  ?persona wdt:P19 ?lloc.
  ?article schema:about ?persona.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
    ?lloc wdt:P1792 ?cat.
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
}
Try it!
# Masies del Vallès Oriental
SELECT DISTINCT ?masiaLabel ?munLabel ?coor ?article ?masia 
WHERE {
  ?masia wdt:P31 wd:Q585956.
  ?masia wdt:P131* wd:Q14303.
  ?masia wdt:P131 ?mun.
  OPTIONAL {?masia wdt:P625 ?coor}
  OPTIONAL {
    ?article schema:about ?masia.
    ?article schema:isPartOf <https://ca.wikipedia.org/>.
  }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } 
}
ORDER BY ASC(?mun)
Try it!
# articles i categories d'estudiants i universitats
SELECT DISTINCT ?persona ?personaLabel ?uni ?uniLabel ?article ?cat ?categoria
WHERE {
  ?persona wdt:P69 ?uni.
  ?article schema:about ?persona.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
  OPTIONAL {
    ?uni wdt:P3876 ?cat.
    ?categoria schema:about ?cat.
    ?categoria schema:isPartOf <https://ca.wikipedia.org/>.
  }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es" . } 
}
Try it!
# Rius de Catalunya sense desembocadura
SELECT ?riu ?riuLabel 
WHERE {
  ?riu wdt:P31 wd:Q355304.
  ?riu wdt:P131* wd:Q5705.
  MINUS {?riu wdt:P403 []}
  SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,oc,eu,gl,en,es,an,eu,pl,sv,ceb" .
}
}
Try it!
# coses dels Països Catalans sense instància ni subclasse de res
SELECT ?item ?itemLabel ?coor
WHERE {
  VALUES ?pc {wd:Q5705 wd:Q5720 wd:Q5765 wd:Q12709 wd:Q166282 wd:Q228 wd:Q1425491 wd:Q1479641 wd:Q804160 wd:Q804155 wd:Q1544003 wd:Q804156}
  ?item wdt:P131* ?pc.
  OPTIONAL {?item wdt:P625 ?coor .}
  MINUS {?item wdt:P31 []}
  MINUS {?item wdt:P279 []}
  SERVICE wikibase:label {bd:serviceParam wikibase:language "ca, oc, en, es, fr, it".}
}
#defaultView:Map
Try it!
#subclasses de fars
SELECT ?classe ?classeLabel 
WHERE {
  ?classe wdt:P279 wd:Q39715.
        SERVICE wikibase:label {
        bd:serviceParam wikibase:language "ca,en,fr,de" .
        }
  
}
Try it!
# coses de Catalunya sense instància ni subclasse de res
SELECT ?item ?itemLabel ?coor
WHERE {
  ?item wdt:P131* wd:Q5705.
  OPTIONAL {?item wdt:P625 ?coor .}
  MINUS {?item wdt:P31 []}
  MINUS {?item wdt:P279 []}
  SERVICE wikibase:label {bd:serviceParam wikibase:language "ca, oc, en, es, fr".}
}
#defaultView:Map
Try it!
# coses amb municipi català sense instància de res
# duplica municipi i comarca
SELECT ?item ?itemLabel ?mun ?munLabel ?llengua
WHERE {
  ?item wdt:P131* ?mun.
  ?mun wdt:P4335 [].
  MINUS {?item wdt:P31 []}
  SERVICE wikibase:label {bd:serviceParam wikibase:language "ca, oc, en, es, fr".}
}
Try it!
#Llocs d'Espanya amb la propietat de no confondre
SELECT DISTINCT ?item ?itemLabel ?noconf ?noconfLabel
WHERE {
  ?item wdt:P17 wd:Q29.
  ?item wdt:P1889 ?noconf.
  ?item wdt:P131 [].
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,oc,eu,gl,en,es,an,eu,pl,sv,ceb" .
}
}
Try it!
#Elements d'una llista segons si tenen propietat de confondre (per buscar duplicats al mapa)
SELECT ?item ?itemLabel ?coord ?layer
WHERE {
  VALUES ?item {wd:Q631075 wd:Q800445 wd:Q17614675 wd:Q11909200 wd:Q17588255 wd:Q11909689 wd:Q73235054 wd:Q73235787 wd:Q11909725 wd:Q11909721 wd:Q11909752 wd:Q11909751 wd:Q11909760 wd:Q11909763 wd:Q11909768 wd:Q11909771 wd:Q8561495 wd:Q73377280 wd:Q17588521 wd:Q30301825 wd:Q96117891 wd:Q47182660 wd:Q11910589 wd:Q11910585 wd:Q17596134 wd:Q73282322 wd:Q11910620 wd:Q65206072 wd:Q18004150 wd:Q11910640 wd:Q11910667 wd:Q18003421 wd:Q17588061 wd:Q28125697 wd:Q23792745 wd:Q61616758 wd:Q2935730 wd:Q18003808 wd:Q61607135 wd:Q61623115 wd:Q28712218 wd:Q28711247 wd:Q28711523 wd:Q28711519 wd:Q21849328 wd:Q21849291 wd:Q18695890 wd:Q18696616 wd:Q28071707 wd:Q24035304 wd:Q85533439 wd:Q47180023 wd:Q83061077 wd:Q62024798 wd:Q96761814 wd:Q47184326 wd:Q18003561 wd:Q11911797 wd:Q20106224 wd:Q97771289 wd:Q11954825 wd:Q28088452 wd:Q47180066 wd:Q49486036 wd:Q73360741 wd:Q83439797 wd:Q549699 wd:Q73416348 wd:Q47180688 wd:Q47185494 wd:Q83499606 wd:Q11954581 wd:Q17594432 wd:Q11952241 wd:Q11912860 wd:Q17594614 wd:Q3661125 wd:Q1333395 wd:Q11912766 wd:Q17594806 wd:Q11912807 wd:Q11912806 wd:Q73243007 wd:Q96743153 wd:Q73393805 wd:Q19594020 wd:Q62024302 wd:Q62024297 wd:Q26940807 wd:Q5757790 wd:Q17615460 wd:Q73405419 wd:Q56401177 wd:Q73417592 wd:Q85324840 wd:Q73406442 wd:Q80971391 wd:Q80968614 wd:Q73244451 wd:Q73244447 wd:Q73244449 wd:Q73244015 wd:Q73244013 wd:Q73238808 wd:Q73238807 wd:Q11930347 wd:Q73261638 wd:Q28466631 wd:Q28711293 wd:Q37586335 wd:Q37586331 wd:Q23498840 wd:Q23500256 wd:Q18004520 wd:Q17617216 wd:Q11913188 wd:Q73406714 wd:Q17617928 wd:Q11909742 wd:Q73362644 wd:Q96621975 wd:Q73242536 wd:Q73242522 wd:Q73244946 wd:Q73244944 wd:Q73241218 wd:Q73241203 wd:Q73263567 wd:Q73262745 wd:Q96743388 wd:Q73260819 wd:Q96743384 wd:Q73240267 wd:Q73240274 wd:Q96743410 wd:Q73243992 wd:Q73243965 wd:Q73243501 wd:Q73243476 wd:Q73243491 wd:Q73243506 wd:Q73228986 wd:Q73232041 wd:Q73241662 wd:Q73241659 wd:Q20876242 wd:Q20985940 wd:Q96621981 wd:Q73380755 wd:Q73240747 wd:Q73240779 wd:Q73260178 wd:Q73263566 wd:Q73233969 wd:Q73235786 wd:Q96621978 wd:Q73395249 wd:Q20985998 wd:Q96143636 wd:Q96142048 wd:Q44061218 wd:Q18004676 wd:Q11936069 wd:Q18004677 wd:Q73405178 wd:Q11918990 wd:Q96586856 wd:Q73405161 wd:Q98219645 wd:Q73260097 wd:Q73394161 wd:Q98396010 wd:Q96657814 wd:Q73260477 wd:Q73281935 wd:Q98092092 wd:Q96655570 wd:Q73361669 wd:Q98219587 wd:Q73416234 wd:Q96654451 wd:Q73245360 wd:Q73406422 wd:Q96641133 wd:Q11937280 wd:Q47186442 wd:Q96621502 wd:Q73262675 wd:Q96654412 wd:Q73394615 wd:Q96655567 wd:Q73394719 wd:Q96656908 wd:Q73237398 wd:Q73241647 wd:Q96655574 wd:Q96653840 wd:Q73362832 wd:Q11943854 wd:Q18006033 wd:Q20679375 wd:Q11947086 wd:Q21530585 wd:Q47171136 wd:Q73361739 wd:Q20985356 wd:Q17389718 wd:Q17602272 wd:Q11947334 wd:Q11947335 wd:Q11947296 wd:Q8777111 wd:Q18696172 wd:Q9034469 wd:Q1278218 wd:Q11682913 wd:Q9007519 wd:Q96658094 wd:Q73243515 wd:Q73238343 wd:Q73238336 wd:Q73238333 wd:Q43126293 wd:Q43127419 wd:Q58461831 wd:Q20104297 wd:Q18325508 wd:Q96099655 wd:Q18008487 wd:Q73238827 wd:Q73238818}
  ?item wdt:P625 ?coord .
  OPTIONAL{?item wdt:P1889 ?conf.}
  BIND(BOUND(?conf) as ?layer)
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,an,eu,pl,sv,ceb" .
}
}
#defaultView:Map
Try it!
#Alies de tot de Catalunya en totes les llengües
SELECT DISTINCT ?item ?itemLabel ?alias
WHERE {
  ?item wdt:P17 wd:Q29.
  ?item wdt:P131* wd:Q5705.
  ?item skos:altLabel ?alias.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca,oc,en,es,pl,sv,ceb" .
}
}
Try it!
#Tot de Catalunya
SELECT ?item ?itemLabel ?tipus ?lat ?lon ?mun ?idescat
WHERE {
  ?item wdt:P17 wd:Q29.
  ?item wdt:P131* wd:Q5705.
  ?item wdt:P31 ?tipus.
  OPTIONAL {
?item p:P625 ?coordinate .
?coordinate psv:P625 ?coordinate_node .
?coordinate_node wikibase:geoLatitude ?lat .
?coordinate_node wikibase:geoLongitude ?lon .
  }
  OPTIONAL {
    ?item wdt:P131* ?mun.
    ?mun wdt:P4335 ?idescat.
    ?mun wdt:P31 wd:Q33146843.}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca,oc,en,es,pl,sv,ceb" .
}
}
Try it!
# llocs amb coordenades referenciades al Nomenclàtor
SELECT ?item ?itemLabel ?inst ?instLabel ?mun ?munLabel ?idescat ?lat ?lon
WHERE {
  ?item wdt:P17 wd:Q29.
  ?item p:P625 ?coordinate.
  ?coordinate prov:wasDerivedFrom ?ref.
  ?ref pr:P248 wd:Q11938912.
  ?coordinate psv:P625 ?coordinate_node.
  ?coordinate_node wikibase:geoLatitude ?lat.
  ?coordinate_node wikibase:geoLongitude ?lon.
  OPTIONAL {?item wdt:P31 ?inst}
  OPTIONAL {?item wdt:P131* ?mun.
            ?mun wdt:P31 wd:Q33146843}
  OPTIONAL {?mun wdt:P4335 ?idescat}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ca,oc,en,es,fr". }
}
Try it!
#Fars de Catalunya (Nord i Sud) ordenats per latitud
SELECT ?item ?itemLabel ?municipi ?municipiLabel ?imatge ?coord ?lat
  WHERE {
    VALUES ?tmun {wd:Q484170 wd:Q33146843}
    VALUES ?catalunya {wd:Q5705 wd:Q12709}
    ?item wdt:P31 wd:Q39715.
    ?item wdt:P131* ?municipi.
    ?municipi wdt:P31 ?tmun.
    ?municipi wdt:P131* ?catalunya.
  OPTIONAL{?item wdt:P625 ?coord.
           ?item p:P625 ?coordinate .
          ?coordinate psv:P625 ?coordinate_node .
          ?coordinate_node wikibase:geoLatitude ?lat .
          }
  OPTIONAL{?item wdt:P18 ?imatge.}
        SERVICE wikibase:label {
        bd:serviceParam wikibase:language "ca" .
        }
  }
    ORDER BY DESC(?lat)
Try it!
#tipus de municipis d'Espanya, Andorra i França
SELECT ?tmun ?tmunLabel WHERE {
  VALUES ?tipus {wd:Q2074737 wd:Q24279 wd:Q484170}
  ?tmun wdt:P279* ?tipus.
  SERVICE wikibase:label {bd:serviceParam wikibase:language "ca, es, fr, en".}
Try it!

}

#Municipis d'Espanya, amb els noms alternatius separats
SELECT DISTINCT ?mun ?munLabel ?oficial ?alias
    WHERE {
        ?mun wdt:P31/wdt:P279* wd:Q2074737.
        OPTIONAL {?mun wdt:P1448 ?oficial}
        OPTIONAL {?mun skos:altLabel ?alias.
                 FILTER(lang(?alias)="ca")}
        SERVICE wikibase:label {
        bd:serviceParam wikibase:language "ca" .
        }
    }
Try it!
# retaules ceràmics identificats pel nom
SELECT ?monument ?label
WHERE
{
  ?monument wdt:P131* wd:Q8818;
         rdfs:label ?label.
  FILTER(CONTAINS(?label, "etaule ceràmic ")).
}
Try it!
# carrers i places de Barcelona (amb mapa segons si tenen foto)
SELECT DISTINCT ?item ?itemLabel ?adm ?admLabel ?coord ?coordcreua ?imatge ?layer ?tipusLabel
WHERE {
  VALUES ?tipus {wd:Q79007 wd:Q56753514 wd:Q787113 wd:Q34442 wd:Q207934 wd:Q174782}
  ?item wdt:P31 ?tipus.
  ?item wdt:P131 ?adm.
  ?adm wdt:P131* wd:Q1492.
  OPTIONAL{?item wdt:P625 ?coord.}
  OPTIONAL{?item wdt:P18 ?imatge.}
  OPTIONAL{?item p:P2789 ?creuament.
          ?creuament pq:P625 ?coordcreua}
  BIND(BOUND(?imatge) as ?layer)
  SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca" .
}
}
Try it!
#Monuments amb IPAC sense estatus patrimonial
SELECT ?item ?name ?coord ?lat ?lon
WHERE {
  ?item wdt:P1600 [].
  MINUS {?item wdt:P1435 []}
  OPTIONAL {
?item wdt:P625 ?coord .
?item p:P625 ?coordinate .
?coordinate psv:P625 ?coordinate_node .
?coordinate_node wikibase:geoLatitude ?lat .
?coordinate_node wikibase:geoLongitude ?lon .
  }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,an,eu,pl,sv,ceb" .
?item rdfs:label ?name.
}
}
#defaultView:Map
Try it!
#Monuments amb IPAC per protecció
SELECT ?item ?name ?coord ?lat ?lon ?layer
WHERE {
  ?item wdt:P1600 [].
  OPTIONAL {
  ?item wdt:P1435 ?prot.
?item wdt:P625 ?coord .
?item p:P625 ?coordinate .
?coordinate psv:P625 ?coordinate_node .
?coordinate_node wikibase:geoLatitude ?lat .
?coordinate_node wikibase:geoLongitude ?lon .
  }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,an,eu,pl,sv,ceb" .
?item rdfs:label ?name.
  ?prot rdfs:label ?layer
}
}
#defaultView:Map
Try it!
#Monuments inventariats
SELECT ?item ?name ?coord ?lat ?lon
WHERE {
?item wdt:P1435 wd:Q28034408.
?item wdt:P131* wd:Q5705 .
  OPTIONAL {
?item wdt:P625 ?coord .
?item p:P625 ?coordinate .
?coordinate psv:P625 ?coordinate_node .
?coordinate_node wikibase:geoLatitude ?lat .
?coordinate_node wikibase:geoLongitude ?lon .
  }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,an,eu,pl,sv,ceb" .
?item rdfs:label ?name
}
}
#defaultView:Map
Try it!
# Nascuts a Constantinoble de 1453 a 1923, amb article
SELECT DISTINCT ?persona ?personaLabel ?data ?article
WHERE {
  ?persona wdt:P31 wd:Q5.
  ?persona wdt:P19 wd:Q16869.
  ?persona wdt:P569 ?data.
  ?article schema:about ?persona.
  ?article schema:isPartOf <https://ca.wikipedia.org/>.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ca,oc,en,es,fr". }
  FILTER("1453-05-29"^^xsd:dateTime <= ?data && ?data < "1924-01-01"^^xsd:dateTime).
}
Try it!
# Llocs de Catalunya amb referències a l'adreça
SELECT ?item ?itemLabel ?adr ?codi ?llengua ?origen ?origenLabel
WHERE {
  ?item wdt:P131* wd:Q5705.
  ?item p:P6375 ?sadr.
  ?sadr prov:wasDerivedFrom ?ref.
  ?ref pr:P143 ?origen.
  ?item wdt:P6375 ?adr.
  OPTIONAL {?item wdt:P1600 ?codi}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "ca,oc,en,es,fr". }
  FILTER (LANG(?adr) AS ?llengua).
}
Try it!
#Coses de Cabanes (Plana Alta)
SELECT ?item ?itemLabel ?coord
WHERE {
  ?item wdt:P131* wd:Q1646899.
  ?item wdt:P625 ?coord .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,an,eu,pl,sv,ceb" .
}
}
#defaultView:Map
Try it!
  • Propietats i sitelink de commons d'una llista de monuments:
SELECT DISTINCT ?item ?lon ?lat ?imatge ?prot ?itemLabel ?protLabel ?ipac ?mun ?estil ?estilLabel ?ccat ?commonslink
    WHERE {
      VALUES ?item {wd:Q250523 wd:Q17596577 wd:Q11913087 wd:Q20104297 wd:Q23499031 wd:Q23499032 wd:Q3816570 wd:Q22893596 wd:Q23499034 wd:Q22809170 wd:Q22809084 wd:Q3816526 wd:Q22968639 wd:Q22809747 wd:Q22809737 wd:Q23499047 wd:Q22893613 wd:Q22809132 wd:Q22893568 wd:Q11947564 wd:Q23499045 wd:Q23499046 wd:Q19255622 wd:Q22809689 wd:Q22809746 wd:Q22809745 wd:Q22893539 wd:Q22893533 wd:Q58461694 wd:Q23499037 wd:Q71365567 wd:Q22893606 wd:Q23499038 wd:Q22809725 wd:Q22809731 wd:Q23499036 wd:Q22893543 wd:Q22809136 wd:Q22809705 wd:Q22893610 wd:Q71367611 wd:Q23499039 wd:Q23499040 wd:Q23499041 wd:Q22968634 wd:Q22893540 wd:Q22968628 wd:Q22968626 wd:Q22809693 wd:Q22809724 wd:Q22968637 wd:Q22968631 wd:Q22968625 wd:Q22968638 wd:Q22893534 wd:Q23499042 wd:Q22893535 wd:Q22968633 wd:Q22968642 wd:Q22968629 wd:Q22968635 wd:Q22968630 wd:Q22893532 wd:Q22893524 wd:Q22893516 wd:Q65208575 wd:Q65208776 wd:Q23499043 wd:Q57959289 wd:Q61982448 wd:Q71441349}
      OPTIONAL {
        ?item wdt:P625 ?coord.
      ?item p:P625 ?coordinate .
      ?coordinate psv:P625 ?coordinate_node .
      ?coordinate_node wikibase:geoLatitude ?lat .
      ?coordinate_node wikibase:geoLongitude ?lon .
    }
      OPTIONAL {?item wdt:P18 ?imatge}
      OPTIONAL {?item wdt:P131 ?adm}
      OPTIONAL {?item wdt:P1435 ?prot}
      OPTIONAL {?item wdt:P373 ?ccat}
      OPTIONAL {?item wdt:P1600 ?ipac}
      OPTIONAL {
       ?item wdt:P131* ?mun.
       ?mun wdt:P31 wd:Q33146843.
      }
      OPTIONAL {?item wdt:P149 ?estil}
      OPTIONAL {?commonslink schema:about ?item;
         schema:isPartOf <https://commons.wikimedia.org/> }
    SERVICE wikibase:label {
    bd:serviceParam wikibase:language "ca,en,oc,fr,es" .
    }
    }
Try it!
#etiquetes items de Catalunya que tenen coordenades
SELECT DISTINCT ?item ?nameca ?nameen
WHERE {
  ?item wdt:P17 wd:Q29.
  ?item wdt:P131* wd:Q5705.
  ?item wdt:P625 [].
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca" .
?item rdfs:label ?nameca
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en".
?item rdfs:label ?nameen
}
}
#ORDER BY ASC (?name)
#defaultView:Table
Try it!
#Rius del Llobregat
SELECT ?item ?itemLabel ?desemboca
WHERE {
  ?item wdt:P403* wd:Q31424.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,an,eu,pl,sv,ceb" .
?item rdfs:label ?itemLabel
}
OPTIONAL {?item wdt:P403 ?desemboca}
}
#defaultView:Graph
Try it!