Skip to content

Instantly share code, notes, and snippets.

@balhoff
Created February 16, 2018 20:49
Show Gist options
  • Save balhoff/8c49618679e35248eacaf971406b1a58 to your computer and use it in GitHub Desktop.
Save balhoff/8c49618679e35248eacaf971406b1a58 to your computer and use it in GitHub Desktop.
ShEx demonstration for validation of OWL classes which make reference to deprecated classes in their definitional axioms
PREFIX : <http://example.org/>
PREFIX schema: <http://schema.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
:NamedClass IRI {
rdf:type [ owl:Class ] ;
owl:equivalentClass @:Expression * ;
rdfs:subClassOf @:Expression * ;
}
:NotObsoleteClassReference IRI @:NotObsolete AND {
rdf:type [ owl:Class ] ;
}
:Intersection BNode {
rdf:type [ owl:Class ] ;
owl:intersectionOf @:ListOfNonObsoleteExpressions
}
:SomeValuesFrom BNode {
rdf:type [ owl:Restriction ] ;
owl:someValuesFrom @:Expression
}
:Expression @:NotObsoleteClassReference OR @:Intersection OR @:SomeValuesFrom
:NotObsolete NOT {
owl:deprecated [ true ]
}
:ListOfNonObsoleteExpressions BNode {
rdf:first @:Expression ;
rdf:rest @:ListOfNonObsoleteExpressions OR [ rdf:nil ]
}
@prefix : <http://example.org/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<http://example.org/#A>
a owl:Class ;
owl:equivalentClass [ a owl:Class ;
owl:intersectionOf ( <http://example.org/#B>
[ a owl:Restriction ;
owl:onProperty <http://example.org/#part_of> ;
owl:someValuesFrom <http://example.org/#C>
]
)
] .
<http://example.org/#part_of>
a owl:ObjectProperty .
<http://example.org/#D>
a owl:Class ;
rdfs:subClassOf [ a owl:Restriction ;
owl:onProperty <http://example.org/#part_of> ;
owl:someValuesFrom <http://example.org/#C>
] .
<http://example.org/#B>
a owl:Class ;
owl:equivalentClass [ a owl:Restriction ;
owl:onProperty <http://example.org/#part_of> ;
owl:someValuesFrom <http://example.org/#D>
] .
<http://example.org/#C>
a owl:Class ;
owl:deprecated true .
: a owl:Ontology .
<http://example.org/#A>@<http://example.org/NamedClass>,
<http://example.org/#B>@<http://example.org/NamedClass>,
<http://example.org/#C>@<http://example.org/NamedClass>,
<http://example.org/#D>@<http://example.org/NamedClass>
@balhoff
Copy link
Author

balhoff commented Feb 16, 2018

A and D will be flagged for violating the schema, since they reference C, a deprecated term.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment