query-0717e28a7dafea0bf75f9cb8f744bed6
title:alternate formats for P10364
adapted from query by User:Dipsacus_fullonum https://www.wikidata.org/wiki/Special:PermanentLink/1576903843#preferred_format_for_id
SELECT * { ?item wdt:P10364 ?value. FILTER( REGEX(?value, "^(\d{3}-\d{3}-\d{4}-\d{4})$") ) #limit to correctly formatted values
BIND (REPLACE(?value, "0{0,2}(\d+)-0{0,2}(\d+)-0{0,3}(\d+)-0{0,3}(\d+)", "$1-$2-$3-$4") AS ?format1) BIND (REPLACE(?value, "-", "") AS ?format3) } LIMIT 10
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
#title:alternate formats for P10364
#adapted from query by User:Dipsacus_fullonum https://www.wikidata.org/wiki/Special:PermanentLink/1576903843#preferred_format_for_id
SELECT *
{
?item wdt:P10364 ?value.
FILTER( REGEX(?value, "^(\\d{3}-\\d{3}-\\d{4}-\\d{4})$") ) #limit to correctly formatted values
BIND (REPLACE(?value, "0{0,2}(\\d+)-0{0,2}(\\d+)-0{0,3}(\\d+)-0{0,3}(\\d+)", "$1-$2-$3-$4") AS ?format1)
BIND (REPLACE(?value, "-", "") AS ?format3)
}
LIMIT 10
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?format1"):::projected
v4("?format3"):::projected
v2("?item"):::projected
v1("?value"):::projected
f0[["regex(?value,'^(\d{3}-\d{3}-\d{4}-\d{4})$')"]]
f0 --> v1
v2 --"wdt:P10364"--> v1
bind1[/"replace(?value,'0{0,2}(\d+)-0{0,2}(\d+)-0{0,3}(\d+)-0{0,3}(\d+)','$1-$2-$3-$4')"/]
v1 --o bind1
bind1 --as--o v3
bind2[/"replace(?value,'-','')"/]
v1 --o bind2
bind2 --as--o v4