query-86c438dfa68b1c69da4ed70a24612175
TODO
Use at
- https://query.wikidata.org/sparql
 
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#>
SELECT ?item ?itemLabel ?male ?female {
  ?item wdt:P31 wd:Q3624078 .
  VALUES ?male_val { wd:Q6581097 wd:Q499327 } .
  VALUES ?female_val { wd:Q6581072 wd:Q1775415 } .
  OPTIONAL {
    ?item p:P1549 ?male_statement .
    ?male_statement (pq:P366|pq:P518) ?male_val; ps:P1549 ?male .
    FILTER( LANG( ?male ) = 'fr' ) .
    MINUS { ?male_statement (pq:P366|pq:P518) wd:Q146786 } .
  } .
  OPTIONAL {
    ?item p:P1549 ?female_statement .
    ?female_statement (pq:P366|pq:P518) ?female_val; ps:P1549 ?female .
    FILTER( LANG( ?female ) = 'fr' ) .
    MINUS { ?female_statement (pq:P366|pq:P518) wd:Q146786 } .
  } .
  FILTER( BOUND( ?male ) && BOUND( ?female ) ) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" } .
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?female"):::projected 
  v7("?female_statement")
  v5("?female_val")
  v3("?item"):::projected 
  v1("?male"):::projected 
  v6("?male_statement")
  v4("?male_val")
  c2(["wd:Q3624078"]):::iri 
  c10(["bd:serviceParam"]):::iri 
  c8(["wd:Q146786"]):::iri 
  c3(["fr"]):::literal 
  f0[["bound(?male)bound(?female)"]]
  f0 --> v1
  f0 --> v2
  v3 --"p:direct/P31"-->  c2
  bind1[/VALUES ?male_val/]
  bind1-->v4
  bind10(["wd:Q6581097"])
  bind10 --> bind1
  bind11(["wd:Q499327"])
  bind11 --> bind1
  bind2[/VALUES ?female_val/]
  bind2-->v5
  bind20(["wd:Q6581072"])
  bind20 --> bind2
  bind21(["wd:Q1775415"])
  bind21 --> bind2
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    f3[["?male = 'fr'"]]
    f3 --> v1
    v3 -."p:P1549".->  v6
    subgraph union0[" Union "]
    subgraph union0l[" "]
      style union0l fill:#abf,stroke-dasharray: 3 3;
      v6 --"p:qualifier/P518"-->  v4
    end
    subgraph union0r[" "]
      style union0r fill:#abf,stroke-dasharray: 3 3;
      v6 --"p:qualifier/P366"-->  v4
    end
    union0r <== or ==> union0l
    end
    v6 --"p:statement/P1549"-->  v1
    subgraph minus4["MINUS"]
      style minus4 stroke-width:6px,fill:pink,stroke:red;
      subgraph union1[" Union "]
      subgraph union1l[" "]
        style union1l fill:#abf,stroke-dasharray: 3 3;
        v6 --"p:qualifier/P518"-->  c8
      end
      subgraph union1r[" "]
        style union1r fill:#abf,stroke-dasharray: 3 3;
        v6 --"p:qualifier/P366"-->  c8
      end
      union1r <== or ==> union1l
      end
    end
  end
  subgraph optional1["(optional)"]
  style optional1 fill:#bbf,stroke-dasharray: 5 5;
    f5[["?female = 'fr'"]]
    f5 --> v2
    v3 -."p:P1549".->  v7
    subgraph union2[" Union "]
    subgraph union2l[" "]
      style union2l fill:#abf,stroke-dasharray: 3 3;
      v7 --"p:qualifier/P518"-->  v5
    end
    subgraph union2r[" "]
      style union2r fill:#abf,stroke-dasharray: 3 3;
      v7 --"p:qualifier/P366"-->  v5
    end
    union2r <== or ==> union2l
    end
    v7 --"p:statement/P1549"-->  v2
    subgraph minus6["MINUS"]
      style minus6 stroke-width:6px,fill:pink,stroke:red;
      subgraph union3[" Union "]
      subgraph union3l[" "]
        style union3l fill:#abf,stroke-dasharray: 3 3;
        v7 --"p:qualifier/P518"-->  c8
      end
      subgraph union3r[" "]
        style union3r fill:#abf,stroke-dasharray: 3 3;
        v7 --"p:qualifier/P366"-->  c8
      end
      union3r <== or ==> union3l
      end
    end
  end
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c10 --"wikibase:language"-->  c3
  end