[protege-owl] Creating new Individuals with SWRL rules

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[protege-owl] Creating new Individuals with SWRL rules

Torben Knerr-2
Hello,

as far as I know, it is not possible to create new individuals with the SWRL rule language,
but I'd urgently need to do soething like that.

Are there rule engines, which allow the creation of new instances from within a SWRL rule,
maybe with proprietary extensions to the standard SWRL built-ins?

Second, from my understanding it is only possible to _add_ new relations between existing
individuals. Is it also possible to _remove_ a relation asserted in OWL using a SWRL rule?


Wish you a merry christmas :)
Torben



_______________________________________________
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 
Reply | Threaded
Open this post in threaded view
|

Re: [protege-owl] Creating new Individuals with SWRL rules

Martin O'Connor

The SWRL specification does not allow the creation of new individuals in
SWRL rules (at least not conveniently) but I have some custom extensions
developed that I will release in the next month or so.

Retraction, however, opens a large can of nonmontonic worms. There are
no plans to support it.

Martin

Torben Knerr wrote:

> Hello,
>
> as far as I know, it is not possible to create new individuals with
> the SWRL rule language,
> but I'd urgently need to do soething like that.
>
> Are there rule engines, which allow the creation of new instances from
> within a SWRL rule,
> maybe with proprietary extensions to the standard SWRL built-ins?
>
> Second, from my understanding it is only possible to _add_ new
> relations between existing
> individuals. Is it also possible to _remove_ a relation asserted in
> OWL using a SWRL rule?
>
>
> Wish you a merry christmas :)
> Torben
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>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 
Reply | Threaded
Open this post in threaded view
|

Re: [protege-owl] Creating new Individuals with SWRL rules

JMiller
In reply to this post by Torben Knerr-2

Torben,

We needed to do the same thing.  I used Jena rules instead of SWRL rules, and this worked for me.  

I don't know if it will work within Protege, however.

Happy New Year!

Jim Miller



"Torben Knerr" <[hidden email]>
Sent by: [hidden email]

12/23/2006 08:54 AM

Please respond to
User support for the Protege-OWL editor        <[hidden email]>

To
"User support for the Protege-OWL editor" <[hidden email]>
cc
Subject
[protege-owl] Creating new Individuals with SWRL rules





Hello,

as far as I know, it is not possible to create new individuals with the SWRL rule language,
but I'd urgently need to do soething like that.

Are there rule engines, which allow the creation of new instances from within a SWRL rule,
maybe with proprietary extensions to the standard SWRL built-ins?

Second, from my understanding it is only possible to _add_ new relations between existing
individuals. Is it also possible to _remove_ a relation asserted in OWL using a SWRL rule?


Wish you a merry christmas :)
Torben

_______________________________________________
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 
Reply | Threaded
Open this post in threaded view
|

Re: [protege-owl] Creating new Individuals with SWRL rules

Martin O'Connor

As I mentioned in a previous reply, I will soon be releasing a extension of
SWRL that will support the creation of individuals. I'll try to get it out
in a beta build in a week or two.

Martin

Quoting James A Miller <[hidden email]>:

> Torben,
>
> We needed to do the same thing.  I used Jena rules instead of SWRL rules,
> and this worked for me.
>
> I don't know if it will work within Protege, however.
>
> Happy New Year!
>
> Jim Miller
>
>
>
>
> "Torben Knerr" <[hidden email]>
> Sent by: [hidden email]
> 12/23/2006 08:54 AM
> Please respond to
> User support for the Protege-OWL editor
> <[hidden email]>
>
>
> To
> "User support for the Protege-OWL editor"
> <[hidden email]>
> cc
>
> Subject
> [protege-owl] Creating new Individuals with SWRL rules
>
>
>
>
>
>
> Hello,
>
> as far as I know, it is not possible to create new individuals with the
> SWRL rule language,
> but I'd urgently need to do soething like that.
>
> Are there rule engines, which allow the creation of new instances from
> within a SWRL rule,
> maybe with proprietary extensions to the standard SWRL built-ins?
>
> Second, from my understanding it is only possible to _add_ new relations
> between existing
> individuals. Is it also possible to _remove_ a relation asserted in OWL
> using a SWRL rule?
>
>
> Wish you a merry christmas :)
> Torben
>
> _______________________________________________
> 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 
Reply | Threaded
Open this post in threaded view
|

Re: [protege-owl] Creating new Individuals with SWRL rules

Michael Wessel-2
In reply to this post by JMiller
Am Sunday 31 December 2006 23:41 schrieb James A Miller:
> Torben,
> We needed to do the same thing.  I used Jena rules instead of SWRL
> rules, and this worked for me.

I think such rules are especially useful if you have a rule engine
which uses reasoning to compute variable bindings, as well as offers
some kind of closed world reasoning.

I am not a Jess expert, but I am curious to learn whether the
following simple inference problem could be solved / addressed with
Jess and/or SWRL rules:

Suppose you have an instance "betty" of the concept / class
"mother" (which is defined as a woman with some child). "Betty" does
not have any known children in the KB. Thus, we would like to fire a
rule to create (at least one) individual child of betty and make this
implicit knowledge explicit in the KB. This is how it would work in  
RacerPro (RacerPorter log):

1 ? (DEFINE-CONCEPT MOTHER (AND WOMAN (SOME HAS-CHILD HUMAN)))
1 > :OKAY

2 ? (INSTANCE BETTY MOTHER)
2 > :OKAY

Now, betty is a mother (as well as a woman, ...):

3 ? (RETRIEVE (?X) (?X MOTHER))
3 > (((?X BETTY)))

4 ? (RETRIEVE (?X) (?X WOMAN))
4 > (((?X BETTY)))

Okay. Due to the definition of mother, betty must have some child in
every model of this KB:

5 ? (RETRIEVE (?X) (?X (SOME HAS-CHILD TOP)))
5 > (((?X BETTY)))

... but there is no explicit individuals to represent that child:

6 ? (RETRIEVE (?X ?Y) (AND (?X WOMAN) (?X ?Y HAS-CHILD)))
6 > NIL

So "betty" is a mother which does not have a known child:

7 ? (RETRIEVE
      (?X)
      (AND (?X MOTHER) (NEG (PROJECT-TO (?X) (?X ?Y HAS-CHILD)))))
7 > (((?X BETTY)))

So, let us fire a rule which creates this implicitly present child of
betty as an explicit individual called "child-of-betty" and establish
the correct "has-child" relationship with "betty":

8 ? (FIRERULE
     (AND (?X MOTHER) (NEG (PROJECT-TO (?X) (?X ?Y HAS-CHILD))))
     ((INSTANCE (NEW-IND CHILD-OF ?X) HUMAN)
      (RELATED ?X (NEW-IND CHILD-OF ?X) HAS-CHILD)))

8 > (((INSTANCE CHILD-OF-BETTY HUMAN)
      (RELATED BETTY CHILD-OF-BETTY HAS-CHILD)))

Thus, the rule has added one new instance and one new related
statement for "child-of-betty" which is the freshly created
individual.

We can confirm with a query that betty has now a known child:

9 ? (RETRIEVE (?X ?Y) (AND (?X WOMAN) (?X ?Y HAS-CHILD)))

9 > (((?X BETTY) (?Y CHILD-OF-BETTY)))

Of course, the same mechanism works on OWL documents as well in
RacerPro.

> I don't know if it will work within Protege, however.
>
> Happy New Year!
>
> Jim Miller

Could this kind of inference problem be addressed with Jess and/or the
SWRL implementation of Protege? I am curious, please tell me.

Regards and thank you,

Michael


_______________________________________________
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 
Reply | Threaded
Open this post in threaded view
|

Re: [protege-owl] Creating new Individuals with SWRL rules

Obrst, Leo J.
What you have done by creating the (INSTANCE CHILD-OF-BETTY HUMAN)
is to create a skolem constant to substitute for the existential
quantifer SOME. This is quite legitimate. However, you will need to do
something similar, i.e., create skolem functions, for n-ary predicates
which similarly bind that existentially quantified variable.

Note that having skolems means that queries can return the knowledge
that Betty, being a mother, has a child -- but you just don't know who
he/she is. However, once a real child instance, say john, is created
for betty, you need to assert that and retract the
skolem-constant/functions.

