ULB-Darmstadt / shacl-form

HTML5 web component for editing/viewing RDF data that conform to SHACL shapes
https://ulb-darmstadt.github.io/shacl-form/
MIT License
24 stars 4 forks source link

minInclusive 0 allows negative integers #6

Closed benjaminaaron closed 8 months ago

benjaminaaron commented 8 months ago

With the following data-shape I can input negative integers and it passes as valid. I would expect anything below 0 to be invalid. Everything above 100 is correctly invalid as expected.

@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix ckg: <http://ckg.de/default#> .

ckg:Citizen a sh:NodeShape ;
  sh:property [
    sh:datatype     xsd:integer ;
    sh:minInclusive 0 ;
    sh:maxInclusive 100 ;
    sh:maxCount     1 ;
    sh:name         'Age' ;
    sh:path         ckg:hasAge ;
] .
s-tittel commented 8 months ago

Thanks for reporting. There where actually two bugs here:

  1. Constraints with value 0 where incorrectly ignored when setting min / max HTML element attributes on the input field
  2. Same as issue 5, so you should add this triple to your shapes graph: ckg:Citizen a rdfs:Class .
benjaminaaron commented 8 months ago

Thanks, much appreciated, adding this triple made it work indeed 👍