# Title: 
#    No Extra Annotation Whitespace
# Constraint Description: 
#    No annotation value may have leading or trailing whitespace.    
# Severity:
#    Error 

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?element ?property ?value ?error
WHERE {
  ?property a owl:AnnotationProperty .
  ?element ?property ?value .
  FILTER (!isBlank(?element) && (REGEX(str(?value), "^[\\s\r\n]+") || REGEX(str(?value), "[\\s\r\n]+$")))
  BIND (concat("ERROR: The following annotation value has leading or trailing whitespace ", str(?element)) AS ?error)
}
ORDER BY ?element

