Discussion:
duplicate values inferred
javed khan
2016-10-14 13:53:25 UTC
Permalink
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}";
Dave Reynolds
2016-10-16 18:16:45 UTC
Permalink
Post by javed khan
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
John
AverageStudents
ExcellentStudents
How can we cope with this issue?
If in your data there is only ever one exam result for a given student
then you it might make sense to have AverageStudents/ExcellentStudent
classes. However, if you have multiple exam results in the same data
then naturally some will be average on some and excellent on others.

So you have to decide what your semantics are. Do you want
ExcellentStudent to mean that the student averages 75% or more across
all exams? Or you you want an n-relationship between students, exams
and classifications?

Once you've decided what you semantics are and how the answers should
look then you can figure out an implementation.

Dave
Post by javed khan
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}";
javed khan
2016-11-11 22:29:54 UTC
Permalink
The students have to appear multiple time in the exam. When student appears
first time, he scored 80% and got in the category of Excellent Students
list. Second time he appears, he scored 60% and thus appeared in Average
Student.
Now after two exams, the Student in the owl file should be in the Average
Student list but both Excellent and Average Student appears and thus the
first value of first exam also there.
Post by Dave Reynolds
Post by javed khan
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
John
AverageStudents
ExcellentStudents
How can we cope with this issue?
If in your data there is only ever one exam result for a given student
then you it might make sense to have AverageStudents/ExcellentStudent
classes. However, if you have multiple exam results in the same data then
naturally some will be average on some and excellent on others.
So you have to decide what your semantics are. Do you want
ExcellentStudent to mean that the student averages 75% or more across all
exams? Or you you want an n-relationship between students, exams and
classifications?
Once you've decided what you semantics are and how the answers should look
then you can figure out an implementation.
Dave
Post by javed khan
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-r
df-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-r
df-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}";
Lorenz B.
2016-11-12 14:55:09 UTC
Permalink
And what is the question now?

By the way, those rules do not overwrite any value, the logic is
supposed to be monotonic, i.e. only additional triples are inferred.
Replacement has to be done in the application code.
Post by javed khan
The students have to appear multiple time in the exam. When student appears
first time, he scored 80% and got in the category of Excellent Students
list. Second time he appears, he scored 60% and thus appeared in Average
Student.
Now after two exams, the Student in the owl file should be in the Average
Student list but both Excellent and Average Student appears and thus the
first value of first exam also there.
Post by Dave Reynolds
Post by javed khan
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
John
AverageStudents
ExcellentStudents
How can we cope with this issue?
If in your data there is only ever one exam result for a given student
then you it might make sense to have AverageStudents/ExcellentStudent
classes. However, if you have multiple exam results in the same data then
naturally some will be average on some and excellent on others.
So you have to decide what your semantics are. Do you want
ExcellentStudent to mean that the student averages 75% or more across all
exams? Or you you want an n-relationship between students, exams and
classifications?
Once you've decided what you semantics are and how the answers should look
then you can figure out an implementation.
Dave
Post by javed khan
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-r
df-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-r
df-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}";
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
javed khan
2016-11-12 17:27:05 UTC
Permalink
Hello Lorenz, kindly if you can suggest me how to avoid this situation.
Recent data property value can be achieved using Jena but I dont know how
to do it in this case because Student is a class here.

On Sat, Nov 12, 2016 at 4:55 PM, Lorenz B. <
Post by Lorenz B.
And what is the question now?
By the way, those rules do not overwrite any value, the logic is
supposed to be monotonic, i.e. only additional triples are inferred.
Replacement has to be done in the application code.
Post by javed khan
The students have to appear multiple time in the exam. When student
appears
Post by javed khan
first time, he scored 80% and got in the category of Excellent Students
list. Second time he appears, he scored 60% and thus appeared in Average
Student.
Now after two exams, the Student in the owl file should be in the Average
Student list but both Excellent and Average Student appears and thus the
first value of first exam also there.
On Sun, Oct 16, 2016 at 9:16 PM, Dave Reynolds <
Post by Dave Reynolds
Post by javed khan
I have divided Students into ExcellentStudents and AverageStudents
based
Post by javed khan
Post by Dave Reynolds
Post by javed khan
on
some criteria via Jena rules: if student got 75% or more, he/she will
be
Post by javed khan
Post by Dave Reynolds
Post by javed khan
in
"ExcellentStudents" else "AverageStudents".
In first exam, if some one takes 75% and put into ExcellentStudents
but
Post by javed khan
Post by Dave Reynolds
Post by javed khan
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
Post by javed khan
Post by Dave Reynolds
Post by javed khan
not overwrite the new one and I see both categories in the owl file
John
AverageStudents
ExcellentStudents
How can we cope with this issue?
If in your data there is only ever one exam result for a given student
then you it might make sense to have AverageStudents/ExcellentStudent
classes. However, if you have multiple exam results in the same data
then
Post by javed khan
Post by Dave Reynolds
naturally some will be average on some and excellent on others.
So you have to decide what your semantics are. Do you want
ExcellentStudent to mean that the student averages 75% or more across
all
Post by javed khan
Post by Dave Reynolds
exams? Or you you want an n-relationship between students, exams and
classifications?
Once you've decided what you semantics are and how the answers should
look
Post by javed khan
Post by Dave Reynolds
then you can figure out an implementation.
Dave
Post by javed khan
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-
rdf-syntax-ns#type
Post by javed khan
Post by Dave Reynolds
Post by javed khan
http://www.semanticweb.org#Student) "
+ "( ?x http://www.semanticweb.org#score ?marks )"
+ "greaterThan(?marks, 70) "
+ " -> (?x http://www.w3.org/1999/02/22-r
df-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-r
df-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);
Post by javed khan
Post by Dave Reynolds
Post by javed khan
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}";
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Lorenz B.
2016-11-13 13:24:05 UTC
Permalink
You don't know what exactly?
Post by javed khan
Hello Lorenz, kindly if you can suggest me how to avoid this situation.
Recent data property value can be achieved using Jena but I dont know how
to do it in this case because Student is a class here.
On Sat, Nov 12, 2016 at 4:55 PM, Lorenz B. <
Post by Lorenz B.
And what is the question now?
By the way, those rules do not overwrite any value, the logic is
supposed to be monotonic, i.e. only additional triples are inferred.
Replacement has to be done in the application code.
Post by javed khan
The students have to appear multiple time in the exam. When student
appears
Post by javed khan
first time, he scored 80% and got in the category of Excellent Students
list. Second time he appears, he scored 60% and thus appeared in Average
Student.
Now after two exams, the Student in the owl file should be in the Average
Student list but both Excellent and Average Student appears and thus the
first value of first exam also there.
On Sun, Oct 16, 2016 at 9:16 PM, Dave Reynolds <
Post by Dave Reynolds
Post by javed khan
I have divided Students into ExcellentStudents and AverageStudents
based
Post by javed khan
Post by Dave Reynolds
Post by javed khan
on
some criteria via Jena rules: if student got 75% or more, he/she will
be
Post by javed khan
Post by Dave Reynolds
Post by javed khan
in
"ExcellentStudents" else "AverageStudents".
In first exam, if some one takes 75% and put into ExcellentStudents
but
Post by javed khan
Post by Dave Reynolds
Post by javed khan
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
Post by javed khan
Post by Dave Reynolds
Post by javed khan
not overwrite the new one and I see both categories in the owl file
John
AverageStudents
ExcellentStudents
How can we cope with this issue?
If in your data there is only ever one exam result for a given student
then you it might make sense to have AverageStudents/ExcellentStudent
classes. However, if you have multiple exam results in the same data
then
Post by javed khan
Post by Dave Reynolds
naturally some will be average on some and excellent on others.
So you have to decide what your semantics are. Do you want
ExcellentStudent to mean that the student averages 75% or more across
all
Post by javed khan
Post by Dave Reynolds
exams? Or you you want an n-relationship between students, exams and
classifications?
Once you've decided what you semantics are and how the answers should
look
Post by javed khan
Post by Dave Reynolds
then you can figure out an implementation.
Dave
Post by javed khan
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-
rdf-syntax-ns#type
Post by javed khan
Post by Dave Reynolds
Post by javed khan
http://www.semanticweb.org#Student) "
+ "( ?x http://www.semanticweb.org#score ?marks )"
+ "greaterThan(?marks, 70) "
+ " -> (?x http://www.w3.org/1999/02/22-r
df-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-r
df-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);
Post by javed khan
Post by Dave Reynolds
Post by javed khan
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}";
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
javed khan
2016-11-14 16:51:21 UTC
Permalink
I am sorry but I have no idea about it.