We've done the above for our OWL/SWRL to DL+LP implementation we call
SWORIER (Semantic Web Ontologies and Rules for Interoperability with
Efficient Reasoning) as reported in:

* Samuel, Ken; Leo Obrst; Suzette Stoutenberg; Karen Fox; Adrian
Johnson; Ken Laskey; Deborah Nichols; and Jason Peterson. 2006.
Applying Prolog to Semantic Web Ontologies & Rules: Moving Toward
Description Logic Programs. ALPSWS: Applications of Logic Programming
in the Semantic Web and Semantic Web Services, Aug. 16, 2006,
International Conference on Logic Programming, pp. 112-113. Federated
Logic Conference 2006, Seattle, WA. Poster presentation and extended
abstract.
http://sunsite.informatik.rwth-aachen.de/Publications/CEUR-WS/Vol-196/a
lpsws2006-poster5.pdf.

The long version will be available soon at the MITRE site:
http://www.mitre.org/work/tech_papers/index.html

Thanks,
Leo

_____________________________________________
Dr. Leo Obrst       The MITRE Corporation, Information Semantics
[hidden email]    Center for Innovative Computing & Informatics
Voice: 703-983-6770 7515 Colshire Drive, M/S H305
Fax: 703-983-1379   McLean, VA 22102-7508, USA
 

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Michael
Wessel
Sent: Monday, January 01, 2007 4:38 AM
To: User support for the Protege-OWL editor
Subject: Re: [protege-owl] Creating new Individuals with SWRL rules

Am Sunday 31 December 2006 23:41 schrieb James A Miller:
> Torben,
> We needed to do the same thing.  I used Jena rules instead of SWRL
> rules, and this worked for me.

I think such rules are especially useful if you have a rule engine
which uses reasoning to compute variable bindings, as well as offers
some kind of closed world reasoning.

I am not a Jess expert, but I am curious to learn whether the
following simple inference problem could be solved / addressed with
Jess and/or SWRL rules:

Suppose you have an instance "betty" of the concept / class
"mother" (which is defined as a woman with some child). "Betty" does
not have any known children in the KB. Thus, we would like to fire a
rule to create (at least one) individual child of betty and make this
implicit knowledge explicit in the KB. This is how it would work in  
RacerPro (RacerPorter log):

1 ? (DEFINE-CONCEPT MOTHER (AND WOMAN (SOME HAS-CHILD HUMAN)))
1 > :OKAY

2 ? (INSTANCE BETTY MOTHER)
2 > :OKAY

Now, betty is a mother (as well as a woman, ...):

3 ? (RETRIEVE (?X) (?X MOTHER))
3 > (((?X BETTY)))

4 ? (RETRIEVE (?X) (?X WOMAN))
4 > (((?X BETTY)))

Okay. Due to the definition of mother, betty must have some child in
every model of this KB:

5 ? (RETRIEVE (?X) (?X (SOME HAS-CHILD TOP)))
5 > (((?X BETTY)))

... but there is no explicit individuals to represent that child:

6 ? (RETRIEVE (?X ?Y) (AND (?X WOMAN) (?X ?Y HAS-CHILD)))
6 > NIL

So "betty" is a mother which does not have a known child:

7 ? (RETRIEVE
      (?X)
      (AND (?X MOTHER) (NEG (PROJECT-TO (?X) (?X ?Y HAS-CHILD)))))
7 > (((?X BETTY)))

So, let us fire a rule which creates this implicitly present child of
betty as an explicit individual called "child-of-betty" and establish
the correct "has-child" relationship with "betty":

8 ? (FIRERULE
     (AND (?X MOTHER) (NEG (PROJECT-TO (?X) (?X ?Y HAS-CHILD))))
     ((INSTANCE (NEW-IND CHILD-OF ?X) HUMAN)
      (RELATED ?X (NEW-IND CHILD-OF ?X) HAS-CHILD)))

8 > (((INSTANCE CHILD-OF-BETTY HUMAN)
      (RELATED BETTY CHILD-OF-BETTY HAS-CHILD)))

Thus, the rule has added one new instance and one new related
statement for "child-of-betty" which is the freshly created
individual.

