[EARL] [W3C ERT WG]

EARL 0.95 Primer

This assumes a certain level of familiarity with the EARL Overview.

EARL, rather than being a particular syntax, is a model based on the W3C's Resource Description Framework. This allows greater flexibility in the way it is implemented. It also ensures that EARL may be compatable with developments from the Semantic Web Activity.

EARL Model

The model for EARL is very simple, consisting as it does of a set of "evaluations". These evaluations, like all things in RDF, are made up of three parts called a "triple". In the case of an EARL evaluation, these three parts make up the statement "an Assertor asserts an Assertion". What does this mean? In RDF, all parts of a triple are made from URIs. This basically means that they are globally unique, and that anyone can refer to them.

In the case of EARL 0.95, all of our URIs start with http://www.w3.org/2001/03/earl/0.95# This is called the "EARL 0.95 namespace", because it is a space in which we put all of our names (URIs). For example, as mentioned before, an evaluation is made up of the triple "an Assertor asserts an Assertion". Already we have made up four names to put in our namespace: Evaluation, Assertor, asserts, and Assertion. The URIs for these are:-

These URIs are very long, so we usually abbreviate them by giving an alias to our namespace. This is declared in XML RDF as:-

<earl:Evaluation xmlns:earl="http://www.w3.org/2001/03/earl/0.95#"/>

And in Notation3 as:-

@prefix earl: <http://www.w3.org/2001/03/earl/0.95#> .

This means that instead of typing out http://www.w3.org/2001/03/earl/0.95# every time, you can just use earl: each time. You don't have to use earl: for a namespace alias, for example you could use e: instead, but it is a good convention to follow.

So, EARL at the moment consists of earl:Evaluation, earl:Assertor, earl:asserts and earl:Assertion. In Notation3:-

@prefix earl: <http://www.w3.org/2001/03/earl/0.95#> .
{ [ a earl:Assertor ] earl:asserts [ a earl:Assertion ] } a earl:Evaluation .

This means that "something which is a type/instance of Assertor asserts something which is a type/instance of Assertion. This whole statement is an Evaluation".

RDF Schema

In the RDF model, each triple consists of a "subject", a "predicate", and an "object". In common terms, this is like saying a noun verb and a noun. e.g. Seth eats Chocolate. In our example above, if "Seth" was an Assertor, and "I like chocolate" was an Assertion, you could see that this might make sense:-

@prefix earl: <http://www.w3.org/2001/03/earl/0.95#> .
:Seth earl:asserts "I like chocolate" .

But EARL is really a language for making technical evluations of Web content and tools, so this would probably be out of scope! At any rate, an "assertion" is much more complicated than it might look, because it itself is made up of a further "triple".

Before we go onto that, let's look closer at what the RDF Schema mechanism is. We have already been using it briefly by saying that an "Assertor" and an "Assertion" are "things", i.e. nouns, and that "asserts" is a property, i.e. verb. In fact, RDF has special names for these: we call the nouns "Classes", and the verbs "Properties". In namespace terms, these are rdfs:Class and rdf:Property respectively.

If we want to say that a certain thing is an instance of a sort of Class, we can do that using the rdf:type property. For example, if I wanted to say that Seth is a sort of person, I could say that:-

:Person rdf:type rdfs:Class .
:Seth rdf:type :Person .

Or in shorthand:-

:Seth a :Person .

Indeed, we do not need to state explicitly that "Person is a Class", because if something is a type of Person, then Person is a Class. We'll go into this in more detail a bit later on. For now, all you need to know is that you have nouns which are all types of classes, and other nouns which can be types of things which are types of classes, and properties, which are all of rdf:type rdf:Property.

rdf:type rdf:type rdf:Property .
rdfs:Class rdf:type rdfs:Class .

So, when it comes to EARL we can now say:-

@prefix earl: <http://www.w3.org/2001/03/earl/0.95#> .
earl:Evaluation a rdfs:Class .
earl:Assertor a rdfs:Class .
earl:Assertion a rdfs:Class .
earl:asserts a rdf:Property .

Domains and Ranges

A domain and a range signify what type of thing the subject and object are for each property. For example:-

:hasEmailAddress

If you wanted to say that when this property is used, the subject must be a type of :Person, and the object must be a type of :EmailAddress, then you could use:-

:hasEmailAddress rdfs:domain :Person; rdfs:range :EmailAddress .

In EARL, we are saying that in an earl:Evaluation, the domain of earl:asserts is earl:Assertor, and the range is earl:Assertion, so:-

@prefix earl: <http://www.w3.org/2001/03/earl/0.95#> .
earl:asserts rdfs:domain earl:Assertor; rdfs:range earl:Assertion .

Remember, this does not mean that the object of earl:asserts is earl:Assertor, it means that the domain is a type of earl:Assertor. That is why earlier on I wrote:-

@prefix earl: <http://www.w3.org/2001/03/earl/0.95#> .
{ [ a earl:Assertor ] earl:asserts [ a earl:Assertion ] } a earl:Evaluation .

So, if for example we say that:-

@prefix earl: <http://www.w3.org/2001/03/earl/0.95#> .
:Seth earl:asserts :MyAssertion .

We can automatically deduce that:-

:Seth a earl:Assertor .
:MyAssertion a earl:Assertion .

In other words, this information is implied, and you don't really need to state it.

Contexts

Now, an earl:Assertion itself is made up of three further parts, an earl:TestSubject, an earl:ResultProperty, and an earl:TestCase. In N3 this might be represented as:-

 { [ a earl:TestSubject ] 
   [ a earl:ResultProperty ] 
   [ a earl:TestCase ] } a earl:Assertion .

The bit in the curly brackets "{}" is called a context, and it's a bit like quoting something. For example:-

:Seth earl:asserts { :MyTestSubject :myResultProp :MyTestCase } .

Would be spoken in English as "Seth asserts 'MyTestSubject has myResultProp of MyTestCase'". Note that anything that is a earl:TestCase must be an rdf:Property. You may also have noticed the convention (although it is not a rule) that Classes always start with capital letters, and properties always start in lower case characters.

Because we want to make sure that anything of type earl:TestCase is also an rdf:Property, we say that:-

earl:TestCase rdfs:subClassOf rdf:Property .

In other words, an earl:TestCase is a specialized instance of an rdf:Property, but it is still an rdf:Property.

Overall so far, we have:-

{ [ a earl:Assertor ] 
  earl:asserts 
  { [ a earl:TestSubject ] 
    [ a earl:ResultProperty ] 
    [ a earl:TestCase ] } } a earl:Evaluation .

Reified EARL

Interestingly, I declared that:-

   earl:Evaluation rdfs:subClassOf rdf:Statement .

And should have added:-

   earl:Assertion rdfs:subClassOf rdf:Statement .

Because when you reify an EARL evaluation out, you get:-

   [ a rdf:Statement; 
     rdf:subject [ a earl:Assertor ]; 
     rdf:predicate earl:asserts; 
     rdf:object [ a rdf:Statement; 
                  rdf:subject [ a earl:TestSubject ]; 
                  rdf:predicate [ a earl:ResultProperty ];
                  rdf:object [ a earl:TestCase ] ] 
   ] a earl:Evaluation .

Which is like:-

   [ a rdf:Statement, earl:Evaluation ] .

Which is fine if earl:Evaluation is a sub class of rdf:Statement (which it is).

Sean B. Palmer
$Id$