On Sun, Nov 13, 2016 at 4:24 PM, Lorenz B. <
Post by Lorenz B.
You don't know what exactly?
Post by javed khan
Hello Lorenz, kindly if you can suggest me how to avoid this situation.
Recent data property value can be achieved using Jena but I dont know how
to do it in this case because Student is a class here.
On Sat, Nov 12, 2016 at 4:55 PM, Lorenz B. <
Post by Lorenz B.
And what is the question now?
By the way, those rules do not overwrite any value, the logic is
supposed to be monotonic, i.e. only additional triples are inferred.
Replacement has to be done in the application code.
Post by javed khan
The students have to appear multiple time in the exam. When student
appears
Post by javed khan
first time, he scored 80% and got in the category of Excellent Students
list. Second time he appears, he scored 60% and thus appeared in
Average
Post by javed khan
Post by Lorenz B.
Post by javed khan
Student.
Now after two exams, the Student in the owl file should be in the
Average
Post by javed khan
Post by Lorenz B.
Post by javed khan
Student list but both Excellent and Average Student appears and thus
the
Post by javed khan
Post by Lorenz B.
Post by javed khan
first value of first exam also there.
On Sun, Oct 16, 2016 at 9:16 PM, Dave Reynolds <
Post by Dave Reynolds
Post by javed khan
I have divided Students into ExcellentStudents and AverageStudents
based
Post by javed khan
Post by Dave Reynolds
Post by javed khan
on
some criteria via Jena rules: if student got 75% or more, he/she will
be
Post by javed khan
Post by Dave Reynolds
Post by javed khan
in
"ExcellentStudents" else "AverageStudents".
In first exam, if some one takes 75% and put into ExcellentStudents
but
Post by javed khan
Post by Dave Reynolds
Post by javed khan
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
Post by javed khan
Post by Dave Reynolds
Post by javed khan
not overwrite the new one and I see both categories in the owl file
John
AverageStudents
ExcellentStudents
How can we cope with this issue?
If in your data there is only ever one exam result for a given student
then you it might make sense to have AverageStudents/ExcellentStudent
classes. However, if you have multiple exam results in the same data
then
Post by javed khan
Post by Dave Reynolds
naturally some will be average on some and excellent on others.
So you have to decide what your semantics are. Do you want
ExcellentStudent to mean that the student averages 75% or more across
all
Post by javed khan
Post by Dave Reynolds
exams? Or you you want an n-relationship between students, exams and
classifications?
Once you've decided what you semantics are and how the answers should
look
Post by javed khan
Post by Dave Reynolds
then you can figure out an implementation.
Dave
Post by javed khan
String rule = "[rule1:(?x http://www.w3.org/1999/02/22-
rdf-syntax-ns#type
Post by javed khan
Post by Dave Reynolds
Post by javed khan
http://www.semanticweb.org#Student) "
+ "( ?x http://www.semanticweb.org#score ?marks )"
+ "greaterThan(?marks, 70) "
+ " -> (?x http://www.w3.org/1999/02/22-r
df-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-r
df-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);
Post by javed khan
Post by Dave Reynolds
Post by javed khan
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}";
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
--
Lorenz BÃŒhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Continue reading on narkive:
Loading...