query-3c05bfea296654aef5a371ea824687ff

rq turtle/ttl

Freguesias antigas

SELECT distinct ?item ?itemLabel ?locadm ?locadmLabel ?conadm ?conadmLabel ?locloc ?loclocLabel ?conloc ?conlocLabel ?locendTime WHERE { { ?item wdt:P131/wdt:P131* wd:Q2915956 . } #portugal

     { ?item wdt:P131   ?locadm . } #locadm

   { ?locadm wdt:P131   ?conadm  . } #conadm  
    { ?conadm  wdt:P31   wd:Q13217644  . } #freguesia

   { ?locadm wdt:P31  wd:Q1131296 . } #freguesia

?locadm p:P31 ?instaceOfStatement . #obtem qual o statment of P31

?instaceOfStatement ps:P31 wd:Q1131296 . #o statment será igual a 'freguesia'

?instaceOfStatement pq:P580 ?admstarTime . #o qualifier será 'start time'

   { ?item wdt:P276  ?locloc . } #local
     { ?locloc wdt:P131   ?conloc  . } #conadm  
    { ?conloc  wdt:P31   wd:Q13217644  . } #freguesia

   { ?locloc wdt:P31  wd:Q1131296 . } #freguesia

?locloc p:P31 ?instaceOfStatement . #obtem qual o statment of P31 ?instaceOfStatement ps:P31 wd:Q1131296 . #o statment será igual a 'freguesia' ?instaceOfStatement pq:P582 ?locendTime . #o qualifier será 'end time'

SERVICE wikibase:label { bd:serviceParam wikibase:language "pt". } }

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Freguesias antigas

SELECT distinct ?item ?itemLabel ?locadm ?locadmLabel ?conadm  ?conadmLabel ?locloc ?loclocLabel ?conloc ?conlocLabel ?locendTime 
WHERE 
{
 {  ?item wdt:P131/wdt:P131* wd:Q2915956  .  } #portugal

         { ?item wdt:P131   ?locadm . } #locadm

       { ?locadm wdt:P131   ?conadm  . } #conadm  
        { ?conadm  wdt:P31   wd:Q13217644  . } #freguesia  

       { ?locadm wdt:P31  wd:Q1131296 . } #freguesia 
#  ?locadm p:P31 ?instaceOfStatement .          #obtem qual o statment of P31
#  ?instaceOfStatement ps:P31 wd:Q1131296 .   #o statment será igual a 'freguesia'
#  ?instaceOfStatement pq:P580 ?admstarTime .     #o qualifier será 'start time'


       { ?item wdt:P276  ?locloc . } #local
         { ?locloc wdt:P131   ?conloc  . } #conadm  
        { ?conloc  wdt:P31   wd:Q13217644  . } #freguesia  

       { ?locloc wdt:P31  wd:Q1131296 . } #freguesia 
  ?locloc p:P31 ?instaceOfStatement .          #obtem qual o statment of P31
 ?instaceOfStatement ps:P31 wd:Q1131296 .   #o statment será igual a 'freguesia'
  ?instaceOfStatement pq:P582 ?locendTime .     #o qualifier será 'end time'  

  SERVICE wikibase:label { bd:serviceParam wikibase:language "pt". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?conadm"):::projected v5("?conloc"):::projected v6("?instaceOfStatement") v1("?item"):::projected v2("?locadm"):::projected v7("?locendTime"):::projected v4("?locloc"):::projected a1((" ")) c13(["pt"]):::literal c5(["wd:Q1131296"]):::iri c11(["bd:serviceParam"]):::iri c2(["wd:Q2915956"]):::iri c4(["wd:Q13217644"]):::iri v1 --"p:direct/P131"--> a1 a1 --"p:direct/P131"--> c2 v1 --"p:direct/P131"--> v2 v2 --"p:direct/P131"--> v3 v3 --"p:direct/P31"--> c4 v2 --"p:direct/P31"--> c5 v1 --"p:direct/P276"--> v4 v4 --"p:direct/P131"--> v5 v5 --"p:direct/P31"--> c4 v4 --"p:direct/P31"--> c5 v4 --"p:P31"--> v6 v6 --"p:statement/P31"--> c5 v6 --"p:qualifier/P582"--> v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end