query-c9f35d77abcc02659aff6a80ae28242f

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 schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel 
WHERE {

  {  
    SERVICE wikibase:mwapi {
      bd:serviceParam wikibase:api "Search";
                      wikibase:endpoint "www.wikidata.org";
                      mwapi:srsearch "Ruth".
      ?title wikibase:apiOutput mwapi:title.
    }
    BIND(IRI(CONCAT(STR(wd:), ?title)) AS ?item)
    ?item rdfs:label ?itemLabel . filter(lang(?itemLabel)="en")
    FILTER NOT EXISTS { ?item wdt:P734 wd:Q37494439 .}
    FILTER(regex(?itemLabel,".+Ruth$"))
  }
  UNION
  {
    ?item wdt:P734 wd:Q37494439 . # Surname is Ruth
  }
  MINUS
  {
    ?article schema:about ?item .
    ?article schema:isPartOf <https://he.wikipedia.org/> . # No article at hewiki
  }
  ?item wdt:P31 wd:Q5
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?article") v4("?item"):::projected v1("?itemLabel"):::projected v3("?title") c10(["www.wikidata.org"]):::literal c18([https://he.wikipedia.org/]):::iri c12(["Ruth"]):::literal c3(["wd:Q37494439"]):::iri c6(["bd:serviceParam"]):::iri c8(["Search"]):::literal c20(["wd:Q5"]):::iri c23(["#91;AUTO_LANGUAGE#93;,en"]):::literal c14(["mwapi:title"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P734"--> c3 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f0[["regex(?itemLabel,'.+Ruth$')"]] f0 --> v1 f1[["not "]] subgraph f1e0["Exists Clause"] e0v1 --"wdt:P734"--> e0c2 e0v1("?item"):::projected e0c2(["wd:Q37494439"]):::iri end f1--EXISTS--> f1e0 f1 --> v4 f1 --> c2 f1 --> c3 v4 --"wdt:P734"--> c3 f2[["?itemLabel = 'en'"]] f2 --> v1 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c6 --"mwapi:api"--> c8 c6 --"mwapi:endpoint"--> c10 c6 --"mwapi:srsearch"--> c12 v3 --"mwapi:apiOutput"--> c14 end bind3[/"concat(str('wd:'),?title)"/] v3 --o bind3 bind3 --as--o v4 v4 --"rdfs:label"--> v1 end union0r <== or ==> union0l end subgraph minus4["MINUS"] style minus4 stroke-width:6px,fill:pink,stroke:red; v4 --"schema:about"--> v4 v4 --"schema:isPartOf"--> c18 end v4 --"wdt:P31"--> c20 subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c6 --"mwapi:language"--> c23 end