We can confirm with a query that betty has now a known child:

9 ? (RETRIEVE (?X ?Y) (AND (?X WOMAN) (?X ?Y HAS-CHILD)))

9 > (((?X BETTY) (?Y CHILD-OF-BETTY)))

Of course, the same mechanism works on OWL documents as well in
RacerPro.

> I don't know if it will work within Protege, however.
>
> Happy New Year!
>
> Jim Miller

Could this kind of inference problem be addressed with Jess and/or the
SWRL implementation of Protege? I am curious, please tell me.

Regards and thank you,

Michael


_______________________________________________
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 
Reply | Threaded
Open this post in threaded view
|

Re: [protege-owl] Creating new Individuals with SWRL rules

Michael Wessel-2
Am Monday 01 January 2007 18:16 schrieb Obrst, Leo J.:
> What you have done by creating the (INSTANCE CHILD-OF-BETTY HUMAN)
> is to create a skolem constant to substitute for the existential
> quantifer SOME.

Somehow, yes.

> This is quite legitimate. However, you will need to
> do something similar, i.e., create skolem functions, for n-ary
> predicates which similarly bind that existentially quantified
> variable.

> Note that having skolems means that queries can return the
> knowledge that Betty, being a mother, has a child -- but you just
> don't know who he/she is. However, once a real child instance, say
> john, is created for betty, you need to assert that and retract the
> skolem-constant/functions.

