Skip to content

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

@jakebeal

Description

@jakebeal

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions