0

I want to cast some OWL-S conditions to SWRL, the cast is done but the result manipulation returns nullpointerexception. Here the code :

final OWLIndividualList<Condition> cs = service.getProfile().getConditions();
final ArrayList<ArrayList<URI>> conditions = new ArrayList<ArrayList<URI>>();
for (final Condition<?> c : cs){
   if (c.canCastTo(Condition.SWRL.class)){ // is it a SWRL condition?
      final Condition.SWRL sc = c.castTo(Condition.SWRL.class);
      for (final Atom a : sc.getBody()){...........

the last line returns :

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

Can anyone help me to deal with this?

Moh Lamine
  • 72
  • 1
  • 9

1 Answers1

0

This issue is not linked to the java code but to the OWLS-S file syntaxe. you can resolve this issue by replacing:

 <expr:expressionBody rdf:parseType="Literal">

which hold the SWRL precondition (or eventually the result), by:

<expr:expressionObject>
Moh Lamine
  • 72
  • 1
  • 9