query-886937b4d45350e357833b0abe0d132e

rq turtle/ttl

Aaron Ward Castleton

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
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 ?itemAltLabel
WHERE {

  SERVICE wikibase:mwapi {
    bd:serviceParam wikibase:api "Search";
                    wikibase:endpoint "www.wikidata.org";
                    mwapi:srsearch "USS Aaron Ward (DF-132)".
    ?item wikibase:apiOutputItem mwapi:title .
  }
 FILTER EXISTS
  {
    { ?item rdfs:label ?text }
    UNION
    { ?item schema:description ?text }
    UNION
    { ?item skos:altLabel ?text }
    FILTER CONTAINS(?text, "HMS Castleton")
  }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-gb,en,mul". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?item"):::projected v1("?text") c10(["www.wikidata.org"]):::literal c17(["en-gb,en,mul"]):::literal c6(["bd:serviceParam"]):::iri c8(["Search"]):::literal c14(["mwapi:title"]):::iri c12(["USS Aaron Ward (DF-132)"]):::literal f0[[" "]] subgraph f0e0["Exists Clause"] e0f0[["contains(?text,'HMS Castleton')"]] e0f0 --> e0v1 subgraph unione00[" Union "] subgraph unione00l[" "] style unione00l fill:#abf,stroke-dasharray: 3 3; subgraph unione01[" Union "] subgraph unione01l[" "] style unione01l fill:#abf,stroke-dasharray: 3 3; e0v2 --"skos:altLabel"--> e0v1 end subgraph unione01r[" "] style unione01r fill:#abf,stroke-dasharray: 3 3; e0v2 --"schema:description"--> e0v1 end unione01r <== or ==> unione01l end end subgraph unione00r[" "] style unione00r fill:#abf,stroke-dasharray: 3 3; e0v2 --"rdfs:label"--> e0v1 end unione00r <== or ==> unione00l end e0v2("?item"):::projected e0v1("?text"):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> v2 f0 --> c2 f0 --> c3 f0 --> c4 f1[["contains(?text,'HMS Castleton')"]] f1 --> v1 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; v2 --"skos:altLabel"--> v1 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v2 --"schema:description"--> v1 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"rdfs:label"--> v1 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c6 --"mwapi:api"--> c8 c6 --"mwapi:endpoint"--> c10 c6 --"mwapi:srsearch"--> c12 v2 --"mwapi:apiOutputItem"--> c14 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c6 --"mwapi:language"--> c17 end