Skip to content

Commit

Permalink
model verification v0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
NourEldin-Ali committed Apr 11, 2024
1 parent 244a4d1 commit 56007a4
Show file tree
Hide file tree
Showing 13 changed files with 3,462 additions and 332 deletions.
2,964 changes: 2,964 additions & 0 deletions DAB/bpmn-model-translations/Mortgage_MCMT-Translation.txt

Large diffs are not rendered by default.

189 changes: 102 additions & 87 deletions DAB/src/main/java/it/unibz/deltabpmn/bpmn/DfbpmnModelReader.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import it.unibz.deltabpmn.dataschema.core.DataSchema;
import it.unibz.deltabpmn.dataschema.elements.CatalogRelation;
import it.unibz.deltabpmn.dataschema.elements.RepositoryRelation;
import it.unibz.deltabpmn.dataschema.elements.Sort;
import org.openbpmn.bpmn.BPMNModel;
import org.openbpmn.bpmn.elements.BPMNProcess;
import org.openbpmn.bpmn.elements.DataObjectAttributeExtension;

import java.util.List;
import java.util.Map;
Expand All @@ -15,7 +17,6 @@ public final class CatalogRelationExtractor {

private final static String CATALOG_ID = "CatalogID";


/**
* Extracts catalog relations from the DF-BPMN model.
*
Expand All @@ -26,21 +27,21 @@ public final class CatalogRelationExtractor {
*/
public static DataSchema extract(BPMNModel modelInstance, DataSchema dataSchema) {

// BPMNProcess openProcess = modelInstance.openDefaultProces();
// Map<String, Map<String, Object>> dataStoreVariables = openProcess.getDataStoresExtensions();
//
// dataStoreVariables.forEach((name, values) -> {
// String catalogRelationName = name.trim();
// CatalogRelation catalogRelation = dataSchema.newCatalogRelation(catalogRelationName);
//
// ((Map<String, String>) values.get("attributes")).forEach((attrName, attrType) -> {
//// String attrName = declarationElements[0].trim();
// Sort attrSort = dataSchema.newSort(attrType);
// // TODO: check the condition!
// catalogRelation.addAttribute(attrName, attrSort);// remember that the first attribute will always be set
// // as Primary Key
// });
// });
BPMNProcess openProcess = modelInstance.openDefaultProces();
Map<String, Map<String, Object>> dataStoreVariables = openProcess.getDataStoresExtensions();

dataStoreVariables.forEach((name, values) -> {
if (Boolean.parseBoolean((String) values.get("readonly")) == true) {
String catalogRelationName = ((String) values.get("type")).trim();
CatalogRelation catalogRelation = dataSchema.newCatalogRelation(catalogRelationName);

((Set<DataObjectAttributeExtension>) values.get("attributes")).forEach((attr) -> {
Sort attrSort = dataSchema.newSort(attr.getAttribute("type"));
catalogRelation.addAttribute(attr.getName(), attrSort);
});
}
});
return dataSchema;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,31 @@

public final class RepositoryRelationExtractor {

private final static String REPOSITORY_ID = "RepositoryID";

/**
* Extracts repository relations from the DF-BPMN model.
*
* @return The updated data schema object contains all the extracted repository relations.
*/
public static DataSchema extract(BPMNModel modelInstance, DataSchema dataSchema) {
BPMNProcess openProcess = modelInstance.openDefaultProces();
private final static String REPOSITORY_ID = "RepositoryID";

/**
* Extracts repository relations from the DF-BPMN model.
*
* @return The updated data schema object contains all the extracted repository
* relations.
*/
public static DataSchema extract(BPMNModel modelInstance, DataSchema dataSchema) {

BPMNProcess openProcess = modelInstance.openDefaultProces();
Map<String, Map<String, Object>> dataStoreVariables = openProcess.getDataStoresExtensions();

dataStoreVariables.forEach((name, values) -> {
String repRelationName = ((String) values.get("type")).trim();
RepositoryRelation repRelation = dataSchema.newRepositoryRelation(repRelationName);

((Set<DataObjectAttributeExtension>) values.get("attributes"))
.forEach((attr) -> {
Sort attrSort = dataSchema.newSort(attr.getAttribute("type"));
repRelation.addAttribute(attr.getName(), attrSort);
});
if (Boolean.parseBoolean((String) values.get("readonly")) == false) {
String repRelationName = ((String) values.get("type")).trim();
RepositoryRelation repRelation = dataSchema.newRepositoryRelation(repRelationName);

((Set<DataObjectAttributeExtension>) values.get("attributes")).forEach((attr) -> {
Sort attrSort = dataSchema.newSort(attr.getAttribute("type"));
repRelation.addAttribute(attr.getName(), attrSort);
});
}
});
return dataSchema;
}
}

}


Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public static BinaryCondition parse(String expression, DataSchema dataSchema) th
condition = BinaryConditionProvider.inequality(terms.getKey(), terms.getValue());
} else if (expression.contains("=")) {
String[] operands = expression.split("=");
System.out.println(operands[0]);
System.out.println(operands[1]);
//if it's an attribute, then don't do anything, just fetch it from list of attributes
//if it's a case variable, we assume that it has been already generated by looking into the vars declaration
Pair<Term, Term> terms = parseOperands(operands[0].trim(), operands[1].trim(), dataSchema);
Expand Down
Loading

0 comments on commit 56007a4

Please sign in to comment.