[rules-users] Runtime Exception null accessor

Wolfgang Laun wolfgang.laun at gmail.com
Tue Feb 26 09:15:33 EST 2013


Your rule doesn't look right to me, even after the fix, provided I've understood
everything correctly. (I'm assuming that a NamedEntity is a range in a
text and ranges don't overlap.) I would have thought that the distance
between two nonoverlapping ranges is given by

function int d( NamedEntity x, NamedEntity y ){
    return Math.min( Math.abs( x.getBeg() - y.getEnd() ),
                     Math.abs( y.getBeg() - x.getEnd() ) );
}

and that such d-values need to be compared to guarantee the minimum,
taking care to replace NamedEntities with equal contents( "anatomy",
etc) when comparing one distance to another.

-W





On 26/02/2013, Bojan Janisch <bojan.janisch at scai.fraunhofer.de> wrote:
> Hey again,
>
> I've solved the problem. Seems that the error came from an unhandled
> condition.
> I hope that the following example helps other people with similar problems:
>
> //Checking if there is and Anatomy-Attribute
> $ne1:NamedEntity(
> ct1:coveredText,
> q1:QuestionId,
> q1.contains("anatomy"),
> label1:ResponseAttribute,
> ne1_begin:begin,
> ne1_end:end)
>
> //Checking if there is also a BodySide-Attribute
> $ne2:NamedEntity(
> ct2:coveredText,
> q2:QuestionId,
> q2.contains("bodySide"),
> label2:ResponseAttribute,
> ne2_begin:begin,
> ne2_end:end)
>
> //Checking that there is no other Attribute nearer
> not $ne3:NamedEntity(
> q3:QuestionId,
> q3.contains("bodySide") || q3.contains("anatomy"),
> ne3_begin:begin,
> ne3_end:end,
> (ne3_begin > ne1_end && (ne3_begin - ne1_end) < (ne1_begin - ne2_end)) ||
> (ne3_end < ne1_begin && (ne1_begin - ne3_end) < (ne2_begin - ne1_end)))
>
> The last condition of ne3 does not handel the fact that ne1 is before ne2.
> And I'm also not testing for this fact otherwise. So I changed the last
> condition into:
>
> not $ne3:NamedEntity(
> q3:QuestionId,
> q4.contains(".bodySide") || q4.contains("anatomy"),
> ne3_begin:begin,
> ne3_end:end,
> ne3_begin > ne1_end && ((ne1_end - ne3_begin) < (ne1_end - ne2_begin)) ||
> ne3_end < ne1_begin && ((ne1_begin - ne3_end) < (ne1_begin - ne2_end)))
>
> Now it is not allowed that a named entity with questionId of anatomy or
> bodyside is
> between ne1 and ne2 (doesn't matter which comes first). The runtime
> exception did not
> occur anymore after I changed the rule.
>
> So seems that the null accessor was a result of an unhandled condition.
>
> Greetings
> Bojan
>
> ----- Ursprüngliche Mail -----
> Von: "Bojan Janisch" <bojan.janisch at scai.fraunhofer.de>
> An: "Rules Users List" <rules-users at lists.jboss.org>
> Gesendet: Montag, 25. Februar 2013 18:11:46
> Betreff: Runtime Exception null accessor
>
> Hello Guys,
>
> I've thought many hours about this problem, but don't know how to fix it.
> I've also searched the web, getting only some unfinished problems. Maybe
> someone here knows how to solve it:
>
> Each time I'm running JDrools through my textfiles (I'm using it in
> textmining concepts), I get the same runtime exception:
>
> 25.02.2013 18:03:59
> org.apache.uima.collection.impl.cpm.engine.CPMThreadGroup process
> SCHWERWIEGEND: The CPM thread group caught the following unhandled error:
> java.lang.RuntimeException (Thread Name: Thread-5)
> 25.02.2013 18:03:59
> de.fraunhofer.scai.bio.uima.core.deploy.StatusCallbackListenerImpl
> entityProcessComplete(151)
> SCHWERWIEGEND: Exception occurred
> java.lang.RuntimeException: Null accessor on node: a1_begin
> 	at
> de.fraunhofer.scai.bio.uima.core.deploy.StatusCallbackListenerImpl.entityProcessComplete(StatusCallbackListenerImpl.java:151)
> 	at
> org.apache.uima.collection.impl.cpm.engine.CPMThreadGroup.notifyListener(CPMThreadGroup.java:103)
> 	at
> org.apache.uima.collection.impl.cpm.engine.CPMThreadGroup.uncaughtException(CPMThreadGroup.java:86)
> 	at java.lang.Thread.dispatchUncaughtException(Thread.java:1888)
>
> For me it looks like an unhandeld race condition (but I'm not quite sure).
> Does someone have had this or a similar problem regarding null accessors at
> runtime?
>
> Thanks for your help.
>
> Bojan
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users



More information about the rules-users mailing list