This helps! I now am able to create more complex sh:values rules that re-use 
the inferred values from a different property shape.

But I am now having some other problems with sh:values. I will probably need to 
move away from generalized examples now and show you one of my actual shapes:

concept_schema:Rollup_Concept-includedVideos
  a sh:PropertyShape ;
  sh:path enterprise_schemas:includedVideos ;
  dash:readOnly true ;
  sh:class content_asset_schema:Video ;
  sh:group tosh:InferencesPropertyGroup ;
  sh:name "included videos (SHACL)" ;
  sh:order "4"^^xsd:decimal ;
  sh:values [
      sh:path [
          sh:inversePath [
              sh:alternativePath (
                  content_asset_schema:level_1
                  content_asset_schema:level_2
                  content_asset_schema:level_3
                ) ;
            ] ;
        ] ;
      sh:filterShape [
          sh:property [
              sh:path content_asset_schema:lifecycle_stage ;
              sh:hasValue supplementary_concept_data:Active_Asset ;
            ] ;
        ] ;
      sh:nodes [
          sh:path enterprise_schemas:includedConcepts ;
        ] ;
    ] ;
.

This shape definition is accepted without errors by EDG's values UI widget, 
which diagrams it like this:
[cid:image001.png@01D812D5.4AFF9EF0]

This diagram seems incomplete, though, in two ways:

  1.  The right-most box should read this (Video), because I have specified 
that sh:class.
  2.  My sh:filterShape seems to be ignored.

Sure enough, the values produced by the shape, while respecting my sh:path and 
sh:nodes statements, seem to ignore the sh:class I specified and my 
sh:filterShape.

What am I doing wrong here?


From: topbraid-users@googlegroups.com <topbraid-users@googlegroups.com> On 
Behalf Of Holger Knublauch
Sent: Tuesday, January 25, 2022 2:55 PM
To: topbraid-users@googlegroups.com
Subject: Re: [topbraid-users] SHACL inferred data question


*** External email: use caution ***


On 2022-01-26 3:13 am, cbur...@healthwise.org<mailto:cbur...@healthwise.org> 
wrote:
Holger,

I am able to create a second property shape, ex:shape2, that uses the values 
from my ex:shape1 in a very simple, non-transformative way and successfully 
returns the values of ex:shape1 for ex:shape2:

ex:Class-shape2
  a sh:PropertyShape ;
  sh:path ex:shape2 ;
  sh:class ex:Class
  sh:values [
      sh:path ex:shape1 ;
    ] ;
.

But the moment I try to introduce any more complexity, my sh:values statement 
stops returning any results. For example, I tried:

  sh:values [
    sh:path ( ex:shape1 skos:broader ) ;
    ]

Right, complex path expressions don't work in that case. This would have 
required a much more complex implementation that would hook into the 
SPARQL-like path execution. Doable in principle, just not implemented yet.

The alternative to the above is to use nested sh:path expressions, try 
something like

sh:values [
    sh:path skos:broader ;
    sh:nodes [
        sh:path ex:shape1 ;
    ]
]

This is based on the optional second argument (sh:nodes) that 
https://w3c.github.io/shacl/shacl-af/#node-expressions-path<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fw3c.github.io%2Fshacl%2Fshacl-af%2F%23node-expressions-path&data=04%7C01%7Ccburnett%40healthwise.org%7Ccde6d575eba949e3f95908d9e055bb5f%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C1%7C637787481106696623%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dpwSujvmDHyT%2FNZDFuEJ%2FTHXAuxceaKDmEU9Wset9qk%3D&reserved=0>
 takes and would first get all values of ex:shape1 and then get the broader 
values of those. I believe this corresponds to your chained path expression.

Hope this works, didn't test... :)

Holger



and got back no values for ex:shape2. (All of the values returned for ex:shape1 
have broader concepts, although they are defined in a different EDG asset 
collection.)

What am I doing wrong?

thanks,
Carl
On Thursday, January 20, 2022 at 5:01:18 PM UTC-8 Holger Knublauch wrote:


On 2022-01-21 10:54 am, cbur...@healthwise.org wrote:
Thanks, Holger. My need in this case isn't to query inferred data using SPARQL 
or GraphQL, but rather to reuse the inferred data as an input for another EDG 
property shape with another sh:values rule in it. I think I'm hearing that 
that's not possible.

That scenario IS possible. You just need to use a path node expression, see

    
https://w3c.github.io/shacl/shacl-af/#node-expressions-path<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fw3c.github.io%2Fshacl%2Fshacl-af%2F%23node-expressions-path&data=04%7C01%7Ccburnett%40healthwise.org%7Ccde6d575eba949e3f95908d9e055bb5f%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C1%7C637787481106696623%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dpwSujvmDHyT%2FNZDFuEJ%2FTHXAuxceaKDmEU9Wset9qk%3D&reserved=0>

So if ex:prop1 is inferred then you can reference it in the sh:values rule of 
another property using [ sh:path ex:prop1 ] and it will compute that inference 
on the fly. This assumes that the receiving property using a sh:values rule 
using SHACL node expressions, not SPARQL.

