how to express n3logic rules in protegé

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

how to express n3logic rules in protegé

Yoandy Rodriguez
Hello:

I'm currently learning about semantic web technologies and using protegé
as a tool and try to model different things. Recently I read an article
about writing rules in ontologies so I tried to make my own example.
Thing is the article used N3Logic and cwm for every example and I don-t
know how to do the same thing in Protegé.
Can anyone point me in the right direction?

Thanks in advance and excuse my poor English.

PD.
What I want is to be able to do something like this.

{?S brother: ?R.
 ?R father: ?R2.
} => {?S uncle: ?R2.}





_______________________________________________
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: how to express n3logic rules in protegé

Thomas Russ

On Mar 1, 2011, at 6:19 PM, Yoandy Rodriguez wrote:

> Hello:
>
> I'm currently learning about semantic web technologies and using  
> protegé
> as a tool and try to model different things. Recently I read an  
> article
> about writing rules in ontologies so I tried to make my own example.
> Thing is the article used N3Logic and cwm for every example and I  
> don-t
> know how to do the same thing in Protegé.
> Can anyone point me in the right direction?
>
> Thanks in advance and excuse my poor English.
>
> PD.
> What I want is to be able to do something like this.
>
> {?S brother: ?R.
> ?R father: ?R2.
> } => {?S uncle: ?R2.}

In OWL 2 (Protégé 4.1) you could do this particular example by making  
uncle be a subset of a role chain.

Your other option would be to encode this using SWRL rules.

OWL does not have a general purpose rule language, so not every  
formula that you could express in N3Logic can be expressed in OWL.  I  
think N3Logic is also more expressive than SWRL, but I am not 100% sure.


_______________________________________________
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: how to express n3logic rules in protegé

Hayden Wimmer
SWRL


On 3/2/2011 11:56 AM, Thomas Russ wrote:

>
> On Mar 1, 2011, at 6:19 PM, Yoandy Rodriguez wrote:
>
>> Hello:
>>
>> I'm currently learning about semantic web technologies and using protegé
>> as a tool and try to model different things. Recently I read an article
>> about writing rules in ontologies so I tried to make my own example.
>> Thing is the article used N3Logic and cwm for every example and I don-t
>> know how to do the same thing in Protegé.
>> Can anyone point me in the right direction?
>>
>> Thanks in advance and excuse my poor English.
>>
>> PD.
>> What I want is to be able to do something like this.
>>
>> {?S brother: ?R.
>> ?R father: ?R2.
>> } => {?S uncle: ?R2.}
>
> In OWL 2 (Protégé 4.1) you could do this particular example by making
> uncle be a subset of a role chain.
>
> Your other option would be to encode this using SWRL rules.
>
> OWL does not have a general purpose rule language, so not every
> formula that you could express in N3Logic can be expressed in OWL.  I
> think N3Logic is also more expressive than SWRL, but I am not 100% sure.
>
>
> _______________________________________________
> 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
|

what am i doing wrong

Girish Joglekar
I have an ontology with a class RCModel, which has one instance BaseRCMatlab. I generate Java code using Code/Generate Protege-OWL Java code option of Protege 3.4.4. A code snippet is given below:

        MyModelDefFactory mf = new MyModelDefFactory(m);
//1
        Iterator iIter = m.getOWLIndividuals().iterator();
        while(iIter.hasNext()) {
            OWLIndividual oi = (OWLIndividual) iIter.next();
            s = oi.getName();
            if(s.contains("BaseRCMatlab")) {
                System.out.println("   Individuals class: "+oi.getRDFType().getLocalName());
            }
        }
//2
        if(mf.getAllRCModelInstances().isEmpty())
            System.out.println(" No instance created of RCModel");

where m is a JenaOWLModel created by reading an ontology owl file. In snippet //1, when I iterate over all OWLIndividuals of m and match the individual's name and print its class I get RCModel. This is class under which that individual was created in the ontology. But in snippet //2 when I check if the class RCModel has any instances, I get a null pointer exception. Of course, I would prefer snippet //2, which, if it worked correctly, will iterate over individuals of a specific class.

Please let me know if you need additional information.
Thanks in advance.

Girish Joglekar

_______________________________________________
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: how to express n3logic rules in protegé

Yoandy Rodriguez
In reply to this post by Hayden Wimmer
Problem partially solved, I've read the SWRL Submission[1] and SWRL
Language FAQ[2]. Thanks to Thomas and Hayden for their answers.
Nevertheless it seams the SWRL or Protege rules editor would not allow
me to do something like
?Ind a ?Class,
?Class a ?Superclass
which in the other hand is perfectly valid in N3Logic. I will try to
find a workaround for this issue and post it to the list.

Links:
[1] http://www.w3.org/Submission/SWRL/
[2] http://protege.cim3.net/cgi-bin/wiki.pl?SWRLLanguageFAQ
 
El mié, 02-03-2011 a las 14:13 -0500, Hayden Wimmer escribió:

