query-c4436d52a3fa56e58bb7498836378001

rq turtle/ttl

Bouzinac

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 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#>
SELECT ?item ?itemLabel ?naissance
  (COALESCE(
    IF (BOUND(?nom2), CONCAT(?nom1Label, " ", ?nom2Label), 1/0),
    IF (BOUND(?nom1), ?nom1Label, 1/0),
    IF (BOUND(?nom), ?nomLabel, 1/0)
  ) AS ?NOM)
  (COALESCE(
    IF (BOUND(?pr_nom2), CONCAT(?pr_nom1Label, " ", ?pr_nom2Label), 1/0),
    IF (BOUND(?pr_nom1), ?pr_nom1Label, 1/0),
    IF (BOUND(?pr_nom), ?pr_nomLabel, 1/0)
  ) AS ?PRENOM)
WHERE {
  ?item wdt:P39 wd:Q258045.
  OPTIONAL { ?item wdt:P569 ?naissance. }
  OPTIONAL {
    ?item p:P734 ?nom1_statement.
    ?nom1_statement a wikibase:BestRank.
    ?nom1_statement pq:P1545 "1".
    ?nom1_statement ps:P734 ?nom1.
  }
  OPTIONAL {
    ?item p:P734 ?nom2_statement.
    ?nom2_statement a wikibase:BestRank.
    ?nom2_statement pq:P1545 "2".
    ?nom2_statement ps:P734 ?nom2.
  }
  OPTIONAL {
    ?item p:P734 ?nom_statement.
    ?nom_statement a wikibase:BestRank.
    ?nom_statement ps:P734 ?nom.
    FILTER (NOT EXISTS { ?nom_statement pq:P1545 "1". } && NOT EXISTS { ?nom_statement pq:P1545 "2". })
  }
  OPTIONAL {
    ?item p:P735 ?pr_nom1_statement.
    ?pr_nom1_statement a wikibase:BestRank.
    ?pr_nom1_statement pq:P1545 "1".
    ?pr_nom1_statement ps:P735 ?pr_nom1.
  }
  OPTIONAL {
    ?item p:P735 ?pr_nom2_statement.
    ?pr_nom2_statement a wikibase:BestRank.
    ?pr_nom2_statement pq:P1545 "2".
    ?pr_nom2_statement ps:P735 ?pr_nom2.
  }
  OPTIONAL {
    ?item p:P735 ?pr_nom_statement.
    ?pr_nom_statement a wikibase:BestRank.
    ?pr_nom_statement ps:P735 ?pr_nom.
    FILTER (NOT EXISTS { ?pr_nom_statement pq:P1545 "1". } && NOT EXISTS { ?pr_nom_statement pq:P1545 "2". })
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "fr".
    ?item    rdfs:label ?itemLabel.
    ?nom1    rdfs:label ?nom1Label.
    ?nom2    rdfs:label ?nom2Label.
    ?nom     rdfs:label ?nomLabel.
    ?pr_nom1 rdfs:label ?pr_nom1Label.
    ?pr_nom2 rdfs:label ?pr_nom2Label.
    ?pr_nom  rdfs:label ?pr_nomLabel.
  }
} ORDER BY ?NOM ?PRENOM

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v24("?NOM") v24("?PRENOM") v5("?item"):::projected v17("?itemLabel"):::projected v6("?naissance"):::projected v11("?nom"):::projected v8("?nom1"):::projected v18("?nom1Label"):::projected v7("?nom1_statement") v10("?nom2"):::projected v19("?nom2Label"):::projected v9("?nom2_statement") v20("?nomLabel"):::projected v4("?nom_statement") v16("?pr_nom"):::projected v13("?pr_nom1"):::projected v21("?pr_nom1Label"):::projected v12("?pr_nom1_statement") v15("?pr_nom2"):::projected v22("?pr_nom2Label"):::projected v14("?pr_nom2_statement") v23("?pr_nomLabel"):::projected v3("?pr_nom_statement") c9(["wikibase:BestRank"]):::iri c16(["fr"]):::literal c5(["wd:Q258045"]):::iri c2(["1"]):::literal c3(["2"]):::literal c14(["bd:serviceParam"]):::iri v5 --"p:direct/P39"--> c5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:direct/P569".-> v6 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:P734".-> v7 v7 --"a"--> c9 v7 --"p:qualifier/P1545"--> c2 v7 --"p:statement/P734"--> v8 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:P734".-> v9 v9 --"a"--> c9 v9 --"p:qualifier/P1545"--> c3 v9 --"p:statement/P734"--> v10 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:P734".-> v4 v4 --"a"--> c9 v4 --"p:statement/P734"--> v11 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:P735".-> v12 v12 --"a"--> c9 v12 --"p:qualifier/P1545"--> c2 v12 --"p:statement/P735"--> v13 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:P735".-> v14 v14 --"a"--> c9 v14 --"p:qualifier/P1545"--> c3 v14 --"p:statement/P735"--> v15 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:P735".-> v3 v3 --"a"--> c9 v3 --"p:statement/P735"--> v16 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c14 --"wikibase:language"--> c16 v5 --"rdfs:label"--> v17 v8 --"rdfs:label"--> v18 v10 --"rdfs:label"--> v19 v11 --"rdfs:label"--> v20 v13 --"rdfs:label"--> v21 v15 --"rdfs:label"--> v22 v16 --"rdfs:label"--> v23 end bind0[/"if(bound(?nom2),concat(?nom1Label,' ',?nom2Label),'1^^xsd:integer' / '0^^xsd:integer')if(bound(?nom1),?nom1Label,'1^^xsd:integer' / '0^^xsd:integer')if(bound(?nom),?nomLabel,'1^^xsd:integer' / '0^^xsd:integer')"/] v10 --o bind0 v18 --o bind0 v19 --o bind0 v8 --o bind0 v11 --o bind0 v20 --o bind0 bind0 --as--o v24 bind1[/"if(bound(?pr_nom2),concat(?pr_nom1Label,' ',?pr_nom2Label),'1^^xsd:integer' / '0^^xsd:integer')if(bound(?pr_nom1),?pr_nom1Label,'1^^xsd:integer' / '0^^xsd:integer')if(bound(?pr_nom),?pr_nomLabel,'1^^xsd:integer' / '0^^xsd:integer')"/] v15 --o bind1 v21 --o bind1 v22 --o bind1 v13 --o bind1 v16 --o bind1 v23 --o bind1 bind1 --as--o v24