Holger



Can you point me to where I can read more about the materialization option and 
decide whether there's a way to make that work for this use case? Thanks.
On Tuesday, January 18, 2022 at 4:03:32 PM UTC-8 Holger Knublauch wrote:


On 2022-01-19 9:44 am, cbur...@healthwise.org<mailto:cbur...@healthwise.org> 
wrote:
I have defined a property shape and am successfully inferring its objects using 
a sh:values rule.

Can you remind me whether it is possible to use this property and its inferred 
data in the sh:values rule for a different property shape? If so, is there a 
special way that it needs to be done -- like, does the data I inferred in the 
first property shape need to be materialized in some way before I can make use 
of it?  --

In general, the RDF graphs that TopBraid operates on do not automatically "see" 
the extra inferred triples, so they are not computed as RDF triples on the fly. 
However, our higher level query languages GraphQL and JavaScript/ADS do see 
them whenever they are requested. The user interface goes through GraphQL and 
will therefore display these values as if they were materialized.

Now, within SHACL itself it depends on what you want to do. If you have 
SHACL-AF inference rules including other sh:values rules you can safely use 
path expressions 
https://w3c.github.io/shacl/shacl-af/#node-expressions-path<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fw3c.github.io%2Fshacl%2Fshacl-af%2F%23node-expressions-path&data=04%7C01%7Ccburnett%40healthwise.org%7Ccde6d575eba949e3f95908d9e055bb5f%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C1%7C637787481106696623%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dpwSujvmDHyT%2FNZDFuEJ%2FTHXAuxceaKDmEU9Wset9qk%3D&reserved=0>
 and the values will be computed on the fly. For SHACL constraints there is no 
such mechanism unless you are expressing the constraints in SPARQL. There you 
can use the magic property

    (?focusNode ?predicate) tosh:values ?result

to query the inferred values.

The other option, of course, is to materialize the inferences, e.g. using the 
Inferences panel or the Transform tab.

Does this help?

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 topbraid-user...@googlegroups.com<mailto:topbraid-user...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/d1fc11f5-f4a3-4d23-84b7-4a72666e6c3fn%40googlegroups.com<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Ftopbraid-users%2Fd1fc11f5-f4a3-4d23-84b7-4a72666e6c3fn%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7Ccburnett%40healthwise.org%7Ccde6d575eba949e3f95908d9e055bb5f%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C1%7C637787481106696623%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=wS0pKR318uXyuZzk6mT5RFcj4bg5fK4skCMgHRc50Ng%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 topbraid-user...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/3d423d68-4f62-4180-a44a-3143e6a1128fn%40googlegroups.com<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Ftopbraid-users%2F3d423d68-4f62-4180-a44a-3143e6a1128fn%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7Ccburnett%40healthwise.org%7Ccde6d575eba949e3f95908d9e055bb5f%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C1%7C637787481106696623%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Z3wlqoD3PFcY4QKCnK7nyCxUXvjxJDvC9Mvrsi5v790%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 
topbraid-users+unsubscr...@googlegroups.com<mailto:topbraid-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/6cd4990a-f08d-4461-b0bf-a15468f8d948n%40googlegroups.com<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Ftopbraid-users%2F6cd4990a-f08d-4461-b0bf-a15468f8d948n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7Ccburnett%40healthwise.org%7Ccde6d575eba949e3f95908d9e055bb5f%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C1%7C637787481106696623%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=lF8JMGy7bEbMee%2Fb8z%2B5AY6ufTdP0Owgbq6gdAk8hQw%3D&reserved=0>.
--
You received this message because you are subscribed to a topic in the Google 
Groups "TopBraid Suite Users" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/topbraid-users/b4pARn09t3s/unsubscribe<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Ftopic%2Ftopbraid-users%2Fb4pARn09t3s%2Funsubscribe&data=04%7C01%7Ccburnett%40healthwise.org%7Ccde6d575eba949e3f95908d9e055bb5f%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C1%7C637787481106696623%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=5D41EYjh8Mba2NUflnNpNv8k5OL6rPCzG0xw1MnyjC8%3D&reserved=0>.
To unsubscribe from this group and all its topics, send an email to 
topbraid-users+unsubscr...@googlegroups.com<mailto:topbraid-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/38344e6d-c2b1-bf0f-e5df-3f77435cdedc%40topquadrant.com<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Ftopbraid-users%2F38344e6d-c2b1-bf0f-e5df-3f77435cdedc%2540topquadrant.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7Ccburnett%40healthwise.org%7Ccde6d575eba949e3f95908d9e055bb5f%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C1%7C637787481106696623%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=08dGAeKPyEHQFQI0U8K7y26bxhN9yYgqwdZg7z6nTlA%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 topbraid-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/MWHPR19MB1598DD7C579AE45BF0DD6679B7219%40MWHPR19MB1598.namprd19.prod.outlook.com.

Reply via email to