This doesn't look right:
focusNode.value(ex:integerProperty) ==
focusNode.value(ex:inferredProperty)
Did you mean ex.integerProperty?
Holger
> On 28 Feb 2023, at 7:42 pm, Hamid Abdirad <[email protected]> wrote:
>
> Hi Holger, Thank you for your reply.
> The example you shared works fine for me. However, my example, is not self
> referencing. Basically, my property A (integer) wants to look at the inferred
> value of property B but it does not see any value in B (but UI shows the
> value).
> Here is the example shapes and screenshot:
>
> ex:TestClass
> a owl:Class ;
> a sh:NodeShape ;
> dash:scriptConstraint [
> a dash:ScriptConstraint ;
> dash:js "focusNode.value(ex:integerProperty) ==
> focusNode.value(ex:inferredProperty)" ;
> sh:message "Integer value must match the inferred value" ;
> ] ;
> rdfs:label "Test class" ;
> rdfs:subClassOf owl:Thing ;
> sh:property ex:TestClass-inferredProperty ;
> sh:property ex:TestClass-integerProperty ;
> .
> ex:TestClass-inferredProperty
> a sh:PropertyShape ;
> sh:path ex:inferredProperty ;
> sh:class xsd:integer ;
> sh:name "inferredProperty" ;
> sh:values [
> dash:js "focusNode.uri.length" ;
> ] ;
> .
> ex:TestClass-integerProperty
> a sh:PropertyShape ;
> sh:path ex:integerProperty ;
> sh:datatype xsd:integer ;
> sh:equals ex:inferredProperty ;
> sh:name "integerProperty" ;
> .
>
> I also added the sh:equals constraint to check if the persisted integer value
> equals the inferred property but neither the script nor the sh:equals worked
> as expected.
>
> <3.jpg>
> Thank you,
> Hamid
>
> On Tuesday, February 28, 2023 at 1:33:27 AM UTC-8 Holger Knublauch wrote:
>> Hello Hamid,
>>
>> I have attached an example file that - I believe - demonstrates that
>> inferences are being executed as part of constraint checks.
>>
>> The main definitions are:
>>
>> ex:TestClass
>> a owl:Class ;
>> a sh:NodeShape ;
>> dash:scriptConstraint [
>> a dash:ScriptConstraint ;
>> dash:js "focusNode.value(ex.inferred) >= 30" ;
>> sh:message "URI must have at least 30 chars" ;
>> ] ;
>> rdfs:label "Test class" ;
>> rdfs:subClassOf owl:Thing ;
>> sh:property ex:TestClass-inferred ;
>> .
>> ex:TestClass-inferred
>> a sh:PropertyShape ;
>> sh:path ex:inferred ;
>> sh:datatype xsd:integer ;
>> sh:name "inferred" ;
>> sh:values [
>> dash:js "focusNode.uri.length" ;
>> ] ;
>> .
>>
>> where ex:inferred is computed to be the length of the URI and the constraint
>> requires that the length >= 30.
>>
>> In my local tests that is working fine.
>>
>> If that same example does not work for you, then you may be on a different
>> version than I am.
>>
>> Could you compare this with your own test and send me a minimal
>> self-contained example that I can run locally if it still does not work for
>> you?
>>
>> Regards
>> Holger
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/topbraid-users/8051c67f-905a-4c21-a973-e968faa6e5dan%40googlegroups.com
>
> <https://groups.google.com/d/msgid/topbraid-users/8051c67f-905a-4c21-a973-e968faa6e5dan%40googlegroups.com?utm_medium=email&utm_source=footer>.
> <3.jpg>
--
You received this message because you are subscribed to the Google Groups
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/FBDBF99D-BB5B-48FC-A26C-1C49EDE400EE%40topquadrant.com.