Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Verification for Decision Model and Notation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Blatt
Verification for Decision Model and Notation
Commits
fa6ad7ed
Commit
fa6ad7ed
authored
5 years ago
by
Jonas Blatt
Browse files
Options
Downloads
Patches
Plain Diff
First try, not finished yet
parent
ce2b6c9e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dmnverifierapi/src/main/java/de/unikoblenz/fgbks/core/dmn/verification/verifier/impl/PartialReductionVerifier.java
+53
-0
53 additions, 0 deletions
.../verification/verifier/impl/PartialReductionVerifier.java
with
53 additions
and
0 deletions
dmnverifierapi/src/main/java/de/unikoblenz/fgbks/core/dmn/verification/verifier/impl/PartialReductionVerifier.java
+
53
−
0
View file @
fa6ad7ed
...
...
@@ -6,14 +6,25 @@ import static de.unikoblenz.fgbks.core.dmn.domain.vdmn.utils.VDmnFunctions.getRu
import
static
de
.
unikoblenz
.
fgbks
.
core
.
dmn
.
domain
.
vdmn
.
utils
.
VDmnFunctions
.
templateDecision
;
import
static
de
.
unikoblenz
.
fgbks
.
core
.
dmn
.
verification
.
result
.
actions
.
VerificationFix
.
SHOW_RULES
;
import
de.unikoblenz.fgbks.base.domain.Name
;
import
de.unikoblenz.fgbks.core.dmn.domain.common.RowNumber
;
import
de.unikoblenz.fgbks.core.dmn.domain.ids.InputEntryId
;
import
de.unikoblenz.fgbks.core.dmn.domain.ids.RuleId
;
import
de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDecision
;
import
de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDecisionTable
;
import
de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnInputColumn
;
import
de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnInputValue
;
import
de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnRule
;
import
de.unikoblenz.fgbks.core.dmn.domain.vdmn.impl.VDmnInputValueImpl
;
import
de.unikoblenz.fgbks.core.dmn.domain.vdmn.impl.VDmnRuleChangeableImpl
;
import
de.unikoblenz.fgbks.core.dmn.domain.vdmn.impl.VDmnRuleImpl
;
import
de.unikoblenz.fgbks.core.dmn.domain.vdmn.utils.VDmnFunctions
;
import
de.unikoblenz.fgbks.core.dmn.verification.result.VerificationResultEntry.VerificationClassification
;
import
de.unikoblenz.fgbks.core.dmn.verification.result.VerificationResultEntryElement
;
import
de.unikoblenz.fgbks.core.dmn.verification.result.actions.Action
;
import
de.unikoblenz.fgbks.core.dmn.verification.result.actions.ActionScope
;
import
de.unikoblenz.fgbks.core.dmn.verification.result.actions.ActionType
;
import
de.unikoblenz.fgbks.core.dmn.verification.result.actions.VerificationFix
;
import
de.unikoblenz.fgbks.core.dmn.verification.verifier.AbstractVerifier
;
import
de.unikoblenz.fgbks.core.dmn.verification.verifier.DmnVerifier
;
import
de.unikoblenz.fgbks.core.dmn.verification.verifier.types.PartialReductionVerification
;
...
...
@@ -41,6 +52,7 @@ public class PartialReductionVerifier extends AbstractVerifier {
List
<
VDmnInputColumn
>
inColumns
,
int
i
,
List
<
VDmnRule
>
clusterRules
,
boolean
hasCombination
)
{
if
(
i
==
inColumns
.
size
())
{
if
(
hasCombination
)
{
createCombinedRule
(
inColumns
,
clusterRules
);
clusterRules
.
forEach
(
rule
->
vreFactory
.
addElement
(
VerificationResultEntryElement
.
create
(
rule
)));
vreFactory
.
addVerificationFix
(
SHOW_RULES
);
...
...
@@ -48,6 +60,7 @@ public class PartialReductionVerifier extends AbstractVerifier {
VerificationClassification
.
INFO
,
templateDecision
(
inColumns
.
get
(
0
).
getDmnDecision
())
+
"Rules %s can be combined."
,
getRulesRowsStrings
(
clusterRules
));
}
}
else
{
List
<
VDmnInputValue
>
rules
=
...
...
@@ -97,4 +110,44 @@ public class PartialReductionVerifier extends AbstractVerifier {
}
}
}
private
void
createCombinedRule
(
List
<
VDmnInputColumn
>
inColumns
,
List
<
VDmnRule
>
clusterRules
)
{
// Combined Rule:
VDmnRuleChangeableImpl
r
=
new
VDmnRuleChangeableImpl
(
VDmnRuleImpl
.
getBuilder
()
.
withRuleId
(
new
RuleId
(
"TODO"
))
.
addInputValue
(
clusterRules
.
get
(
1
).
getDmnInputValues
().
get
(
0
))
.
withDmnDecisionTable
(
inColumns
.
get
(
0
).
getDmnDecisionTable
())
.
withRowNumber
(
new
RowNumber
(
999L
))
.
build
());
for
(
int
x
=
0
;
x
<
inColumns
.
size
();
x
++)
{
r
.
setInputValue
(
x
,
VDmnInputValueImpl
.
getBuilder
()
.
withInputEntryId
(
new
InputEntryId
(
"TODO"
))
.
withText
(
""
)
.
withBoundary
(
clusterRules
.
get
(
0
)
.
getDmnInputValues
()
.
get
(
x
)
.
getBoundary
()
.
createBi
(
COMBINE
,
clusterRules
.
get
(
1
).
getDmnInputValues
().
get
(
x
).
getBoundary
())
.
get
())
.
withDmnInputColumn
(
inColumns
.
get
(
x
))
.
withDmnRule
(
r
)
.
build
());
}
vreFactory
.
addVerificationFix
(
VerificationFix
.
getBuilder
()
.
withFixName
(
new
Name
(
"Combine"
))
.
addAction
(
Action
.
getBuilder
()
.
withActionScope
(
ActionScope
.
RULE
)
.
withActionType
(
ActionType
.
CREATE
)
.
addValue
(
"value"
,
r
.
toString
())
// TODO
.
build
())
.
build
()
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment