Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sbol-shacl validation fails when inherited properties are set #74

Open
jakebeal opened this issue Aug 25, 2022 · 0 comments
Open

sbol-shacl validation fails when inherited properties are set #74

jakebeal opened this issue Aug 25, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@jakebeal
Copy link
Contributor

jakebeal commented Aug 25, 2022

For classes derived from SBOL classes other than the roots, the sbol-shacl validation fails when inherited properties are set. This seems to be because sbol-shacl is not aware of the sub-class relationship.

A minimal reproduction showing the generality of the failure mode:

TTL file:

@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix sbol: <http://sbols.org/v3#> .
@prefix sep054: <http://sbols.org/SEP054#> .
@base <http://sbols.org/SEP054#> .

sep054: rdf:type owl:Ontology ; owl:imports sbol: ; rdfs:comment "failure test" ; owl:versionInfo "1.0-alpha1" .

sep054:SequenceX rdf:type owl:Class ;
        rdfs:comment  '''Subclass failure''' ;
        rdfs:subClassOf sbol:Sequence  .

sep054:CollectionX rdf:type owl:Class ;
        rdfs:comment  '''Subclass failure''' ;
        rdfs:subClassOf sbol:Collection  .

Python code:

from pathlib import Path
from sbol_factory import SBOLFactory
import sbol3

sbol3.set_namespace('http://foo.org/bar/')
sep_054 = SBOLFactory('sep_054', Path(__file__).parent / 'scratch.ttl', 'http://sbols.org/SEP054#')

doc = sbol3.Document()
seq = sep_054.SequenceX('seqOK')
doc.add(seq)
doc.add(sep_054.SequenceX('seqFail', encoding=sbol3.IUPAC_DNA_ENCODING))
doc.add(sep_054.CollectionX('colOK'))
doc.add(sep_054.CollectionX('colFail', members=seq))

for e in doc.validate().errors:
    print(str(e))
assert not doc.validate().errors and not doc.validate().warnings
@jakebeal jakebeal added the bug Something isn't working label Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant