Newbie playing with events in protege 4.0

7 messages Options
Embed this post
Permalink
Martin Baldan

Newbie playing with events in protege 4.0

Reply Threaded More More options
Print post
Permalink
Hello!

I hope this is the right list for my question. I'm a newbie to Protégé, and in order to get a hang of it, I'm trying to write an ontology of items in my home, places where they are stored and which of them were lent to me by other people, by whom and when.  I want to have record of "lending episodes" (I guess "events" is also okay) which begin when something is lent to someone and end when this thing is returned.  So, my classes look something like this:

Thing
   Furniture
   Item
   Episode
      LendingEpisode
  Person

There are also object properties:

contains :: Furniture -> Item
(Inverse: is_in)

hasBorrower ::  LendingEpisode -> Person
(Inverse: isBorrowerOf)

hasLender :: LendingEpisode -> Person
(Inverse: isLenderOf)

hasLentItem :: LendingEpisode -> Item
(Inverse: isLentItemOf)

And then there are datatype properties, or range "date":

hasBeginningBefore:: Episode->date
      hasEndBefore:: Episode->date
hasBeginningAfter:: Episode->date
     hasEndAfter:: Episode->date

I made hasEndBefore a subproperty of hasBeginningBefore because if something ends before a given date, it must have begun before that date as well. The same applies to hasEndAfter and hasBeginningAfter.

Then I define two peple, an item and a lending episode:

person_1
person_2
item_1
lendingEp_1

And some axioms:

lendingEp_1 hasLender person_1
lendingEp_1 hasBorrower person_2
lendingEp_1 hasLentItem item_1
lendingEp_1 hasBeginningAfter  "2009-05-01"^^date
lendingEp_1 hasBeginningBefore  "2009-06-01"^^date
lendingEp_1 hasEndAfter  "2009-07-01"^^date

That is, person_1 lent item_1 to person_2 ; the lending began some date between (excluding) "2009-05-01"^^date and "2009-06-01"^^date, and it is known that item_1 was not returned as of "2009-07-01"^^date. Nothing is stated about its hasEndBefore property. Those lending episodes which have a hasEndBefore property are known to have ended (let's assume no speculation about future ending dates is allowed, only description of known facts) Now I'd like to query this ontology to find out which lending episodes are NOT known to have ended as of today. The problem is that I think I'm bumping into the Open World Assumption. For instance, if I ask (in manchester-owl syntax, in the "DL Query" tab):

not (has_end_before some  date)

No instances are returned. I guess that's because no axioms states  or implies that "not (lendingEp_1  hasEndBefore some date)".


My next idea was to introduce a new property assertion to lendingEp_1 so that:

lendingEp_1 hasEndBefore only date [  >= "2009-07-02"^^date ]

That is, that it can only end strictly before a date equal or greater than tomorrow, in other words, it the soonest it can end is today. Then I could enter the query:

hasEndBefore only date [  >= "2009-07-01"^^date ]

Here I'm asking for lending episodes which only end before dates which are greater or equal than today. Since any date which fullfills the condition [  >= "2009-07-02"^^date ] also fullfills [  >= "2009-07-01"^^date ],  the query should return (at least) lendingEp_1.

This seemed very promising, but alas, I see no way in Protege 4.0 to introduce the "lendingEp_1 hasEndBefore only date [  >= "2009-07-02"^^date ]" assertion.  The data property assertion dialog only lets me write a value, like "2009-07-01" and pick its type (date).

So I'm kind of stuck :/

What I'm misssing? Should I be using Protege 3? Is the Manchester OWL syntax query not powerful enough? Should I be using the SWRLTemporalOntology instead of my little example?
All kinds of tips and guidance are welcome. Thanks in advance.

Regards,

     Martin OB

 



_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 
Thomas Russ

Re: Newbie playing with events in protege 4.0

Reply Threaded More More options
Print post
Permalink
The quick summary is that open world semantics are causing your problem.

This affects the NOT operator as well as the ONLY operator.

So, for example, your constraint:

   hasEndBefore only date [  >= "2009-07-01"^^date ]

may not be satisfied because there could be another, unknown to the  
system, hasEndBefore value that doesn't meet this constraint.


On Jul 1, 2009, at 10:55 AM, Martin Baldan wrote:

> Hello!
>
> I hope this is the right list for my question. I'm a newbie to  
> Protégé, and in order to get a hang of it, I'm trying to write an  
> ontology of items in my home, places where they are stored and which  
> of them were lent to me by other people, by whom and when.  I want  
> to have record of "lending episodes" (I guess "events" is also okay)  
> which begin when something is lent to someone and end when this  
> thing is returned.  So, my classes look something like this:
>
> Thing
>    Furniture
>    Item
>    Episode
>       LendingEpisode
>   Person
>
> There are also object properties:
>
> contains :: Furniture -> Item
> (Inverse: is_in)
>
> hasBorrower ::  LendingEpisode -> Person
> (Inverse: isBorrowerOf)
>
> hasLender :: LendingEpisode -> Person
> (Inverse: isLenderOf)
>
> hasLentItem :: LendingEpisode -> Item
> (Inverse: isLentItemOf)
>
> And then there are datatype properties, or range "date":
>
> hasBeginningBefore:: Episode->date
>       hasEndBefore:: Episode->date
> hasBeginningAfter:: Episode->date
>      hasEndAfter:: Episode->date
>
> I made hasEndBefore a subproperty of hasBeginningBefore because if  
> something ends before a given date, it must have begun before that  
> date as well. The same applies to hasEndAfter and hasBeginningAfter.
>
> Then I define two peple, an item and a lending episode:
>
> person_1
> person_2
> item_1
> lendingEp_1
>
> And some axioms:
>
> lendingEp_1 hasLender person_1
> lendingEp_1 hasBorrower person_2
> lendingEp_1 hasLentItem item_1
> lendingEp_1 hasBeginningAfter  "2009-05-01"^^date
> lendingEp_1 hasBeginningBefore  "2009-06-01"^^date
> lendingEp_1 hasEndAfter  "2009-07-01"^^date
>
> That is, person_1 lent item_1 to person_2 ; the lending began some  
> date between (excluding) "2009-05-01"^^date and "2009-06-01"^^date,  
> and it is known that item_1 was not returned as of  
> "2009-07-01"^^date. Nothing is stated about its hasEndBefore  
> property. Those lending episodes which have a hasEndBefore property  
> are known to have ended (let's assume no speculation about future  
> ending dates is allowed, only description of known facts) Now I'd  
> like to query this ontology to find out which lending episodes are  
> NOT known to have ended as of today. The problem is that I think I'm  
> bumping into the Open World Assumption. For instance, if I ask (in  
> manchester-owl syntax, in the "DL Query" tab):
>
> not (has_end_before some  date)
>
> No instances are returned. I guess that's because no axioms states  
> or implies that "not (lendingEp_1  hasEndBefore some date)".
>
>
> My next idea was to introduce a new property assertion to  
> lendingEp_1 so that:
>
> lendingEp_1 hasEndBefore only date [  >= "2009-07-02"^^date ]
>
> That is, that it can only end strictly before a date equal or  
> greater than tomorrow, in other words, it the soonest it can end is  
> today. Then I could enter the query:
>
> hasEndBefore only date [  >= "2009-07-01"^^date ]
>
> Here I'm asking for lending episodes which only end before dates  
> which are greater or equal than today. Since any date which  
> fullfills the condition [  >= "2009-07-02"^^date ] also fullfills  
> [  >= "2009-07-01"^^date ],  the query should return (at least)  
> lendingEp_1.
>
> This seemed very promising, but alas, I see no way in Protege 4.0 to  
> introduce the "lendingEp_1 hasEndBefore only date [  >=  
> "2009-07-02"^^date ]" assertion.  The data property assertion dialog  
> only lets me write a value, like "2009-07-01" and pick its type  
> (date).
>
> So I'm kind of stuck :/
>
> What I'm misssing? Should I be using Protege 3? Is the Manchester  
> OWL syntax query not powerful enough? Should I be using the  
> SWRLTemporalOntology instead of my little example?
> All kinds of tips and guidance are welcome. Thanks in advance.
>
> Regards,
>
>      Martin OB
>
>
>
>
> _______________________________________________
> protege-owl mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03

_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 
Martin Baldan

Re: Newbie playing with events in protege 4.0

Reply Threaded More More options
Print post
Permalink
Thanks for your fast reply :)



On Wed, Jul 1, 2009 at 8:39 PM, Thomas Russ <[hidden email]> wrote:
The quick summary is that open world semantics are causing your problem.

This affects the NOT operator as well as the ONLY operator.

So, for example, your constraint:

  hasEndBefore only date [  >= "2009-07-01"^^date ]

may not be satisfied because there could be another, unknown to the
system, hasEndBefore value that doesn't meet this constraint.


But what if I could add to the ontology (notice, not to the query), as I described, a new property assertion about lendingEp_1, of the form:

lendingEp_1 hasEndBefore only date [  >= "2009-07-02"^^date ]

Assuming it is indeed possible to add such an assertion (I can't find out how to do it in Protege 4.0, as I said), wouldn't it be now guaranteed that every further hasEndBefore data property assertion to be added to lendingEp_1  must have a value that meets the constraint of the ontology   [  >= "2009-07-02"^^date ] and, therefore, must meet the constraint of the query [  >= "2009-07-01"^^date ]?  In other words, wouldn't it now be guaranteed that whatever further assertions are added to the individual lendingEp_1,  this individual will satisfy the constraint of the query?

Again, it may well be that what I'm asking for (the ability to add to an individual a data property assertion of the form "only" instead of the form "value" ) is just not possible and there's a much better way to do what I'm trying to do.

Regards,

_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 
Martin Baldan

Re: Newbie playing with events in protege 4.0

Reply Threaded More More options
Print post
Permalink
Hmm, never mind. I'm still curious to know whether it's possible to do introduce the kind of data property assertions I had in mind, but I see it won't reallly solve my problem. So I guess I need a query language other than the default Manchester OWL DL Query, so that I can do as follows:

1) Query: LendingEpisode

Retrieve all the individuals of the class LendingEpisode.

2)Query: LendingEpisode and hasEndBefore some date

 Retrieve all the individuals of the class LendingEpisode which have a hasEndBefore property assertion.

3) Substract the second group from the first group in the query results, to obtain the lending episodes which are not known to have ended.

Then maybe what I need is either SPARQL or SQWRL. Is that correct? If so, does that mean that I should switch to Protege 3.x , or is it possible to use them in Protege 4.0?

Regards,

On Wed, Jul 1, 2009 at 9:45 PM, Martin Baldan <[hidden email]> wrote:
Thanks for your fast reply :)




On Wed, Jul 1, 2009 at 8:39 PM, Thomas Russ <[hidden email]> wrote:
The quick summary is that open world semantics are causing your problem.

This affects the NOT operator as well as the ONLY operator.

So, for example, your constraint:

  hasEndBefore only date [  >= "2009-07-01"^^date ]

may not be satisfied because there could be another, unknown to the
system, hasEndBefore value that doesn't meet this constraint.


But what if I could add to the ontology (notice, not to the query), as I described, a new property assertion about lendingEp_1, of the form:


lendingEp_1 hasEndBefore only date [  >= "2009-07-02"^^date ]

Assuming it is indeed possible to add such an assertion (I can't find out how to do it in Protege 4.0, as I said), wouldn't it be now guaranteed that every further hasEndBefore data property assertion to be added to lendingEp_1  must have a value that meets the constraint of the ontology   [  >= "2009-07-02"^^date ] and, therefore, must meet the constraint of the query [  >= "2009-07-01"^^date ]?  In other words, wouldn't it now be guaranteed that whatever further assertions are added to the individual lendingEp_1,  this individual will satisfy the constraint of the query?

Again, it may well be that what I'm asking for (the ability to add to an individual a data property assertion of the form "only" instead of the form "value" ) is just not possible and there's a much better way to do what I'm trying to do.

Regards,


_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 
Martin Baldan

Re: Newbie playing with events in protege 4.0

Reply Threaded More More options
Print post
Permalink
Ok, so now I'm using Protégé 3.4.1, which has SPARQL support. My SPARQL query looks like this:

##

 PREFIX abc: <http://www.semanticweb.org/ontologies/2009/5/Ontology1245869510946_trial.owl#>

SELECT DISTINCT   ?lending ?bbdate  ?badate ?ebdate
WHERE
{
{
 ?lending abc:has_beginning_before ?bbdate
OPTIONAL {?lending  abc:has_beginning_after     ?badate}
OPTIONAL {?lending abc:has_end_before ?ebdate}
 }
UNION
{
?lending  abc:has_beginning_after     ?badate
OPTIONAL { ?lending abc:has_beginning_before ?bbdate}
OPTIONAL {?lending abc:has_end_before ?ebdate}
}
 FILTER ( !bound (?ebdate) )
}
ORDER BY (?lending)

##

The only problem is that, if an event has several properties of a type (say, it has has_beginning_after properties for several dates) then the query will return some repeated results. The "SELECT DISTINCT" only eliminates identical rows. So, I thought I could order each one of the two members of the UNION independently, and then delete the ones with redundant dates. For instance, if "lending-ep-1 has_beginning_after "2009-12-31"^^date " then it is redundant to say "lending-ep-1 has_beginning_after "2008-12-31"^^date"  , and so on. I want to allow those redundant statements in the ontology, but I want to wipe them from the query, so that only the has_beginning_after statement with the highest date, and the has_beginning_before statement with the lowest date, are preserved .

So, I wanted to do something like:

### (wrong code ahead)

 PREFIX abc: <http://www.semanticweb.org/ontologies/2009/5/Ontology1245869510946_trial.owl#>

SELECT DISTINCT   ?lending ?bbdate  ?badate ?ebdate
WHERE
{
{
 ?lending abc:has_beginning_before ?bbdate
OPTIONAL {?lending  abc:has_beginning_after     ?badate}
OPTIONAL {?lending abc:has_end_before ?ebdate}
ORDER BY (?bbdate) LIMIT 1
 }

UNION
{
?lending  abc:has_beginning_after     ?badate
OPTIONAL { ?lending abc:has_beginning_before ?bbdate}
OPTIONAL {?lending abc:has_end_before ?ebdate}
ORDER BY DESC (?badate) LIMIT 1
}
ORDER BY DESC (?badate) LIMIT 1
 FILTER ( !bound (?ebdate) )
}
ORDER BY (?lending)


###

My doubt now is what's the right way to do it, if it's possible at all in the Protégé SPARQL implementation. I also thought a sub-query might be the way, but either I'm doing it wrong or sub-queries are not supported.
All help appreciated!

Regards,



_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 
Martin O'Connor

Re: Newbie playing with events in protege 4.0

Reply Threaded More More options
Print post
Permalink
In reply to this post by Martin Baldan
SQWRL is only available in 3.4. We plan to port it to 4 by the end of
the year.

Martin

Martin Baldan wrote:

> Hmm, never mind. I'm still curious to know whether it's possible to do
> introduce the kind of data property assertions I had in mind, but I
> see it won't reallly solve my problem. So I guess I need a query
> language other than the default Manchester OWL DL Query, so that I can
> do as follows:
>
> 1) Query: LendingEpisode
>
> Retrieve all the individuals of the class LendingEpisode.
>
> 2)Query: LendingEpisode and hasEndBefore some date
>
>  Retrieve all the individuals of the class LendingEpisode which have a
> hasEndBefore property assertion.
>
> 3) Substract the second group from the first group in the query
> results, to obtain the lending episodes which are not known to have ended.
>
> Then maybe what I need is either SPARQL or SQWRL. Is that correct? If
> so, does that mean that I should switch to Protege 3.x , or is it
> possible to use them in Protege 4.0?
>
> Regards,
>
> On Wed, Jul 1, 2009 at 9:45 PM, Martin Baldan <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Thanks for your fast reply :)
>
>
>
>
>     On Wed, Jul 1, 2009 at 8:39 PM, Thomas Russ <[hidden email]
>     <mailto:[hidden email]>> wrote:
>
>         The quick summary is that open world semantics are causing
>         your problem.
>
>         This affects the NOT operator as well as the ONLY operator.
>
>         So, for example, your constraint:
>
>           hasEndBefore only date [  >= "2009-07-01"^^date ]
>
>         may not be satisfied because there could be another, unknown
>         to the
>         system, hasEndBefore value that doesn't meet this constraint.
>
>
>     But what if I could add to the ontology (notice, not to the
>     query), as I described, a new property assertion about
>     lendingEp_1, of the form:
>
>
>     lendingEp_1 hasEndBefore only date [  >= "2009-07-02"^^date ]
>
>     Assuming it is indeed possible to add such an assertion (I can't
>     find out how to do it in Protege 4.0, as I said), wouldn't it be
>     now guaranteed that every further hasEndBefore data property
>     assertion to be added to lendingEp_1  must have a value that meets
>     the constraint of the ontology   [  >= "2009-07-02"^^date ] and,
>     therefore, must meet the constraint of the query [  >=
>     "2009-07-01"^^date ]?  In other words, wouldn't it now be
>     guaranteed that whatever further assertions are added to the
>     individual lendingEp_1,  this individual will satisfy the
>     constraint of the query?
>
>     Again, it may well be that what I'm asking for (the ability to add
>     to an individual a data property assertion of the form "only"
>     instead of the form "value" ) is just not possible and there's a
>     much better way to do what I'm trying to do.
>
>     Regards,
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> protege-owl mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 
>  

_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 
Martin Baldan

Re: Newbie playing with events in protege 4.0

Reply Threaded More More options
Print post
Permalink
Ok, thanks for the information. Protege 4 is shaping up nicely :)

On Mon, Jul 6, 2009 at 11:18 PM, Martin O'Connor <[hidden email]> wrote:
SQWRL is only available in 3.4. We plan to port it to 4 by the end of
the year.



_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03