query-ab6a73c8ad988fe54c529743668b7c58

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

  SERVICE wikibase:mwapi {
    bd:serviceParam wikibase:api "Search";
                    wikibase:endpoint "www.wikidata.org";
                    mwapi:srsearch "Diodati".
    ?title wikibase:apiOutput mwapi:title.
  }
  BIND(IRI(CONCAT(STR(wd:), ?title)) AS ?item)
  ?item rdfs:label ?itemLabel. filter(lang(?itemLabel)="en") 
  FILTER(CONTAINS(LCASE(?itemLabel), "diodati"))
  {?item wdt:P31 wd:Q5.}
  UNION
  {filter not exists {?item wdt:P31 [].} }
  optional {?item wdt:P734 ?familyname. optional {?familyname rdfs:label ?familynameLabel. filter(lang(?familynameLabel)="en") } } 
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?familyname"):::projected v4("?familynameLabel"):::projected v3("?item"):::projected v1("?itemLabel"):::projected v2("?title") a1((" ")) c8(["www.wikidata.org"]):::literal c10(["Diodati"]):::literal c4(["bd:serviceParam"]):::iri c6(["Search"]):::literal c15(["wd:Q5"]):::iri c12(["mwapi:title"]):::iri f0[["contains(lower-case(?itemLabel),'diodati')"]] f0 --> v1 f1[["?itemLabel = 'en'"]] f1 --> v1 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c4 --"mwapi:api"--> c6 c4 --"mwapi:endpoint"--> c8 c4 --"mwapi:srsearch"--> c10 v2 --"mwapi:apiOutput"--> c12 end bind2[/"concat(str('wd:'),?title)"/] v2 --o bind2 bind2 --as--o v3 v3 --"rdfs:label"--> v1 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; f3[["not "]] subgraph f3e0["Exists Clause"] e0v1 --"wdt:P31"--> e0a1 e0v1("?item"):::projected e0a1((" ")):::projected end f3--EXISTS--> f3e0 f3 --> v3 f3 --> c14 f3 --> a1 v3 --"wdt:P31"--> a1 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P31"--> c15 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P734".-> v5 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v5 -."rdfs:label".-> v4 end end