Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #656

Merged
merged 3 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

## Useful information

* [Documentation](https://goldmansachs.github.io/jdmn/)
* [Documentation](https://github.com/goldmansachs/jdmn/blob/master/docs/index.md)
* [Getting started with jDMN](https://github.com/goldmansachs/jdmn/blob/master/docs/getting-started.md)
* [FAQ](https://github.com/goldmansachs/jdmn/blob/master/docs/faq/index.md)
* [Resources](https://github.com/goldmansachs/jdmn/blob/master/docs/resources.md)
Expand Down
22 changes: 11 additions & 11 deletions docs/faq/general.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

DMN models can be executed in jDMN in two ways:
* interpretation on JVM
* translation to Java, followed by the execution of the generated code on JVM.
* translation to the target language (e.g. Java or Python), followed by the execution of the generated code on JVM.

For more information please look at the other [FAQs](index.md).

Expand All @@ -16,8 +16,8 @@ DMN models can be read as follows:
```
BuildLogger LOGGER = new Slf4jBuildLogger(LoggerFactory.getLogger("logger"));
File input = new File("model.dmn");
DMNReader reader = new DMNReader(LOGGER, false);
TDefinitions definitions = reader.read(input).getLeft();
DMNSerializer reader = new XMLDMNSerializer(LOGGER, false);
TDefinitions definitions = reader.readModel(input);
```

## How to validate a DMN model?
Expand All @@ -27,20 +27,20 @@ DMN models can be validated at the syntax level (XSD schema validation) as follo
```
BuildLogger LOGGER = new Slf4jBuildLogger(LoggerFactory.getLogger("logger"));
File input = new File("model.dmn");
DMNReader reader = new DMNReader(LOGGER, true);
TDefinitions definitions = reader.read(input).getLeft();
DMNSerializer reader = new XMLDMNSerializer(LOGGER, false);
TDefinitions definitions = reader.readModel(input);
```

DMN models can be validated at the semantic level by implementing the ```DMNValidator``` interface. jDMN provides a default implementation.

```
BuildLogger LOGGER = new Slf4jBuildLogger(LoggerFactory.getLogger("logger"));
File input = new File("model.dmn");
DMNReader reader = new DMNReader(LOGGER, false);
Pair<TDefinitions, PrefixNamespaceMappings> pair = reader.read(input);
DMNSerializer reader = new XMLDMNSerializer(LOGGER, false);
TDefinitions definitions = reader.readModel(input);

DMNValidator validator = new DefaultDMNValidator();
validator.validate(new DMNModelRepository(pair));
validator.validate(new DMNModelRepository(definitions));
```

## How to transform a DMN model?
Expand All @@ -50,11 +50,11 @@ DMN models can be transformed by implementing the ```DMNTransformer``` interface
```
BuildLogger LOGGER = new Slf4jBuildLogger(LoggerFactory.getLogger("logger"));
File input = new File("model.dmn");
DMNReader reader = new DMNReader(LOGGER, false);
Pair<TDefinitions, PrefixNamespaceMappings> pair = reader.read(input);
DMNSerializer reader = new XMLDMNSerializer(LOGGER, false);
TDefinitions definitions = reader.readModel(input);

DMNTransformer<TestCases> transformer = new ToQuotedNameTransformer(LOGGER);
transformer.transform(new DMNModelRepository(pair));
transformer.transform(new DMNModelRepository(definitions));
```

## What is a jDMN dialect?
Expand Down
8 changes: 5 additions & 3 deletions docs/faq/interpretation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Follow the steps:
// Read DMN file
BuildLogger LOGGER = new Slf4jBuildLogger(LoggerFactory.getLogger("logger"));
File input = new File("model.dmn");
DMNReader reader = new DMNReader(LOGGER, true);
Pair<TDefinitions, PrefixNamespaceMappings> pair = reader.read(input);
DMNSerializer reader = new XMLDMNSerializer(LOGGER, false);
TDefinitions definitions = reader.readModel(input);

// Create interpreter
MixedJavaTimeDMNDialectDefinition dialect = new MixedJavaTimeDMNDialectDefinition();
Expand All @@ -21,7 +21,9 @@ Follow the steps:
// Evaluate decision
String namespace = "http://www.provider.com/model-id";
String decisionName = "Decision A";
TDecision decision = (TDecision) repository.findDRGElementByName(repository.getRootDefinitions(), decisionName);

Map<String, Object> inputs = new LinkedHashMap<>();
inputs.put("income", BigDecimal.valueOf(10000));
Object result = interpreter.evaluateDecision(namespace, decisionName, inputs);
interpreter.evaluateDecision(namespace, decisionName, EvaluationContext.makeDecisionEvaluationContext(decision, inputs));
```
17 changes: 9 additions & 8 deletions docs/faq/translation.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,13 @@ More examples in the pom of the [dmn-tck-integration-tests](https://github.com/g
For example:

```
com.gs.dmn.generated.example_credit_decision.GenerateOutputData generateOutputData = new com.gs.dmn.generated.example_credit_decision.GenerateOutputData();

java.math.BigDecimal currentRiskAppetite = number("50");
java.math.BigDecimal lendingThreshold = number("25");
com.gs.dmn.generated.example_credit_decision.type.Applicant applicant = new com.gs.dmn.generated.example_credit_decision.type.ApplicantImpl(number("38"), number("100"), "Amy", asList("Late payment"));

com.gs.dmn.runtime.annotation.AnnotationSet annotationSet_ = new com.gs.dmn.runtime.annotation.AnnotationSet();
List<com.gs.dmn.generated.example_credit_decision.type.GenerateOutputData> generateOutputData = this.generateOutputData.apply(applicant, currentRiskAppetite, lendingThreshold, annotationSet_);
// Initialize input data
com.gs.dmn.generated.other.decision_table_with_annotations.type.TA structA = new com.gs.dmn.generated.other.decision_table_with_annotations.type.TAImpl("A", number("5"));

// Evaluate decision 'priceGt10'
com.gs.dmn.runtime.ExecutionContext context_ = new com.gs.dmn.runtime.ExecutionContext();
com.gs.dmn.runtime.cache.Cache cache_ = context_.getCache();
new PriceGt10().apply(structA, context_);
```

## How to optimize the translator?
Expand Down Expand Up @@ -233,3 +232,5 @@ The following configuration is needed:
. . .
</inputParameters>
```

More examples in the [dmn-tck-integration-tests](https://github.com/goldmansachs/jdmn/blob/master/dmn-tck-it/dmn-tck-it-translator) module.
8 changes: 8 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Getting started with jDMN

## Introduction:

jDMN is an collection of processors for DMN implemented in Java:
- interpreter
- cross-transpilers to Java, Kotlin and Python

More details are [here(https://github.com/goldmansachs/jdmn/blob/master/docs/jDMN.pdf)]

## Requirements:

### Java 8 or higher
Expand Down
Binary file added docs/jDMN.pdf
Binary file not shown.
Binary file modified docs/jDMN.pptx
Binary file not shown.
8 changes: 2 additions & 6 deletions docs/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@

## Conferences

* [DecisionCAMP 2021](https://decisioncamp2021.wordpress.com/)
* [DecisionCAMP 2020](https://decisioncamp2020.home.blog/)
* [DecisionCAMP 2019](https://decisioncamp2019.wordpress.com/)
* [DecisionCAMP 2018](https://decisioncamp2018.wordpress.com/)
* [DecisionCAMP 2017](http://2017.ruleml-rr.org/decisioncamp-2017/)
* [DecisionCAMP 2016](http://2016.ruleml.org/decisioncamp)
* [DecisionCAMP conferences](https://dmcommunity.org/decisioncamp/)

## Research articles

* [Performance and Scalability of DMN-Based LCNC Platforms, Models 2023](https://www.computer.org/csdl/proceedings-article/models-c/2023/249800a863/1T96uSBctEI)
* [A Modern Appraisal of Decision Tables. A CODASYL Report, 1982](articles/A%20Modern%20Appraisal%20of%20Decision%20Tables.%20A%20CODASYL%20Report.pdf)
* [Semantics and Analysis of DMN Decision Tables, 2016](articles/Semantics%20and%20Analysis%20of%20DMN%20Decision%20Tables.pdf)
* [Semantics, Analysis and Simplification of DMN Decision Tables](articles/Semantics,%20Analysis%20and%20Simplification%20of%20DMN%20Decision%20Tables.pdf)
Expand Down
Loading