Re: Musings on resource grouping

I would bring to your attention an alternative solution to resource
grouping wrt the one based on the DRs' scope/packages. Very simply, the
idea is to express the constraints determining the scope of the DR
itself by using RDF rules.

Thanks to this we can keep separate a DR and the scope of such DR. So,
if we wish to apply to a group of resources the same DR, we just have to
 specify a set of rules. Of course, the current WDR approach is a
shortcut to this, but I think we'll have more flexibility using standard
rule syntax and, in addition, we can use already existing RDF reasoners
(such as Cwm [1] or Euler [2]) to verify whether a DR apply to a
resource, without the need of developing further and ad hoc software
tools. Finally, in a rule we can use any RDF/OWL vocabulary for
expressing the conditions to be satisfied, without the need of defining
ad hoc properties/classes.

I think I can better explain myself with an example.

Consider the strawman example at [3], reported herebelow (I use N3 [4,5]
instead of `plain' RDF for brevity's sake):

    @prefix : <http://www.w3.org/2007/02/powder-ns#> .
    @prefix ex: <http://example.org/vocabulary#> .
    @prefix foa: <http://labellingauthority.example.org/foaf.rdf#> .
    @prefix wd: <#> .

    wd:description_1     ex:property1 "value 1";
         ex:property2 "value 2" .

    wd:description_2     ex:property3 "value 3";
         ex:property4 "value 4" .

    wd:description_3     ex:property1 "value 1";
         ex:property4 "value 4" .

    wd:dr_1     a :WDR;
         <http://purl.org/dc/terms/issued> "2006-09-01";
         :hasDescription wd:description_1;
         :hasScope  [
             a :Scope;
             :UAstring "NOKIA";
             :hasHost "example.org";
             :hasURI "\\.jpg$" ];
         :validUntil "2007-09-01";
         <http://xmlns.com/foaf/0.1/maker> foa:me .

    wd:dr_2     a :WDR;
         <http://purl.org/dc/terms/issued> "2006-09-01";
         :hasDescription wd:description_2;
         :hasScope  [
             a :Scope;
             :hasHost "example.org";
             :hasPath "foo" ];
         :validUntil "2007-09-01";
         <http://xmlns.com/foaf/0.1/maker> foa:me .

    wd:dr_3     a :WDR;
         <http://purl.org/dc/terms/issued> "2006-09-01";
         :hasDescription wd:description_3;
         :hasScope wd:primaryScope;
         :validUntil "2007-09-01";
         <http://xmlns.com/foaf/0.1/maker> foa:me .

    wd:package     a :Package;
         :hasDRs  (
        wd:dr_1
        wd:dr_2
        wd:dr_3 );
         :hasPackageScope wd:primaryScope .

    wd:primaryScope     a :Scope;
         :hasHost "example.org" .


Now, by using rules to express the constraints determining the scope of
each DR, we can reword the code above as follows:

    @prefix : <http://www.w3.org/2007/02/powder-ns#> .
    @prefix ex: <http://example.org/vocabulary#> .
    @prefix foa: <http://labellingauthority.example.org/foaf.rdf#> .
    @prefix wd: <#> .
    @prefix foaf:  <http://xmlns.com/foaf/0.1/> .

    wd:description_1     ex:property1 "value 1";
         ex:property2 "value 2" .

    wd:description_2     ex:property3 "value 3";
         ex:property4 "value 4" .

    wd:description_3     ex:property1 "value 1";
         ex:property4 "value 4" .

    wd:dr_1     a :WDR;
         <http://purl.org/dc/terms/issued> "2006-09-01";
         :hasDescription wd:description_1;
         :validUntil "2007-09-01";
         <http://xmlns.com/foaf/0.1/maker> foa:me .

    wd:dr_2     a :WDR;
         <http://purl.org/dc/terms/issued> "2006-09-01";
         :hasDescription wd:description_2;
         :validUntil "2007-09-01";
         <http://xmlns.com/foaf/0.1/maker> foa:me .

    wd:dr_3     a :WDR;
         <http://purl.org/dc/terms/issued> "2006-09-01";
         :hasDescription wd:description_3;
         :validUntil "2007-09-01";
         <http://xmlns.com/foaf/0.1/maker> foa:me .

    {?rsc :UAstring "NOKIA";
          :hasHost "example.org";
          :hasURI "\\.jpg$" . }       => { wd:dr_1 :appliesTo ?rsc } .

    {?rsc :hasHost "example.org";
          :hasPath "foo" . }          => { wd:dr_2 :appliesTo ?rsc } .

    {?rsc :hasHost "example.org" . }  => { wd:dr_3 :appliesTo ?rsc } .


As you can see, DRs do not contain any more their scope, which is
expressed by three rules (last lines), and both the package and the
primary scope are gone.

Syntactically, a rule consists of three components: an antecedent
(containing a set of conditions), an implication operator (=>), and a
consequent (containing one or more statements). Both the antecedent and
the consequent are delimited by curly brackets (
{conditions}=>{statement(s)} ). The meaning of a rule is that, if all
the conditions in the antecedent are satisfied, the the statement(s) in
the consequent are true. For instance, the rule

    {?rsc :hasHost "example.org" . }  => { wd:dr_3 :appliesTo ?rsc } .

states that, if a resource (denoted by variable ?rsc) has a URL where
the host component is "example.org", then the DR identified by wd:dr_2
applies to it.

Now, if I access a resource with URL "http://www.example.org/foo.html"
and we ask the reasoner to analyse the RDF file containing DRs and
rules, it will return:

    wd:dr_2     a :WDR;
         <http://purl.org/dc/terms/issued> "2006-09-01";
         :hasDescription wd:description_2;
         :validUntil "2007-09-01";
         <http://xmlns.com/foaf/0.1/maker> foa:me .
         :appliesTo <http://www.example.org/foo.html> .

thus providing the `view' of the RDF file concerning the DR(s) applying
to the requested resource. (Of course, the whole content of the RDF file
can still be read by retrieving the file itself without running the
reasoner).

The objection here may be that, if the scope is kept separate from the
corresponding DR, anyone can publish a rule anywhere stating that, e.g.,
wd:dr_2 applies to mysite.com. But if we suppose that DRs can be
considered trustworthy only when valid/authenticated, we can apply the
same approach to rules: a DR applies to a resource only if a
valid/authentic rule states that. (By the way, Cwm has some built-in
cryptographic functions which, maybe, can be used for this purpose [6]).

Note however that by using rules we don't have necessary to separate a
DR from its scope. For instance, the original DR wd:dr_2

    wd:dr_2     a :WDR;
         <http://purl.org/dc/terms/issued> "2006-09-01";
         :hasDescription wd:description_2;
         :hasScope  [
             a :Scope;
             :hasHost "example.org";
             :hasPath "foo" ];
         :validUntil "2007-09-01";
         <http://xmlns.com/foaf/0.1/maker> foa:me .

can be reworded as follows

    {?rsc :hasHost "example.org"; :hasPath "foo" . }
    => { wd:dr_2     a :WDR;
         <http://purl.org/dc/terms/issued> "2006-09-01";
         :hasDescription wd:description_2;
         <http://xmlns.com/foaf/0.1/maker> foa:me .
         :appliesTo ?rsc} .

which is quite similar to the original one, but with the advantage that
it can be processed by a RDF reasoner.


Andrea



[1] http://www.w3.org/2000/10/swap/doc/cwm.html
[2] http://www.agfa.com/w3c/euler/
[3] http://www.w3.org/2007/powder/History
[4] http://www.w3.org/DesignIssues/Notation3.html
[5] http://www.w3.org/DesignIssues/N3Logic
[6] http://www.w3.org/2000/10/swap/doc/Trust

Received on Tuesday, 27 March 2007 09:00:45 UTC