Reset a local ANNOTATION variable? - uima

I'm using an ANNOTATION variable within a BLOCK statement. How do I initialize and/or reset an ANNOTATION variable to an "empty" value?

All variables in UIMA Ruta are global and thus are not automatically reset within a block.
As the comments of the question correctly mention, resetting the values of the variables is currently done by a separate rule at the beginning of the block using an implicit action or the ASSIGN action.
DISCLAIMER: I am a developer of UIMA Ruta

Related

Variable inside a macro

How do I create variables inside of a macro? I've created a macro library with some macros and now I am trying to figure out how to create a local variable that exists inside a macro for the lifetime of the macro. Perhaps theres a way to store that data somewhere else?
While editing the Macro, use the Inputs collection of the Details panel to create a dummy variable of the required type.
Do not check the By-Ref checkbox.
Leave it unconnected when calling the Macro.
Use the variable like any other variable.
If you are not using latent functions like delay or timeline, use functions instead.
I create function libraries anytime I need code reuse.

In simulink, programmatically create a variant subsystem

I want to use scripting to create and define a variant subsystem in simulink.
I am able to create the variant subsystem and add subsystems within it using the add_block but cannot find the appropriate property that defines the variant subsystem by using the get_param command.
The way I graphically configure a variant subsystem is by right clicking the block and going to Block Parameters and then adding the variant control conditions for each subsystem.
I want to do the same thing but from an m-file so that I can create multiple blocks programmatically.
I checked the documentation and google search but couldn't find anything.
Thanks in advance.
Based on a comment by #Praetorian, I opened the model in a text editor and found the parameter line where the variant condition was defined.
I found that the variant conditions are stored in the subsystems within the variant subsystem and not within the top-level variant subsystem.
So you store the condition within each subsystem's "VariantControl" parameter.
Example:
set_param([variantSys '/' sys],'VariantControl','a==1') where sys is a subsystem within the variant subsystem variantSys.
The variant control should be written on the Callbacks of the Model. In order to put the simulink variant controls available to the model, the variables should be created in the workspace. For this to happen you need to put your Sys = Simulink.Variant(Mode== value) etc on the PreLoadFcn.
Check access PreLoadFcn and put the formulas in there then your table will be automatically filled.
If you do not mind can you tell me how you created the variant subsystem?
Good luck

Change local variable or function parameter in google chrome

I'm using chrome's devtools to debug/modify a non-local javascript file(so I can't edit it).
The code is rather complex and defines function inside of functions and uses these pointers throughout.
The point is that I do not know where I'm exactly at in the process but I can set a breakpoint to a variable I need to modify. BUT I can't figure out how to modify it. I can add a watch or modify it under the locals panel BUT it won't actually change (after stepping once the value reverts to original)
So how can I change the variable? I don't know why it is so difficult. In my traditional debugging you can simply edit the value in the watch or locals and it will modify it. I've tried modifying it at the console but I guess I don't know the complete path to the variable and I always get an undefined variable.
All I want to do is modify a local variable or argument in side some function I set a breakpoint at.
Try doing this in the console. E.g.: window.myVar = "newValue"
First watch the variable, second in Scope tab you can change the value of the var!

Changing Map parameters in Drools Flow

Am a beginner in drools flow and Jbpm 5. I want to pass in some parameter in map and i need certain script tasks to alter that parameter. How do i do it?
In an action script you can do something like:
kcontext.setVariable("name", value);
For example, if you have a variable i:
kcontext.setVariable("i", i + "Changed");
Note that you probably should define your variable as a process variable to be able to do this. Click on the background of your process and in the Properties view, edit the "variables" property to add a new process property with a given name and type.
For more documentation, see:
http://docs.jboss.org/jbpm/v5.2/userguide/ch05.html#sec.data
Kris

Global launch configuration in Eclipse?

This seems like a simple thing, but I can't find an answer in the existing questions:
How do you add a global argument to all your present and existing run or debug configurations? In my case, I need a VM argument, but I see that this could be useful for runline arguments as well.
Basically, every time I create a unit test I need to create a configuration (or run, which creates one), and then manually edit each one with the same VM argument. This seems silly for such a good tool.
This is not true. You can add the VM arguments to the JRE definition. This is exactly what it is for. I use it myself so that assertions are enabled and heap is 1024mb on every run, even future ones.
Ouch: 7-years bug, asking for running configuration template, precisely for that kind or reason.
This thread proposes an interesting workaround, based on duplicating a fake configuration based on string substitution:
You can define variables in Window->Preferences->Run/Debug->String Substitution. For example you can define a projectName_log4j variable with the
correct -Dlog4j.configuration=... value.
In a run configuration you can use ${projectName_log4j} and you don't have to remember the real value.
You can define a project-specific "empty" run configuration.
Set the project and the arguments fields in this configuration but not the main class. If you have to create a new run configuration for this project select this one and use 'Duplicate' from its popup-menu to copy this configuration.
You have to simply set the main class and the program arguments.
Also you can combine both solutions: use a variable and define an "empty"
run configuration which use this variable. The great advantage in this case
is when you begin to use a different log4j config file you have to change
only the variable declaration.
Not ideal, but it may alleviate your process.