query-42d778bc4314c75c29c1c5fa04608e4b
01:05, 2 June 2017 (UTC)) talk (SharkDHowever, this does not work when the value of the item is "unknown" or "no value". How do I catch these two cases? Thanks. 02:32, 2 June 2017 (UTC)) talk (d1g: you could use BIND/variables and IF to achieve any custom logic. SharkD@ 02:20, 2 June 2017 (UTC)) talk (SharkD:: I should have been more clear. I don't want to filter these items out. I just want different text to show up if the items are: 1) blank, 2) unknown or 3) no value. Sorry. D1gggg@ 02:01, 2 June 2017 (UTC)) talk (d1g. Property talk:P577 at Items with unknown value claims and Items with novalue claims: both were used in SharkD@ ?item p:P577/a wdno:P577 ?item wdt:P577 ?value . FILTER (isBlank(?value))
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?prefix ?type ?value ?customText
WHERE
{
wd:Q4233718 ?prefix ?value.
# FILTER(isBlank(?value)).
?prefix rdf:type ?type .
BIND(IF(isBlank(?value), "BLANK-BLANK-BLANK", ?value) as ?customText)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?customText"):::projected
v1("?prefix"):::projected
v3("?type"):::projected
v2("?value"):::projected
c4(["bd:serviceParam"]):::iri
c1(["wd:Q4233718"]):::iri
c6(["en"]):::literal
c1 -->v1--> v2
v1 --"a"--> v3
bind0[/"if(isBlank(?value),'BLANK-BLANK-BLANK',?value)"/]
v2 --o bind0
bind0 --as--o v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c4 --"wikibase:language"--> c6
end