In textual modules defaultLocalName can be set in the module header. For
ontology modules, use Ontology.defaultLocalName property.
Change-Id: I2966c0b16e5d5f07c0e591a094f63908a7b492b3
L0.SCLModule <T L0.Entity
>-- L0.SCLModule.definition --> L0.String <R L0.HasProperty : L0.TotalFunction
L0.SCLModule <T L0.Entity
>-- L0.SCLModule.definition --> L0.String <R L0.HasProperty : L0.TotalFunction
- >-- L0.SCLModule.alias --> L0.String <R L0.HasProperty : L0.TotalFunction
@L0.assert L0.SCLModule.definition ""
@L0.assert L0.SCLModule.definition ""
- @L0.assert L0.SCLModule.alias ""
+
+L0.Ontology
+ >-- L0.Ontology.defaultLocalName --> L0.String <R L0.HasProperty : L0.TotalFunction
+ @L0.assert L0.Ontology.defaultLocalName ""
L0.entityReplacer ==> "Resource -> Resource -> <WriteGraph> ()" <R L0.HasProperty : L0.FunctionalRelation
L0.HasDescription """Used for defining an SCL function that knows how to copy the contents from one entity instance to another when both instances are known to be of the same type.
L0.entityReplacer ==> "Resource -> Resource -> <WriteGraph> ()" <R L0.HasProperty : L0.FunctionalRelation
L0.HasDescription """Used for defining an SCL function that knows how to copy the contents from one entity instance to another when both instances are known to be of the same type.
public final Resource NamespaceMigrationStep_Prefix_to;
public final Resource NamespaceMigrationStep_Prefix_to_Inverse;
public final Resource Ontology;
public final Resource NamespaceMigrationStep_Prefix_to;
public final Resource NamespaceMigrationStep_Prefix_to_Inverse;
public final Resource Ontology;
+ public final Resource Ontology_defaultLocalName;
+ public final Resource Ontology_defaultLocalName_Inverse;
public final Resource Ontology_download;
public final Resource Ontology_download_Inverse;
public final Resource Ontology_global;
public final Resource Ontology_download;
public final Resource Ontology_download_Inverse;
public final Resource Ontology_global;
public final Resource SCLMigrationStep;
public final Resource SCLMigrationStep_SCLMigrationStepAction;
public final Resource SCLModule;
public final Resource SCLMigrationStep;
public final Resource SCLMigrationStep_SCLMigrationStepAction;
public final Resource SCLModule;
- public final Resource SCLModule_alias;
- public final Resource SCLModule_alias_Inverse;
public final Resource SCLModule_definition;
public final Resource SCLModule_definition_Inverse;
public final Resource SCLValue;
public final Resource SCLModule_definition;
public final Resource SCLModule_definition_Inverse;
public final Resource SCLValue;
public static final String NamespaceMigrationStep_Prefix_to = "http://www.simantics.org/Layer0-1.1/NamespaceMigrationStep/Prefix/to";
public static final String NamespaceMigrationStep_Prefix_to_Inverse = "http://www.simantics.org/Layer0-1.1/NamespaceMigrationStep/Prefix/to/Inverse";
public static final String Ontology = "http://www.simantics.org/Layer0-1.1/Ontology";
public static final String NamespaceMigrationStep_Prefix_to = "http://www.simantics.org/Layer0-1.1/NamespaceMigrationStep/Prefix/to";
public static final String NamespaceMigrationStep_Prefix_to_Inverse = "http://www.simantics.org/Layer0-1.1/NamespaceMigrationStep/Prefix/to/Inverse";
public static final String Ontology = "http://www.simantics.org/Layer0-1.1/Ontology";
+ public static final String Ontology_defaultLocalName = "http://www.simantics.org/Layer0-1.1/Ontology/defaultLocalName";
+ public static final String Ontology_defaultLocalName_Inverse = "http://www.simantics.org/Layer0-1.1/Ontology/defaultLocalName/Inverse";
public static final String Ontology_download = "http://www.simantics.org/Layer0-1.1/Ontology/download";
public static final String Ontology_download_Inverse = "http://www.simantics.org/Layer0-1.1/Ontology/download/Inverse";
public static final String Ontology_global = "http://www.simantics.org/Layer0-1.1/Ontology/global";
public static final String Ontology_download = "http://www.simantics.org/Layer0-1.1/Ontology/download";
public static final String Ontology_download_Inverse = "http://www.simantics.org/Layer0-1.1/Ontology/download/Inverse";
public static final String Ontology_global = "http://www.simantics.org/Layer0-1.1/Ontology/global";
public static final String SCLMigrationStep = "http://www.simantics.org/Layer0-1.1/SCLMigrationStep";
public static final String SCLMigrationStep_SCLMigrationStepAction = "http://www.simantics.org/Layer0-1.1/SCLMigrationStep/SCLMigrationStepAction";
public static final String SCLModule = "http://www.simantics.org/Layer0-1.1/SCLModule";
public static final String SCLMigrationStep = "http://www.simantics.org/Layer0-1.1/SCLMigrationStep";
public static final String SCLMigrationStep_SCLMigrationStepAction = "http://www.simantics.org/Layer0-1.1/SCLMigrationStep/SCLMigrationStepAction";
public static final String SCLModule = "http://www.simantics.org/Layer0-1.1/SCLModule";
- public static final String SCLModule_alias = "http://www.simantics.org/Layer0-1.1/SCLModule/alias";
- public static final String SCLModule_alias_Inverse = "http://www.simantics.org/Layer0-1.1/SCLModule/alias/Inverse";
public static final String SCLModule_definition = "http://www.simantics.org/Layer0-1.1/SCLModule/definition";
public static final String SCLModule_definition_Inverse = "http://www.simantics.org/Layer0-1.1/SCLModule/definition/Inverse";
public static final String SCLValue = "http://www.simantics.org/Layer0-1.1/SCLValue";
public static final String SCLModule_definition = "http://www.simantics.org/Layer0-1.1/SCLModule/definition";
public static final String SCLModule_definition_Inverse = "http://www.simantics.org/Layer0-1.1/SCLModule/definition/Inverse";
public static final String SCLValue = "http://www.simantics.org/Layer0-1.1/SCLValue";
NamespaceMigrationStep_Prefix_to = getResourceOrNull(graph, URIs.NamespaceMigrationStep_Prefix_to);
NamespaceMigrationStep_Prefix_to_Inverse = getResourceOrNull(graph, URIs.NamespaceMigrationStep_Prefix_to_Inverse);
Ontology = getResourceOrNull(graph, URIs.Ontology);
NamespaceMigrationStep_Prefix_to = getResourceOrNull(graph, URIs.NamespaceMigrationStep_Prefix_to);
NamespaceMigrationStep_Prefix_to_Inverse = getResourceOrNull(graph, URIs.NamespaceMigrationStep_Prefix_to_Inverse);
Ontology = getResourceOrNull(graph, URIs.Ontology);
+ Ontology_defaultLocalName = getResourceOrNull(graph, URIs.Ontology_defaultLocalName);
+ Ontology_defaultLocalName_Inverse = getResourceOrNull(graph, URIs.Ontology_defaultLocalName_Inverse);
Ontology_download = getResourceOrNull(graph, URIs.Ontology_download);
Ontology_download_Inverse = getResourceOrNull(graph, URIs.Ontology_download_Inverse);
Ontology_global = getResourceOrNull(graph, URIs.Ontology_global);
Ontology_download = getResourceOrNull(graph, URIs.Ontology_download);
Ontology_download_Inverse = getResourceOrNull(graph, URIs.Ontology_download_Inverse);
Ontology_global = getResourceOrNull(graph, URIs.Ontology_global);
SCLMigrationStep = getResourceOrNull(graph, URIs.SCLMigrationStep);
SCLMigrationStep_SCLMigrationStepAction = getResourceOrNull(graph, URIs.SCLMigrationStep_SCLMigrationStepAction);
SCLModule = getResourceOrNull(graph, URIs.SCLModule);
SCLMigrationStep = getResourceOrNull(graph, URIs.SCLMigrationStep);
SCLMigrationStep_SCLMigrationStepAction = getResourceOrNull(graph, URIs.SCLMigrationStep_SCLMigrationStepAction);
SCLModule = getResourceOrNull(graph, URIs.SCLModule);
- SCLModule_alias = getResourceOrNull(graph, URIs.SCLModule_alias);
- SCLModule_alias_Inverse = getResourceOrNull(graph, URIs.SCLModule_alias_Inverse);
SCLModule_definition = getResourceOrNull(graph, URIs.SCLModule_definition);
SCLModule_definition_Inverse = getResourceOrNull(graph, URIs.SCLModule_definition_Inverse);
SCLValue = getResourceOrNull(graph, URIs.SCLValue);
SCLModule_definition = getResourceOrNull(graph, URIs.SCLModule_definition);
SCLModule_definition_Inverse = getResourceOrNull(graph, URIs.SCLModule_definition_Inverse);
SCLValue = getResourceOrNull(graph, URIs.SCLValue);
private static final TCon RESOURCE = Types.con(DB_MODULE, "Resource");
Resource ontology;
private static final TCon RESOURCE = Types.con(DB_MODULE, "Resource");
Resource ontology;
+ String defaultLocalName;
THashMap<Resource,Map<String,Resource>> childMaps = new THashMap<Resource,Map<String,Resource>>();
public OntologyModule(ReadGraph graph, String moduleName) throws DatabaseException {
super(moduleName);
ontology = graph.getResource(moduleName);
THashMap<Resource,Map<String,Resource>> childMaps = new THashMap<Resource,Map<String,Resource>>();
public OntologyModule(ReadGraph graph, String moduleName) throws DatabaseException {
super(moduleName);
ontology = graph.getResource(moduleName);
+ readDefaultLocalName(graph);
childMaps.put(ontology, createLocalMap(graph, ontology));
}
childMaps.put(ontology, createLocalMap(graph, ontology));
}
+
+ private void readDefaultLocalName(ReadGraph graph) throws DatabaseException {
+ Layer0 L0 = Layer0.getInstance(graph);
+ defaultLocalName = graph.getPossibleRelatedValue(ontology, L0.Ontology_defaultLocalName);
+ if(defaultLocalName == null)
+ defaultLocalName = "";
+ }
+
+ @Override
+ public String getDefaultLocalName() {
+ return defaultLocalName;
+ }
@Override
public List<ImportDeclaration> getDependencies() {
@Override
public List<ImportDeclaration> getDependencies() {
module = new ConcreteModule(moduleName);
compilationContext.module = module;
module = new ConcreteModule(moduleName);
compilationContext.module = module;
+ if(moduleHeader != null && moduleHeader.defaultLocalName != null)
+ module.setDefaultLocalName(moduleHeader.defaultLocalName);
try {
if(timer != null)
timer.suspendTimer();
try {
if(timer != null)
timer.suspendTimer();
public class ModuleHeader {
public String classLoader;
public long classLoaderLocation;
public class ModuleHeader {
public String classLoader;
public long classLoaderLocation;
+ public String defaultLocalName;
private void read(ErrorLog errorLog, DModuleHeader header) {
for(FieldAssignment assignment : header.fields)
private void read(ErrorLog errorLog, DModuleHeader header) {
for(FieldAssignment assignment : header.fields)
classLoaderLocation = assignment.location;
}
break;
classLoaderLocation = assignment.location;
}
break;
+ case "defaultLocalName":
+ if(assignment.value == null)
+ errorLog.log(assignment.location, "Property defaultLocalName needs to be given a string value.");
+ else {
+ defaultLocalName = AnnotationUtils.extractString(assignment.value);
+ if(defaultLocalName == null)
+ errorLog.log(assignment.value.location, "Expected string here.");
+ }
+ break;
default:
errorLog.logWarning(assignment.location, "Unknown module header field was skipped.");
}
default:
errorLog.logWarning(assignment.location, "Unknown module header field was skipped.");
}
public class ConcreteModule implements Module {
String moduleName;
public class ConcreteModule implements Module {
String moduleName;
+ String defaultLocalName;
THashMap<String, TypeDescriptor> typeDescriptors = new THashMap<String, TypeDescriptor>();
THashMap<String, EffectConstructor> effectConstructors = new THashMap<String, EffectConstructor>();
THashMap<String, TypeClass> typeClasses = new THashMap<String, TypeClass>();
THashMap<String, TypeDescriptor> typeDescriptors = new THashMap<String, TypeDescriptor>();
THashMap<String, EffectConstructor> effectConstructors = new THashMap<String, EffectConstructor>();
THashMap<String, TypeClass> typeClasses = new THashMap<String, TypeClass>();
this.moduleName = moduleName;
}
this.moduleName = moduleName;
}
+ @Override
+ public String getDefaultLocalName() {
+ return defaultLocalName;
+ }
+
+ public void setDefaultLocalName(String defaultLocalName) {
+ this.defaultLocalName = defaultLocalName;
+ }
+
public boolean addTypeDescriptor(String name, TypeDescriptor typeConstructor) {
return typeDescriptors.put(name, typeConstructor) != null;
}
public boolean addTypeDescriptor(String name, TypeDescriptor typeConstructor) {
return typeDescriptors.put(name, typeConstructor) != null;
}
public interface Module {
String getName();
public interface Module {
String getName();
+ String getDefaultLocalName();
SCLValue getValue(String name);
SCLRelation getRelation(String name);
SCLValue getValue(String name);
SCLRelation getRelation(String name);