Aufgrund einer Störung des s3 Storage, könnten in nächster Zeit folgende GitLab Funktionen nicht zur Verfügung stehen: LFS, Container Registry, Job Artifacs, Uploads (Wiki, Bilder, Projekt-Exporte). Wir bitten um Verständnis. Es wird mit Hochdruck an der Behebung des Problems gearbeitet. Weitere Informationen zur Störung des Object Storage finden Sie hier:

Commit ffd39b99 authored by Baran Dalgic's avatar Baran Dalgic
Browse files

resolve data path of instances with corresponding instantiation symbol

parent 1e4380d4
Pipeline #155164 failed with stages
in 1 minute and 9 seconds
......@@ -26,6 +26,7 @@ import;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAComponentSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstantiationSymbol;
import de.monticore.lang.math._symboltable.MathStatementsSymbol;
import de.monticore.lang.monticar.cnnarch.CNNArchGenerator;
import de.monticore.lang.monticar.cnnarch.DataPathConfigParser;
......@@ -47,18 +48,15 @@ import de.se_rwth.commons.Splitters;
import de.se_rwth.commons.logging.Log;
import freemarker.template.TemplateException;
import javax.xml.bind.DatatypeConverter;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import javax.xml.bind.DatatypeConverter;
import java.util.*;
public class EMADLGenerator {
......@@ -343,13 +341,39 @@ public class EMADLGenerator {
return fileContents;
* returns data path either from tags or data_paths.txt
protected String getDataPath(TaggingResolver taggingResolver, EMAComponentSymbol component, EMAComponentInstanceSymbol instance){
List<TagSymbol> instanceTags = new LinkedList<>();
boolean isChildComponent = instance.getEnclosingComponent().isPresent();
// get all instantiated components of parent
List<EMAComponentInstantiationSymbol> instantiationSymbols =
(List<EMAComponentInstantiationSymbol>) instance
// filter corresponding instantiation of instance and add tags
.filter(e -> e.getName().equals(instance.getName()))
symbol -> instanceTags.addAll(taggingResolver.getTags(symbol, DataPathSymbol.KIND))
// instance tags have priority
List<TagSymbol> instanceTags = (List<TagSymbol>) taggingResolver.getTags(instance, DataPathSymbol.KIND);
List<TagSymbol> tags = !instanceTags.isEmpty() ? instanceTags :
(List<TagSymbol>) taggingResolver.getTags(component, DataPathSymbol.KIND);
String dataPath;
if (!tags.isEmpty()) {
dataPath = (String) tags.get(0).getValues().get(0);
......@@ -2,6 +2,6 @@ package tagging;
conforms to dltag.DataPathTagSchema;
tags AlexNet {
tag Alexnet with DataPath = {path = data, type = random};
tag Parent.a1 with DataPath = {path = lisjef, type = r34};
tag Alexnet with DataPath = {path = component, type = random};
tag Parent.a1 with DataPath = {path = instanceA1, type = random};
package tagging;
component Parent{
instance Alexnet a1;
instance tagging.Alexnet a1;
instance tagging.Alexnet a2;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment