How to add DocumentBlockExtension in uima ruta - uima

When I try to use DocumentBlock it shows not define in script block. How I need to add it in additional Engine? Can anyone explain in detail about the usage of DocumentBlock.

It depends on how you call/execute the RutaEngine. You need to add org.apache.uima.ruta.block.DocumentBlockExtension to the value of the configuration parameter additionalExtensions.
Using uimaFIT, this would look like:
AnalysisEngineFactory.createEngineDescription(RutaEngine.class, ...,
RutaEngine.PARAM_ADDITIONAL_EXTENSIONS, new String[] {
DocumentBlockExtension.class.getName() });
In a simple Ruta project, the value needs to be set in descriptor/BasicEngine.xml which is used as a template for the generated descriptors which are used in the launch configuration, if it is not automatically set in the generated descriptor.
DISCLAIMER: I am a developer of UIMA Ruta

Related

Agenda Group not working with drools 8.29.FINAL version

We have java rules service microservice & Using drools 7.X version to process the dynamic rules process. business rules (.xlsx) file using the Agenda-groups which is working fine.
After upgrading to drools 8.29.FINAL. kiesession.getAgenda().setAgendaFocus("1") is returning null.
NOTE :
Drools 7.49 is giving me list of agenda's
kieContainer.getKieBase().getKiePackages().parallelStream()
.forEach(obj -> obj.getRules().stream().forEach(innerObj -> {
agendaGroups.add(KieRuleMetaData.builder().agendaGroup(((RuleImpl) innerObj).getAgendaGroup())
.ruleName(innerObj.getName()).build());
}));
After upgrading to 8.29.FINAL - it's notworking
Appreciate if any help
As per the documentation, changed only drools version on pom.xml file.
Without some reproducer, it is difficult to support you effectively; next time kindly consider providing a reproducer (on GitHub for example) and share it here or via mailing-list on drools-usage or kogito-development
To me, this snippet returns as expected the agenda-group(s) defined in the rules, using 8.33.0.Final in this little reproducer here: https://github.com/tarilabs/demo20230212-so75416633/blob/main/src/test/java/org/drools/demo/RuleTest.java#L32-L34
kContainer.getKieBase().getKiePackages().stream().forEach(obj -> obj.getRules().stream().forEach(innerObj -> {
LOG.info("Rules contain this Agenda group: {}", ((RuleImpl) innerObj).getAgendaGroup() );
}));
I've used some simplified logging as you didn't provide details of KieRuleMetaData in your snippet, but as you can see with rules defining
rule "will execute per each Measurement having ID color"
agenda-group "mygroup"
when
...
The snippet above correctly prints:
2023-02-12 10:51:45,868 [main] INFO Rules contain this Agenda group: mygroup
Then, in the test code, as you can see I'm using the agenda-group I wanted by locating it on the agenda and setting it in-focus: https://github.com/tarilabs/demo20230212-so75416633/blob/main/src/test/java/org/drools/demo/RuleTest.java#L58-L69
session.getAgenda().getAgendaGroup("mygroup").setFocus();
session.fireAllRules();
So to me I cannot reproduce any error in using agenda-groups using latest Drools available at the time of writing.
You mention you are using Spreadsheet (.xlsx) for defining the rules, and the agenda group "1" is very suspicious it might be interpreted wrongly as number Vs string.
I hope with my very first snippet above, you are able to re-instate the inspection of all the agenda-groups defined in all rules in all packages, so to verify your agenda-group "1" is really present.
If not, suggesting you try by writing in Excel as "aaa1" instead of the simple digit for one, so to make sure it is correctly saved in the Excel as a string.

How to include application version number in HTML documentation genertated by Spring Rest Docs?

I would like to include application version number (version from build.gradle).
I see no way to pass some custom variables to ascidoc and use them in generated documentation. Is it possible?
Passing custom variables from gradle can be done using
asciidoctor {
attributes "build=${build}"
}
Then defined attribute may be refered in adoc file as {build}

Patterns not recognized after executing EXEC action

I have a strange problem with Apache UIMA Ruta (2.6.1) that I don't understand. I made the following script to demonstrate the situation. I recognize some patterns in the input text and create patterns from it.
After execution of the EXEC action patterns based on combination of annotations are not recognized:
For the following script I tried to use input text "aaa bbb". PATTERN_A is recognized (created) but PATTERN_B not.
Single annotations are still recognized (AAA_2 is created).
I serialized to a XCAS (cas) object before and after the EXEC command, and both files are equal.
Note: the TableLookupAnalysisEngine use an empty ruta script in this example. If I add a custom annotation in the script it also work.
ENGINE TableLookupAnalysisEngine;
DECLARE AAA;
DECLARE AAA_1;
DECLARE AAA_2;
DECLARE BBB;
DECLARE PATTERN_A;
DECLARE PATTERN_B;
"aaa"{-> MARK(AAA)};
"bbb"{-> MARK(BBB)};
AAA{-> AAA_1};
(AAA BBB){-> PATTERN_A};
Document{-> CONFIGURE(TableLookupAnalysisEngine, "dictRemoveWS" = true),
EXEC(TableLookupAnalysisEngine, {AAA, BBB})};
AAA{-> AAA_2};
// Not recognized -> internal index numbers changed?
(AAA BBB){-> PATTERN_B};
We tried the same test in Eclipse Workbench and get the expected result. The pattern matching after the EXEC command still work.
Because the XML descriptor files used in our project and Eclipse Workbench where equal we looked into the engine execution code:
We changed the following statement to solve the problem.
From:
JCas jCas = CasCreationUtils.createCas(rutaEngine.getAnalysisEngineMetaData()).getJCas();
To:
JCas jCas = rutaEngine.newJCas();
You need to specify the relevant type for internal Ruta reindexing by adding them in a TypeList as a second argument. There is an example in the documentation:
ENGINE NamedEntities;
Document{->EXEC(NamedEntities, {Person, Location})};
In your example, you probably need to add {AAA, BBB}.
DISCLAIMER: I am a developer of UIMA Ruta:

