Validating SHACL-Values using explicitly allowed values

47 Views Asked by At

I have the following RDF-triples that describe an attribute as well as a constraint class. The constraint class offers three allowed values for the attribute.

TestAttribute rdf:type :Attribute ;
               :hasConstraint :TestNomConstraint ,
               :hasAttributeValue "green" .

:TestNomConstraint rdf:type :NominalScaledConstraint ;
                   :hasAllowedValue "blue" ,
                                    "red" ,
                                    "yellow" .

I would like to create a SHACL-shape, that validates, if the value for :hasAttributeValue is in the set defined by :hasAllowedValue.

I tried the following:

:NominalScaledConstraintShape
    a sh:PropertyShape ;
    sh:targetClass :NominalScaledConstraint ;
    sh:property [
        sh:path ([sh:inversePath :hasConstraint] :hasAttributeValue);
        sh:in (sh:path :hasRequiredValueNominal);
        #sh:in ("red")
    ] ;
.

Using a construct like sh:in("red") the shape works as expected. However, I would like to read the allowed shapes for every :NominalScaledConstraint. If using a sh:path insinde sh:in, the shapes are not correctly evaluated.

  1. Is using a sh:path in sh:in not possible?
  2. If it is not possible, what are possible alternatives for this use case?
0

There are 0 best solutions below