Search code examples
intellij-ideauimaruta

Debugging Apache UIMA Ruta scripts


I work on a project that will use Apache UIMA Ruta to process text fragments/documents. Our project will include a lot of Ruta scripts, maybe some larger complex ones by using imports.

I there a way to debug the scripts? In ideal situation we can set breakpoints in the IDE (IntelliJ would be great).

I checked the UIMA workbench in Eclipse and the CAS visual debugger but that's not really where I'm looking for.

I already found the debug flags that can be passed against the ruta analysis engine but that returns only all the found annotations (inclusive default ones like SW). That's after the script is completed.

Another related question is if there are any projects that gives a web based IDE / console / debugger for Ruta scripts? (like https://regex101.com )


Solution

  • (I have no experience with IntelliJ. I only work with Eclipse.)

    Here's what I do for debugging ruta scripts:

    • activate the config param for debugging, i.e. debug, debugWithMatches, createdBy. Then, I use Explain perspective in the Ruta Workbench to check what rules caused the problem and why. There are special views on what the rules matched or failed to match, and which rule element or condition caused that. There is also a view that displays what rule created a selected annotation. Combination with the selection view often helps. The explanation for inlined rules is yet limited.
    • import ruta-core into the workspace and set a break point somewhere in the java implementation. When you launch a ruta script with the debug button, its actually a java launch delegate and you can debug the implementation just like java programs.
    • sometimes I add a simple rule like Person; just to see the explanation at one specific stage of the script without changing the annotations, e.g., are there annotation of this type and are they visible at this point. Some others use the old LOG action to provide some informaation on the console.

    The break points in the ruta script do not mean anything. The editor supports them, but they are not implemented.

    There are no web-based IDEs for Ruta as far as I know.

    DISCLAIMER: I am a developer of UIMA Ruta