Is there a detailed documentation on how to create own jsdoc templates?

Short version:
If I wanted to develop a completely new jsDoc template from scratch, what would I have to read to understand what jsDoc does, what interface my template must provide and what data I get to work with?
Long version:
I've been using jsDoc for a while now and have come across some tags that I would like to add and overview pages that I would like to have generated out of my documentation. Up to now I solved all my "user problems" with usejsdoc.org. I even managed to add a new jsdoc plugin that adds some tags. However, I can't find any developer documentation on how to create templates for jsdoc. I use ink-docstrap so I clicked my way through the template-folder (publish.js, /tmpl, etc.) and somehow got the idea of how everything works. But its very very time consuming.
What should I read to become a jsDoc template pro?
These instructions are the closest I could find:
To create or use your own template:
Create a folder with the same name as your template (for example, mycooltemplate).
Within the template folder, create a file named publish.js. This file must be a CommonJS module that exports a method named publish.
For example:
/** #module publish */
/**
* Generate documentation output.
*
* #param {TAFFY} data - A TaffyDB collection representing
* all the symbols documented in your code.
* #param {object} opts - An object with options information.
*/
exports.publish = function(data, opts) {
// do stuff here to generate your output files
};
To invoke JSDoc 3 with your own template, use the -t command line option, and specify the path to your template folder:
./jsdoc mycode.js -t /path/to/mycooltemplate
Failing that, you can read the source code!
I am running into a similar difficulty with lack of documentation. There is a GitHub issue that has been open for 7 years on this: Provide docs that explain how templates work.
The only example I've found so far of a custom template that doesn't look like just a modified version of the default is Ramda's documentation. It looks like they use a completely custom publish.js script that uses handlebars.js instead of underscore.js templates, constructs a non-hierarchical nav, pulls info from #sig and #category tags, and uses links to github for 'view source' instead of rendering its own html pages for source code.
Some of their code will be difficult to understand unless you are familiar with Ramda and functional programming (they use Ramda itself in their version of publish.js) but dumping out the values of data and docs during execution should help provide insight into what is going on.
It is helpful as well that their template is a single file so you don't have to jump between a lot of partial template files to follow how the doc is constructed.
I've just published my own new jsdoc theme. What I did is I simply copied the default template: https://github.com/jsdoc3/jsdoc/tree/master/templates/default, and worked on that.
I also managed to add grunt with the following features:
* transcompile + minify js files
* parse sass styles and minify them
* refresh the docs when you change something
You can see how it works here: https://github.com/SoftwareBrothers/better-docs
you can customize one of existing templates (default, haruki or silent):
go into node_modules/jsdoc/template and grab on of them into your app directory outside node_modules.
feel free to rename the dir ex: jsdoc-template.
open jsdoc-template update/customize the content as you want. ex: open publish.js find Home and replace My Js App.
update jsdoc.json by adding:
"opts": {
"template": "jsdoc-template"
}
another option to use one of those templates too: jsdoc3 template list examples
Followup to my previous comment about Ramda's JSDoc template. I've since created a customized version of it and published it on GitHub at https://github.com/eluv-io/elv-ramdoc
This is tailored for my company's projects, but it may be helpful as another learning tool. It adds a 'Show private' checkbox, updates Bootstrap to v5.13, replaces Handlebars with Pug, adds JSDoc comments to the publish.js script itself, and supports setting an environment variable to dump data to console during doc generation.

Data.c file generation

i'm very new to matlab, i'm working on a software which needs the following files as input model.c,model.h,model_data.c for a particular simulink model. I have a model for which i can't generate model_data file using RTW, i have tried to get some information on the files generated by RTW, but i didnt get sufficient info. If there anybody who knows about the RTW please let me know the blocks which are required to generate model_data.c
thank you
model_data.c is a conditionally created file (i.e. it is only created if it is needed, which depends on the way the model is set up for code generation).
For a discussion of the Simulink Coder build process, and what files get generated when, search the doc for the section titled "Files and Folders Created by Build Process".
For others who need help in future.
Open the Configuration Parameters pane. Go to Code Generation -> Optimization and make sure that Default parameter behavior is set to Tunable.