Re: Urgent : Create Rule for looking a best student
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.
----- 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
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) →
it generated result if i used select in the consequent.
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
In Eclipse, I get red x for line which says //ERROR Here is the tag
associated with it
Multiple markers at
- a cannot be resolved
- Syntax error, insert ";" to complete BlockStatements
- Syntax error, insert "AssignmentOperator Expression" to complete
- 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.
> So, is there a way to create bestStudent Rule in SWRL format
> Student(?s) ....???..... -> BestStudent(?s)
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.