|
http://spinrdf.org/sp#text
|
CONSTRUCT
{ _:c0 rdf:type spin:ConstraintViolation .
_:c0 spin:violationRoot ?instance .
_:c0 spin:violationPath ?arg2 .}
WHERE
{ ?instance rdf:type ?arg1 .
?instance ?arg2 ?ean
LET (?1 := afn:substr(str(?ean), 0, 1))
LET (?2 := afn:substr(str(?ean), 1, 2))
LET (?3 := afn:substr(str(?ean), 2, 3))
LET (?4 := afn:substr(str(?ean), 3, 4))
LET (?5 := afn:substr(str(?ean), 4, 5))
LET (?6 := afn:substr(str(?ean), 5, 6))
LET (?7 := afn:substr(str(?ean), 6, 7))
LET (?8 := afn:substr(str(?ean), 7, 8))
LET (?9 := afn:substr(str(?ean), 8, 9))
LET (?10 := afn:substr(str(?ean), 9, 10))
LET (?11 := afn:substr(str(?ean), 10, 11))
LET (?12 := afn:substr(str(?ean), 11, 12))
LET (?13 := afn:substr(str(?ean), 12, 13))
LET (?value := ( ( ( ( ( ( ( xsd:int(?2) + xsd:int(?4) ) + xsd:int(?6) ) + xsd:int(?8) ) + xsd:int(?10) ) + xsd:int(?12) ) * 3 ) + ( ( ( ( ( xsd:int(?1) + xsd:int(?3) ) + xsd:int(?5) ) + xsd:int(?7) ) + xsd:int(?9) ) + xsd:int(?11) ) ))
LET (?check := afn:substr(str(?value), ( fn:string-length(str(?value)) - 1 ), fn:string-length(str(?value))))
FILTER ( ( ( ( xsd:int(?check) + xsd:int(?13) ) != 0 ) && ( ( xsd:int(?check) + xsd:int(?13) ) != 10 ) ) || ( ! regex(str(?ean), "^[0-9]{13}$") ) )
}
|