User:Pere prlpz

From Wikidata
Jump to navigation Jump to search


# Hotels amb ubicació de la seu en un edifici
SELECT DISTINCT ?hotel ?hotelBuilding ?hotelLabel ?hotelBuildingLabel WHERE {
  ?hotel wdt:P159 ?hotelBuilding.
  ?hotel wdt:P31 wd:Q27686.
  ?hotelBuilding wdt:P31/wdt:P279* wd:Q41176.
  SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr,pl,pt,de".}   
}
Try it!
# Ponts amb mides normalitzades (totes en metres)
SELECT DISTINCT ?item ?itemLabel ?mides
 WHERE {
 VALUES ?tipus {wd:Q12280}
 ?item wdt:P17 wd:Q29.
 ?item wdt:P31/wdt:P279* ?tipus.
        OPTIONAL {?item p:P2043  ?sllarg.
               ?sllarg psn:P2043  ?sllargn.
                ?sllargn wikibase:quantityAmount ?llarg. 
              }
        OPTIONAL { ?item p:P2787  ?sllum.
               ?sllum psn:P2787  ?sllumn.
                ?sllumn wikibase:quantityAmount ?llum. 
              }
        OPTIONAL {?item p:P2049  ?sample.
               ?sample psn:P2049  ?samplen.
                ?samplen wikibase:quantityAmount ?ample. 
              }
        OPTIONAL {?item p:P2048  ?salt.
               ?salt psn:P2048  ?saltn.
                ?saltn wikibase:quantityAmount ?alt. 
              }
   OPTIONAL {?item wdt:P1314 ?ulls}
   BIND(CONCAT(IF(BOUND(?ulls),CONCAT("ulls:",str(?ulls),"</br>"),""), 
               IF(BOUND(?llum),CONCAT("llum:",str(?llum),"</br>"),""), 
               IF(BOUND(?llarg),CONCAT("llarg:",str(?llarg),"</br>"),""), 
               IF(BOUND(?ample),CONCAT("ample:",str(?ample),"</br>"),""), 
               IF(BOUND(?alt),CONCAT("ample:",str(?alt),"</br>"),"")) as ?mides)
   SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca,en,es,fr".}   
}
Try it!
# Elements de nivell A i B, no anomenats "Entorn" ni "Conjunt", que no són a Wikidata
SELECT ?id ?link WHERE {
  VALUES ?id {"3384" "REPO" "3085" "3217" "3219" "3367" "3317" "1733" "2617" "1121" "4765" "3214" "3211" "2467" "1081" "1082" "1113" "1114" "1003" "1083" "1084" "1006" "1007" "1085" "1086" "112" "1049" "1087" "3053" "3057" "280" "3124" "436" "2087" "2322" "2618" "1088" "1122" "1123" "1050" "1089" "1090" "326" "295" "3050" "437" "445" "455" "3309" "519" "2485" "2545" "2491" "2827" "248" "135" "1350" "206" "207" "175" "213" "1125" "1052" "1054" "1055" "1091" "1092" "1093" "579" "753" "691" "214" "137" "176" "177" "215" "1320" "138" "1126" "1094" "1095" "1127" "1097" "1022" "758" "774" "78" "680" "954" "178" "179" "218" "143" "144" "222" "1099" "1134" "1023" "1024" "1025" "1067" "1100" "931" "858" "865" "146" "186" "187" "224" "225" "15" "1101" "1137" "1026" "1027" "1028" "1139" "866" "1549" "188" "152" "191" "192" "230" "231" "232" "1140" "1309" "131" "1223" "1268" "1185" "1484" "1429" "2844" "1338" "153" "154" "155" "193" "194" "1224" "1226" "127" "1270" "1272" "1438" "1359" "1455" "2784" "2941" "2925" "234" "1339" "156" "198" "1341" "115" "1151" "1190" "1276" "1152" "1518" "1519" "1527" "1470" "980" "1743" "16" "160" "199" "2" "239" "1153" "1235" "1279" "1238" "1472" "3293" "240" "1342" "1343" "162" "12" "1240" "1282" "1283" "120" "1475" "1404" "200" "241" "242" "163" "1163" "1168" "1205" "1169" "1250" "1172" "1776" "1746" "1575" "1592" "1029" "1070" "35" "3036" "3038" "316" "317" "1297" "1174" "1175" "1176" "1258" "1299" "1771" "3127" "1786" "2047" "1071" "1106" "1107" "1145" "1146" "1073" "1074" "287" "304" "2912" "358" "288" "1177" "1178" "1213" "1214" "1179" "118" "2053" "2277" "2203" "2076" "1108" "1109" "1147" "1148" "1149" "1077" "1078" "2653" "253" "254" "3043" "1305" "1267" "1307" "1308" "246" "2301" "2221" "1110" "1" "108" "1080" "1111" "1112" "3046" "323" "3048" "145" "318" "3040" "3041" "3042" "1068" "1069" "1164" "1207" "1208" "125" "1262" "1347" "1348" "18" "1138" "1505" "3071" "2045" "1864" "1784" "1381" "1459" "1460" "1523" "1525" "972" "1382" "1684" "1747" "1570" "1574" "1687" "1787" "2004" "2611" "2418" "2419" "2494" "2495" "1383" "1384" "1463" "1528" "1529" "975" "976" "1117" "1576" "1638" "2190" "2191" "2062" "2198" "2005" "1795" "1798" "2014" "1464" "1465" "1532" "1689" "1691" "2199" "2280" "2067" "2288" "2204" "1800" "1888" "1891" "1893" "2022" "1806" "859" "1535" "978" "979" "355" "523" "527" "1012" "2294" "2074" "2212" "2298" "1813" "1814" "2033" "1393" "1468" "1469" "1537" "1579" "1580" "1581" "1753" "1582" "1644" "1645" "2078" "2220" "2082" "3233" "1539" "1540" "98" "1397" "1702" "1754" "1196" "1590" "1591" "2083" "2225" "2229" "2321" "3067" "1820" "1398" "1399" "1473" "124" "1596" "2642" "2652" "1600" "2088" "2089" "2233" "2433" "1823" "2340" "1541" "1542" "1543" "1544" "1401" "1403" "1654" "1655" "1763" "1602" "1604" "2507" "2565" "2566" "2448" "2518" "2095" "2245" "2248" "2249" "1476" "1477" "1765" "1766" "1605" "1606" "1607" "870" "2519" "2520" "2567" "2364" "2365" "2345" "2098" "2252" "2352" "2102" "1478" "1545" "1548" "985" "1409" "1673" "1770" "2452" "2570" "2572" "3074" "2259" "2050" "2267" "2051" "1777" "1778" "1780" "2369" "2457" "2461" "2580" "2581" "2052" "2054" "2055" "2105" "1674" "1446" "1665" "1668" "2586" "2469" "1561" "1467" "2470" "2529" "2388" "1562" "1563" "1622" "1053" "1565" "2389" "2472" "2056" "2057" "2058" "2059" "2060" "2061" "2108" "1625" "1682" "1567" "1568" "1569" "1683" "2595" "2541" "2408" "2409" "2546" "2548" "1457" "1517" "1521" "1380" "733" "759" "76" "664" "694" "695" "825" "826" "903" "946" "947" "827" "828" "327" "328" "3051" "329" "33" "417" "418" "419" "461" "494" "696" "735" "761" "666" "667" "697" "948" "949" "1550" "988" "1410" "1411" "1412" "297" "266" "3" "3055" "3056" "334" "42" "420" "462" "463" "464" "50" "698" "699" "765" "1413" "1414" "1482" "1483" "1553" "1554" "1555" "270" "300" "301" "336" "302" "273" "502" "386" "387" "465" "466" "467" "503" "766" "668" "669" "700" "701" "1415" "1416" "1418" "1485" "274" "275" "34" "340" "276" "303" "388" "424" "425" "426" "427" "651" "546" "4739" "671" "706" "744" "674" "994" "1422" "1426" "1489" "1490" "3060" "308" "3031" "3033" "3123" "580" "581" "547" "582" "586" "620" "675" "707" "708" "777" "1512" "1513" "1514" "2726" "314" "39" "391" "428" "429" "468" "51" "622" "71" "747" "679" "682" "715" "716" "685" "1441" "1502" "837" "1506" "469" "507" "392" "393" "432" "592" "625" "686" "72" "687" "688" "721" "722" "950" "1362" "1363" "1366" "1507" "394" "395" "473" "396" "4" "400" "626" "829" "91" "951" "952" "834" "953" "1515" "1516" "1372" "1373" "401" "402" "440" "441" "48" "480" "597" "555" "599" "557" "835" "836" "350" "795" "796" "839" "403" "404" "442" "444" "558" "524" "602" "525" "797" "1508" "1510" "1511" "1367" "1368" "37" "405" "406" "526" "561" "606" "635" "639" "569" "798" "840" "841" "92" "800" "842" "1431" "1495" "958" "446" "447" "448" "449" "484" "57" "609" "61" "572" "642" "643" "843" "844" "845" "883" "885" "805" "806" "485" "409" "45" "450" "451" "487" "644" "539" "540" "847" "93" "810" "890" "932" "853" "1369" "1371" "1450" "1451" "372" "374" "41" "410" "454" "376" "377" "575" "648" "649" "577" "816" "855" "856" "938" "939" "899" "1500" "1501" "1360" "1361" "412" "456" "378" "415" "416" "457" "578" "650" "689" "723" "690" "755" "793" "942" "821" "861" "1355" "944" "945" "381" "794" "73" "756" "662" "663" "693" "2829" "2632" "2636" "3265" "3008" "3009" "3010" "3011" "3271" "2704" "2706" "2772" "2643" "3020" "3021" "3278" "3023" "2644" "2774" "3062" "3209" "3301" "5092" "6760" "1781" "2843" "2845" "2649" "7548" "529" "587" "646" "647" "1752" "3094" "2780" "2846" "2651" "2783" "2785" "2851" "2859" "2667" "1756" "1757" "1758" "2668" "2727" "2731" "2802" "2870" "2674" "1594" "1598" "3070" "2737" "2740" "2814" "2884" "2885" "2886" "1727" "4509" "4518" "4517" "2888" "2890" "2891" "2942" "3291" "4774" "4510" "2579" "166" "3259" "1827" "1828" "1829" "1834" "2911" "2970" "1839" "2915" "2977" "1844" "1845" "1846" "1848" "1849" "1851" "1852" "2864" "2994" "2896" "2817" "2750" "2902" "2903" "2904" "2998" "2927" "3007" "2064"}
  MINUS {?item wdt:P11557 ?id}
  BIND (CONCAT("https://ajuntament.barcelona.cat/informaciourbanistica/cerca/ca/fitxa/",?id,"/--/--/cp/") AS ?link)
}
Try it!
# Elements amb protecció de nivell C del catàleg de Barcelona que no són a Wikidata
SELECT ?id ?link WHERE {
  VALUES ?id {"4790" "4798" "4785" "4802" "4775" "4776" "4807" "4808" "4809" "2742" "4791" "2641" "2955" "4801" "2693" "2577" "2521" "2691" "2695" "2631" "2701" "2768" "3001" "2926" "655" "2746" "2815" "2816" "2819" "2961" "2836" "2638" "2769" "3203" "3126" "2339" "2094" "2103" "2106" "2773" "2840" "3087" "1231" "811" "2907" "2522" "2582" "2585" "2591" "1726" "1617" "1749" "3090" "2841" "2842" "2647" "2090" "2616" "2620" "2913" "2920" "2921" "1597" "2107" "2202" "2290" "3092" "3095" "2778" "3096" "2657" "4758" "4759" "1714" "2386" "2387" "2536" "2539" "1722" "1723" "1724" "2559" "2562" "2713" "2788" "2795" "4275" "2922" "2990" "2999" "2040" "1854" "1858" "4282" "3104" "2820" "2821" "2822" "2900" "3099" "2799" "2861" "2865" "2670" "4794" "4762" "4797" "4766" "4767" "1990" "1991" "217" "1993" "1997" "2006" "2673" "2734" "2806" "2809" "4768" "1324" "1882" "1883" "1889" "1803" "1805" "1853" "2741" "4792" "4793" "4796" "2210" "2234" "2323" "2325" "359" "3108" "2947" "2818" "4795" "2544" "2549" "2496" "2892" "367" "299" "30" "333" "269" "27" "3058" "335" "271" "272" "3026" "3027" "1252" "1253" "1254" "1296" "1298" "183" "184" "221" "223" "1328" "337" "338" "3029" "2863" "306" "339" "277" "63" "630" "52" "520" "60" "600" "601" "1211" "1212" "1255" "1256" "13" "1259" "126" "1329" "133" "147" "185" "226" "227" "488" "489" "373" "411" "3030" "307" "341" "278" "279" "1301" "1302" "1303" "1215" "1216" "1217" "1330" "1331" "1332" "148" "149" "189" "19" "452" "453" "49" "3032" "309" "31" "310" "311" "1263" "1264" "1304" "1180" "228" "229" "23" "1333" "1334" "490" "375" "413" "491" "379" "38" "414" "342" "281" "282" "3034" "312" "313" "1181" "1182" "1218" "1219" "122" "1220" "1265" "1335" "150" "151" "1336" "195" "233" "459" "492" "46" "460" "493" "382" "383" "343" "344" "283" "284" "1266" "1306" "244" "245" "167" "168" "203" "235" "134" "157" "158" "196" "197" "236" "5" "384" "421" "422" "423" "504" "505" "285" "315" "346" "347" "348" "506" "390" "204" "205" "247" "249" "1349" "169" "237" "1340" "159" "20" "24" "161" "389" "652" "544" "545" "58" "616" "43" "430" "431" "47" "470" "17" "25" "250" "251" "776" "171" "201" "202" "243" "1344" "1345" "1346" "164" "617" "653" "471" "508" "509" "433" "434" "172" "209" "21" "211" "1317" "165" "349" "351" "2833" "654" "548" "584" "585" "618" "619" "36" "360" "397" "1773" "173" "174" "212" "1318" "286" "352" "353" "319" "32" "354" "289" "656" "657" "658" "659" "549" "1782" "398" "474" "475" "476" "361" "362" "363" "1319" "1774" "136" "216" "320" "4263" "255" "29" "291" "322" "256" "621" "510" "55" "550" "589" "59" "399" "40" "477" "1772" "132" "1321" "139" "257" "292" "293" "3049" "305" "325" "590" "623" "511" "512" "591" "478" "479" "364" "365" "44" "14" "259" "26" "260" "294" "261" "262" "624" "513" "514" "552" "593" "594" "368" "481" "483" "140" "141" "142" "180" "181" "182" "296" "565" "263" "264" "265" "3054" "595" "627" "515" "516" "553" "596" "369" "370" "371" "407" "408" "219" "22" "220" "1325" "1326" "1327" "330" "331" "332" "267" "268" "298" "598" "628" "629" "517" "518" "554" "6" "1251" "1295" "1171" "1173" "1209" "121" "1210" "1014" "1016" "1017" "1056" "1057" "1058" "1244" "1245" "1128" "1129" "1018" "1019" "102" "1059" "1246" "1287" "1288" "1289" "129" "1060" "1096" "113" "1130" "1166" "1167" "1206" "1247" "1248" "1249" "1131" "1020" "1021" "4267" "1061" "1062" "1063" "1098" "11" "1132" "1133" "1064" "1065" "1066" "110" "1135" "107" "1102" "1103" "1104" "114" "1183" "1184" "1221" "1222" "1310" "1311" "1312" "1313" "1186" "1227" "1314" "1315" "1187" "1188" "1189" "1228" "1229" "123" "1271" "117" "1170" "1141" "1142" "1273" "1150" "119" "1191" "1232" "1233" "1143" "1030" "1072" "1105" "1144" "1031" "1274" "1275" "1154" "1192" "1193" "1194" "1032" "1033" "1075" "1034" "1035" "1036" "1076" "1234" "1236" "1277" "1278" "1155" "1156" "1157" "111" "10" "1037" "1038" "1039" "1079" "100" "1197" "1198" "1237" "1239" "128" "1280" "1000" "1001" "104" "1040" "1041" "1115" "1281" "1158" "1159" "116" "1199" "1160" "1161" "1002" "1004" "1042" "1043" "1044" "1116" "1119" "1162" "1200" "1201" "1241" "1242" "1243" "1284" "1005" "1045" "1046" "1008" "1009" "101" "1048" "1285" "1286" "1165" "1202" "1203" "1204" "105" "1124" "1010" "1011" "1768" "109" "1013" "1715" "1716" "1762" "1764" "1656" "1657" "1658" "1659" "1717" "986" "987" "3329" "3330" "3331" "356" "522" "1578" "1641" "1642" "1718" "1719" "1720" "1767" "1660" "2010" "2011" "2012" "1797" "1799" "1405" "1407" "1408" "1587" "1692" "1693" "1694" "1695" "3072" "3125" "1861" "1862" "1863" "1989" "1661" "1662" "1663" "1664" "1775" "1611" "1670" "1583" "1584" "1585" "1643" "1696" "1698" "1118" "1120" "1785" "1865" "1866" "1867" "1868" "1721" "1671" "1672" "1225" "1589" "1646" "1647" "1648" "1729" "1730" "1612" "1649" "1705" "87" "3063" "3064" "1608" "1613" "1614" "1615" "1675" "1676" "1731" "1706" "1707" "1708" "1257" "1869" "1870" "1871" "1992" "1609" "1666" "1667" "1669" "1734" "1779" "2332" "1783" "1616" "1759" "1593" "2609" "1725" "1618" "1619" "1677" "1651" "1994" "1996" "1788" "1678" "1735" "1560" "1620" "1621" "1623" "1709" "1710" "1712" "1760" "1789" "1790" "1872" "1873" "1874" "1679" "1680" "1737" "1741" "1742" "1761" "1652" "1998" "1999" "1791" "1876" "1564" "1566" "1624" "1626" "1627" "1653" "1713" "1877" "1878" "1879" "2041" "1681" "1744" "1745" "1628" "1629" "1630" "1855" "1685" "1748" "1572" "1573" "1856" "2044" "1857" "1631" "1633" "1634" "1635" "1686" "1688" "2007" "1880" "1881" "1859" "1860" "1751" "1577" "1636" "1637" "1639" "1690" "2009" "982" "983" "984" "1402" "1479" "1546" "887" "888" "928" "929" "808" "809" "81" "1494" "1496" "959" "999" "1356" "1357" "603" "604" "633" "634" "562" "563" "678" "712" "748" "778" "779" "68" "713" "848" "849" "889" "89" "930" "812" "1358" "1434" "1437" "564" "605" "636" "53" "566" "567" "568" "714" "749" "75" "780" "781" "782" "85" "850" "851" "1497" "96" "960" "1440" "1442" "1443" "1444" "1445" "607" "608" "637" "638" "530" "531" "683" "717" "750" "751" "783" "784" "785" "891" "892" "933" "934" "813" "814" "570" "64" "641" "535" "537" "538" "571" "684" "718" "719" "752" "815" "852" "854" "893" "894" "895" "935" "962" "1364" "1365" "4726" "4732" "1449" "573" "610" "611" "645" "54" "576" "786" "787" "788" "720" "936" "937" "817" "818" "857" "896" "897" "977" "1392" "1394" "1395" "612" "613" "541" "542" "543" "614" "615" "95" "83" "831" "867" "868" "898" "94" "819" "82" "820" "86" "1378" "1379" "1522" "1524" "1526" "65" "789" "79" "69" "724" "725" "790" "869" "909" "910" "832" "252" "28" "871" "9" "90" "940" "941" "822" "823" "971" "973" "1385" "1386" "1461" "726" "727" "728" "754" "729" "757" "872" "345" "911" "912" "913" "955" "1353" "860" "862" "900" "901" "943" "824" "863" "1396" "1471" "1536" "1538" "981" "1400" "1474" "66" "660" "661" "3408" "3409" "3410" "3411" "730" "864" "902" "904" "905" "906" "907" "908" "731" "692" "732" "760" "665" "734" "1551" "989" "99" "1480" "1462" "1530" "974" "1387" "1388" "1389" "763" "737" "738" "739" "873" "874" "875" "914" "915" "916" "1481" "1552" "990" "991" "992" "1419" "963" "964" "965" "1454" "966" "967" "968" "764" "7" "74" "740" "838" "84" "876" "877" "878" "917" "1420" "1556" "1557" "1558" "993" "1503" "961" "741" "767" "768" "769" "67" "670" "918" "919" "799" "879" "88" "920" "921" "995" "1421" "1423" "1425" "1487" "1488" "956" "1390" "1391" "1466" "1531" "703" "704" "742" "743" "77" "770" "8" "80" "801" "1354" "880" "881" "957" "4728" "996" "997" "998" "1427" "1374" "1375" "1376" "1456" "969" "97" "970" "1377" "672" "673" "705" "771" "772" "773" "709" "882" "922" "923" "924" "802" "803" "1428" "1430" "1433" "1492" "1493" "631" "632" "521" "559" "56" "560" "745" "746" "775" "676" "677" "804" "886" "925" "926" "927" "807" "846" "2326" "2327" "2328" "2091" "2275" "2276" "2278" "2279" "2092" "2239" "2240" "2241" "2243" "2244" "2329" "2353" "2354" "2355" "2356" "2063" "2065" "2330" "2331" "2334" "2614" "2615" "2195" "2196" "2197" "2281" "2282" "2283" "2284" "2297" "2299" "2300" "2213" "2285" "2066" "3345" "3346" "3347" "2214" "2217" "2302" "2303" "2304" "2305" "2420" "2421" "2422" "3348" "3349" "3350" "2200" "2306" "2079" "2080" "2081" "2218" "2219" "2423" "2424" "2425" "2222" "2307" "2308" "2310" "2311" "2312" "2313" "2497" "2499" "2500" "2501" "2550" "2084" "2085" "2223" "2224" "2551" "2552" "2553" "2554" "2227" "2228" "2314" "2315" "2316" "2621" "2426" "2427" "2428" "2317" "2318" "2086" "2230" "2231" "2429" "2430" "2431" "2432" "2319" "2320" "2232" "2502" "2503" "2504" "2505" "2286" "2287" "2289" "2506" "2555" "2556" "2557" "2069" "2071" "2623" "2624" "2625" "2434" "2435" "2072" "2205" "2206" "2207" "2208" "2436" "2437" "2438" "2508" "2509" "2511" "2291" "2292" "2293" "2560" "2561" "2073" "2075" "2209" "2324" "2192" "2193" "2194" "1885" "2015" "2016" "1801" "1886" "1887" "2336" "2337" "2338" "2017" "2018" "2019" "2020" "1802" "2104" "2181" "2182" "2183" "4783" "2093" "1890" "2246" "1892" "2021" "2023" "2024" "2247" "2342" "2343" "2189" "2269" "2271" "2272" "2273" "1808" "1809" "1810" "3235" "2344" "2346" "2096" "2097" "2274" "1895" "3234" "3236" "2025" "2026" "2027" "2028" "2099" "2100" "2250" "2251" "2253" "2254" "2029" "1811" "1812" "1815" "3231" "2255" "2347" "2348" "2349" "2351" "2101" "2180" "2184" "2185" "2263" "2264" "2265" "2030" "2031" "2032" "1816" "1817" "1818" "2256" "2257" "2258" "2260" "2261" "1819" "3065" "2034" "2262" "2035" "2036" "2037" "1822" "3069" "2038" "2266" "2268" "2186" "2187" "1884" "2775" "2901" "2776" "2777" "2692" "2755" "2756" "2757" "2758" "2823" "2824" "2825" "2626" "2627" "2694" "2705" "2707" "3086" "3097" "2710" "2711" "2646" "2696" "2759" "2760" "2761" "2770" "2787" "2852" "2853" "2854" "2826" "2629" "2630" "2612" "2658" "2659" "2697" "2698" "2699" "2700" "2648" "2762" "2763" "2764" "2828" "2830" "2831" "2650" "3091" "2832" "2633" "2634" "2635" "2703" "2765" "2766" "2767" "2837" "2838" "2839" "2714" "2715" "2716" "2717" "3093" "2834" "2645" "2789" "2790" "2791" "2792" "2857" "3098" "2637" "2661" "2662" "2663" "2718" "2719" "2781" "2782" "2720" "2721" "2722" "2723" "2847" "2848" "2794" "2796" "2797" "2849" "2654" "2656" "2639" "2640" "3088" "3089" "2532" "2533" "2534" "2594" "2596" "2393" "2610" "2613" "2441" "2442" "2443" "2512" "2513" "2394" "2395" "2396" "2475" "2476" "2414" "2415" "2493" "2514" "2516" "2517" "2563" "2477" "2478" "2479" "2535" "2564" "2359" "2360" "2361" "2362" "2378" "2379" "2380" "2893" "2894" "2895" "2363" "2444" "2445" "2446" "2381" "2464" "2465" "2466" "2447" "2568" "2569" "2367" "2468" "2523" "2524" "2525" "2416" "2449" "2450" "2451" "2453" "2583" "2584" "2537" "2538" "2597" "2598" "2599" "2686" "3075" "3078" "2571" "2370" "2371" "2600" "2397" "2399" "2400" "2401" "2402" "2687" "2688" "2751" "2754" "2372" "2454" "2455" "2480" "2481" "2482" "2483" "2484" "2456" "2458" "3083" "2575" "2540" "2542" "2602" "2603" "2684" "2685" "2745" "2382" "2383" "2403" "2404" "2578" "2373" "2384" "2471" "2527" "2405" "2406" "2486" "2488" "2543" "3103" "2374" "2375" "2376" "2377" "2528" "2588" "2589" "2590" "2592" "2747" "2748" "2459" "2460" "2462" "2463" "2605" "2606" "2607" "2410" "2411" "2412" "2413" "2489" "2490" "2547" "2473" "2357" "2358" "2439" "2440" "2474" "2530" "2531" "3279" "3280" "3281" "3282" "2939" "2940" "3336" "3337" "3338" "3339" "3340" "3341" "3342" "2986" "3343" "3344" "2987" "2988" "3004" "3284" "3290" "3294" "3412" "3413" "3414" "3415" "2989" "2991" "1300" "3248" "3005" "3264" "3302" "3303" "3304" "4733" "3305" "3306" "3307" "3250" "3251" "3252" "3267" "2928" "2929" "2930" "2931" "4727" "4787" "6060" "3406" "6411" "5086" "3253" "2923" "2924" "2992" "2993" "2995" "2932" "3012" "3013" "3015" "6710" "6763" "7213" "7564" "7899" "4285" "4288" "830" "3254" "3256" "3257" "3201" "3269" "3270" "4289" "4290" "7790" "8643" "8739" "3258" "3272" "2934" "8797" "8756" "4233" "4287" "556" "3000" "3002" "3003" "3260" "3261" "3016" "3017" "3018" "3019" "4803" "4769" "3262" "3273" "4780" "4781" "4506" "4820" "4811" "4812" "3274" "3275" "2938" "3022" "4813" "4461" "4814" "3024" "3061" "2917" "2973" "2665" "2666" "2724" "2725" "2728" "2956" "1825" "1826" "2906" "2959" "2974" "2976" "3237" "2729" "2730" "2798" "2800" "2960" "3238" "3241" "2801" "2744" "2810" "2812" "2813" "2887" "2962" "2963" "2964" "1830" "2918" "2919" "2889" "3285" "3286" "3287" "1832" "1833" "3288" "3289" "2943" "3224" "3225" "3292" "3246" "3247" "3228" "3232" "3332" "3333" "3334" "2866" "2672" "2944" "2945" "2946" "2732" "2979" "2981" "2982" "2985" "2733" "2908" "2965" "2969" "1835" "1836" "1837" "2735" "2803" "2804" "2948" "3223" "2909" "2910" "2937" "2805" "2867" "2868" "2869" "2871" "2675" "2676" "1824" "3242" "2270" "2971" "2972" "1847" "1850" "3244" "3245" "2677" "2678" "2739" "3243" "3249" "3335" "1840" "1843" "3226" "3227" "2807" "2808" "2954" "3230" "2914" "3101" "2877" "2878" "2679" "2680" "2681" "2682" "4804" "4810" "2669" "2664" "2655" "2608" "2601" "2622" "2619" "4825" "2558" "4827" "4806" "4805" "2702" "4836" "4835" "4837" "4823" "2683" "2039" "2587" "4474" "8679" "4818" "4462" "4463" "4451" "4815" "4816" "4817" "4479" "4503" "4778" "4777" "4480" "4511" "4770" "4771" "4473" "4487" "4772" "4773" "4819" "4821" "4822" "4501" "4504" "4508" "4502" "4514" "4477" "4478" "4729" "4730" "4731" "4734" "4784"}
  MINUS {?item wdt:P11557 ?id}
  BIND (CONCAT("https://ajuntament.barcelona.cat/informaciourbanistica/cerca/ca/fitxa/",?id,"/--/--/cp/") AS ?link)
}
Try it!
# edificis de Barcelona sense barri
SELECT DISTINCT ?edifici ?edificiLabel
WITH {
  SELECT ?edifici 
WHERE {
  ?edifici wdt:P131* wd:Q1492.
 } } AS %1
WHERE {
  INCLUDE %1.
  ?edifici wdt:P31/wdt:P279* wd:Q41176.
    OPTIONAL {
    ?edifici wdt:P131+ ?div.
    ?div wdt:P31 wd:Q790344 # barri Q75135432, districte Q790344.
  }
  FILTER (!BOUND(?div))
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca" .
}
}
Try it!
# 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!
# gegants
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!