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].
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/B11044B3-48D4-4766-BCCA-69E55E7E0A1B%40topquadrant.com.

Attachment: constraint-inference.test.ttl
Description: Binary data


On 28 Feb 2023, at 12:19 am, Hamid Abdirad <[email protected]> wrote:

Hello all,
Using TopBraid EDG, I am wondering if a script constraint for a property can read the inferred value of another property. Here is my case:

I have a string property named "win_est_assembly_code".
I have an object property "WinEstConcept" that infers a skos:concept based on the string value of "win_est_assembly_code". Inferred by "sh:values" and dash:js - searching and finding the matching skos:concept. 

I have a string property named "takeoff_unit_abbreviation", for which I want to check if its value equals to the "unit" property of the skos:concept in WinEstConcept. 

I am using a script constraint on takeoff_unit_abbreviation but it seems it cannot read the inferred WinEstConcept (it treats it as if it returns null).

Here is the script:
focusNode.namedValue(graph.namedNode('http://dpr.com/ontologies/RvtAsmbTestHarness1#WinEstConcept'))!=null ? String(value) == String(focusNode.namedValue(graph.namedNode('http://dpr.com/ontologies/RvtAsmbTestHarness1#WinEstConcept')).literalValue('http://dpr.com/ontologies/RvtAsmbTestHarness1#unit')): false


<1.jpg>

<2.jpg>

I appreciate any thoughts on whether we can read the value of inferred object properties, or any workarounds. 

Thank you,
Hamid

--
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/e56527be-62f8-4f51-b4fa-7754c70a2d5an%40googlegroups.com.
<2.jpg><1.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/B11044B3-48D4-4766-BCCA-69E55E7E0A1B%40topquadrant.com.

Reply via email to