I have divided Students into ExcellentStudents and AverageStudents based on
some criteria via Jena rules: if student got 75% or more, he/she will be in
"ExcellentStudents" else "AverageStudents".
In first exam, if some one takes 75% and put into  ExcellentStudents but
next time if he scores less than 75%, he will be AverageStudents.

The problem is that when I store it in the file, the previous value does
not overwrite the new one and I see both categories in the owl file like:
John
 AverageStudents
 ExcellentStudents

How can we cope with this issue?

The rules are:

String rule = "[rule1:(?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.semanticweb.org#Student) "
                + "( ?x http://www.semanticweb.org#score  ?marks )"
                + "greaterThan(?marks, 70) "
                + " ->  (?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.semanticweb.org#ExcellentStudents )]"

+ "[rule2:(?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.semanticweb.org#Student) "
                + "( ?x http://www.semanticweb.org#score  ?marks )"
                + "lessThan(?marks, 70) "
                + " ->  (?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.semanticweb.org#AverageStudents )]";


for (Iterator i = inf.listResourcesWithProperty(RDF.type,stutype1 );
i.hasNext();) {
           inf.listStatements(null,RDF.type, "ExcellentStudents");

        }
     for (Iterator i = inf.listResourcesWithProperty(RDF.type, stutype2);
i.hasNext();) {
             inf.listStatements(null,RDF.type, "AverageStudents");

        }

I also tried with SPARQL but same result.
SELECT  * " +
                " WHERE {   ?x rdf:type std:ExcellentStudents . ?x rdf:type
std:AverageStudents}";

Reply via email to