query-230aabfa40381c969b6d9a2ba7e8df49

rq turtle/ttl

See https://m.wikidata.org/wiki/User:PAC2/Gender_neutral_labels

title: Items of class occupation with label, male form, female form and aliases

SELECT ?item ?itemLabel ?maleform ?femaleform (GROUP_CONCAT(?alias; SEPARATOR = ", ") AS ?aliases) WHERE { wd:Q12737077 (^(wdt:P279*)/^wdt:P31) ?item. ?item rdfs:label ?itemLabel. BIND(LANG(?itemLabel) AS ?lang) FILTER((LANG(?itemLabel)) = "fr") OPTIONAL { ?item wdt:P2521 ?femaleform. FILTER((LANG(?femaleform)) = ?lang) } OPTIONAL { ?item wdt:P3321 ?maleform. FILTER((LANG(?maleform)) = ?lang) } OPTIONAL { ?item skos:altLabel ?alias. FILTER((LANG(?alias)) = ?lang) } } GROUP BY ?item ?itemLabel ?maleform ?femaleform LIMIT 100

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
# See https://m.wikidata.org/wiki/User:PAC2/Gender_neutral_labels
#title: Items of class occupation with label, male form, female form and aliases
SELECT ?item ?itemLabel ?maleform ?femaleform 
(GROUP_CONCAT(?alias; SEPARATOR = ", ") AS ?aliases) WHERE {
  wd:Q12737077 (^(wdt:P279*)/^wdt:P31) ?item.
  ?item rdfs:label ?itemLabel.
  BIND(LANG(?itemLabel) AS ?lang)
  FILTER((LANG(?itemLabel)) = "fr")
  OPTIONAL {
    ?item wdt:P2521 ?femaleform.
    FILTER((LANG(?femaleform)) = ?lang)
  }
  OPTIONAL {
    ?item wdt:P3321 ?maleform.
    FILTER((LANG(?maleform)) = ?lang)
  }
  OPTIONAL {
    ?item skos:altLabel ?alias.
    FILTER((LANG(?alias)) = ?lang)
  }
}
GROUP BY ?item ?itemLabel ?maleform ?femaleform
LIMIT 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?alias"):::projected v7("?aliases") v5("?femaleform"):::projected v6("?item"):::projected v4("?itemLabel"):::projected v7("?lang") v3("?maleform"):::projected a1((" ")) c3(["wd:Q12737077"]):::iri f0[["?itemLabel = 'fr'"]] f0 --> v4 a1 --"wdt:P279"--> c3 v6 --"wdt:P31"--> a1 v6 --"rdfs:label"--> v4 bind1[/"?itemLabel"/] v4 --o bind1 bind1 --as--o v7 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P2521".-> v5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P3321".-> v3 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v6 -."skos:altLabel".-> v1 end bind3[/"?alias"/] v1 --o bind3 bind3 --as--o v7