Skip to content

Commit

Permalink
DMN 15b - no-name imports
Browse files Browse the repository at this point in the history
  • Loading branch information
StrayAlien committed Aug 6, 2024
1 parent b01a742 commit b91b4c5
Show file tree
Hide file tree
Showing 67 changed files with 1,727 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions namespace="http://www.montera.com.au/spec/DMN/1158-noname-imports-001-A"
name="1158-noname-imports-001-A"
id="_i9fboPUUEeesLuP4RHs4vA"
xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/"
>
<import namespace="http://www.montera.com.au/spec/DMN/1158-noname-imports-001-B"
name=""
importType="https://www.omg.org/spec/DMN/20230324/MODEL/"
/>

<!-- references an informationRequirement from an import -->
<decision name="decision001" id="_decision001">
<variable name="decision001"/>
<informationRequirement>
<requiredDecision href="#_model_b_decision001"/>
</informationRequirement>
<literalExpression>
<text>model_b_decision001</text>
</literalExpression>
</decision>

<!-- references an knowledgeRequirement from an import -->
<decision name="decision002" id="_decision002">
<variable name="decision002"/>
<knowledgeRequirement>
<requiredKnowledge href="#_model_b_bkm001"/>
</knowledgeRequirement>
<literalExpression>
<text>model_b_bkm001()</text>
</literalExpression>
</decision>

<!-- references an inputData from an import -->
<decision name="decision003" id="_decision003">
<variable name="decision003"/>
<informationRequirement>
<requiredInput href="#_model_b_input001"/>
</informationRequirement>
<literalExpression>
<text>model_b_input001</text>
</literalExpression>
</decision>

<!-- uses an imported "string" typeRef - two tests will provide a string and a number
as input to assert the correct type is being used (we'll see a null for a number value) -->
<decision name="decision004" id="_decision004">
<variable name="decision004" typeRef="typeRefA"/>
<informationRequirement>
<requiredInput href="#_model_b_input001"/>
</informationRequirement>
<literalExpression>
<text>model_b_input001</text>
</literalExpression>
</decision>


</definitions>

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions namespace="http://www.montera.com.au/spec/DMN/1158-noname-imports-001-B"
name="1158-noname-imports-001-B"
id="_i9fboPUUEeesLuP4RHs4vA"
xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/"
>
<itemDefinition name="typeRefA">
<typeRef>string</typeRef>
</itemDefinition>

<inputData name="model_b_input001" id="_model_b_input001">
<variable name="model_b_input001" typeRef="Any"/>
</inputData>

<!-- decision just returns its own name -->
<decision name="model_b_decision001" id="_model_b_decision001">
<variable name="model_b_decision001"/>
<literalExpression>
<text>"model_b_decision001"</text>
</literalExpression>
</decision>

<!-- BKM just returns its own name -->
<businessKnowledgeModel name="model_b_bkm001" id="_model_b_bkm001">
<variable name="model_b_bkm001"/>
<encapsulatedLogic>
<literalExpression>
<text>"model_b_bkm001"</text>
</literalExpression>
</encapsulatedLogic>
</businessKnowledgeModel>


</definitions>

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Contributed to DMN TCK by StrayAlien -->
<testCases xmlns="http://www.omg.org/spec/DMN/20160719/testcase"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<modelName>1158-noname-imports-001-A.dmn</modelName>

<!-- model A uses a number of no-name imports from model B -->

<testCase id="001">
<description>will import a decision</description>
<resultNode name="decision001" type="decision">
<expected>
<value xsi:type="xsd:string">model_b_decision001</value>
</expected>
</resultNode>
</testCase>

<testCase id="002">
<description>will import a BKM</description>
<resultNode name="decision002" type="decision">
<expected>
<value xsi:type="xsd:string">model_b_bkm001</value>
</expected>
</resultNode>
</testCase>

<testCase id="003">
<description>will import an inputData</description>
<inputNode name="model_b_input001">
<value xsi:type="xsd:string">model_b_input001</value>
</inputNode>
<resultNode name="decision003" type="decision">
<expected>
<value xsi:type="xsd:string">model_b_input001</value>
</expected>
</resultNode>
</testCase>

<testCase id="004">
<!-- imported typeRef is a string, we test a string against it -->
<description>will import a typeRef</description>
<inputNode name="model_b_input001">
<value xsi:type="xsd:string">a string</value>
</inputNode>
<resultNode name="decision004" type="decision">
<expected>
<value xsi:type="xsd:string">a string</value>
</expected>
</resultNode>
</testCase>

<testCase id="004_a">
<!-- imported typeRef is a string, we test a number against it -->
<description>will import a typeRef</description>
<inputNode name="model_b_input001">
<value xsi:type="xsd:decimal">1234</value>
</inputNode>
<resultNode name="decision004" type="decision">
<expected>
<value xsi:nil="true"/>
</expected>
</resultNode>
</testCase>


</testCases>
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions namespace="http://www.montera.com.au/spec/DMN/1158-noname-imports-002-A"
name="1158-noname-imports-002-A"
id="_i9fboPUUEeesLuP4RHs4vA"
xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/"
>
<import namespace="http://www.montera.com.au/spec/DMN/1158-noname-imports-002-B"
name=""
importType="https://www.omg.org/spec/DMN/20230324/MODEL/"
/>

<!-- references an informationRequirement from an import -->
<decision name="decision001" id="_decision001">
<variable name="decision001"/>
<informationRequirement>
<requiredDecision href="#_model_a_decision001"/>
</informationRequirement>
<literalExpression>
<text>model_a_decision001</text>
</literalExpression>
</decision>

<!-- references an knowledgeRequirement from an import -->
<decision name="decision002" id="_decision002">
<variable name="decision002"/>
<knowledgeRequirement>
<requiredKnowledge href="#_model_a_bkm001"/>
</knowledgeRequirement>
<literalExpression>
<text>model_a_bkm001()</text>
</literalExpression>
</decision>

<!-- references an inputData from an import -->
<decision name="decision003" id="_decision003">
<variable name="decision003"/>
<informationRequirement>
<requiredInput href="#_model_a_input001"/>
</informationRequirement>
<literalExpression>
<text>model_a_input001</text>
</literalExpression>
</decision>

<!-- uses an imported "string" typeRef - two tests will provide a string and a number
as input to assert the type is being used (we'll see a null for a number value) -->
<decision name="decision004" id="_decision004">
<variable name="decision004" typeRef="typeRefA"/>
<informationRequirement>
<requiredInput href="#_model_a_input001"/>
</informationRequirement>
<literalExpression>
<text>model_a_input001</text>
</literalExpression>
</decision>


</definitions>

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions namespace="http://www.montera.com.au/spec/DMN/1158-noname-imports-002-B"
name="1158-noname-imports-002-B"
id="_i9fboPUUEeesLuP4RHs4vA"
xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/"
>
<!-- does nothing but effectively import, then re-export everything in model C -->

<import namespace="http://www.montera.com.au/spec/DMN/1158-noname-imports-002-C"
name=""
importType="https://www.omg.org/spec/DMN/20230324/MODEL/"
/>

</definitions>

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions namespace="http://www.montera.com.au/spec/DMN/1158-noname-imports-002-C"
name="1158-noname-imports-002-C"
id="_i9fboPUUEeesLuP4RHs4vA"
xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/"
>
<itemDefinition name="typeRefA">
<typeRef>string</typeRef>
</itemDefinition>

<inputData name="model_a_input001" id="_model_a_input001">
<variable name="model_a_input001" typeRef="Any"/>
</inputData>

<!-- decision just returns its own name -->
<decision name="model_a_decision001" id="_model_a_decision001">
<variable name="model_a_decision001"/>
<literalExpression>
<text>"model_a_decision001"</text>
</literalExpression>
</decision>

<!-- BKM just returns its own name -->
<businessKnowledgeModel name="model_a_bkm001" id="_model_a_bkm001">
<variable name="model_a_bkm001"/>
<encapsulatedLogic>
<literalExpression>
<text>"model_a_bkm001"</text>
</literalExpression>
</encapsulatedLogic>
</businessKnowledgeModel>


</definitions>

Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Contributed to DMN TCK by StrayAlien -->
<testCases xmlns="http://www.omg.org/spec/DMN/20160719/testcase"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<modelName>1158-noname-imports-002-A.dmn</modelName>

<!-- asserting that imports are recursive in that no-name imports of no-name imports
are also considered part of the current model namespace. Here, the model A imports
model B, which subsequently imports stuff from model C. The things in C
are used in A. -->

<!-- Effectively, Model B imports model C then 'exports' it all again -->

<testCase id="001">
<description>will import a decision</description>
<resultNode name="decision001" type="decision">
<expected>
<value xsi:type="xsd:string">model_a_decision001</value>
</expected>
</resultNode>
</testCase>

<testCase id="002">
<description>will import a BKM</description>
<resultNode name="decision002" type="decision">
<expected>
<value xsi:type="xsd:string">model_a_bkm001</value>
</expected>
</resultNode>
</testCase>

<testCase id="003">
<description>will import an inputData</description>
<inputNode name="model_a_input001">
<value xsi:type="xsd:string">model_a_input001</value>
</inputNode>
<resultNode name="decision003" type="decision">
<expected>
<value xsi:type="xsd:string">model_a_input001</value>
</expected>
</resultNode>
</testCase>

<testCase id="004">
<!-- imported typeRef is a string, we test a string against it -->
<description>will import a typeRef</description>
<inputNode name="model_a_input001">
<value xsi:type="xsd:string">a string</value>
</inputNode>
<resultNode name="decision004" type="decision">
<expected>
<value xsi:type="xsd:string">a string</value>
</expected>
</resultNode>
</testCase>

<testCase id="004_a">
<!-- imported typeRef is a string, we test a number against it -->
<description>will import a typeRef</description>
<inputNode name="model_a_input001">
<value xsi:type="xsd:decimal">1234</value>
</inputNode>
<resultNode name="decision004" type="decision">
<expected>
<value xsi:nil="true"/>
</expected>
</resultNode>
</testCase>


</testCases>
Loading

0 comments on commit b91b4c5

Please sign in to comment.