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"/>

My first naive approach was:

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

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">
      <owl:unionOf rdf:parseType="Collection">
        <rdf:type rdf:resource="&xsd;date"/>
        <rdf:type rdf:resource="&xsd;duration"/>

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">
    <rdf:type rdf:resource="&owl;DataRange"/>
        <rdf:type rdf:resource="&owl;List"/>
        <rdf:first rdf:datatype="&xsd;date"/>
            <rdf:type rdf:resource="&owl;List"/>
            <rdf:first rdf:datatype="&xsd;date"/>
            <rdf:rest rdf:resource="&rdf;nil">

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?

asked 22 Feb '10, 15:45

Jerven's gravatar image

Jerven ♦
accept rate: 35%

edited 24 Feb '10, 10:15

You might find integrity constraints useful.

permanent link

answered 23 Feb '10, 15:28

mhgrove's gravatar image

accept rate: 29%

I do find it useful. The question here is not how to test/reason on the restriction but on how to encode it.

(24 Feb '10, 10:16) Jerven ♦ Jerven's gravatar image

Have you looked at user defined [datatypes][http://www.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.

(24 Feb '10, 12:21) mhgrove mhgrove's gravatar image

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.

(03 Mar '10, 07:59) Jerven ♦ Jerven's gravatar image

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!

permanent link

answered 23 Feb '10, 12:03

ViktorZ's gravatar image

accept rate: 0%


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

(24 Feb '10, 10:26) Jerven ♦ Jerven's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 22 Feb '10, 15:45

question was seen: 3,054 times

last updated: 24 Feb '10, 10:15