query-96b29c8c57316decad31f2b42bb8de4f

rq turtle/ttl

persons surnames 12 maio

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT distinct ?person  ?personLabel  ?surname  ?surnameLabel  ?commcat ?familyLabel # ?comm
WHERE {

   ?person   wdt:P31    wd:Q5 .        # é pessoa
#    ?person   wdt:P21    wd:Q6581072 .        # é mulher
   ?person   wdt:P734   ?surname .    # tem famyli name   

   ?person   wdt:P27     wd:Q38  .      # pais ou continente         ortugal   # /wdt:P361* 

   ?commpe schema:about ?person ; schema:isPartOf <https://commons.wikimedia.org/> .   #esta na commons

               ?surname   wdt:P31             ?family  . 
            {  ?surname   wdt:P31   wd:Q101352  .    }  # UNION          #  /wdt:P279*   #é family name  Q101352
         #   {  ?surname   wdt:P31   wd:Q66480858  .  } UNION          #affixed
       #      { ?surname   wdt:P31   wd:Q29042997  .  } UNION          #double
     #        { ?surname   wdt:P31   wd:Q106319018  . }                #hyphenated


    optional  { ?surname   wdt:P373   ?commcat  . }
   filter not exists { ?commsu schema:about ?surname ; schema:isPartOf <https://commons.wikimedia.org/> .  }  # nao esta na commons   

   SERVICE wikibase:label { bd:serviceParam wikibase:language "en,pt". } 
}
LIMIT 15000

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?commcat"):::projected v4("?commpe") v1("?commsu") v5("?family") v3("?person"):::projected v2("?surname"):::projected c9(["wd:Q101352"]):::iri c3([https://commons.wikimedia.org/]):::iri c14(["en,pt"]):::literal c8(["wd:Q38"]):::iri c12(["bd:serviceParam"]):::iri c5(["wd:Q5"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"schema:about"--> e0v2 e0v1 --"schema:isPartOf"--> e0c3 e0v1("?commsu"):::projected e0v2("?surname"):::projected e0c3([https://commons.wikimedia.org/]):::iri end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> v2 f0 --> c2 f0 --> c3 v1 --"schema:about"--> v2 v1 --"schema:isPartOf"--> c3 v3 --"wdt:P31"--> c5 v3 --"wdt:P734"--> v2 v3 --"wdt:P27"--> c8 v4 --"schema:about"--> v3 v4 --"schema:isPartOf"--> c3 v2 --"wdt:P31"--> v5 v2 --"wdt:P31"--> c9 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P373".-> v6 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end