{"id":15466141,"url":"https://github.com/powerflows/powerflows-dmn","last_synced_at":"2025-04-09T12:05:45.665Z","repository":{"id":47312808,"uuid":"143469638","full_name":"powerflows/powerflows-dmn","owner":"powerflows","description":"Power Flows DMN - Powerful decisions and rules engine","archived":false,"fork":false,"pushed_at":"2024-10-17T16:22:56.000Z","size":558,"stargazers_count":51,"open_issues_count":7,"forks_count":6,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-18T23:14:16.706Z","etag":null,"topics":["decision-engine","decision-tables","dmn","dmn-engine","dmn-model","evaluation","evaluation-framework","feel","groovy","java","javascript","kotlin","kotlin-dsl","mvel","rule-engine","rules","rules-engine","xml","yaml"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/powerflows.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-03T20:15:59.000Z","updated_at":"2024-03-31T14:21:22.000Z","dependencies_parsed_at":"2024-11-08T17:00:30.353Z","dependency_job_id":"baff6105-1ddd-4ef4-85ca-7cb37de6335d","html_url":"https://github.com/powerflows/powerflows-dmn","commit_stats":{"total_commits":135,"total_committers":2,"mean_commits":67.5,"dds":"0.11111111111111116","last_synced_commit":"2b656b3fa20626607f4de5ca42ae74c753f89340"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powerflows%2Fpowerflows-dmn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powerflows%2Fpowerflows-dmn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powerflows%2Fpowerflows-dmn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powerflows%2Fpowerflows-dmn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/powerflows","download_url":"https://codeload.github.com/powerflows/powerflows-dmn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036063,"owners_count":21037092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decision-engine","decision-tables","dmn","dmn-engine","dmn-model","evaluation","evaluation-framework","feel","groovy","java","javascript","kotlin","kotlin-dsl","mvel","rule-engine","rules","rules-engine","xml","yaml"],"created_at":"2024-10-02T01:05:14.038Z","updated_at":"2025-04-09T12:05:45.641Z","avatar_url":"https://github.com/powerflows.png","language":"Java","readme":"[![Build Status](https://travis-ci.org/powerflows/powerflows-dmn.svg?branch=master)](https://travis-ci.org/powerflows/powerflows-dmn)\n[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=org.powerflows%3Admn\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=org.powerflows%3Admn)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=org.powerflows%3Admn\u0026metric=coverage)](https://sonarcloud.io/component_measures?id=org.powerflows%3Admn\u0026metric=coverage)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.powerflows/dmn-engine/badge.svg)](https://mvnrepository.com/artifact/org.powerflows)\n[![Java Doc](http://www.javadoc.io/badge/org.powerflows/dmn-engine.svg?color=brightgreen)](http://www.javadoc.io/doc/org.powerflows/dmn-engine)\n# About Power Flows DMN\nPower Flows DMN - a powerful decision engine.\n\n\n# Getting Started\nDepending on you would like to use the version 2.x.x (recommended as the latest version) or 1.x.x \nthere are 2 different ways of importing dependencies.\n\n## Version 2.x.x\n\nThe Power Flows DMN can be imported as a dependency via:\n\n### Maven\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.powerflows\u003c/groupId\u003e\n    \u003cartifactId\u003edmn-engine\u003c/artifactId\u003e\n    \u003cversion\u003e2.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\nSince in version 2.0.0 Power Flows DMN has been divided into modules,\na developer can decide what features have to be imported to his project. \nTherefore, the first decision will be which modeling format of decision tables to be supported. \nThere is a choice between:\n* YAML file - requires **dmn-io-yaml** dependency\n* XML file - requires **dmn-io-xml** dependency\n* Java/Groovy file (fluent and functional) - delivered with **dmn-engine** dependency. In order to use Groovy style, dependency to Groovy is required as well.\n* Kotlin DSL - requires **dmn-kotlin-dsl** dependency\n\n**Surely, Power Flows DMN supports all of them within a single application.**\n\nThe next step is to add dependencies of expression evaluation languages. \nThe developer can use the all of some of them:\n* Literals - delivered with **dmn-engine** dependency\n* FEEL - requires **dmn-feel-evaluation-provider** dependency\n* JUEL - requires **dmn-juel-evaluation-provider** dependency\n* Groovy - requires **dmn-groovy-evaluation-provider** dependency\n* MVEL - requires **dmn-mvel-evaluation-provider** dependency\n* JavaScript - requires **dmn-javascript-evaluation-provider** dependency\n\nOptional dependencies:\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.powerflows\u003c/groupId\u003e\n    \u003cartifactId\u003edmn-io-yaml\u003c/artifactId\u003e\n    \u003cversion\u003e2.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.powerflows\u003c/groupId\u003e\n    \u003cartifactId\u003edmn-io-xml\u003c/artifactId\u003e\n    \u003cversion\u003e2.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.powerflows\u003c/groupId\u003e\n    \u003cartifactId\u003edmn-kotlin-dsl\u003c/artifactId\u003e\n    \u003cversion\u003e2.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.powerflows\u003c/groupId\u003e\n    \u003cartifactId\u003edmn-feel-evaluation-provider\u003c/artifactId\u003e\n    \u003cversion\u003e2.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.powerflows\u003c/groupId\u003e\n    \u003cartifactId\u003edmn-juel-evaluation-provider\u003c/artifactId\u003e\n    \u003cversion\u003e2.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.powerflows\u003c/groupId\u003e\n    \u003cartifactId\u003edmn-groovy-evaluation-provider\u003c/artifactId\u003e\n    \u003cversion\u003e2.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.powerflows\u003c/groupId\u003e\n    \u003cartifactId\u003edmn-mvel-evaluation-provider\u003c/artifactId\u003e\n    \u003cversion\u003e2.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.powerflows\u003c/groupId\u003e\n    \u003cartifactId\u003edmn-javascript-evaluation-provider\u003c/artifactId\u003e\n    \u003cversion\u003e2.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\n```gradle    \ncompile group: 'org.powerflows', name: 'dmn-engine', version: '2.1.0'\n```\n\nOptional dependencies:\n```gradle    \ncompile group: 'org.powerflows', name: 'dmn-io-yaml', version: '2.1.0'\ncompile group: 'org.powerflows', name: 'dmn-io-xml', version: '2.1.0'\ncompile group: 'org.powerflows', name: 'dmn-kotlin-dsl', version: '2.1.0'\ncompile group: 'org.powerflows', name: 'dmn-feel-evaluation-provider', version: '2.1.0'\ncompile group: 'org.powerflows', name: 'dmn-juel-evaluation-provider', version: '2.1.0'\ncompile group: 'org.powerflows', name: 'dmn-groovy-evaluation-provider', version: '2.1.0'\ncompile group: 'org.powerflows', name: 'dmn-mvel-evaluation-provider', version: '2.1.0'\ncompile group: 'org.powerflows', name: 'dmn-javascript-evaluation-provider', version: '2.1.0'\n```\n### Grape\n```groovy\n@Grapes(\n    @Grab(group='org.powerflows', module='dmn-engine', version='2.1.0')\n)\n```   \nOptional dependencies:\n```groovy\n@Grapes([\n    @Grab(group='org.powerflows', module='dmn-io-yaml', version='2.1.0'),\n    @Grab(group='org.powerflows', module='dmn-io-xml', version='2.1.0'),\n    @Grab(group='org.powerflows', module='dmn-kotlin-dsl', version='2.1.0'),\n    @Grab(group='org.powerflows', module='dmn-feel-evaluation-provider', version='2.1.0'),\n    @Grab(group='org.powerflows', module='dmn-juel-evaluation-provider', version='2.1.0'), \n    @Grab(group='org.powerflows', module='dmn-groovy-evaluation-provider', version='2.1.0'),\n    @Grab(group='org.powerflows', module='dmn-mvel-evaluation-provider', version='2.1.0'),\n    @Grab(group='org.powerflows', module='dmn-javascript-evaluation-provider', version='2.1.0')   \n])\n```  \n\n## Version 1.x.x\n\nThe Power Flows DMN can be imported as a dependency via:\n\n### Maven\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.powerflows\u003c/groupId\u003e\n    \u003cartifactId\u003edmn\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\n```gradle    \ncompile group: 'org.powerflows', name: 'dmn', version: '1.1.1'\n```\n\n### Grape\n```groovy\n@Grapes(\n    @Grab(group='org.powerflows', module='dmn', version='1.1.1')\n)\n```   \n \nOther ways to import, visit Maven Central repo [https://mvnrepository.com/artifact/org.powerflows/dmn](https://mvnrepository.com/artifact/org.powerflows/dmn) \n\n\n\n# Define your DMN model\nPower Flows model has been designed as an easy to describe and maintain file. The file contains information about input and output data. The additional division is section with rules and their input and output entries.\n\nPower Flows supports the model in the following formats:\n* YAML file;\n* XML file;\n* Java / Groovy file.\n    * Fluent\n    * Functional\n* Kotlin DSL\n## YAML file\n\n```yaml\nid: loan_qualifier\nname: Loan qualifier\nhit-policy: COLLECT\nexpression-type: FEEL\nfields:\n  in:\n    age:\n      type: INTEGER\n    activeLoansNumber:\n      description: Number of active loans on user's account\n      type: INTEGER\n      expression-type: LITERAL\n    startDate:\n      type: DATE\n  out:\n    loanAmount:\n      description: Loan amount in Euro\n      type: DOUBLE\n    loanTerm:\n      description: Loan term in months\n      type: INTEGER\nrules:\n- description: Loan for 18 years\n  in:\n    age: 18\n    activeLoansNumber: 0\n    startDate: '[date and time(\"2019-01-01T12:00:00\")..date and time(\"2019-12-31T12:00:00\")]'\n  out:\n    loanAmount: 10000\n    loanTerm: 12\n- in:\n    age: 18\n    startDate: '[date and time(\"2019-03-01T12:00:00\")..date and time(\"2019-03-31T12:00:00\")]'\n  out:\n    loanAmount: 15000\n    loanTerm: 6\n- description: Loan for older than 18 years\n  in:\n    age: '\u003e18'\n  out:\n    loanAmount: 20000\n    loanTerm: 12\n\n```\n\n## Java / Groovy file\n### Using fluent style\n```groovy\nDecision decision = Decision.fluentBuilder()\n.id(\"loan_qualifier\")\n.name(\"Loan qualifier\")\n.hitPolicy(HitPolicy.COLLECT)\n.expressionType(ExpressionType.FEEL)\n.withInputs()\n    .name(\"age\")\n    .type(ValueType.INTEGER)\n    .next()\n    .name(\"activeLoansNumber\")\n    .description(\"Number of active loans on user's account\")\n    .type(ValueType.INTEGER)\n    .withExpression()\n        .type(ExpressionType.LITERAL)\n        .and()\n    .next()\n    .name(\"startDate\")\n    .type(ValueType.DATE)\n.end()\n.withOutputs()\n    .name(\"loanAmount\")\n    .description(\"Loan amount in Euro\")\n    .type(ValueType.DOUBLE)\n    .next()\n    .name(\"loanTerm\")\n    .description(\"Loan term in months\")\n    .type(ValueType.INTEGER)\n.end()\n.withRules()\n    .description(\"Loan for 18 years\")\n    .withInputEntries()\n        .name(\"age\")\n        .withExpression()\n            .type(ExpressionType.FEEL)\n            .value(18)\n            .and()\n        .next()\n        .name(\"activeLoansNumber\")\n        .evaluationMode(EvaluationMode.INPUT_COMPARISON)\n        .withExpression()\n            .type(ExpressionType.LITERAL)\n            .value(0)\n            .and()\n        .next()\n        .name(\"startDate\")\n        .withExpression()\n            .type(ExpressionType.FEEL)\n            .value(\"[date and time(\\\"2019-01-01T12:00:00\\\")..date and time(\\\"2019-12-31T12:00:00\\\")]\")\n            .and()\n    .end()\n    .withOutputEntries()\n        .name(\"loanAmount\")\n        .withExpression()\n            .type(ExpressionType.LITERAL)\n            .value(10000)\n            .and()\n        .next()\n        .name(\"loanTerm\")\n        .withExpression()\n            .type(ExpressionType.LITERAL)\n            .value(12)\n            .and()\n    .end()\n    .next()\n    .withInputEntries()\n        .name(\"age\")\n        .evaluationMode(EvaluationMode.INPUT_COMPARISON)\n        .withExpression()\n            .type(ExpressionType.LITERAL)\n            .value(18)\n            .and()\n        .next()\n        .name(\"startDate\")\n        .withExpression()\n            .type(ExpressionType.FEEL)\n            .value(\"[date and time(\\\"2019-03-01T12:00:00\\\")..date and time(\\\"2019-03-31T12:00:00\\\")]\")\n            .and()\n    .end()\n    .withOutputEntries()\n        .name(\"loanAmount\")\n        .withExpression()\n            .type(ExpressionType.LITERAL)\n            .value(15000)\n.           and()\n        .next()\n        .name(\"loanTerm\")\n        .withExpression()\n            .type(ExpressionType.LITERAL)\n            .value(6)\n            .and()\n    .end()\n    .next()\n    .withInputEntries()\n        .name(\"age\")\n        .withExpression()\n            .type(ExpressionType.FEEL)\n            .value(\"\u003e18\")\n            .and()\n    .end()\n    .withOutputEntries()\n        .name(\"loanAmount\")\n        .withExpression()\n            .type(ExpressionType.LITERAL)\n            .value(20000)\n            .and()\n        .next()\n        .name(\"loanTerm\")\n        .withExpression()\n            .type(ExpressionType.LITERAL)\n            .value(12)\n            .and()\n    .end()\n.end()\n.build();\n```\n### Using functional style\n```java\nDecision decision = Decision.builder()\n.id(\"loan_qualifier\")\n.name(\"Loan qualifier\")\n.hitPolicy(HitPolicy.COLLECT)\n.expressionType(ExpressionType.FEEL)\n.withInput(in -\u003e in\n        .name(\"age\")\n        .type(ValueType.INTEGER)\n        .build())\n.withInput(in -\u003e in\n        .name(\"activeLoansNumber\")\n        .description(\"Number of active loans on user's account\")\n        .type(ValueType.INTEGER)\n        .withExpression(ex -\u003e ex\n                .type(ExpressionType.LITERAL)\n                .build())\n        .build())\n.withInput(in -\u003e in\n        .name(\"startDate\")\n        .type(ValueType.DATE)\n        .build())\n.withOutput(out -\u003e out\n        .name(\"loanAmount\")\n        .description(\"Loan amount in Euro\")\n        .type(ValueType.DOUBLE)\n        .build())\n.withOutput(out -\u003e out\n        .name(\"loanTerm\")\n        .description(\"Loan term in months\")\n        .type(ValueType.INTEGER)\n        .build())\n.withRule(rule -\u003e rule\n        .description(\"Loan for 18 years\")\n        .withInputEntry(in -\u003e in\n                .name(\"age\")\n                .evaluationMode(EvaluationMode.INPUT_COMPARISON)\n                .withExpression(ex -\u003e ex\n                        .type(ExpressionType.LITERAL)\n                        .value(18)\n                        .build())\n                .build())\n        .withInputEntry(in -\u003e in\n                .name(\"activeLoansNumber\")\n                .evaluationMode(EvaluationMode.INPUT_COMPARISON)\n                .withExpression(ex -\u003e ex\n                        .type(ExpressionType.LITERAL)\n                        .value(0)\n                        .build())\n                .build())\n        .withInputEntry(in -\u003e in\n                .name(\"startDate\")\n                .withExpression(ex -\u003e ex\n                        .type(ExpressionType.FEEL)\n                        .value(\"[date and time(\\\"2019-01-01T12:00:00\\\")..date and time(\\\"2019-12-31T12:00:00\\\")]\")\n                        .build())\n                .build())\n        .withOutputEntry(out -\u003e out\n                .name(\"loanAmount\")\n                .withExpression(ex -\u003e ex\n                        .type(ExpressionType.LITERAL)\n                        .value(10000)\n                        .build())\n                .build())\n        .withOutputEntry(out -\u003e out\n                .name(\"loanTerm\")\n                .withExpression(ex -\u003e ex\n                        .type(ExpressionType.LITERAL)\n                        .value(12)\n                        .build())\n                .build())\n        .build())\n.withRule(rule -\u003e rule\n        .withInputEntry(in -\u003e in\n                .name(\"age\")\n                .withExpression(ex -\u003e ex\n                        .type(ExpressionType.FEEL)\n                        .value(18)\n                        .build())\n                .build())\n        .withInputEntry(in -\u003e in\n                .name(\"startDate\")\n                .withExpression(ex -\u003e ex\n                        .type(ExpressionType.FEEL)\n                        .value(\"[date and time(\\\"2019-03-01T12:00:00\\\")..date and time(\\\"2019-03-31T12:00:00\\\")]\")\n                        .build())\n                .build())\n        .withOutputEntry(out -\u003e out\n                .name(\"loanAmount\")\n                .withExpression(ex -\u003e ex\n                        .type(ExpressionType.LITERAL)\n                        .value(15000)\n                        .build())\n                .build())\n        .withOutputEntry(out -\u003e out\n                .name(\"loanTerm\")\n                .withExpression(ex -\u003e ex\n                        .type(ExpressionType.LITERAL)\n                        .value(6)\n                        .build())\n                .build())\n        .build())\n.withRule(rule -\u003e rule\n        .withInputEntry(in -\u003e in\n                .name(\"age\")\n                .withExpression(ex -\u003e ex\n                        .type(ExpressionType.FEEL)\n                        .value(\"\u003e18\")\n                        .build())\n                .build())\n        .withOutputEntry(out -\u003e out\n                .name(\"loanAmount\")\n                .withExpression(ex -\u003e ex\n                        .type(ExpressionType.LITERAL)\n                        .value(20000)\n                        .build())\n                .build())\n        .withOutputEntry(out -\u003e out\n                .name(\"loanTerm\")\n                .withExpression(ex -\u003e ex\n                        .type(ExpressionType.LITERAL)\n                        .value(12)\n                        .build())\n                .build())\n        .build())\n.build();\n```\n## Kotlin DSL\n```kotlin\ndecision {\n    id = \"loan_qualifier\"\n    name = \"Loan qualifier\"\n    hitPolicy = HitPolicy.COLLECT\n    expressionType = ExpressionType.FEEL\n    inputs {\n        input(\"age\") {\n            type = ValueType.INTEGER\n        }\n        input(\"activeLoansNumber\") {\n            description = \"Number of active loans on user's account\"\n            type = ValueType.INTEGER\n            expression(ExpressionType.LITERAL)\n        }\n        input(\"startDate\") {\n            type = ValueType.DATE\n        }\n    }\n    outputs {\n        output(\"loanAmount\") {\n            description = \"Loan amount in Euro\"\n            type = ValueType.DOUBLE\n        }\n        output(\"loanTerm\") {\n            description = \"Loan term in months\"\n            type = ValueType.INTEGER\n        }\n    }\n    rules {\n        rule {\n            input(\"age\") {\n                value = 18\n            }\n            input(\"activeLoansNumber\")\n            input(\"startDate\") {\n                expression(\"[date and time(\\\"2019-01-01T12:00:00\\\")..date and time(\\\"2019-12-31T12:00:00\\\")]\")\n            }\n            output(\"loanAmount\") {\n                value = 10000\n            }\n            output(\"loanTerm\") {\n                value = 12\n            }\n        }\n        rule {\n            input(\"age\") {\n                value = 18\n            }\n            input(\"startDate\") {\n                expression(\"[date and time(\\\"2019-03-01T12:00:00\\\")..date and time(\\\"2019-03-31T12:00:00\\\")]\")\n            }\n            output(\"loanAmount\") {\n                value = 15000\n            }\n            output(\"loanTerm\") {\n                value = 6\n            }\n        }\n        rule {\n            description = \"Loan for older than 18 years\"\n            input(\"age\") {\n                expression(\"\u003e18\")\n            }\n            output(\"loanAmount\") {\n                value = 20000\n            }\n            output(\"loanTerm\") {\n                value = 12\n            }\n        }\n    }\n}\n```\n# Use IO to import/export your model\nThanks to IO module there is a possibility to:\n* Read decisions from Power Flows *.yml files;\n* Read decisions from DMN 1.1 *.xml files;\n* Write decisions to *.yml files.\n\n## Reading\nThe follow example shows how to read *.yml file and get decision object.\nFirst of all input stream is needed. Then, using YamlDecisionReader class a developer can read the decision from the input stream.\n\nCreate input stream from file:\n\n```java\nFile loanQualifierFile = new File(\"loan-qualifier.yml\");\nInputStream loanQualifierInputStream = new FileInputStream(loanQualifierFile);\n```\n\nor from resource:\n\n```java\nInputStream loanQualifierInputStream = this.class.getResourceAsStream(\"loan-qualifier.yml\");\n```\n\nAnd read the input stream:\n\n```java\nOptional\u003cDecision\u003e loanQualifierDecision = new YamlDecisionReader().read(loanQualifierInputStream);\n```\n\nAnother source of Decision may be OMG defined DMN 1.1 compatible XML file.\n\nCreate input stream from file:\n\n```java\nFile loanQualifierFile = new File(\"loan-qualifier.xml\");\nInputStream loanQualifierInputStream = new FileInputStream(loanQualifierFile);\n```\n\nor from resource:\n\n```java\nInputStream loanQualifierInputStream = this.class.getResourceAsStream(\"loan-qualifier.xml\");\n```\n\nAnd read the input stream:\n\n```java\nOptional\u003cDecision\u003e loanQualifierDecision = new XmlDecisionReader().read(loanQualifierInputStream);\n```\nCurrently only reading of decision tables from _decision_ tags is supported.\n\n## Writing\nThe IO module can be used to conversion between different formats. For now the only one supported is *.yml.\n\n```java\nDecision decision = ... //here developer has to build a valid decision object or read from *.yml or *.xml file\n\nDecisionWriter writer = new YamlDecisionWriter();\nFileOutputStream outputStream = new FileOutputStream(\"your-decision-file-name.yml\");\n\nwriter.write(decision, outputStream);\n```\n\n# Decision Engine for decisions evaluation\nA decision engine is a service that allows evaluation of decision tables. Default decision engine instance can be created using\nDefaultDecisionEngineConfiguration class. Decision engine expects decision object and decision variables.\n\n## Evaluation\nThe result of an evaluation process is decision result object.\n\n```java\nDecision decision = ... //here developer has to build a valid decision object or read from *.yml or *.xml file\nDecisionEngine decisionEngine = new DefaultDecisionEngineConfiguration().configure();\n\nSimpleDateFormat format = new SimpleDateFormat(\"yyyy-MM-dd\");\n\nMap\u003cString, Serializable\u003e variables = new HashMap\u003c\u003e();\nvariables.put(\"age\", 18);\nvariables.put(\"activeLoansNumber\", 0);\nvariables.put(\"startDate\", format.parse(\"2019-01-05\"));\nDecisionVariables decisionVariables = new DecisionVariables(variables);\n\nDecisionResult decisionResult = decisionEngine.evaluate(decision, decisionVariables);\n```\nThe decision result has methods like follows:\n```java\ndecisionResult.isSingleEntryResult();\ndecisionResult.isSingleRuleResult();\ndecisionResult.isCollectionRulesResult();\ndecisionResult.getSingleEntryResult();\ndecisionResult.getSingleRuleResult();\ndecisionResult.getCollectionRulesResult();\n```\n\n## Supported languages\nPower Flows supports evaluation in following languages:\n* FEEL\n* JUEL\n* Groovy\n* MVEL\n* JavaScript\n\n## Much more features\nPower Flows brings with it lots of features described in [WIKI](https://github.com/powerflows/powerflows-dmn/wiki).\n\n### [How to contribute to the repository](CONTRIBUTING.md)\n\n# License\nCopyright (c) 2018-present Power Flows. All rights reserved.\n\nPower Flows DMN Model is Open Source software released under the [Apache 2.0 license.](http://www.apache.org/licenses/LICENSE-2.0.html)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowerflows%2Fpowerflows-dmn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpowerflows%2Fpowerflows-dmn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowerflows%2Fpowerflows-dmn/lists"}