@prefix bibo: <http://purl.org/ontology/bibo/> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix error: <http://www.essepuntato.it/2009/10/error#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix reg: <http://purl.org/linked-data/registry#> .
@prefix schema: <https://schema.org/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix vann: <http://purl.org/vocab/vann/> .
@prefix vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

dc:creator a owl:AnnotationProperty .

dc:date a owl:AnnotationProperty .

dc:description a owl:AnnotationProperty .

dc:rights a owl:AnnotationProperty .

dc:title a owl:AnnotationProperty .

<http://purl.org/spar/error> a owl:Ontology ;
    rdfs:label "Error Ontology"@en ;
    dc:contributor "Sebastian Barzaghi (https://orcid.org/0000-0002-0799-1527)"^^xsd:string ;
    dc:creator "Silvio Peroni (https://orcid.org/0000-0003-0530-4305)"^^xsd:string ;
    dc:date "2026-09-25"^^xsd:date ;
    dc:description """
The **_Error Ontology_** is an unit test that allow to produce an inconsistent model if a particular (and incorrect) situation happens.

![The main architecture of the Error Ontology.](error.png)

It works by means of a data property `error:hasError` that denies its usage for ant resource. 
In fact, by defining its domain as "all those resource that do not have any `hasErrorDescription` assertion", a resource that asserts having an error makes the ontology inconsistent.

## Examples of use

In the following subsections, we introduce some examples to showcase how to use the Error Ontology. 

The prefixes that are used in all the examples provided below are defined as follows:

    @prefix : <http://www.sparontologies.net/example/> .
    @prefix error: <http://www.essepuntato.it/2009/10/error#> .
    @prefix owl: <http://www.w3.org/2002/07/owl#> .
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

### Flagging an erroneous resource

A resource can be directly marked as erroneous by asserting a description of its error. 
Since no resource can have any `error:hasError` assertion, a reasoner will classify it as a member of `owl:Nothing`, making the model inconsistent.

    :my-article a fabio:Article ;
        error:hasError "The article has two different publication dates."^^xsd:string .

### Defining a forbidden situation through a class axiom

An incorrect situation can be modelled as a class whose members are automatically associated with an error description. 
Any individual that falls in such a class makes the model inconsistent, and the error description explains why.

    :DraftAndPublishedDocument
        owl:equivalentClass [ a owl:Class ;
            owl:intersectionOf ( fabio:Manuscript fabio:JournalArticle ) ] ;
        rdfs:subClassOf [ a owl:Restriction ;
            owl:onProperty error:hasError ;
            owl:hasValue "A document cannot be a draft and published at the same time."^^xsd:string ] .

    :my-document a fabio:Manuscript , 
        fabio:JournalArticle .

## Competency Questions

The Error Ontology can be used to produce an inconsistent model if a particular (and incorrect) situation happens.
In the following subsections, some competency questions are introduced together with their respective SPARQL queries.

The prefixes that are used in all the SPARQL queries provided below are defined as follows:

    PREFIX error: <http://www.essepuntato.it/2009/10/error#>
    PREFIX owl: <http://www.w3.org/2002/07/owl#>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

### CQ1

Which resources are explicitly asserted to have an error, and what is the description of that error?

    SELECT ?resource ?description WHERE {
        ?resource error:hasError ?description .
    }

### CQ2

Which classes describe a forbidden situation, and what is the error description associated with their members?

    SELECT ?class ?description WHERE {
        ?class rdfs:subClassOf ?restriction .
        ?restriction a owl:Restriction ;
            owl:onProperty error:hasError ;
            owl:hasValue ?description .
    }

### CQ3

Does the dataset contain at least one resource with an error?

    ASK {
        ?resource error:hasError ?description .
    }

"""@en ;
    dc:title "The Error Ontology"@en ;
    dcterms:bibliographicCitation "Ciccarese, P., & Peroni, S. (2014). The Collections Ontology: creating and handling collections in OWL 2 DL frameworks. Semantic Web, 5(6), 515-529. DOI: https://doi.org/10.3233/SW-130121." ;
    dcterms:created "2010-11-29" ;
    dcterms:issued "2010-11-29" ;
    dcterms:license <http://creativecommons.org/licenses/by/4.0/> ;
    dcterms:modified "2026-09-25" ;
    dcterms:publisher <https://ror.org/00wb4mk85> ;
    dcterms:source <https://github.com/SPAROntologies/error/blob/master/docs/cq.md> ;
    bibo:doi "TBA" ;
    bibo:status <http://purl.org/ontology/bibo/status/published> ;
    vann:changes """
* **v1.0.1**: 
Added new documentation, including annotation properties (e.g., `bibo:doi`, `schema:codeRepository`, etc.), term properties (e.g., `vann:example`, `vs:term_status`, etc.), exemplary competency questions with their respective SPARQL queries, and a Grafoo diagram.
    """@en ;
    vann:preferredNamespacePrefix "error"@en ;
    vann:preferredNamespaceUri "http://purl.org/spar/error"@en ;
    owl:backwardCompatibleWith error:2010-11-29 ;
    owl:priorVersion error:2010-11-29 ;
    owl:versionIRI error:2026-09-25 ;
    owl:versionInfo "1.0.1"^^xsd:string ;
    foaf:logo <https://github.com/SPAROntologies/error/blob/master/spar.png> ;
    schema:codeRepository <https://github.com/SPAROntologies/error> ;
    schema:image <https://github.com/SPAROntologies/error/blob/master/docs/current/error.png> ;
    schema:includedInDataCatalog <https://fairsharing.org/> ;
    schema:keywords "error descriptions"@en,
        "errors"@en,
        "semantic publishing"@en .

rdfs:comment a owl:AnnotationProperty .

rdfs:label a owl:AnnotationProperty .

owl:versionInfo a owl:AnnotationProperty .

error:hasError a owl:DatatypeProperty ;
    rdfs:label "has error"@en ;
    vann:example """
    :my-resource
        error:hasError "This resource violates a constraint of the model."^^xsd:string .
    """ ;
    rdfs:comment "A description, usually in natural language, of which kind of error results from a resource."@en ;
    rdfs:domain [ a owl:Restriction ;
            owl:cardinality "0"^^xsd:nonNegativeInteger ;
            owl:onProperty error:hasError ] ;
    rdfs:isDefinedBy <http://purl.org/spar/error/> ;
    rdfs:range xsd:string ;
    vs:term_status reg:statusStable ;
    skos:note "A data property linking a resource that contains a logical error (which results in it belonging to the class `owl:Nothing`, therefore making the model inconsistent) to a textual description of that error."@en .

