Re: "globally closed" schema?

Hi Thomas,

I would recommend recording these suggestions to a GitHub issue

https://github.com/w3c/data-shapes/issues
as they may otherwise get lost in these threads and the topic was originally about something else.

Holger


> On 22 Jan 2024, at 9:23 am, Thomas Francart <thomas.francart@sparna.fr> wrote:
> 
> Hello
> 
> On a (maybe) related note : I have a use-case that involves documenting a dataset (not necessarily validating it) against a SHACL specification. By documenting I mean provide a "summary" of the graph.
> To do this I would like to *count* the number of targets of each shape in the dataset; for this :
> I could use a more direct predicate to indicate a node is a target of a shape (e.g. "xx:isTargetOfShape") (which would then be the basis to determine if a node is not targeted by any shape). This could be seen as the inverse of sh:targetNode.
> I would like to express the statistics of the dataset against the SHACL specification, that is the number of targets of each node shape, the number of occurrences of each property shape, and the number of distinct values of each property shape. For this I can rely on VOID vocabulary (https://www.w3.org/TR/void/#statistics), but only if the node shapes corresponds to classes (i.e. use sh:targetClass) to use void:classPartition. To generalize this partitioning approach (https://www.w3.org/TR/void/#subset) I could also use a more SHACL-related partitioning of a dataset, such as xx:shapePartition, with a "xx:shape" property pointing to a shape. This partition would "contain all triples that describe entities that are targets of the shape indicated with xx:shape." The statistics are then expressed on the partition entity.
> Best Regards
> Thomas
> 
> 
> 
> Le jeu. 18 janv. 2024 à 18:44, Holger Knublauch <holger@topquadrant.com <mailto:holger@topquadrant.com>> a écrit :
>> 
>> 
>>> On 18 Jan 2024, at 4:29 pm, Vladimir Alexiev <vladimir.alexiev@ontotext.com <mailto:vladimir.alexiev@ontotext.com>> wrote:
>>> 
>>> sh:closed is local, i.e. per shape. It checks that a targeted node doesn't include unsanctioned props.
>>> I'm looking for ways to declare a globally closed schema, i.e. to catch untargeted nodes, i.e. that the KG doesn't include unsanctioned nodes. 
>>> 
>>> 1. I guess one can do it with SPARQL (SHACL advanced) by triggering off some fixed node.
>>>   Here's a very expensive way to catch all nodes: select distinct ?s {?s ?p ?o}
>>> 2. It would be useful to "mark" all nodes visited during SHACL validation.
>>> - SHEX has a way to report positive results: https://shexspec.github.io/primer/ShExJ#validation 
>>> - SHACL doesn't have a standard way to report positive results: https://www.w3.org/TR/shacl/#results-validation-result .
>>>   But there is a note "SHACL implementations may use other SHACL subclasses of sh:AbstractResult, for example, to report successfully completed constraint checks or accumulated results."
>>>   Say we "standardize" a new class eg dash:PositiveValidation
>> 
>> Already exist:
>> dash:SuccessResult
>>   a rdfs:Class ;
>>   rdfs:comment "A result representing a successfully validated constraint." ;
>>   rdfs:label "Success result" ;
>>   rdfs:subClassOf sh:AbstractResult ;
>> .
>> 
>>> Then one could look for nodes that don't appear in sh:ValidationResult.focusNode nor dash:PositiveValidation.focusNode
>> 
>> Yes.
>> 
>> There may also be different algorithms such as enumerating the allowed rdf:types which could be represented with a targeted constraint on rdf:type and a sh:in. This depends on what someone considers unsanctioned nodes.
>> 
>> Holger
>> 
>> 
>>> 
>>> All feedback is welcome!
>> 
> 
> 
> --
> 
> Thomas Francart - SPARNA
> Web de données | Architecture de l'information | Accès aux connaissances
> blog : blog.sparna.fr <http://blog.sparna.fr/>, site : sparna.fr <http://sparna.fr/>, linkedin : fr.linkedin.com/in/thomasfrancart <https://fr.linkedin.com/in/thomasfrancart>
> tel :  +33 (0)6.71.11.25.97, skype : francartthomas

Received on Monday, 22 January 2024 09:49:20 UTC