Hi Rob,
On 04/01/17 14:05, Rob Vesse wrote:
Most likely not
You seem to be running into the XY problem a lot (http://xyproblem.info)
You keep asking how to do things with rules for which rules are not really
designed. And from some of your responses it sounds like the problems you’re
trying to solve don’t actually need rules at all.
Agreed, though these seem to be class assignments so they could easily
take the form of "do X using rules" rather than "find a sensible way to
do X", depending on what the aim of the class is.
For example finding the top score for a student would be much more easily done
with a SPARQL query although from what little I have seen of your data model it
looks like it would make it even that quite awkward. But in general terms
something like the following would work:
PREFIX ex: <http://example.com/ns/>
SELECT ?student (MAX(?score) AS ?topScore)
WHERE
{
?student ex:score ?score .
}
GROUP BY ?student
The goal as originally expressed (which may or may not be the real
goal!) was to find which subject has max score, not the max score
itself. Perfectly possible in SPARQL and probably still simpler than
using rules.
Dave
Rob
On 04/01/2017 13:25, "javed khan" <[email protected]> wrote:
Thanks Dave and Lorenz for your response.
What if we have entered the score for a student in Cryptography and
SoftwareEngineering and did not entered for Networking subject and stored
something like this in our owl file:
Student1
Name: Bob
CryptographyScore: 60
SoftwareEngineeringScore: 80
//NetworkingScore, not mentioned here
Then will the above rule fires?
On Wed, Jan 4, 2017 at 11:35 AM, Lorenz B. <
[email protected]> wrote:
> Inline comments:
> > I have three subjects marks for a student.
> > Cryptography, Networking, Software Engineering with different marks for
> > each student.
> > I want to calculate in which subject a student got maximum marks using
> Jena
> > rule and will set that subject as HighScoreSubject of the student (
> > HighScoreSubject is data propety) whose values will be one of these
three
> > subjects.
> >
> > Is this rule correct to get the required result ( I am asking this
> because
> > I am not getting the result required)
> Without seeing the data, it's always difficult to say if something is
> correct or not. Sample data makes things easier.
> And without knowing how you apply the rules (in a correct syntax) it's
> even harder. That means, it's always good to show the relevant code.
> >
> > ?x rdf:type std:Student + ?x std:CryptographyScore ?score1 + ?x
> > std:NetworkingScore ?score2 + ?x std:SEScore ?score3 +
> > greaterThan(?score1,?score2), greaterThan(?score1, ?score3) -->
> > ?x std:HighScoreSubject std:Cryptography
> >
> This rule covers only the case when the score for Cryptography is the
> highest. If your data doesn't contain a student that matches the rule,
> nothing will happen.
>
>
> Cheers,
> Lorenz
>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>
>