Skip to content
This repository has been archived by the owner on Mar 2, 2020. It is now read-only.

Translate Objectif pseudo code into CEG #471

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open

Conversation

fischJan
Copy link
Collaborator

No description provided.

Daedo and others added 10 commits May 23, 2019 16:39
# Conflicts:
#	bundles/specmate-cause-effect-patterns/.classpath
#	bundles/specmate-integration-test/.classpath
#	bundles/specmate-integration-test/bnd.bnd
#	bundles/specmate-integration-test/resources/test_rules.objectif
#	bundles/specmate-model-generation/bnd.bnd
#	bundles/specmate-model-generation/generated/buildfiles
#	bundles/specmate-model-generation/src/com/specmate/modelgeneration/GenerateModelFromRequirementService.java
#	bundles/specmate-model-generation/src/com/specmate/modelgeneration/PatternbasedCEGGenerator.java
#	bundles/specmate-objectif/src/com/specmate/objectif/resolve/rule/ObjectifNode.java
#	bundles/specmate-std-env/dev-specmate-all.bndrun
@fischJan fischJan requested a review from junkerm July 11, 2019 10:29
Copy link
Owner

@junkerm junkerm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not working for
WENN A ODER B
DANN
C
SONST
WENN
E ODER F
DANN
D
SONST
K
ENDE-WENN
ENDE-WENN

@@ -242,9 +242,12 @@ private static void printConstituent(Constituent con, StringJoiner joiner) {
private static String DE_Pattern = "\\b(der|die|das|ein|eine|einen)\\b";

public static ELanguage detectLanguage(String text) {
if (text.matches(".*WENN.*ENDE-WENN.*")) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the dot will not match line breaks, hence something like below is not detected. Solution: Use pattern=Pattern.compile(.*WENN.ENDE-WENN., Pattern.DOT_ALL)
pattern.matcher(text).matches()

WENN bla
DANN
blup
ENDE-WENN

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in new commit

@@ -1,4 +1,4 @@
WENN A=5 UND B=3 DANN C=7 ENDE-WENN
WENN A=5 UND X=9 DANN C=7 ENDE-WENN
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible to add multiline text to the test?

try {
rules = new BusinessRuleUtil().parseXTextResource(text);
} catch (XTextException e) {
throw new SpecmateInternalException(ErrorCode.INTERNAL_PROBLEM, "...");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a sensible exception message. something that indicates that the xtext pasrsing went wrong. also include the orginal message (e.getMessage())

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in new commit

@@ -1,4 +1,4 @@
WENN A=5 UND B=3 DANN C=7 ENDE-WENN
WENN A=5 UND X=9 DANN C=7 ENDE-WENN
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The model generation does not work when special chars (e.g. [(*<)) or umlauts (ÄÖÜ etc.) are in the text
The model generation does not work when line breaks are in the text (see comment below)

Pelase fix and add tests

@junkerm
Copy link
Owner

junkerm commented Jul 12, 2019

Generally it seems that "SONST" is not correctly interpreted. I oculd not create a working example

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants