maxLength-001.ttl expects support for blank nodes for sh:maxLength
Closed this issue · 2 comments
Just as a bit of context for my use case: I am currently working on a Shacl validator that aims to use SPARQL endpoints to implement the actual validation by encoding constraints into queries.
I see strange situation in the test /core/node/maxLength-001.ttl which seems incompatible with the textual definition of sh:maxLength
TEXTUAL DEFINITION
For each value node v where the length (as defined by the SPARQL STRLEN function) of the string representation of v (as defined by the SPARQL str function) is greater than $maxLength, or where v is a blank node, there is a validation result with v as sh:value.
In /code/node/maxLength-001.ttl we have this blank node:
_:b34236
rdf:type ex:TestClass ;
And it should appear also in the validation report:
sh:result [
rdf:type sh:ValidationResult ;
sh:focusNode _:b34236 ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MaxLengthConstraintComponent ;
sh:sourceShape ex:TestShape ;
sh:value _:b34236 ;
] ;
The issue:
The Sparql "str" function is not defined over blank nodes and indeed many (all?) systems that serve as Sparql endpoints do not return a value for the str value of blank nodes. That is however exactly how maxLength (and minLength) are defined.
So str(_:b34236) (as defined by the SPARQL str function) will not return a string. Of course, one could interpret this as returning the empty string, but then it becomes strange why it should violate a max length constraint.
I don't understand your concern. The textual definition explicitly states "or where v is a blank node" which is covered by that test case. In that case it doesn't matter how str() works.
Oh, sorry, seems I missed that part somehow. This is a non-issue then