query-da3a1887b2b1f47a60f224804acb9a61

rq turtle/ttl

Propertiesinstance of (P31)subclass of (P279)country (P17)located in the administrative territorial entity (P131)religious order (P611)coordinate location (P625)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?label ?subj (SAMPLE(?whereLabel) AS ?where) (SAMPLE(?countryLabel) as ?country) (SAMPLE(?orderLabel) AS ?order) WHERE
{  ?subj wdt:P31/wdt:P279? ?type ;
      rdfs:label ?label filter (lang(?label) = "en")
?type wdt:P279? wd:Q44613. # instance of monastery or subtype
OPTIONAL { ?subj wdt:P17/rdfs:label ?countryLabel filter (lang(?countryLabel) = "en") }
OPTIONAL { ?subj wdt:P131/rdfs:label ?whereLabel filter (lang(?whereLabel) = "en") }
OPTIONAL { ?subj wdt:P611/rdfs:label ?orderLabel filter (lang(?orderLabel) = "en") }
MINUS {?subj wdt:P17 wd:Q142 } # not France
 MINUS {?subj wdt:P17 wd:Q27 } # not Ireland
?subj p:P625/psv:P625 ?loc. # coordinate-location statement
  ?loc wikibase:geoLatitude ?lat .
  ?loc wikibase:geoLongitude ?long .
   FILTER (?lat > 50) FILTER (?lat < 63)
   FILTER (?long > -10.5) FILTER (?long < 2.02) 
} GROUP BY ?label ?subj
ORDER BY ?label

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v11("?country") v6("?countryLabel"):::projected v1("?label"):::projected v3("?lat") v9("?loc") v2("?long") v12("?order") v4("?orderLabel"):::projected v7("?subj"):::projected v8("?type") v10("?where") v5("?whereLabel"):::projected a1((" ")) a2((" ")) a3((" ")) a4((" ")) a5((" ")) c9(["wd:Q44613"]):::iri c14(["wd:Q27"]):::iri c13(["wd:Q142"]):::iri f0[["?long < '2.02^^xsd:decimal'"]] f0 --> v2 f1[["?long > '-10.5^^xsd:decimal'"]] f1 --> v2 f2[["?lat < '63^^xsd:integer'"]] f2 --> v3 f3[["?lat > '50^^xsd:integer'"]] f3 --> v3 f4[["?label = 'en'"]] f4 --> v1 v7 --"p:direct/P31"--> a1 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; a1 --"p:direct/P279"--> v8 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; end union0r <== or ==> union0l end v7 --"rdfs:label"--> v1 subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v8 --"p:direct/P279"--> c9 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; end union1r <== or ==> union1l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v7 -."p:direct/P17".-> a2 a2 --"rdfs:label"--> v6 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v7 -."p:direct/P131".-> a3 a3 --"rdfs:label"--> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v7 -."p:direct/P611".-> a4 a4 --"rdfs:label"--> v4 end subgraph minus5["MINUS"] style minus5 stroke-width:6px,fill:pink,stroke:red; v7 --"p:direct/P17"--> c13 end subgraph minus6["MINUS"] style minus6 stroke-width:6px,fill:pink,stroke:red; v7 --"p:direct/P17"--> c14 end v7 --"p:P625"--> a5 a5 --"p:statement/value/P625"--> v9 v9 --"wikibase:geoLatitude"--> v3 v9 --"wikibase:geoLongitude"--> v2 bind10[/"sample(?whereLabel)"/] v5 --o bind10 bind10 --as--o v10 bind11[/"sample(?countryLabel)"/] v6 --o bind11 bind11 --as--o v11 bind12[/"sample(?orderLabel)"/] v4 --o bind12 bind12 --as--o v12