Re: Restrictions on Bags and Seqs content

[cc'd to owl-dev: perhaps some experts there seeing any flaws in my 
discussion below?]

Hi, Roberto!

IMO, what Alan proposed, the creation of a custom 'OWLList' class, is 
probably the best one can do in order to build some kind of collection 
which is restricted to containing instances of some 'Person' class, 
only. For completeness, I will try to discuss what is possible if one 
really insists on applying 'rdf:Bag' for this purpose.

The first problem is that one cannot build axioms with 'rdfs:member' in 
OWL/DL, because it is "disallowed vocabulary", see

    http://www.w3.org/TR/owl-semantics/mapping.html#4.2

(BTW, for the same reason, it is not possible to create axioms with 
'rdf:List'.)

Luckily, when working with rdf:Bag, one does not have to use rdfs:member 
directly, but instead one uses its subproperties 'rdf:_n', with integers 
n >= 1. Those properties are /not/ disallowed vocabulary.

Next problem: An OWL parser does not necessarily know about the RDF(S) 
vocabulary, so one has to explicitly introduce classes like rdf:Bag and 
properties like rdf:_n. Further, rdf:Bag is not an owl:Class, and rdf:_n 
is an rdf:Property, so in order to get some OWL/DL conform ontology, one 
has to "correct" this (this is a hack!):

    Class(rdf:Bag partial)
    ObjectProperty(rdf:_1)
    ObjectProperty(rdf:_2)

There are two further problems with this:

First, making rdfs:_n into an ObjectProperty might become a problem, 
because one will not longer be able to build an instance of rdf:Bag 
containing datavalues! But declaring the rdf:_n properties to be 
ObjectPropertyS is AFAIK a necessary task in order to later build 
'allValuesFrom' Restrictions on them.

A second problem is: One has to know /in advance/ how large the largest 
bag will become in one's application, and one has to create that many 
ObjectProperty declarations for all those rdf:_n properties. :-(

Accepting all those drawbacks, it now really seems to be possible to 
build a PersonBag:

    Class(PersonBag partial rdf:Bag
      restriction(rdf:_1 allValuesFrom(Person))
      restriction(rdf:_2 allValuesFrom(Person))
    )

Again, one has to estimate the largest possible PersonBag: That's the 
number of allValuesFrom restriction one has to declare in the above 
class axiom.

Below is an example ontology (RDF/XML) containing the above axioms, 
which turns out to be in OWL/Lite (checked with Wonderweb validator).

Best regards,
Michael

============ START: EXAMPLE ONTOLOGY ================

<?xml version="1.0"?>
<rdf:RDF
      xmlns="http://www.example.org/rdfbag.owl#"
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
      xmlns:owl="http://www.w3.org/2002/07/owl#"
    xml:base="http://www.example.org/rdfbag.owl">

    <owl:Ontology rdf:about="" />

    <!-- introducing container vocabulary into OWL/DL -->

    <owl:Class rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag" />

    <owl:ObjectProperty
rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#_1" />
    <owl:ObjectProperty
rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#_2" />

    <!-- special rdf:Bag, which can only contain instances of class
:Person -->

    <owl:Class rdf:about="#Person" />

    <owl:Class rdf:about="#PersonBag">
      <rdfs:subClassOf
rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag" />
      <rdfs:subClassOf>
        <owl:Restriction>
          <owl:onProperty
rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#_1"/>
          <owl:allValuesFrom rdf:resource="#Person"/>
        </owl:Restriction>
      </rdfs:subClassOf>
      <rdfs:subClassOf>
        <owl:Restriction>
          <owl:onProperty
rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#_2"/>
          <owl:allValuesFrom rdf:resource="#Person"/>
        </owl:Restriction>
      </rdfs:subClassOf>
    </owl:Class>

    <!-- example person bag -->

    <Person rdf:about="#person1" />
    <Person rdf:about="#person2" />

    <PersonBag rdf:about="#aPersonBag">
      <rdf:_1 rdf:resource="#person1" />
      <rdf:_2 rdf:resource="#person2" />
    </PersonBag>

</rdf:RDF>

========= END: EXAMPLE ONTOLOGY =============


On Apr 8, 2007, at 9:51 AM, Roberto García wrote:

> Thank you Alan for the pointers.
>
> If I have understood them well, they are about Lists in OWL. What
> about the use of custom Bags and Seqs? Is it possible to define a
> BagOfPerson whose members are restricted to instances of the class
> Person?
>
> Best,
>
>
> Roberto García
> http://rhizomik.net/~roberto
>
>
> On 01/04/07, Alan Ruttenberg <alanruttenberg@gmail.com> wrote:
>> It is possible, in OWL Full, but I don't think using OWL Full should
>> be considered to be a good practice (yes, go ahead, flame me if you
>> must).
>> If you want to do this sort of thing in OWL DL, you might have a look
>> at:
>>
>> http://protege.stanford.edu/conference/2006/submissions/slides/
>> 7.1_Drummond.pdf
>> or http://owl-workshop.man.ac.uk/acceptedLong/submission_12.pdf
>>
>> Best,
>> Alan
>>
>> On Apr 1, 2007, at 10:33 AM, Roberto García wrote:
>>
>> > Dear all,
>> >
>> > Does anyone know if it is possible, and considered a good  
>> practice, to
>> > define subclasses of Bag and Seq using OWL in order to get  
>> containers
>> > that contain a specific class of resources?
>> >
>> > For instance, is it possible to model this using a restriction  
>> on the
>> > rdfs:member property when applied to a custom subclass of Bag?
>> >
>> > Best,
>> >
>> > --
>> > Roberto García
>> > http://rhizomik.net/~roberto

Received on Tuesday, 10 April 2007 19:41:59 UTC