query-ef4a1fa586dfd74f602ac0fee2b6e981

rq turtle/ttl

SPARQL query

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 DISTINCT ?wikidata ?wikidata_group ?area ?gender WHERE {
    ?wikidata p:P39 ?mem.
    ?mem ps:P39 wd:Q42310659.
    OPTIONAL { ?mem pq:P4100 ?wikidata_group. }
    OPTIONAL { ?mem pq:P768 ?wikidata_area. }
    OPTIONAL { ?wikidata wdt:P21 ?raw_gender }
    OPTIONAL { ?wikidata wdt:P2002 ?twitter }
    OPTIONAL { ?wikidata wdt:P2013 ?facebook }
    FILTER NOT EXISTS { ?mem pq:P582 [] }
    SERVICE wikibase:label { 
      bd:serviceParam wikibase:language "en". 
      ?raw_gender rdfs:label ?gender .
      ?wikidata_area rdfs:label ?area .
    }
  }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?area"):::projected v7("?facebook") v8("?gender"):::projected v1("?mem") v5("?raw_gender") v6("?twitter") v2("?wikidata"):::projected v4("?wikidata_area") v3("?wikidata_group"):::projected a1((" ")) c13(["en"]):::literal c4(["wd:Q42310659"]):::iri c11(["bd:serviceParam"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"p:qualifier/P582"--> e0a1 e0v1("?mem"):::projected e0a1((" ")):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> a1 v1 --"p:qualifier/P582"--> a1 v2 --"p:P39"--> v1 v1 --"p:statement/P39"--> c4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:qualifier/P4100".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:qualifier/P768".-> v4 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P21".-> v5 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P2002".-> v6 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P2013".-> v7 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 v5 --"rdfs:label"--> v8 v4 --"rdfs:label"--> v9 end