query-9c3eaf65a62270c5d78e74c1ad65d9f9

rq turtle/ttl

10:17, 2 December 2019 (UTC) JuraIs there an easy way to speed this up? I tried a couple of ways with more items, but they tend to timeout or the optional part not even matching. --- Actually, it's much easier to highlight when it gets slow:

Use at

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#>
SELECT *
WHERE
{
  BIND("Douglas Adams"@en as ?name1)  BIND(strafter(?name1, " ") as ?name)  #slow
  # BIND( strlang("Adams", "en") as ?name)                                  #slow
  # BIND("Adams"@en as ?name)                                               #fast
  OPTIONAL { ?lastname wdt:P31 wd:Q101352 ; rdfs:label ?name }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?lastname"):::projected v2("?name"):::projected v1("?name1"):::projected c2(["wd:Q101352"]):::iri bind0[/"sDouglas Adams^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>'"/] bind0 --as--o v1 bind1[/"substring-after(?name1,' ')"/] v1 --o bind1 bind1 --as--o v2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P31".-> c2 v3 --"rdfs:label"--> v2 end