0

Hi All,

I want to record that some data was published on a specific data e.g.

a :published_in  "2009-01-01"^^date ;

However, sometimes I only have a period in which it was published not a specific date.

  :published_in  "P2009Y01M"^^duration .

Now in my OWL file I want to constrain :published_in to either one of these datatypes. So I want to give it a Range. The usual approach for one datatype is:

<owl:DatatypeProperty rdf:about="published_in">
  <rdfs:range rdf:resource="&xsd;date"/>
</owl:DatatypeProperty>

My first naive approach was:

<owl:DatatypeProperty rdf:about="published_in">
  <rdfs:range rdf:resource="&xsd;date"/>
  <rdfs:range rdf:resource="&xsd;duration"/>
</owl:DatatypeProperty>

This fails in pellet once data is introduced. (No literal can meet the restrictions of date and duration).

Two other approaches I tried were:

<owl:DatatypeProperty rdf:about="published_in">
<rdfs:range>
  <owl:Class>
    <rdf:Description>
      <owl:unionOf rdf:parseType="Collection">
        <rdf:type rdf:resource="&xsd;date"/>
        <rdf:type rdf:resource="&xsd;duration"/>
      </owl:unionOf>
    </rdf:Description>
  </owl:Class>
</rdfs:range>
</owl:DatatypeProperty>

This seems to work in Pellet but not in Protege (a random datatype is loaded as constraint in Protege instead of the unionOf).

The second approach I tried was

<owl:DatatypeProperty rdf:about="published_in">
<rdfs:range>
  <rdf:Description>
    <rdf:type rdf:resource="&owl;DataRange"/>
    <owl:oneOf>
      <rdf:Description>
        <rdf:type rdf:resource="&owl;List"/>
        <rdf:first rdf:datatype="&xsd;date"/>
        <rdf:rest>
          <rdf:Description>
            <rdf:type rdf:resource="&owl;List"/>
            <rdf:first rdf:datatype="&xsd;date"/>
            <rdf:rest rdf:resource="&rdf;nil">
           </rdf:Description>
         </rdf:rest>
      </rdf:Description>
    </owl:oneOf>
  </rdf:Description>
</rdfs:range>
</owl:DatatypeProperty>

This second approach does not work at all. It expects a <> empty element/literal with a datatype of either which is not at all that I want.

So in other words how do I correctly encode in OWL that :published_in is limit to the things that are a date or a duration?

flag

2 Answers

1

You might find integrity constraints useful.

link|flag
I do find it useful. The question here is not how to test/reason on the restriction but on how to encode it. – Jerven Feb 24 at 10:16
Have you looked at user defined [datatypes][w3.org/TR/swbp-xsch-datatypes/]? Also, did you try putting restrictions on the class which will use the property? You could be able to do it that way. – Michael Feb 24 at 12:21
The answer that worked well is int the second suggestion. In the end I used the class that uses the property to have the restriction. – Jerven Mar 3 at 7:59
0

You have made the same mistake that I did some time ago.
Rdfs:Range and Rdfs:Domain properties mean that the object or subject respectively has the specified type. It doesn't note a constraint on the type.

Take a look at this answer for further discussion on domain/range behaviour.

To define a value type constraint you need to a Restriction.
Check out the syntax of owl:Restriction and use it to solve your problem.

Hope it will help you!

link|flag
The restriction concept as defined here is correct. I want to say that if a literal is of the type date or duration then it could be a :published_in. And more importantly if the literal is not date or duration then it can not be a :published_in Thing. Meaning that if I write bla :published_in "123"^^int an OWL reasoner will tell me that the declared type of bla :published_in "123"^^int does not conform to the OWL definition of :published_in – Jerven Feb 24 at 10:26

Your Answer

Get an OpenID
or

Not the answer you're looking for? Browse other questions tagged or ask your own question.