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 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/d1fc11f5-f4a3-4d23-84b7-4a72666e6c3fn%40googlegroups.com.
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
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 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 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/d1fc11f5-f4a3-4d23-84b7-4a72666e6c3fn%40googlegroups.com.
--
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.
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-shape2a 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 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
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/6cd4990a-f08d-4461-b0bf-a15468f8d948n%40googlegroups.com.
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:

This diagram seems incomplete, though, in two ways:
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: topbrai...@googlegroups.com <topbrai...@googlegroups.com>
On Behalf Of Holger Knublauch
Sent: Tuesday, January 25, 2022 2:55 PM
To: topbrai...@googlegroups.com
Subject: Re: [topbraid-users] SHACL inferred data question
*** External email: use caution ***
--
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.
To unsubscribe from this group and all its topics, send an email to
topbraid-user...@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.
You're mixing two node expressions into the same top level sh:values blank node. Either use sh:filterShape or sh:path but not both. I don't know what the chaining is supposed to look like, but if you want the values of the upper path to go through the filter shape, try
sh:values [
sh:filterShape [ ... ] ;
sh:nodes [
sh:path [ sh:inversePath [ ... ] ]
]
]
See
https://w3c.github.io/shacl/shacl-af/#node-expressions-filter-shape
for the spec - sh:filterShape can only have exactly one sh:nodes
as input.
The outer sh:class is unrelated to the sh:values rule and is only used for validation purposes, not inferencing.
Holger
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/MWHPR19MB1598DD7C579AE45BF0DD6679B7219%40MWHPR19MB1598.namprd19.prod.outlook.com.
So, is there a way to combine both of the things we've discussed in this thread into one sh:values expression?1. a nested path expression that reuses the inferred sh:values from another property shape (you had me represent this with nested sh:path expressions, which worked)2. a sh:filterShape with a single sh:nodes expression
That is, is the real-world example in my last message expressible as a sh:values statement, or do I need to resort to SPARQL?
I honestly don't understand what exactly you are trying to model, but in principle yes, sh:values expressions can be nested to arbitrary depth, and include filterShapes along the way. I just don't see which path values you are trying to infer from your turtle code below. Maybe try to express this with an example instance tree first?
Holger
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/22935818-ca3f-42dc-bc0e-8866b06a7698n%40googlegroups.com.