query-fc1e953623ebfe05a85dd2e75ab4fe26

rq turtle/ttl

Get de.wiki article name 16:27, 6 May 2018 (UTC) --TagishsimonIn short, I'm wanting to extract the de.wiki article name from an item, and compare it with a string. If we imagine I'm looking for an item which has a de.wiki sitelink named "Monkey Island (England)", how do I achieve that? Some broken SPRQL, below, as a starter for 10. (1. in the borked SPARQL, why are the binds failing? 2. and I appreciate that even if they worked, I'd be extracting a string with underscores in it, rather than space ... presumably we also store the de.wiki name, without underscores, as we see it displayed in the wikipedia links section of the item record. 3. VALUEs ?itemLabel is commented out as I was working on the stringslicing problem.). thx

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
SELECT ?item ?itemLabel ?geni ?article ?out ?length
WHERE 
{
#  VALUES ?itemLabel {"Despotović (Familienname)" "Monkey Island (England)" "Iwajlo Marinow"}
 VALUES ?item {wd:Q6900750}
  ?item wdt:P31 [].
  ?article  schema:about ?item ;
            schema:isPartOf <https://de.wikipedia.org/> .
  bind(xsd:integer(strlen(?article)) as ?length)
  bind(substr(?article,31, ?length-1) as ?out)
        }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?article"):::projected v1("?item"):::projected v3("?length"):::projected v4("?out"):::projected a1((" ")) c4([https://de.wikipedia.org/]):::iri bind0[/VALUES ?item/] bind0-->v1 bind00(["wd:Q6900750"]) bind00 --> bind0 v1 --"wdt:P31"--> a1 v2 --"schema:about"--> v1 v2 --"schema:isPartOf"--> c4 bind1[/"http://www.w3.org/2001/XMLSchema#integer(string-length(?article))"/] v2 --o bind1 bind1 --as--o v3 bind2[/"substring(?article,'31^^xsd:integer',?length + '-1^^xsd:integer')"/] v2 --o bind2 v3 --o bind2 bind2 --as--o v4