Warning:
This wiki has been archived and is now read-only.

Error vocabulary

From RDFa Working Group Wiki
Jump to: navigation, search

RDFa Error Vocabulary

Errors in RDFa are added to a separate, "processor" graph by an RDFa processor. This means adding special triples for each individual error.

The fundamental approach is to define an RDFS Class hierarchy for Errors; specific errors are added to the graph by adding a (usually) blank node (referred to as "error" node) with that type. Each error category is a separate Class, ie, the type of the error node. Error nodes have some additional required properties, and some possible labels that are application specific.

Two approaches are currently looked at. One is closely related to EARL, the other one is a simpler, only RDFa specific vocabulary. In both cases the typical error that is used is as follow: the file http://www.example.org is processed by the RDFa processor; this file refers to the http://www.example.org/profile @profile file but this is not refereancable.

Simple approach

@prefix rdfa: <http://www.w3.org/ns/rdfa#> .
@prefix xsd:  <http://www.w3.org/2001/XMLSchema#> .
@prefix dc:   <http://purl.org/dc/terms/> .
@prefix ptr:  <http://www.w3.org/2009/pointers#> .
@prefix http: <http://www.w3.org/2006/http#> .

[]
     a rdfa:ProfileReferenceError ;
     dc:description "The @profile value could not be deferenced" ;
     dc:date "2010-06-30T13:40"^^xsd:dateTime ;
     rdfa:context <http://www.example.org/profile> ;
     rdfa:context [
           a ptr:Pointer ;
           # if exact pointer information can be provided here...
     ] ;
     rdfa:context [
           a http:Response ;
           # Get the http response parameters here, possibly...
     ]
     .

The content of the dc:description is not specified by the standard although it is required to be present. dc:date should give the time when the error was found and it is advised to be as precise as possible because if, for example, this problem refers to a network issue (that may be the case in our example), that may be very helpful to detect the real problem. Again, the presence of dc:date is required.

rdfa:context is optional, and depends on whether the processor can provide meaningful information on the exact origin of the error (note that the 'ptr' vocabulary also allows for an XPath like information). In other cases, instead of the pointer vocabulary, the http://www.w3.org/TR/HTTP-in-RDF10/ vocabulary can also be used for further details on the error (eg, to provide information originating from an HTTP response).

RDFa Schema

@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#> .
@prefix rdfa: <http://www.w3.org/ns/rdfa#> .

rdfa:Error a  rdfs:Class, owl:Class .

rdfa:ProfileReferenceError rdfs:subClassOf rdfa:Error ;
    rdfs:comment "To be used when a @profile cannot be dereferenced, consequently a complete subtree is ignored for further processing" .

# More classes come here...
 
rdfa:context a owl:objectProperty ;
    rdfs:domain rdfa:Error;
    rdfs:comment "provides extra context for the error, eg, http response, or pointer information, or simply the URI that created the error"


An EARL-like approach

@prefix rdfa: <http://www.w3.org/ns/rdfa#> .
@prefix xsd:  <http://www.w3.org/2001/XMLSchema#> .
@prefix earl: <http://www.w3.org/ns/earl#> .
@prefix foaf: <http://xmlns.com/foaf/spec/#> .
@prefix dc:   <http://purl.org/dc/terms/> .
@prefix ptr:  <http://www.w3.org/2009/pointers#> .
@prefix http: <http://www.w3.org/2006/http#> .

<#assertor> a earl:Assertor, earl:Software, foaf:Agent ;
   foaf:name "RDFa Distiller" ;
   dc:description "RDFa Distiller Service" ;
   foaf:homepage <http://www.w3.org/2007/08/pyRdfa/> ;
   dc:hasVersion "2.3.5" .

[] a earl:Assertion ;
   earl:assertedBy <#assertor> ;
   rdfa:subject <http://www.example.org> ;
   rdfa:error [
       a rdfa:ProfileReferenceError ;
       dc:description "The @profile value could not be deferenced" ;
       dc:date "2010-06-30T13:40"^^xsd:dateTime ;
       rdfa:onUri <http://www.example.org/profile> ;
       rdfa:pointer [
           a ptr:Pointer ;
           # if exact pointer information can be provided here...
       ] ;
       earl:context [
           a http:Response ;
           # Get the http response parameters here, possibly...
       ]
   ] .
  

The content of the dc:description is not specified by the standard although it is required to be present. dc:date should give the time when the error was found and it is advised to be as precise as possible because if, for example, this problem refers to a network issue (that may be the case in our example), that may be very helpful to detect the real problem. Again, the presence of dc:date is required.

rdfa:pointer is optional, and depends on whether the processor can provide meaningful information on the exact origin of the error (note that the 'ptr' vocabulary also allows for an XPath like information). In other cases, instead of the pointer vocabulary, the http://www.w3.org/TR/HTTP-in-RDF10/ vocabulary can also be used for further details on the error (eg, to provide information originating from an HTTP response).

The earl:assertedBy (and the corresponding resource, i.e., <#assertor> in our case), as well as the rdfa:subject predicate are not required. They give further information to the caller that can be useful, though.

However: strictly speaking, all this is not legal. The EARL documentation indeed says that an Assertion class requires the presence of the properties like earl:result, earl:test, earl:subject, etc.

RDFa Schema

@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#> .
@prefix rdfa: <http://www.w3.org/ns/rdfa#> .
@prefix earl: <http://www.w3.org/ns/earl#> .
@prefix ptr:  <http://www.w3.org/2009/pointers#> . 

rdfa:Error  rdfs:subClassOf earl:OutcomeValue .

rdfa:ProfileReferenceError rdfs:subClassOf rdfa:Error ;
    rdfs:comment "To be used when a @profile cannot be dereferenced, consequently a complete subtree is ignored for further processing" .

# More classes come here...
 
rdfa:error a owl:objectProperty ;
    rdfs:domain earl:Assertion ;
    rdfs:range rdfa:Error ;
    rdfs:comment "much like earl:result, but is range is not TestResult"

rdfa:subject a owl:objectProperty ;
    rdfs:comment "much like an earl:subject, but its range is not set to be a test subject" ;

rdfa:pointer a owl:objectProperty ;
   rdfs:comment "much like earl:pointer, but its domain is not set to TestResult" .