Why would you want to do that? You could just state that they are
equal (child-of-betty could just be another name for john; using  
owl:same-as). OWL does not employ the unique name assumption for
individuals (unless you state that "skolem constants" and "normal OWL
individuals / constants" are distinct).

Regards

Michael

_______________________________________________
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 
Reply | Threaded
Open this post in threaded view
|

Re: [protege-owl] Creating new Individuals with SWRL rules

Obrst, Leo J.
Comments below.

Thanks,
Leo
 
Am Monday 01 January 2007 18:16 schrieb Obrst, Leo J.:
> What you have done by creating the (INSTANCE CHILD-OF-BETTY HUMAN)
> is to create a skolem constant to substitute for the existential
> quantifer SOME.

Somehow, yes.

> This is quite legitimate. However, you will need to
> do something similar, i.e., create skolem functions, for n-ary
> predicates which similarly bind that existentially quantified
> variable.

> Note that having skolems means that queries can return the
> knowledge that Betty, being a mother, has a child -- but you just
> don't know who he/she is. However, once a real child instance, say
> john, is created for betty, you need to assert that and retract the
> skolem-constant/functions.

Why would you want to do that? You could just state that they are
equal (child-of-betty could just be another name for john; using  
owl:same-as). OWL does not employ the unique name assumption for
individuals (unless you state that "skolem constants" and "normal OWL
individuals / constants" are distinct).

LEO: Yes, you can do that, but you will proliferate many individuals,
some of which (the arbitrary placeholding skolems) are really overruled
by the actuals (in some sense, typically better interpreted as such
under Closed World Assumption). With the Open World Assumption,
probably that's all you can do.  And a query language may or may not
weed these out in what's returned. My guess is: it won't (since why
should it; it's an open world) and you might be subject to a whole lot
of arbitrary placeholding individuals (possibly placed there by those
who don't know you already have these kinds of things).

LEO: In our system, we try to wend our way through these issues and
tolerate distinct behaviors via pragmas, i.e., instructions to the
automated reasoning compiler/interpreter on how to interpret things
locally, as desired by the developer. The problem of course is when you
have interacting, distinct reasoners which work on parts of the same
ontology/kb and yet have distinct pragmas (possibly mutually
inconsistent pragmas). We haven't addressed that problem yet, expect
that it leads to a meta-reasoning resolution.

LEO: Yes, if you state that skolem constants and normal individual
constants are distinct, you can enforce distinct reasoning behaviors.
Even in Prolog this is the case, since really what you are doing is
"typing" the constants. Since neither OWL nor Prolog are typed
languages, you do what you must.

_______________________________________________
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 
Reply | Threaded
Open this post in threaded view
|

Re: [protege-owl] Creating new Individuals with SWRL rules

Michael Wessel-2
Am Monday 01 January 2007 22:17 schrieb Obrst, Leo J.:

> > Note that having skolems means that queries can return the
> > knowledge that Betty, being a mother, has a child -- but you just
> > don't know who he/she is. However, once a real child instance,
> > say john, is created for betty, you need to assert that and
> > retract the skolem-constant/functions.
>
> Why would you want to do that? You could just state that they are
> equal (child-of-betty could just be another name for john; using
> owl:same-as). OWL does not employ the unique name assumption for
> individuals (unless you state that "skolem constants" and "normal
> OWL individuals / constants" are distinct).
>
> LEO: Yes, you can do that, but you will proliferate many
> individuals, some of which (the arbitrary placeholding skolems) are
> really overruled by the actuals (in some sense, typically better
> interpreted as such under Closed World Assumption). With the Open
> World Assumption, probably that's all you can do.  And a query
> language may or may not weed these out in what's returned.

Yes.  

> My guess
> is: it won't (since why should it; it's an open world) and you
> might be subject to a whole lot of arbitrary placeholding
> individuals (possibly placed there by those who don't know you
> already have these kinds of things).

The current nRQL engine can be configured in such a way to

a) either consider single individuals / constants as bindings to
variables, or
b) to consider synonym equivalence classes of individuals / constants
as bindings.

Thus, returning to the example above with owl:same-as john
child-of-betty, the individual synonyms / equivalence class  
(child-of-betty john) would be considered as one (not as two) binding
possibilities for a variable, say ?x.

However, if b) is used, then only one individual from the equivalence
class is returned, and not the whole class. But having one member  
from the equivalence class enables you to ask for additional members
subsequently as well (within the same query).

> LEO: In our system, we try to wend our way through these issues and
> tolerate distinct behaviors via pragmas, i.e., instructions to the
> automated reasoning compiler/interpreter on how to interpret things
> locally, as desired by the developer. The problem of course is when
> you have interacting, distinct reasoners which work on parts of the
> same ontology/kb and yet have distinct pragmas (possibly mutually
> inconsistent pragmas). We haven't addressed that problem yet,
> expect that it leads to a meta-reasoning resolution.

I see.

Regards

Michael
_______________________________________________
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 
Reply | Threaded
Open this post in threaded view
|

Re: [protege-owl] Creating new Individuals with SWRL rules

Stephen Larson
In reply to this post by Martin O'Connor
Not to pressure you Martin, but is there a beta of this functionality ready yet?  I want to make sure I haven't missed its announcement.  This is an important development in SWRL and some of us are chomping at the bit to try it out.

Thanks,
--Stephen

On 12/31/06, Martin O'Connor <[hidden email]> wrote:

As I mentioned in a previous reply, I will soon be releasing a extension of
SWRL that will support the creation of individuals. I'll try to get it out
in a beta build in a week or two.

Martin

Quoting James A Miller <[hidden email]>:

> Torben,
>
> We needed to do the same thing.  I used Jena rules instead of SWRL rules,
> and this worked for me.
>
> I don't know if it will work within Protege, however.
>
> Happy New Year!
>
> Jim Miller
>
>
>
>
> "Torben Knerr" < [hidden email]>
> Sent by: [hidden email]
> 12/23/2006 08:54 AM
> Please respond to
> User support for the Protege-OWL editor
> <[hidden email]>
>
>
> To
> "User support for the Protege-OWL editor"
> <[hidden email]>
> cc
>
> Subject
> [protege-owl] Creating new Individuals with SWRL rules
>
>
>
>
>
>
> Hello,
>
> as far as I know, it is not possible to create new individuals with the
> SWRL rule language,
> but I'd urgently need to do soething like that.
>

> Are there rule engines, which allow the creation of new instances from
> within a SWRL rule,
> maybe with proprietary extensions to the standard SWRL built-ins?
>
> Second, from my understanding it is only possible to _add_ new relations
> between existing
> individuals. Is it also possible to _remove_ a relation asserted in OWL
> using a SWRL rule?
>
>
> Wish you a merry christmas :)
> Torben
>
> _______________________________________________
> 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


_______________________________________________
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