query-05c725157881cdd6d8a018242c6c12cc

rq turtle/ttl

Using Wikipedia category in queryI tried using mwapi to get articles from a category on Wikipedia (it's only 176 articles in my example). When I just do that, it works fine, but if I add more restrictions I get a timeout. Is it possible to optimize it in some way? What I tried:

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?genderLabel WHERE {
  SERVICE wikibase:mwapi {
     bd:serviceParam wikibase:endpoint "en.wikipedia.org";
                     wikibase:api "Generator";
                     mwapi:generator "categorymembers";
                     mwapi:gcmtitle "Category:Israeli lawyers";.
     ?item wikibase:apiOutputItem mwapi:item.
  } 
  ?item wdt:P21 ?gender . 
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,he". }    
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?gender") v1("?item"):::projected c16(["en,he"]):::literal c12(["mwapi:item"]):::iri c8(["categorymembers"]):::literal c4(["en.wikipedia.org"]):::literal c2(["bd:serviceParam"]):::iri c10(["Category:Israeli lawyers"]):::literal c6(["Generator"]):::literal subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c2 --"mwapi:endpoint"--> c4 c2 --"mwapi:api"--> c6 c2 --"mwapi:generator"--> c8 c2 --"mwapi:gcmtitle"--> c10 v1 --"mwapi:apiOutputItem"--> c12 end v1 --"wdt:P21"--> v2 subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c2 --"mwapi:language"--> c16 end