query-e0ea628186fc45cb56eed7f23b8099f5

rq turtle/ttl

TODO

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT
  ?item ?itemLabel ?itemDescription ?sitelinks ?date_of_birth
  ?cod ?cod_refs ?mod ?mod_refs
WHERE
{

{
  SELECT
    ?item ?cod_stm ?cod ?cod_refs (SAMPLE(?modLabel) AS ?mod)
    (GROUP_CONCAT(CONCAT(?mod_ref_propLabel, ": ", ?mod_ref_valueLabel); SEPARATOR=", ") AS ?mod_refs)
  WHERE
  {

{
  SELECT
    ?item ?cod_stm (SAMPLE(?codLabel) AS ?cod)
    (GROUP_CONCAT(CONCAT(?cod_ref_propLabel, ": ", ?cod_ref_valueLabel); SEPARATOR=", ") AS ?cod_refs)
  WHERE
  {
    ?item wdt:P31 wd:Q5 .
    ?item wdt:P570 "+2001-08-25T00:00:00Z"^^xsd:dateTime .
    OPTIONAL
    {
      ?item p:P509 ?cod_stm .
      ?cod_stm ps:P509 ?cod .
      OPTIONAL
      {
        ?cod_stm prov:wasDerivedFrom ?cod_ref .
        ?cod_ref ?cod_ref_pr ?cod_ref_value .
        ?cod_ref_prop wikibase:reference ?cod_ref_pr .
      }
    }
    SERVICE wikibase:label
    {
      bd:serviceParam wikibase:language "en" .
      ?cod rdfs:label ?codLabel .
      ?cod_ref_prop rdfs:label ?cod_ref_propLabel .
      ?cod_ref_value rdfs:label ?cod_ref_valueLabel .
    }
  }
  GROUP BY ?item ?cod_stm
}    OPTIONAL
    {
      ?item p:P1196 ?mod_stm .
      ?mod_stm ps:P1196 ?mod .
      OPTIONAL
      {
        ?mod_stm prov:wasDerivedFrom ?mod_ref .
        ?mod_ref ?mod_ref_pr ?mod_ref_value .
        ?mod_ref_prop wikibase:reference ?mod_ref_pr .
      }
    }
    SERVICE wikibase:label
    {
      bd:serviceParam wikibase:language "en" .
      ?mod rdfs:label ?modLabel .
      ?mod_ref_prop rdfs:label ?mod_ref_propLabel .
      ?mod_ref_value rdfs:label ?mod_ref_valueLabel .
    }
  }
  GROUP BY ?item ?mod_stm ?cod_stm ?cod ?cod_refs
}  ?item wikibase:sitelinks ?sitelinks .
  OPTIONAL { ?item wdt:P569 ?date_of_birth . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY DESC(?sitelinks)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v12("?cod"):::projected v9("?codLabel") v5("?cod_ref") v6("?cod_ref_pr") v8("?cod_ref_prop") v10("?cod_ref_propLabel") v7("?cod_ref_value") v11("?cod_ref_valueLabel") v12("?cod_refs"):::projected v3("?cod_stm") v23("?date_of_birth"):::projected v2("?item"):::projected v22("?mod"):::projected v19("?modLabel") v15("?mod_ref") v16("?mod_ref_pr") v18("?mod_ref_prop") v20("?mod_ref_propLabel") v17("?mod_ref_value") v21("?mod_ref_valueLabel") v22("?mod_refs"):::projected v13("?mod_stm") v1("?sitelinks"):::projected c12(["en"]):::literal c10(["bd:serviceParam"]):::iri c2(["wd:Q5"]):::iri c4(["+2001-08-25T00:00:00Z^^xsd:dateTime"]):::literal v2 --"p:direct/P31"--> c2 v2 --"p:direct/P570"--> c4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:P509".-> v3 v3 --"p:statement/P509"--> v12 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."prov:wasDerivedFrom".-> v5 v5 -->v6--> v7 v8 --"wikibase:reference"--> v6 end end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 v12 --"rdfs:label"--> v9 v8 --"rdfs:label"--> v10 v7 --"rdfs:label"--> v11 end bind2[/"sample(?codLabel)"/] v9 --o bind2 bind2 --as--o v12 bind3[/"concat(?cod_ref_propLabel,': ',?cod_ref_valueLabel)"/] v10 --o bind3 v11 --o bind3 bind3 --as--o v12 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:P1196".-> v13 v13 --"p:statement/P1196"--> v22 subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v13 -."prov:wasDerivedFrom".-> v15 v15 -->v16--> v17 v18 --"wikibase:reference"--> v16 end end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 v22 --"rdfs:label"--> v19 v18 --"rdfs:label"--> v20 v17 --"rdfs:label"--> v21 end bind6[/"sample(?modLabel)"/] v19 --o bind6 bind6 --as--o v22 bind7[/"concat(?mod_ref_propLabel,': ',?mod_ref_valueLabel)"/] v20 --o bind7 v21 --o bind7 bind7 --as--o v22 v2 --"wikibase:sitelinks"--> v1 subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P569".-> v23 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end