query-130a902b7a068298237d607e812ac083

rq turtle/ttl

Query to list oblasts and republics of Russia PREFIX schema: http://schema.org/ # remember to add this SELECT DISTINCT ?region ?regionLabel ?wplink WHERE { {?region wdt:P31 wd:Q835714} UNION {?region wdt:P31 wd:Q41162} UNION {?region wdt:P31 wd:Q831740} union {?region wdt:P31 wd:Q184122} UNION {?region wdt:P31 wd:Q183342} . # region - is an instance of an oblast, republic, or krai of - Russia ?region wdt:P131 wd:Q159 . # region - is in administrative district of - Russia # BIND (wd:Q2753 AS ?region) . # Limits results to Ryazan Oblast (Q2753) # OPTIONAL {?dist wdt:P625 ?coord } # district - has geographic coordinates of - ?coord (if added column for items that exist) # OPTIONAL {?dist wdt:P18 ?pic } . # add a column for pics (p18) if there is one in WD (toggle w/next line) #MINUS {?dist wdt:P18 ?pic} . # use this instead of previous line to see items with NO PIC OPTIONAL { ?wplink schema:about ?region . # WP link - is about - ?region ?wplink schema:inLanguage "en" . ?wplink schema:isPartOf https://en.wikipedia.org/ . } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY ASC(?regionLabel)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Query to list oblasts and republics of Russia
PREFIX schema: <http://schema.org/> # remember to add this
SELECT DISTINCT ?region ?regionLabel ?wplink
WHERE {
      {?region wdt:P31 wd:Q835714} UNION {?region wdt:P31 wd:Q41162} UNION {?region wdt:P31 wd:Q831740} union {?region wdt:P31 wd:Q184122} 
           UNION {?region wdt:P31 wd:Q183342} . 
                    # region - is an instance of an oblast, republic, or krai of - Russia
      ?region wdt:P131 wd:Q159 .        # region - is in administrative district of - Russia
      # BIND (wd:Q2753 AS ?region) .       # Limits results to Ryazan Oblast (Q2753)
      # OPTIONAL {?dist wdt:P625 ?coord }   # district - has geographic coordinates of - ?coord (if added column for items that exist)
      # OPTIONAL {?dist wdt:P18 ?pic } .        # add a column for pics (p18) if there is one in WD   (toggle w/next line) 
      #MINUS {?dist wdt:P18 ?pic} .           # use this instead of previous line to see items with NO PIC
      OPTIONAL {
         ?wplink schema:about ?region .   # WP link - is about - ?region
         ?wplink schema:inLanguage "en" .
         ?wplink schema:isPartOf <https://en.wikipedia.org/> .
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ASC(?regionLabel)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?region"):::projected v1("?regionLabel"):::projected v3("?wplink"):::projected c2(["wd:Q835714"]):::iri c3(["wd:Q41162"]):::iri c11(["en"]):::literal c6(["wd:Q183342"]):::iri c4(["wd:Q831740"]):::iri c8(["wd:Q159"]):::iri c5(["wd:Q184122"]):::iri c13([https://en.wikipedia.org/]):::iri c15(["bd:serviceParam"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; subgraph union3[" Union "] subgraph union3l[" "] style union3l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> c6 end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> c5 end union3r <== or ==> union3l end end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> c4 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> c3 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> c2 end union0r <== or ==> union0l end v2 --"wdt:P131"--> c8 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."schema:about".-> v2 v3 --"schema:inLanguage"--> c11 v3 --"schema:isPartOf"--> c13 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c15 --"wikibase:language"--> c11 end