As another point of reference, the ADS help pages contain a chapter on sh:values rules:
https://archive.topquadrant.com/doc/7.4/scripting/shacl.html#inferring-values Holger > On 30 Nov 2022, at 9:53 am, Holger Knublauch <[email protected]> wrote: > > For the record I am also attaching the whole example (using the JavaScript > solution). > > <wftech.ttl> > > and here is the proof that it works in principle: > > <PastedGraphic-1.png> > > Holger > > >> On 30 Nov 2022, at 9:41 am, Holger Knublauch <[email protected]> wrote: >> >> Hi GaBriella, >> >> the example that I had sent in my email was in Turtle notation, which you >> can edit on the Source Code tab of TopBraid EDG. >> >> To enter the sh:values rule, select the property shape and switch to the >> Source Code panel. Then paste the sh:values snippet so that it looks as >> follows: >> >> wftech:AuthoritativeDataSourceDeclarationView-sponsoredInvestment >> a sh:PropertyShape ; >> sh:path wftech:sponsoredInvestment ; >> sh:datatype xsd:boolean ; >> sh:maxCount 1 ; >> sh:name "sponsored investment" ; >> sh:values [ >> sh:exists [ >> sh:path wftech:systemOwner ; >> ] ; >> ] ; >> . >> >> It will then display like this on the form: >> >> <PastedGraphic-1.png> >> >> We do not have a dedicated editor for such sh:values rules in SHACL node >> expression syntax, so Source Code is the only option. >> >> From the error message that you mention, it seems you have pasted the source >> code into the default editor for sh:values that shows up on the form. That >> is however expecting JavaScript source code, not Turtle. If you want to use >> JavaScript instead of the SHACL syntax above, you can paste the following: >> >> <PastedGraphic-2.png> >> >> which would be another way of deriving the boolean for the case that the >> systemOwner property has any value. If you want to use the example above, >> also go the Home asset of your Ontology and switch to the Script API tab, >> then enter wftech as shown: >> >> <PastedGraphic-3.png> >> >> This makes sure that the wftech constant is known to the JavaScript API. You >> may need to press refresh on the Script Editor panel to activate that. >> >> HTH >> Holger >> >> >> >>> On 30 Nov 2022, at 12:21 am, 'Branson, GaBriella C' via TopBraid Suite >>> Users <[email protected]> wrote: >>> >>> Hi Holger, >>> >>> Thank you for the link and sample code. >>> >>> I’ve tried several variations and am doing something wrong. Here is the >>> latest: >>> >>> wftech:AuthoritativeDataSourceDeclarationView >>> a sh:NodeShape ; >>> sh:property >>> wftech:AuthoritativeSourceDeclarationView-sponsoredInvestment ; >>> . >>> >>> wftech:AuthoritativeSourceDeclarationView-sponsoredInvestment >>> a sh:PropertyShape ; >>> sh:path wftech:sponsoredInvestment ; >>> sh:datatype xsd:boolean ; >>> sh:values [ >>> sh:exists [ >>> sh:path wftech:systemOwner ; >>> ] ; >>> ] >>> . >>> >>> wftech = my prefix >>> AuthoritativeDataSourceDeclarationView = the node shape >>> >>> >>> And this is the error I get: (I tried to compare what I had done versus >>> your sample to ensure I had all the correct punctuation and I didn’t notice >>> any missing, but it sure seems to think it wants some more semi-colons ) >>> <image003.png> >>> >>> I took out owl:class because my type is only a node shape. >>> >>> <image001.png> >>> >>> Perhaps I need to schedule a call and use support hours? >>> >>> GaBriella Branson >>> Wildland Fire Data Management Program - Knowledge Manager >>> >>> Stay Connected! Sign up to receive email updates from the Wildland Fire >>> Data Management Program >>> <https://public.govdelivery.com/accounts/USDOI/subscriber/new?qsp=USDOI_6> >>> <image002.png> >>> >>> From: [email protected] >>> <mailto:[email protected]> <[email protected] >>> <mailto:[email protected]>> On Behalf Of Holger Knublauch >>> Sent: Tuesday, November 29, 2022 12:11 AM >>> To: [email protected] <mailto:[email protected]> >>> Subject: [EXTERNAL] Re: [topbraid-users] Help Writing Inferences >>> >>> >>> >>> This email has been received from outside of DOI - Use caution before >>> clicking on links, opening attachments, or responding. >>> >>> >>> >>> Hi GaBriella, >>> >>> you can use SHACL Advanced Features to infer values. For your use cases, >>> sh:values rules sound like a good match. >>> >>> See https://datashapes.org/forms.html#inferred-values >>> <https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdatashapes.org%2Fforms.html%23inferred-values&data=05%7C01%7Cgabriella_branson%40ios.doi.gov%7Cff603dd7f53341c6950408dad1e9bacb%7C0693b5ba4b184d7b9341f32f400a5494%7C0%7C0%7C638053099056740422%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=niQjx7NWzA3IUhcKdHKDdZHJ9IZRLO%2FZkU%2F%2F87PAGkk%3D&reserved=0> >>> for the basic mechanism. >>> >>> In your case, maybe this helps: >>> >>> ex:MyClass >>> a owl:Class, sh:NodeShape ; >>> sh:property ex:MyClass-sponsoredInvestment ; >>> . >>> >>> ex:MyClass-sponsoredInvestment >>> a sh:PropertyShape ; >>> sh:path ex:sponsoredInvestment ; >>> sh:datatype xsd:boolean ; >>> sh:values [ >>> sh:exists [ >>> sh:path ex:systemOwner ; >>> ] ; >>> ] >>> . >>> >>> This would mark "sponsoredInvestment" as a read-only property that will be >>> automatically computed when displayed and queried, esp on forms, through >>> GraphQL and through JavaScript/ADS. >>> >>> Such sh:values rules can also be expressed in SPARQL or JavaScript/ADS. >>> >>> Feel free to post your follow-up questions if you need more instructions. >>> >>> Holger >>> >>> >>> >>> >>> On 29 Nov 2022, at 1:02 am, 'GaBriella Branson' via TopBraid Suite Users >>> <[email protected] <mailto:[email protected]>> >>> wrote: >>> >>> Hello, >>> >>> I have a series of 10 boolean attributes. I would like "true" to be >>> inferred if another property has a value. >>> >>> As an example >>> if systemOwner has any value, then sponsoredInvestment is true >>> >>> An additional example >>> if hostedOn matches NIFC eNet or Denver Federal Center or WRCC, then >>> enterpriseArchitectureSupportedDevelopmentEnvironment is true, but if >>> hostedOn is AWS or Desktop or ESRI Cloud or null, then >>> enterpriseArchitectureSupportedDevelopmentEnvironment is false >>> >>> Is this a legitimate use of inferrencing or should I handle this a >>> different way? >>> >>> Do you have any recommendations on courses or resources I can use to write >>> these? >>> >>> Thanks in advance! >>> >>> -- >>> 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/0cdd2f9d-85dc-43e9-ac81-5f6382513f28n%40googlegroups.com >>> >>> <https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Ftopbraid-users%2F0cdd2f9d-85dc-43e9-ac81-5f6382513f28n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cgabriella_branson%40ios.doi.gov%7Cff603dd7f53341c6950408dad1e9bacb%7C0693b5ba4b184d7b9341f32f400a5494%7C0%7C0%7C638053099056740422%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=AJxBghgb%2F4SPNFFTyOj1Nco6e3dbR2yDm3KgALHNL4w%3D&reserved=0>. >>> >>> -- >>> 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/8A55465A-F45A-44A5-B0F3-C796D108AB92%40topquadrant.com >>> >>> <https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Ftopbraid-users%2F8A55465A-F45A-44A5-B0F3-C796D108AB92%2540topquadrant.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cgabriella_branson%40ios.doi.gov%7Cff603dd7f53341c6950408dad1e9bacb%7C0693b5ba4b184d7b9341f32f400a5494%7C0%7C0%7C638053099056740422%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=aNGwrcHdtIc0bCE2r6o4p0hoOJ5Fmf9NIhNrPJ2IiUE%3D&reserved=0>. >>> >>> -- >>> 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/CO6PR09MB7319A0292DAB4E81F8F06401DA159%40CO6PR09MB7319.namprd09.prod.outlook.com >>> >>> <https://groups.google.com/d/msgid/topbraid-users/CO6PR09MB7319A0292DAB4E81F8F06401DA159%40CO6PR09MB7319.namprd09.prod.outlook.com?utm_medium=email&utm_source=footer>. >> > -- 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/36AE4280-B8BA-43A7-8582-95FCCA0E1296%40topquadrant.com.
