query-9ddc2b8ddb2fd48c2729a3f644be5f46

rq turtle/ttl

Searching for multiple text strings in one query 13:31, 11 August 2020 (UTC)) talk (Trilotat: you've been amazing. Dipsacus fullonumI've got a long list of faults (my spouse reminds me of this often! haha) and would like to search for articles that contain these terms, but I don't want to search each string individually. I can manipulate the results to add my list, but my question is can someone provide the structure. Example, how can I search for articles that contain Fault Atacama OR Fault Wellington? If I search for fault atacama (WITHOUT quotes), I get three results. If I search for fault wellington, I get 10 results. I'd like this requested query to provide all 13 in the result. Peculiar, I know, but I can extend your query to include many other faults so I can then work on the results. If you have to filter the query to make it work, please consider Q13442814 and Q193842. Thanks so much for your time; I have been asking for a lot lately and @

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 ?itemLabel ?instance_of ?instance_ofLabel
WHERE
{
  VALUES ?search_string {
    "Atacama fault"
    "Wellington fault" 
    "it's my fault honey"
  }
  SERVICE wikibase:mwapi
  {
      bd:serviceParam wikibase:api "Search" .
      bd:serviceParam wikibase:endpoint "www.wikidata.org" .
      bd:serviceParam mwapi:srnamespace "0" .
      bd:serviceParam mwapi:srsearch ?search_string  .
      ?title wikibase:apiOutput mwapi:title .
  }
  BIND( URI(CONCAT(str(wd:),?title)) as ?item)
  OPTIONAL { ?item wdt:P31 ?instance_of }
  # MINUS { ?item wdt:P31 wd:Q13442814 }  # no articles
  # ?item wdt:P31 wd:Q47089 #only faults
  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("?instance_of"):::projected v3("?item"):::projected v1("?search_string") v2("?title") c6(["www.wikidata.org"]):::literal c8(["0"]):::literal c2(["bd:serviceParam"]):::iri c4(["Search"]):::literal c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal c11(["mwapi:title"]):::iri bind0[/VALUES ?search_string/] bind0-->v1 bind00(["Atacama fault"]) bind00 --> bind0 bind01(["Wellington fault"]) bind01 --> bind0 bind02(["it's my fault honey"]) bind02 --> bind0 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c2 --"mwapi:api"--> c4 c2 --"mwapi:endpoint"--> c6 c2 --"mwapi:srnamespace"--> c8 c2 --"mwapi:srsearch"--> v1 v2 --"mwapi:apiOutput"--> c11 end bind1[/"concat(str('wd:'),?title)"/] v2 --o bind1 bind1 --as--o v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P31".-> v4 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c2 --"mwapi:language"--> c15 end