Comments (7)
Hello Radoslaw,
I think that just chaning the DMN parsing version to V1_3ext
will solve your problem. The way how the DMN XML has been designed, corresponds to that version of parser.
I did try also with your application (just tweaked a bit the repository service, so I don't need to use the DB and keep the uploaded definitions just in DI singleton object) and it worked.
Hope this help
from common.dmn.engine.
You are awesome! Thanks a lot. Your engine works like a charm.
from common.dmn.engine.
KWS30_Inkomen_Bepaal inkomens toetsnorm v0.12.dmn.txt
from common.dmn.engine.
In order to reproduce the exception call the enigine in NET 6 with the following input parameters set as follows:
Decision = "Bepaal inkomens toetsnorm"
inputvar = value:
beleidsvrijheid_PW_normpercentage = 90
beleidsvrijheid_AOW_normenkader = "PW"
aanvrager_AOW = "ja"
partner_AOW = "nee"
aantal_kostendelers = 2
leefvorm = "Gehuwd/samenwonend"
from common.dmn.engine.
Hello Radoslaw,
thanks for your feedback.
I had a quick check and will need some additional clarification from you.
The DMN Engine library (both project and nuget) is netstandard 2.0, but I'm not sure what do you mean when saying that the decision is "executed in netstandard 2.0". When the DMN Engine lib is referenced/imported in an executable project, the runtime (for example .net 5 or .net 6) is set in that project. So I would say you never execute "netstandard 2.0" as it's not a .net runtime.
I did try to open your DMN file in DMN Simulator that uses .NET 6 runtime. I executed the decision as described in the comment above and I think it worked fine as you can see on the image below.
Could you please provide me more details how do you
- set the executable project - what typ of app and what runtime do you use
- use the DMN Engine library - import nuget, include clonned project, or copied the code into executable project, etc.
- parse the DMN - what parser method/version. Meaning how do you get
dmnModel
before callingDmnDefinitionFactory.CreateDmnDefinition(dmnModel)
. For exampledmnModel = DmnParser.Parse13ext(fileFullName);
- configure the execution context when calling
DmnExecutionContextFactory.CreateExecutionContext
(if applicable)
Thanks in advance
Radek
cc @rmerkx
from common.dmn.engine.
Hi Radek,
Thanks for the quick reply! I am calling the engine from a Net.6 application, which is now attached to this issue. It doesn't matter if I reference the nuget package or clone the project, in both cases on executing the DMN (Definition generation gave no error) with the same inputs you tried yourself results in an expression being invalidated concerning input parameter 'aantal_kostendelers', which should be interpreted as integer but appears not to be. I will give detailed steps to reproduce.
I use almost the same way of parsing the definition and making the executioncontext as done in DmnService.cs in the Simulator, with small differences. The idea is to create a webservice which can receive any DMN's to store for execution later. Once stored a get operation is used to execute the specific DMN by supplying the parameters in a json request. So I first upload the DMN as base64 to the database and then retrieve the model like this, assuming decisionModel.DecisionModelFile
holds the base64 file content of the DMN:
byte[] data = Convert.FromBase64String(decisionModel.DecisionModelFile); string dmnDefinition = Encoding.UTF8.GetString(data); var dmnModel = DmnParser.ParseString(dmnDefinition, decisionModel.DmnVersion);
The version used here is DmnVersionEnum.V1_3. Please see DecisionModelRepository.cs
for actual implementation.
Creation of the context and execution is also implemented inspired by the Simulator approach. Please chekc out DecisionModelEngineService.cs
DmnExecutionContext? ctx = null; ctx = DmnExecutionContextFactory.CreateExecutionContext(definition, o => { o.RecordSnapshots = true; o.ParsedExpressionCacheScope = ParsedExpressionCacheScopeEnum.Execution; });
ctx.WithInputParameter(inputVeld.Key, inputVeldWaarde.Item2);
ctx!.ExecuteDecision(decisionName);
I will detail the steps to run this DMN in the attached service below. Please don't hesitate if more is needed. Your help is much appreciated!
Best regards,
Radoslaw ([email protected])
from common.dmn.engine.
post_request _to_upload_dmn_to_database.json.txt
Once you have the solution IB.DMN.EngineService.sln open in VS please follow these steps:
-
The tool requires a MSSQL database server to store the DMN. You can change the connection string in appsettings.json. It uses Entity Framework to create the database. To create set the service project as your startup project and run in package manager console:
dotnet ef database update
-
Assuming you have a database you can now run the service and POST the attached request to upload the DMN.
-
Once the DMN is available in the database you can send attached GET request to execute the DMN with the same values as you did in the example execution above.
curl -X 'GET' \
'https://localhost:7036/DecisionModelEngine?Name=name1&Version=version1&Product=KWS&InputValues=beleidsvrijheid_PW_normpercentage&InputValues=90&InputValues=beleidsvrijheid_AOW_normenkader&InputValues=PW&InputValues=aanvrager_AOW&InputValues=ja&InputValues=partner_AOW&InputValues=nee&InputValues=aantal_kostendelers&InputValues=2&InputValues=leefvorm&InputValues=Gehuwd%2Fsamenwonend&Decision=Bepaal%20inkomens%20toetsnorm' \
-H 'accept: text/plain'
Also see the screenshots if you prefer to use the Swagger interface.
The response shows the exception:
(Exception while parsing the expression aantal kostendelers> 0) (Exception while parsing the expression aantal kostendelers==0)\r\n", "outputValues": null }
from common.dmn.engine.
Related Issues (13)
- NormalizeVariableName(string name) HOT 7
- DMN "CodeCoverage" HOT 2
- XML file HOT 2
- Memory leak detected within DmnExecutionContext class HOT 14
- How run all decisions ? HOT 2
- Support for DMN 1.3 HOT 13
- how do i install DMN.Engine in my .NET project? HOT 5
- DMN files from latest version of camunda modeler not working HOT 4
- DmnExecutionContext.ExecuteDecision() seems to be using the label instead of the name to identify output from a dependent Decision HOT 2
- Not working under parallel HOT 3
- ParsedExpressionsCache Corruption when running multiple concurrent evaluations HOT 5
- Return matched rules as part of Decision Result HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from common.dmn.engine.