Hello, I asked about this rule few days ago.
String rule ="[rule1: ( ?x http://www.semanticweb.org/t/o
ntologies/2016/7/myOWL#Physics_Preferred_Category ?cat1 )" +
"( ?x http://www.semanticweb.org/t/ontologies/2016/7/myOWL#Chem_Pr
eferred_Category ?cat2 )" +
// "( ?x http://www.semanticweb.org/t/o
ntologies/2016/7/myOWL#Geo_Preferred_Category ?cat3 )" +
// "greaterThan(?cat1,?cat2), greaterThan(?cat1,?cat3)"
+ " -> (?x http://www.semanticweb.org/t/
ontologies/2016/7/myOWL#BestCategory http://www.semanticweb.org/t/
ontologies/2016/7/myOWL#BestCategory#Physics )]";
The BestCategory is saved but as you know a user will select all the three
categories in the quiz, then the rule will execute, otherwise the user the
user will have not the property BestCategory.
When I want to extract the value of BestCategory for some operation, for
first time users to the quiz, it gives me Null Pointer Exception, and
rightly so because the user has no value of BestCategory.
RDFNode physicsBestCat=indiv.getPropertyValue(bestcat);
Literal l1=physicsBestCat.asLiteral();
//*here I think is the exception is*
String s1=l1.toString();
if (s1=="Physics"){
}
How should I handle this problem please?
Much regards