query-9eb8866ffabdbeb6fbb2141a44429049

rq turtle/ttl

Gamalielseems

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT DISTINCT ?item ?linkcount ?lambiekurl
where
{
  { { SELECT ?item ?linkcount { 
   {
  select ?occ WHERE {
    ?list wdt:P31 wd:Q65181907 .                     # find the WD item for the list
    ?article schema:name ?sitelink_list ; schema:about ?list ; schema:isPartOf <https://en.wikipedia.org/> .
    filter(str(?sitelink_list)="Wikipedia:WikiProject Women in Red/Missing articles by occupation/Cartoonists")
    ?list p:P360 [ pq:P106 ?occ1 ].                    # get its occupations
    ?occ wdt:P279* ?occ1 .
  }
}
    {?item wdt:P106 ?occ .}                            # item has this occupation
  MINUS { ?item wdt:P5035 ?lambiek } # those in the Comiclopedia omitted here, since it will be returned in the other subquery
  MINUS {?wen schema:about ?item ; schema:isPartOf <https://en.wikipedia.org/> . } # has no en.wikipedia sitelink
  ?item wdt:P21 wd:Q6581072 .                      # gender is female
  ?item wdt:P31 wd:Q5 .                            # instance is human
  ?item wikibase:sitelinks ?linkcount .            # number of sitelinks for the item
  }
}} UNION { { SELECT ?item ?linkcount ?lambiekurl { 
   {
  select ?occ WHERE {
    ?list wdt:P31 wd:Q65181907 .                     # find the WD item for the list
    ?article schema:name ?sitelink_list ; schema:about ?list ; schema:isPartOf <https://en.wikipedia.org/> .
    filter(str(?sitelink_list)="Wikipedia:WikiProject Women in Red/Missing articles by occupation/Cartoonists")
    ?list p:P360 [ pq:P106 ?occ1 ].                    # get its occupations
    ?occ wdt:P279* ?occ1 .
  }
}
  ?item wdt:P5035 ?lambiek.  BIND ((CONCAT ("[https://www.lambiek.net/artists/", ?lambiek, ".htm entry]")) as ?lambiekurl) . # is in the Lambiek Comiclopedia
  MINUS {?wen schema:about ?item ; schema:isPartOf <https://en.wikipedia.org/> . } # has no en.wikipedia sitelink
  ?item wdt:P21 wd:Q6581072 .                      # gender is female
  ?item wdt:P31 wd:Q5 .                            # instance is human
  ?item wikibase:sitelinks ?linkcount .            # number of sitelinks for the item
  }
}}
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?article") v6("?item"):::projected v7("?lambiek") v10("?lambiekurl"):::projected v9("?linkcount"):::projected v2("?list") v5("?occ") v4("?occ1") v1("?sitelink_list") v8("?wen") a1((" ")) a2((" ")) c14(["wd:Q6581072"]):::iri c3(["wd:Q65181907"]):::iri c7([https://en.wikipedia.org/]):::iri c15(["wd:Q5"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; f0[["str(?sitelink_list) = 'Wikipedia:WikiProject Women in Red/Missing articles by occupation/Cartoonists'"]] f0 --> v1 v2 --"p:direct/P31"--> c3 v3 --"schema:name"--> v1 v3 --"schema:about"--> v2 v3 --"schema:isPartOf"--> c7 a2 --"p:qualifier/P106"--> v4 v2 --"p:P360"--> a2 v5 --"p:direct/P279"--> v4 v6 --"p:direct/P5035"--> v7 bind1[/"concat('#91;https://www.lambiek.net/artists/',?lambiek,'.htm entry#93;')"/] v7 --o bind1 bind1 --as--o v10 subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v8 --"schema:about"--> v6 v8 --"schema:isPartOf"--> c7 end v6 --"p:direct/P21"--> c14 v6 --"p:direct/P31"--> c15 v6 --"wikibase:sitelinks"--> v9 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f3[["str(?sitelink_list) = 'Wikipedia:WikiProject Women in Red/Missing articles by occupation/Cartoonists'"]] f3 --> v1 v2 --"p:direct/P31"--> c3 v3 --"schema:name"--> v1 v3 --"schema:about"--> v2 v3 --"schema:isPartOf"--> c7 a1 --"p:qualifier/P106"--> v4 v2 --"p:P360"--> a1 v5 --"p:direct/P279"--> v4 v6 --"p:direct/P106"--> v5 subgraph minus4["MINUS"] style minus4 stroke-width:6px,fill:pink,stroke:red; v6 --"p:direct/P5035"--> v7 end subgraph minus5["MINUS"] style minus5 stroke-width:6px,fill:pink,stroke:red; v8 --"schema:about"--> v6 v8 --"schema:isPartOf"--> c7 end v6 --"p:direct/P21"--> c14 v6 --"p:direct/P31"--> c15 v6 --"wikibase:sitelinks"--> v9 end union0r <== or ==> union0l end