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<https://www.w3.org/TR/rdf12-schema/#ch_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]<mailto:[email protected]> 
> <[email protected]<mailto:[email protected]>> On Behalf Of

> Joshua Watt

> Sent: Wednesday, October 25, 2023 12:06 PM

> To: SPDX Technical Mailing List 
> <[email protected]<mailto:[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 <http://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 (#5399): https://lists.spdx.org/g/Spdx-tech/message/5399
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]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to