28 September 2021

In this episode, I want to share with you about an experimental JBang catalog to quickly operate some KIE capabilities such as DMN and FEEL, directly on the Command Line!

What is JBang!?

JBang! is a powerful command line and shell capability, allowing you to run jsh and Java source code as a script.

JBang offers a great advantage with Java 8 compatibility and a very smart way to handle dependencies directly within the source of the scripts. You can read more about how JBang facilitates Developers, but also Students and Educators create, edit, and run self-contained source-only Java programs on the Jbang! website.

You only need JBang to be installed on your system in order to follow the steps shown in the video and summarised in this post.

DMN

You can use the jbang dmn@kiegroup alias to evaluate a DMN model using the Drools DMN Engine:

The script takes as input a DMN mode file, and a DMN Context expressed as JSON. It produces as output a JSON of the evaluated DMN result context.

As with most common command line utilities, you can issue --help to get usage help information:

jbang dmn@kiegroup --help

Converter for Excel (.xls/.xlsx) files containing DMN decision tables

You can use the jbang xls2dmn@kiegroup alias to convert Excel (.xls/.xlsx) files containing DMN decision tables using the Drools DMN Engine experimental converter:

For more details about the Converter and the conventions to be used in the Excel file, please reference the Converter documentation.

FEEL

You can use the jbang feel@kiegroup alias to evaluate a FEEL expression using the Drools DMN Engine.

This script takes as input a FEEL expression (as a string) and it produces a FEEL representation of the result of evaluating the expression.

This jBang alias can be very handy when you want to quickly try out some FEEL expressions, using the command line for additional fun!

Conclusions

You can reference the video embedded with this post to get an overview of how to use this JBang! catalog. Don't forget to checkout the README in the repository for the full details.

For more information on JBang, see:

Try it out today!

Go to: https://github.com/kiegroup/jbang-catalog

Don't forget to let us know your feedback using the Kogito community channels!