Urgent : Create Rule for looking a best student

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

Urgent : Create Rule for looking a best student

koharudin
I've simple ontology

Student is a class
   hasproperty hasRank

BestStudent is subclassOf Student

Here's is my rule
   Student(?s) ∧ hasRank(?s, ?rank) ˚
   sqwrl:makeSet(?set, ?rank) ˚
   sqwrl:max(?max, ?set) ∧ swrlb:equal(?rank, ?max) →
   sqwrl:select(?s)

it generated result if i used select in the consequent.

But why it didnt generate any instances ?

Student(?s) ∧ hasRank(?s, ?rank) ˚
sqwrl:makeSet(?set, ?rank) ˚
sqwrl:max(?max, ?set) ∧ swrlb:equal(?rank, ?max) →
BestStudent(?s)


Help me pliss

Reply | Threaded
Open this post in threaded view
|

Re: Urgent : Create Rule for looking a best student

Martin O'Connor

SQWRL operators are designed to be used the SQWRL query language only. They should not be used in SWRL rules. The collection operators, in particular, will violate the open world assumption adopted by OWL and SWRL (search this list for many discussions of the open world assumption). I have added a line to the wiki to clarify this.

Martin

----- Original Message -----
From: "koharudin" <[hidden email]>
To: [hidden email]
Sent: Sunday, June 12, 2011 2:00:10 AM
Subject: [protege-owl] Urgent : Create Rule for looking a best student

I've simple ontology

Student is a class
   hasproperty hasRank

BestStudent is subclassOf Student

Here's is my rule
   Student(?s) ∧ hasRank(?s, ?rank) ˚
   sqwrl:makeSet(?set, ?rank) ˚
   sqwrl:max(?max, ?set) ∧ swrlb:equal(?rank, ?max) →
   sqwrl:select(?s)

it generated result if i used select in the consequent.

But why it didnt generate any instances ?

Student(?s) ∧ hasRank(?s, ?rank) ˚
sqwrl:makeSet(?set, ?rank) ˚
sqwrl:max(?max, ?set) ∧ swrlb:equal(?rank, ?max) →
BestStudent(?s)


Help me pliss



--
View this message in context: http://protege-ontology-editor-knowledge-acquisition-system.136.n4.nabble.com/Urgent-Create-Rule-for-looking-a-best-student-tp3591640p3591640.html
Sent from the Protege OWL mailing list archive at Nabble.com.
_______________________________________________
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: Urgent : Create Rule for looking a best student

koharudin
So, is there a way to create bestStudent Rule in SWRL format

Student(?s) ....???..... -> BestStudent(?s)
Reply | Threaded
Open this post in threaded view
|

Casting an individual into a subclass

Girish Joglekar
I have a property p whose range is a class consisting of two levels of subclasses, sclev1, sclev2. I create instances of the lowest level subclasses, sclev2, and specify them as required when creating an instance of a class with property p. Here is the snippet of my code to identify the class of an individual specified in the collection for a property propertyValueSource..

            if(dpc.hasPropertyValueSource()) {
                jIter = dpc.getPropertyValueSource().iterator();
                if(jIter.hasNext()) {
                    OWLIndividual oi = (OWLIndividual) jIter.next();
                    if(oi.canAs(DPCap1Expt.class)){
                        (DPCap1Expt) a = (DPCap1Expt) oi.as(DPCap1Expt.class); //ERROR
                        System.out.println("is DPCap1Expt class!!");
                    }
                }
            }

In Eclipse, I get red x for line which says //ERROR Here is the tag associated with it

Multiple markers at this line
    - a cannot be resolved
    - Syntax error, insert ";" to complete BlockStatements
    - Syntax error, insert "AssignmentOperator Expression" to complete Assignment
    - DPCap1Expt cannot be resolved


How do I cast an individual to its correct class, so that I can then get to its properties? Even after canAs is true, I cannot seem to cast it as shown. Please help.

Thanks much.
Girish

_______________________________________________
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: Casting an individual into a subclass

koharudin
DPCap1Expt a = (DPCap1Expt) oi.as(DPCap1Expt.class); //Changes
Reply | Threaded
Open this post in threaded view
|

Re: Urgent : Create Rule for looking a best student

Martin O'Connor
In reply to this post by koharudin

No. cf. http://protege.cim3.net/cgi-bin/wiki.pl?SWRLLanguageFAQ#nid9KT

Martin

On 6/13/2011 6:47 AM, koharudin wrote:

> So, is there a way to create bestStudent Rule in SWRL format
>
> Student(?s) ....???..... ->  BestStudent(?s)
>
> --
> View this message in context: http://protege-ontology-editor-knowledge-acquisition-system.136.n4.nabble.com/Urgent-Create-Rule-for-looking-a-best-student-tp3591640p3593879.html
> Sent from the Protege OWL mailing list archive at Nabble.com.
> _______________________________________________
> 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: Urgent : Create Rule for looking a best student

Thomas Russ
In reply to this post by koharudin

On Jun 13, 2011, at 6:47 AM, koharudin wrote:

> So, is there a way to create bestStudent Rule in SWRL format
>
> Student(?s) ....???..... -> BestStudent(?s)

No.

Maintaining open world semantics prevents this.

I can't think of a closure axiom that would allow this under SWRL, since I'm not sure if the SWRL interpreter uses any such axioms.  But there isn't, as far as I know, any syntax that would let you get the maximum outside of a query.

So that leaves you with the need to write some external code to compute this, probably in Java.  There isn't any way to define this inside the OWL/SWRL language.


_______________________________________________
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