query-4047caa508ab0df9c370b779406630e9

rq turtle/ttl

Format constraint to exclude titles with two or more "$"

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?item ?value ?test ?formatconstraint
{
  VALUES ?item { wd:Q18689133 #zero pass
                           wd:Q7711690 #one   pass 
                           wd:Q29302883 wd:Q29396284 #two fail
                           wd:Q24806537 #more fail
                           wd:wd:Q29301301 wd:Q27012930 #pair fail                       
                }          
  ?item wdt:P1476 ?value .
  BIND( !REGEX( STR( ?value ), "\\$[^$]*\\$" )  as ?test) .          
  BIND( REGEX( STR( ?value ), "^[^$]+$" )  as ?formatconstraint) .          
} 
ORDER BY ?test

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?formatconstraint"):::projected v2("?item"):::projected v4("?test"):::projected v3("?value"):::projected bind0[/VALUES ?item/] bind0-->v2 bind00(["wd:Q18689133"]) bind00 --> bind0 bind01(["wd:Q7711690"]) bind01 --> bind0 bind02(["wd:Q29302883"]) bind02 --> bind0 bind03(["wd:Q29396284"]) bind03 --> bind0 bind04(["wd:Q24806537"]) bind04 --> bind0 bind05(["wd:wd:Q29301301"]) bind05 --> bind0 bind06(["wd:Q27012930"]) bind06 --> bind0 v2 --"wdt:P1476"--> v3 bind1[/"not regex(str(?value),'\$#91;^$#93;*\$')"/] v3 --o bind1 bind1 --as--o v4 bind2[/"regex(str(?value),'^#91;^$#93;+$')"/] v3 --o bind2 bind2 --as--o v4