I do not see anything here that would constrain core:createdBy to exactly
Agent. It should be fine for any subclass of Agent.
The first object in the JSON defines the core:CreationInfo class and associates
a particular property shape ("@id": "_:N34622bbc773e4833a8e46851e0ed869c",
) with that class.
The third object in the JSON defines the core:createdBY property. It specifies
its semantic relationship to the CreationInfo class with the domain assertion.
BTW, I strongly suggest we avoid asserting domains on properties as this has
complex semantic inferencing meaning in rdf/owl that I do not think we intend
to assert or have thought/talked through yet. The rdfs:range on the property
definition asserts that all values of the createdBy property should be of the
class Agent. This means ANY instance of Agent which included instances of
subclasses Agent are valid values.
The second object in the JSON defines a property shape to constrain how the
createdBy property can exist as a property of CreationInfo. It have no effect
of how createdBy could be used on any other class that is not CreationInfo or a
subclass of CreationInfo. In this case, the sh:path property of the shape
identifies which property we are dealing with, the sh:minCount asserts a
cardinality constraint of 1 (there must be at least one) on the values of
createdBy property on the CreationInfo class. The sh:class property of the
shape asserts that any values of createdBy specifically on instances of the
CreationInfo class must be Agent (or any subclass of agent).
The reason for specifying a rdfs:range on the property definition AND
specifying an sh:class constraint on the property shape is that the sh:class
could assert a narrower class constraint (e.g., Person) for the use of
createdBy property specifically on the CreationInfo class than the broader
constrain on its use in general.
BTW, the sh:property property on the definition of CreationInfo is a list of
relevant property shapes for that class. It is present in the class definition
because that definition is BOTH a class definition AND a SHACL NodeShape
definition as expressed in
"@type": [
"owl:Class",
"sh:NodeShape"
],
Does this make sense?
Sean
From: Joshua Watt <[email protected]>
Date: Thursday, October 26, 2023 at 10:57 AM
To: Sean Barnum <[email protected]>
Cc: Alexios Zavras <[email protected]>, Gary O'Neall
<[email protected]>, SPDX Technical Mailing List <[email protected]>
Subject: [EXT] Re: [spdx-tech] RDF range problem in SHACL model
I couldn't figure out how to get that example to work (because this is all very
new to me, and the https: //shacl. org/playground/ didn't like it when I just
copied and pasted it in there. . . . however I was looking through the model.
jsonld and
I couldn't figure out how to get that example to work (because this is
all very new to me, and the https://shacl.org/playground/ didn't like
it when I just copied and pasted it in there.... however I was looking
through the model.jsonld and I think maybe I saw something suspicious.
The CreationInfo class is defined as:
{
"@id": "core:CreationInfo",
"@type": [
"owl:Class",
"sh:NodeShape"
],
"sh:property": [
{
"@id": "_:N34622bbc773e4833a8e46851e0ed869c"
},
]
},
{
"@id": "_:N34622bbc773e4833a8e46851e0ed869c",
"sh:class": {
"@id": "core:Agent"
},
"sh:minCount": 1,
"sh:name": "createdBy",
"sh:path": {
"@id": "core:createdBy"
}
},
{
"@id": "core:createdBy",
"@type": "owl:ObjectProperty",
"rdfs:domain": {
"@id": "core:CreationInfo"
},
"rdfs:range": {
"@id": "core:Agent"
}
},
So, based on my reading, is is possible the property
(_:N34622bbc773e4833a8e46851e0ed869c) is placing an additional
constraint on the property via the "sh:class" that must exactly match
"core:Agent".
Also, strange to me (but again, I don't understand RDF) why the
"rdfs:range" only seems to be linked to the property via "sh:path"
instead of being in the "sh:property" itself ?
On Thu, Oct 26, 2023 at 8:48 AM Sean Barnum <[email protected]> wrote:
>
> I agree.
>
>
>
> From: [email protected] <[email protected]> on behalf of
> Alexios Zavras <[email protected]>
> Date: Thursday, October 26, 2023 at 10:32 AM
> To: Gary O'Neall <[email protected]>, 'Joshua Watt'
> <[email protected]>, 'SPDX Technical Mailing List'
> <[email protected]>
> Subject: [EXT] Re: [spdx-tech] RDF range problem in SHACL model
>
> I agree that all instances of a subclass (Organization) are also instances of
> the superclass (Agent), so there should not be any issue. This is not even
> related to SHACL; it’s simple RDF. Minimal example to try: @prefix rdfs:
> http: //www. w3. org/2000/01/rdf-schema#
>
> I agree that all instances of a subclass (Organization) are also instances of
> the superclass (Agent), so there should not be any issue.
>
> This is not even related to SHACL; it’s simple RDF.
>
>
>
> Minimal example to try:
>
> @prefix rdfs: http://www.w3.org/2000/01/rdf-schema# .
>
> @prefix owl: http://www.w3.org/2002/07/owl# .
>
> @prefix ex: http://zvr.invalid/rdf .
>
>
>
> ex:CreationInfo a owl:Class .
>
> ex:createdBy a owl:ObjectProperty ;
>
> rdfs:domain ex:CreationInfo ;
>
> rdfs:range ex:Agent .
>
> ex:Agent a owl:Class .
>
> ex:Organization a owl:Class ;
>
> rdfs:subClassOf ex:Agent .
>
>
>
> ex:someOrganization a ex:Organization .
>
> ex:someCreationInfo a ex:CreationInfo .
>
> ex:someCreationInfo ex:createdBy ex:someOrganization .
>
>
>
>
>
>
>
> --
>
> zvr
>
> From: [email protected] <[email protected]> On Behalf Of Gary
> O'Neall
> Sent: Thursday, 26 October, 2023 14:19
> To: 'Joshua Watt' <[email protected]>; 'SPDX Technical Mailing List'
> <[email protected]>
> Subject: Re: [spdx-tech] RDF range problem in SHACL model
>
>
>
> Hi Joshua,
>
>
>
> From the RDF spec definition of rdfs:SubclassOf, it looks like subclasses
> should be allowed in the range since all instances of the subclass should
> also be instances of the class.
>
>
>
> We could try a different validator to see if this is an issue with PySHACL.
> Here’s an online validator: https://shacl.org/playground/
>
>
>
> If you found any documentation to the contrary, let me know.
>
>
>
> Sean, Alexios – any thoughts?
>
> Gary
>
>
>
> > -----Original Message-----
>
> > From: [email protected] <[email protected]> On Behalf Of
>
> > Joshua Watt
>
> > Sent: Wednesday, October 25, 2023 12:06 PM
>
> > To: SPDX Technical Mailing List <[email protected]>
>
> > Subject: [spdx-tech] RDF range problem in SHACL model
>
> >
>
> > I dug further into trying to get my Yocto SPDX output to validate against
> > the
>
> > JSON LD SHACL model. I've made some progress, but I think maybe I've come
>
> > up against a problem that don't know how to solve.
>
> >
>
> > Disclaimer: I'm not an SHACL, RDF or ontology expert so please excuse my
>
> > misuse of nomenclature.
>
> >
>
> > It looks like there might be a problem in the model in regard to the usage
> > of
>
> > "rdfs:range" to validate the type values of object properties. Based on my
>
> > reading and experiments, it looks like that field requires that the
> > referenced
>
> > object be of _exactly_ one of the listed types, and cannot be a subclass
>
> > derived from that type. As an example, the "createdBy" property of
>
> > core:CreationInfo has "rdfs:range" of "core:Agent". Practically speaking,
> > this
>
> > means that only an _exact_ core:Agent is allowed in this field, and classes
>
> > derived from that class (such as core:Organization) are not allowed (or at
>
> > least, pyshacl indicates a violation).
>
> >
>
> >
>
> >
>
>
>
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de
> Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#5404): https://lists.spdx.org/g/Spdx-tech/message/5404
Mute This Topic: https://lists.spdx.org/mt/102185295/21656
Group Owner: [email protected]
Unsubscribe: https://lists.spdx.org/g/Spdx-tech/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-