query-3b6843fcc5485cd47e0d058bb06e61b8

rq turtle/ttl

TODO

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?title (URI(CONCAT("https://es.wikipedia.org/wiki/", ?title)) AS ?article)
WHERE
{
  OPTIONAL # OPTIONAL is used to force this block to be evaluated first 
  {
    SERVICE wikibase:mwapi
    {
      bd:serviceParam wikibase:endpoint "es.wikipedia.org" .
      bd:serviceParam wikibase:api "Generator" .
      bd:serviceParam mwapi:generator "search" .
      bd:serviceParam mwapi:gsrsearch '"esposa de" incategory:Mujeres' .
      bd:serviceParam mwapi:gsrlimit "max" .
      ?title wikibase:apiOutput mwapi:title .
      ?item wikibase:apiOutputItem mwapi:item .
    }
    FILTER BOUND(?item)
  }

{
  SELECT DISTINCT ?item
  WHERE
  {
    { ?item wdt:P27 wd:Q419 . }
    UNION
    { wd:Q419 ^wdt:P131* / ^wdt:P19 ?item . }
    UNION
    { ?item wdt:P1532 wd:Q419 . }

    ?item wdt:P31 wd:Q5 .
    ?item wdt:P21 wd:Q6581072 .
  }
}}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?article") v1("?item"):::projected v2("?title"):::projected a1((" ")) c16(["mwapi:item"]):::iri c25(["wd:Q6581072"]):::iri c8(["search"]):::literal c10([""esposa de" incategory:Mujeres"]):::literal c2(["bd:serviceParam"]):::iri c23(["wd:Q5"]):::iri c12(["max"]):::literal c18(["wd:Q419"]):::iri c4(["es.wikipedia.org"]):::literal c14(["mwapi:title"]):::iri c6(["Generator"]):::literal subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; 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:gsrsearch"--> c10 c2 --"mwapi:gsrlimit"--> c12 v2 --"mwapi:apiOutput"--> c14 v1 --"mwapi:apiOutputItem"--> c16 end end subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P1532"--> c18 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; a1 --"wdt:P131"--> c18 v1 --"wdt:P19"--> a1 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P27"--> c18 end union0r <== or ==> union0l end v1 --"wdt:P31"--> c23 v1 --"wdt:P21"--> c25 bind0[/"concat('https://es.wikipedia.org/wiki/',?title)"/] v2 --o bind0 bind0 --as--o v3