> SWRL
>
>
> On 3/2/2011 11:56 AM, Thomas Russ wrote:
> >
> > On Mar 1, 2011, at 6:19 PM, Yoandy Rodriguez wrote:
> >
> >> Hello:
> >>
> >> I'm currently learning about semantic web technologies and using protegé
> >> as a tool and try to model different things. Recently I read an article
> >> about writing rules in ontologies so I tried to make my own example.
> >> Thing is the article used N3Logic and cwm for every example and I don-t
> >> know how to do the same thing in Protegé.
> >> Can anyone point me in the right direction?
> >>
> >> Thanks in advance and excuse my poor English.
> >>
> >> PD.
> >> What I want is to be able to do something like this.
> >>
> >> {?S brother: ?R.
> >> ?R father: ?R2.
> >> } => {?S uncle: ?R2.}
> >
> > In OWL 2 (Protégé 4.1) you could do this particular example by making
> > uncle be a subset of a role chain.
> >
> > Your other option would be to encode this using SWRL rules.
> >
> > OWL does not have a general purpose rule language, so not every
> > formula that you could express in N3Logic can be expressed in OWL.  I
> > think N3Logic is also more expressive than SWRL, but I am not 100% sure.
> >
> >
> > _______________________________________________
> > 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
Reply | Threaded
Open this post in threaded view
|

Re: how to express n3logic rules in protegé

Thomas Russ

On Mar 2, 2011, at 4:57 PM, Yoandy Rodriguez wrote:

> Problem partially solved, I've read the SWRL Submission[1] and SWRL
> Language FAQ[2]. Thanks to Thomas and Hayden for their answers.
> Nevertheless it seams the SWRL or Protege rules editor would not allow
> me to do something like
> ?Ind a ?Class,
> ?Class a ?Superclass
> which in the other hand is perfectly valid in N3Logic. I will try to
> find a workaround for this issue and post it to the list.

OK, I'm not up on N3Logic, so I'm not completely sure what the snippet  
above is supposed to mean.

It seems to me, naively, that you are looking for individuals that  
belong to a particular ?Superclass.  You should be able to ask that  
directly of an OWL model or OWL reasoner and get the answer.  Or is  
this form trying to specify something different?

I will note that OWL distinguishes between instance-of and subclass-of  
relations, although some other formalisms unify them into a single  
"isa" relation.


_______________________________________________
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: how to express n3logic rules in protegé

Yoandy Rodriguez
El mié, 02-03-2011 a las 17:33 -0800, Thomas Russ escribió:

> On Mar 2, 2011, at 4:57 PM, Yoandy Rodriguez wrote:
>
> > Problem partially solved, I've read the SWRL Submission[1] and SWRL
> > Language FAQ[2]. Thanks to Thomas and Hayden for their answers.
> > Nevertheless it seams the SWRL or Protege rules editor would not allow
> > me to do something like
> > ?Ind a ?Class,
> > ?Class a ?Superclass
> > which in the other hand is perfectly valid in N3Logic. I will try to
> > find a workaround for this issue and post it to the list.
>
> OK, I'm not up on N3Logic, so I'm not completely sure what the snippet  
> above is supposed to mean.
>
> It seems to me, naively, that you are looking for individuals that  
> belong to a particular ?Superclass.  You should be able to ask that  
> directly of an OWL model or OWL reasoner and get the answer.  Or is  
> this form trying to specify something different?
>
> I will note that OWL distinguishes between instance-of and subclass-of  
> relations, although some other formalisms unify them into a single  
> "isa" relation.
>
Exactly, that rule looks for individuals that belongs to a
particular ?Superclass but after that I can do something like
?Ind ancester: ?Superclass
which seems rather difficult to do using only SWRL. Is there something
like a OWL-beginners list where I can ask this questions?

_______________________________________________
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: how to express n3logic rules in protegé

Martin O'Connor
The SWRLTab has ABox [1] and TBox [2] built-in libraries, which may allow you do to what you are requesting here.
Obviously, the use of such built-ins in rules may make then semantically unsound - but they can be safely used for
querying in SWQRL.

Martin

[1] http://protege.cim3.net/cgi-bin/wiki.pl?SWRLTBoxBuiltIns
[2] http://protege.cim3.net/cgi-bin/wiki.pl?SWRLABoxBuiltIns

On 3/3/2011 7:27 AM, Yoandy Rodriguez wrote:

> El mié, 02-03-2011 a las 17:33 -0800, Thomas Russ escribió:
>> On Mar 2, 2011, at 4:57 PM, Yoandy Rodriguez wrote:
>>
>>> Problem partially solved, I've read the SWRL Submission[1] and SWRL
>>> Language FAQ[2]. Thanks to Thomas and Hayden for their answers.
>>> Nevertheless it seams the SWRL or Protege rules editor would not allow
>>> me to do something like
>>> ?Ind a ?Class,
>>> ?Class a ?Superclass
>>> which in the other hand is perfectly valid in N3Logic. I will try to
>>> find a workaround for this issue and post it to the list.
>> OK, I'm not up on N3Logic, so I'm not completely sure what the snippet
>> above is supposed to mean.
>>
>> It seems to me, naively, that you are looking for individuals that
>> belong to a particular ?Superclass.  You should be able to ask that
>> directly of an OWL model or OWL reasoner and get the answer.  Or is
>> this form trying to specify something different?
>>
>> I will note that OWL distinguishes between instance-of and subclass-of
>> relations, although some other formalisms unify them into a single
>> "isa" relation.
>>
> Exactly, that rule looks for individuals that belongs to a
> particular ?Superclass but after that I can do something like
> ?Ind ancester: ?Superclass
> which seems rather difficult to do using only SWRL. Is there something
> like a OWL-beginners list where I can ask this questions?
>
> _______________________________________________
> 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