modeltype UML uses 'http://www.omg.org/spec/UML/20131001'; transformation NIEMGlobals() ; main() { } // names of stereotype tag property substitutionGroupAffiliationTag:String='substitutionGroupAffiliation'; // name of package defining attributeGroups, for NIEM non-conformant schemas property attributeGroupDefinitionPackageName:String='attributeGroupDefinition'; // default name of class holding element declarations property elementDeclarationClassName:String='elementDeclaration'; // default name of class holding attribute declarations property attributeDeclarationClassName:String='attributeDeclaration'; // name of UML Primitive Types Package property UMLPrimitiveTypesPackageName:String='PrimitiveTypes';// tjd // name of XML Primitive Types Package property XMLPrimitiveTypesPackageName:String='XMLPrimitiveTypes'; // default namespace for schema for schema property schemaForSchemaNamespace:String='http://www.w3.org/2001/XMLSchema'; // default namespace for schema for schema instance property schemaForSchemaInstanceNamespace:String=schemaForSchemaNamespace+'-instance'; // base namespace for niem2 infrastructure schemas property baseNiemNamespaceNiem2:String='http://niem.gov/niem/';// niem2 // base namespace for niem3 schemas property baseNiemNamespace:String='http://release.niem.gov/niem/'; // NIEM2 property appinfo2Namespace:String=baseNiemNamespaceNiem2+'appinfo/2.1'; // niem2; no longer exists in niem3 // base namespace for niem2 reference models property baseReferenceNiemNamespaceNiem2:String='http://reference.niem.gov/niem/'; property baseReferenceNiemNamespace:String=baseNiemNamespace; property structuresSchemaNamespaceNiem2:String='http://niem.gov/niem/structures/2.0';// niem2 structures namespace property structuresSchemaNamespace:String=baseNiemNamespace+'structures/3.0/';// niem3 structures namespace property appinfoNamespaceNiem2:String=baseNiemNamespaceNiem2+'appinfo/2.0'; // niem2 appinfo schema namespace property appinfoNamespace:String=baseNiemNamespace+'appinfo/3.0/';// niem3 appinfo schema namespace property proxySchemaNamespaceNiem2:String='http://niem.gov/niem/proxy/xsd/2.0';// niem2 proxy schema namespace property proxySchemaNamespace:String=baseNiemNamespace+'proxy/xsd/3.0/';// niem3 proxy schema namespace property niemCoreSchemaNamespace:String=baseNiemNamespace+'niem-core/3.0/';// niem3 core schema namespace property LocalTerminologyTargetNamespace:String=baseNiemNamespace+'localTerminology/3.0/';// local terminology schema namespace property ConformanceTargetNamespace:String=baseNiemNamespace+'conformanceTargets/3.0/';// conformance targets schema namespace property ConformanceTargetsAttributeName:String='conformanceTargets';// conformanceTargets attribute name property provisioningMpdStereotypeName:String='ModelPackageDescription';// name of <> Stereotype property packageCodeLiteralEnumeration:UML::Enumeration=null;// the Enumeration named 'ModelPackageDescriptionClassCode' in the ModelPackagingDescription Profile property defaultPackageCodeLiteral:UML::EnumerationLiteral=null;// the EnumerationLiteral named 'iepd' within the packageCodeLiteralEnumeraiton property defaultPackageCodeName:String='iepd';// name of default package code in packageCodeLiteralEnumeration property provisioningNdrSchemaStereotypeName:String='Namespace';// name of the <> Stereotype property propertyHolderStereotypeName:String='PropertyHolder';// name of the <> Stereotype property logicalProfileName:String='NIEM_PIM_Profile';// name of the PIM Profile property structureProfileName:String='NIEM_Common_Profile';// name of the Common Profile property niemXsdProfileName:String='NIEM_PSM_Profile';// name of the PSM Profile property provisioningProfileBaseName:String='Model_Package_Description';// base name of the ModelPackageDescription Profile property provisioningProfileName:String=provisioningProfileBaseName+'_Profile';// full name of the ModelPackageDescription Profile property modelGroupDefinitionPackageName:String='modelGroupDefinition';// name of package which contains (non-NIEM conformant) model group definitions property provisioningProfile:UML::Profile=null; // Model_Package_Description_Profile property logicalProfile:UML::Profile=null; // NIEM_PIM_Profile property structureProfile:UML::Profile=null; // NIEM_Common_Profile property niemXsdProfile:UML::Profile=null; // NIEM_PSM_Profile property NIEMSchemaStereotype:UML::Stereotype=null;// the <> Stereotype property prompdStereotype:UML::Artifact=null;// The ModelPackageDescription Artifact property NIEMModelPackageDescriptionRelationshipStereotype:UML::Stereotype=null;// the <> Stereotype property NIEMPropertyHolderStereotype:UML::Stereotype=null;// the <> Stereotype property NIEMTypeStereotype:UML::Stereotype=null;// the <> Stereotype property NIEMReferencesStereotype:UML::Stereotype=null;// <> Stereotype property NIEMChoiceStereotype:UML::Stereotype=null;// <> Stereotype property NIEMReferenceNameStereotype:UML::Stereotype=null;// <> Stereotype property NIEMRoleOfStereotype:UML::Stereotype=null;// <> Stereotype property NIEMAugmentationStereotype:UML::Stereotype=null;// <> Stereotype property NIEMMetadataStereotype:UML::Stereotype=null;// <> Stereotype property NIEMDeprecatedStereotype:UML::Stereotype=null;// <> Stereotype property NIEMAssociationStereotype:UML::Stereotype=null;// <> Stereotype property NIEMDescriptionStereotype:UML::Stereotype=null;// <> Stereotype property NIEMSimpleTypeStereotype:UML::Stereotype=null;// <> Stereotype property NIEMLocalVocabularyStereotype:UML::Stereotype=null;// <> Stereotype property NIEMLocalTermStereotype:UML::Stereotype=null;// <> Stereotype property NIEMRepresentationStereotype:UML::Stereotype=null;// <> Stereotype property NIEMRoleStereotype:UML::Stereotype=null;// <> Stereotype property NIEMInformationModelStereotype:UML::Stereotype=null;// <> Stereotype property NIEMAdapterStereotype:UML::Stereotype=null;// <> Stereotype property NIEMUnionTypeStereotype:UML::Stereotype=null;// <> Stereotype property NIEMUnionOfStereotype:UML::Stereotype=null;// <> Stereotype property NIEMListTypeStereotype:UML::Stereotype=null;// <> Stereotype property NIEMObjectTypeStereotype:UML::Stereotype=null;// <> Stereotype property NIEMAnyPropertyStereotype:UML::Stereotype=null;// <> Stereotype property NIEMPropertyStereotype:UML::Stereotype=null;// <> Stereotype property NIEMMetadataApplicationStereotype:UML::Stereotype=null;// <> Stereotype property NIEMRestrictionStereotype:UML::Stereotype=null;// <> Stereotype property NIEMSimpleContentStereotype:UML::Stereotype=null;// <> Stereotype property NIEMRepresentationRestrictionStereotype:UML::Stereotype=null;// <> Stereotype property NIEMDeclarationStereotype:UML::Stereotype=null;// <> Stereotype property NIEMReferenceSchemaDocument:UML::Stereotype=null;// <> Stereotype property NIEMExtensionSchemaDocument:UML::Stereotype=null;// <> Stereotype property NIEMSubsetSchemaDocument:UML::Stereotype=null;// <> Stereotype property NIEMExternalSchemaDocument:UML::Stereotype=null;// <> Stereotype property NIEMRequiredFile:UML::Stereotype=null;// <> Stereotype property NIEMIEPSampleXMLDocument:UML::Stereotype=null;// <> Stereotype property NIEMBusinessRulesArtifact:UML::Stereotype=null;// <> Stereotype property NIEMConformanceAssertion:UML::Stereotype=null;// <> Stereotype property NIEMDocumentation:UML::Stereotype=null;// <> Stereotype property NIEMReadMe:UML::Stereotype=null;// <> Stereotype property NIEMMPDChangeLog:UML::Stereotype=null;// <> Stereotype property NIEMWantlist:UML::Stereotype=null;// <> STereotype property NIEMApplicationInfo:UML::Stereotype=null;// <> Stereotype property NIEMSchematronSchema:UML::Stereotype=null;// <> Stereotype property NIEMXMLCatalog:UML::Stereotype=null;// <> Stereotype property NIEMRelaxNGSchema:UML::Stereotype=null;// <> Stereotype property NIEMConformanceReport:UML::Stereotype=null;// <> Stereotype property NIEMXMLSchemaDocument:UML::Stereotype=null;// <> Stereotype property NIEMFile:UML::Stereotype=null;// <> Stereotype property NIEMFileType:UML::Stereotype=null;// <> Stereotype // Classes in Model_Package_Description_Profile property ValidityContextTypeArtifact:UML::Artifact=null;// ValidityContextType Artifact property XPathTypeArtifact:UML::Artifact=null;// XPathType Artifact property QualifiedNamesTypeArtifact:UML::Artifact=null;// QualifiedNamesType Artifact property XMLSchemaTypeArtifact:UML::Artifact=null;// XMLSchemaType Artifact property SchematronValidationTypeArtifact:UML::Artifact=null;// SchematronValidationType Artifact property RelaxNGValidationTypeArtifact:UML::Artifact=null;// RelaxNGValidationType Artifact property ConformanceTargetTypeArtifact:UML::Artifact=null;// ConformanceTargetType Artifact property TextRuleTypeArtifact:UML::Artifact=null;// TextRuleType Artifact property IEPConformanceTarget:UML::Artifact=null;// IEPConformanceTargetTYpe Artifact property ValidityConstraintWithContext:UML::Artifact=null;// ValidityConstraintWithContextType Artifact property umlXmlLibrary:UML::Model=null; // the NIEM XML Type library property BASE_XSD_NAME:String='base-xsd';// name of xsd folder property CONSTRAINT_XSD_NAME:String='constraint-xsd';//name of constraint folder // is name the proxy schema namespace? query String::isProxySchemaNamespace():Boolean= (self=proxySchemaNamespace) or (self=proxySchemaNamespaceNiem2); // is name the structures schema namespace? query String::isStructuresSchemaNamespace():Boolean= (self=structuresSchemaNamespace) or (self=structuresSchemaNamespaceNiem2); // is name the appinfo namespace? query String::isAppinfoNamespace():Boolean= (self=appinfoNamespace) or (self=appinfoNamespaceNiem2); // get closest containing UML::Package to given UML::Element query UML::Element::getNearestPackage():UML::Package= if(self.oclIsKindOf(UML::Package)) then self.oclAsType(UML::Package) else if((self.owner=null)or self.owner.oclIsUndefined())then null else self.owner.getNearestPackage() endif endif; // is this an instance of 'FileSet'? query UML::InstanceSpecification::isMpdFileSet():Boolean=self.isInstanceOf('FileSet'); // get Usages for which this instance is the client query UML::InstanceSpecification::getMpdFileUsages():Sequence(UML::Usage)= self.clientDependency ->select(t|t.oclIsKindOf(UML::Usage)).oclAsType(UML::Usage)->asSequence(); // get the name of the mpdClassCode value for this instance helper UML::InstanceSpecification::getMpdClassCode():String=self.getEnumerationLiteralValue('mpdClassCode').name; // is this an instance of the named Classifier? helper UML::InstanceSpecification::isInstanceOf(classifierName:String):Boolean =self.classifier->exists(c|c.isInstanceOf(classifierName)); // does this Classifier, or any of its parents, have the given name? helper UML::Classifier::isInstanceOf(classifierName:String):Boolean =(self.name=classifierName) or self.general->exists(g|g.isInstanceOf(classifierName)); // get the value of the named Property of this Instance, which is assumed to be an EnumerationLiteral query UML::InstanceSpecification::getEnumerationLiteralValue(tagName:String):UML::EnumerationLiteral= self.getValueSpecification(tagName).getEnumerationLiteralValue()->select(v|(v<>null) and not(v.oclIsUndefined()))->asSequence()->first(); // get the Values for the given Property name of this instance query UML::InstanceSpecification::getValueSpecification(tagName:String):Sequence(UML::ValueSpecification)= self.slot->select(s|s.definingFeature.name=tagName).value->asSequence(); // get the EnumerationLiteral which is the instance of this ValueSpecification query UML::ValueSpecification::getEnumerationLiteralValue():UML::EnumerationLiteral= self->select(v|v.oclIsKindOf(UML::InstanceValue)).oclAsType(UML::InstanceValue) .instance->select(i|i.oclIsKindOf(UML::EnumerationLiteral)).oclAsType(UML::EnumerationLiteral) ->asSequence()->first(); // is the profile applied to this package? query UML::Package::isProfileApplied(profile:UML::Profile):Boolean= self.profileApplication->exists(a|a.appliedProfile=profile); // get nearest Package which has indicated profile applied query UML::Package::getNearesProfileApplication(profile:UML::Profile):UML::Package= if(self.isProfileApplied(profile))then self else self.owner.getNearestPackage().getNearesProfileApplication(profile) endif; // get all parents, recursively, of given Classifier query UML::Classifier::allParents():OrderedSet(UML::Classifier)= self.general->select(g|(g<>self) and (g<>null)and not(g.oclIsUndefined())) ->union(self.general->select(g|(g<>self) and (g<>null)and not(g.oclIsUndefined())).allParents())->asOrderedSet(); // apply given profile to this package helper UML::Package::applyProfile(profile : UML::Profile){ var profileApplication: UML::ProfileApplication=new UML::ProfileApplication(); profileApplication.applyingPackage:=self; profileApplication.appliedProfile:=profile; return; } // find named stereotype within this Profile query UML::Profile::getOwnedStereotype(stereotypeName:String):UML::Stereotype{ var stereotype:UML::Stereotype=self.ownedStereotype->select(s|s.name=stereotypeName)->asSequence()->first(); if(stereotype.oclIsUndefined())then{ log('ERROR: stereotype '+stereotypeName+' not found in profile '+self.name); }else{}endif; return stereotype; } // find named Classifier within this Profile query UML::Profile::getOwnedClassifier(stereotypeName:String):UML::Classifier{ var stereotype:UML::Classifier=self.ownedType->select(s|(s.name=stereotypeName)and s.oclIsKindOf(UML::Classifier)).oclAsType(UML::Classifier)->asSequence()->first(); if(stereotype.oclIsUndefined())then{ log('ERROR: classifier '+stereotypeName+' not found in profile '+self.name); }else{}endif; return stereotype; } // find named EnumerationLiteral within this Enumeration query UML::Enumeration::getOwnedLiteral(schemaKind:String):UML::EnumerationLiteral= self.ownedLiteral->select(l|l.name=schemaKind)->asSequence()->first(); /* In the context of a top-level Model, find and initialize globals for all NIEM Profiles plus the XML Type Library */ // locate and initialize global properties related to profiles and packages associated with NIEM-UML helper UML::Model::initializeProfileGlobals(){ var pimRoot:UML::Model=self; var allSourceProfiles:Set(UML::Profile)=pimRoot.allSubobjectsOfType(UML::Profile).oclAsType(UML::Profile)->asSet(); allSourceProfiles ->select(p|p.name=provisioningProfileName)->asSequence()->first().initProvisioningProfileStereotypes();//getProvisioningProfile(); allSourceProfiles->select(p|p.name=logicalProfileName) ->asSequence()->first().initLogicalProfileStereotypes(); allSourceProfiles->select(p|p.name=structureProfileName) ->asSequence()->first().initStructureProfileStereotypes(); allSourceProfiles->select(p|p.name=niemXsdProfileName) ->asSequence()->first().initNiemXsdProfileStereotypes(); umlXmlLibrary:=pimRoot.allSubobjectsOfType(UML::Model).oclAsType(UML::Model) ->select(m|m.name=XMLPrimitiveTypesPackageName)->asSequence()->first(); return; } // initialize global Stereotype properties for the PSM Profile helper UML::Profile::initNiemXsdProfileStereotypes(){ niemXsdProfile:=self; NIEMPropertyStereotype:=niemXsdProfile.getOwnedStereotype('XSDProperty'); NIEMAnyPropertyStereotype:=niemXsdProfile.getOwnedStereotype('XSDAnyProperty'); NIEMRepresentationRestrictionStereotype:=niemXsdProfile.getOwnedStereotype('XSDRepresentationRestriction'); NIEMSimpleContentStereotype:=niemXsdProfile.getOwnedStereotype('XSDSimpleContent'); NIEMDeclarationStereotype:=niemXsdProfile.getOwnedStereotype('XSDDeclaration'); return; } // initialize global Stereotype properties for the Common Profile helper UML::Profile::initStructureProfileStereotypes(){ structureProfile:=self; NIEMAdapterStereotype:=structureProfile.getOwnedStereotype('AdapterType'); NIEMAssociationStereotype:=structureProfile.getOwnedStereotype('AssociationType'); NIEMAugmentationStereotype:=structureProfile.getOwnedStereotype('AugmentationType'); NIEMChoiceStereotype:=structureProfile.getOwnedStereotype('Choice'); NIEMDescriptionStereotype:=structureProfile.getOwnedStereotype('Documentation'); NIEMListTypeStereotype:=structureProfile.getOwnedStereotype('List'); NIEMMetadataApplicationStereotype:=structureProfile.getOwnedStereotype('MetadataApplication'); NIEMMetadataStereotype:=structureProfile.getOwnedStereotype('MetadataType'); NIEMDeprecatedStereotype:=structureProfile.getOwnedStereotype('Deprecated'); NIEMSchemaStereotype:=structureProfile.getOwnedStereotype(provisioningNdrSchemaStereotypeName); NIEMTypeStereotype:=structureProfile.getOwnedStereotype('NIEMType'); NIEMObjectTypeStereotype:=structureProfile.getOwnedStereotype('ObjectType'); NIEMPropertyHolderStereotype:=structureProfile.getOwnedStereotype(propertyHolderStereotypeName); NIEMReferencesStereotype:=structureProfile.getOwnedStereotype('References'); NIEMUnionTypeStereotype:=structureProfile.getOwnedStereotype('Union'); NIEMUnionOfStereotype:=structureProfile.getOwnedStereotype('UnionOf'); NIEMRestrictionStereotype:=structureProfile.getOwnedStereotype('Restriction'); NIEMSimpleTypeStereotype:=structureProfile.getOwnedStereotype('ValueRestriction'); NIEMLocalVocabularyStereotype:=structureProfile.getOwnedStereotype('LocalVocabulary'); NIEMLocalTermStereotype:=structureProfile.getOwnedStereotype('LocalTerm'); NIEMRepresentationStereotype:=structureProfile.getOwnedStereotype('Representation'); return; } // initialize global Stereotype properties for the PIM Profile helper UML::Profile::initLogicalProfileStereotypes(){ logicalProfile:=self; NIEMRoleOfStereotype:=logicalProfile.getOwnedStereotype('RoleOf'); NIEMReferenceNameStereotype:=logicalProfile.getOwnedStereotype('ReferenceName'); NIEMRoleStereotype:=logicalProfile.getOwnedStereotype('RolePlayedBy'); NIEMInformationModelStereotype:=logicalProfile.getOwnedStereotype('InformationModel'); return; } // initialize global Stereotype and Classifier properties for the ModelPackageDescription Profile helper UML::Profile::initProvisioningProfileStereotypes(){ provisioningProfile:=self; prompdStereotype:=provisioningProfile.getOwnedClassifier(provisioningMpdStereotypeName).oclAsType(UML::Artifact); ValidityContextTypeArtifact:=provisioningProfile.getOwnedClassifier('ValidityContextType').oclAsType(UML::Artifact); XPathTypeArtifact:=provisioningProfile.getOwnedClassifier('XPathType').oclAsType(UML::Artifact); QualifiedNamesTypeArtifact:=provisioningProfile.getOwnedClassifier('QualifiedNamesType').oclAsType(UML::Artifact); XMLSchemaTypeArtifact:=provisioningProfile.getOwnedClassifier('XMLSchemaType').oclAsType(UML::Artifact); SchematronValidationTypeArtifact:=provisioningProfile.getOwnedClassifier('SchematronValidationType').oclAsType(UML::Artifact); RelaxNGValidationTypeArtifact:=provisioningProfile.getOwnedClassifier('RelaxNGValidationType').oclAsType(UML::Artifact); ConformanceTargetTypeArtifact:=provisioningProfile.getOwnedClassifier('ConformanceTargetType').oclAsType(UML::Artifact); TextRuleTypeArtifact:=provisioningProfile.getOwnedClassifier('TextRuleType').oclAsType(UML::Artifact); IEPConformanceTarget:=provisioningProfile.getOwnedClassifier('IEPConformanceTargetType').oclAsType(UML::Artifact); ValidityConstraintWithContext:=provisioningProfile.getOwnedClassifier('ValidityConstraintWithContextType').oclAsType(UML::Artifact); NIEMModelPackageDescriptionRelationshipStereotype:=provisioningProfile.getOwnedStereotype('ModelPackageDescriptionRelationship'); NIEMReferenceSchemaDocument:=provisioningProfile.getOwnedStereotype('ReferenceSchemaDocument'); NIEMExtensionSchemaDocument:=provisioningProfile.getOwnedStereotype('ExtensionSchemaDocument'); NIEMSubsetSchemaDocument:=provisioningProfile.getOwnedStereotype('SubsetSchemaDocument'); NIEMExternalSchemaDocument:=provisioningProfile.getOwnedStereotype('ExternalSchemaDocument'); NIEMRequiredFile:=provisioningProfile.getOwnedStereotype('RequiredFile'); NIEMIEPSampleXMLDocument:=provisioningProfile.getOwnedStereotype('IEPSampleXMLDocument'); NIEMBusinessRulesArtifact:=provisioningProfile.getOwnedStereotype('BusinessRulesArtifact'); NIEMConformanceAssertion:=provisioningProfile.getOwnedStereotype('ConformanceAssertion'); NIEMDocumentation:=provisioningProfile.getOwnedStereotype('Documentation'); NIEMReadMe:=provisioningProfile.getOwnedStereotype('ReadMe'); NIEMMPDChangeLog:=provisioningProfile.getOwnedStereotype('MPDChangeLog'); NIEMWantlist:=provisioningProfile.getOwnedStereotype('Wantlist'); NIEMApplicationInfo:=provisioningProfile.getOwnedStereotype('ApplicationInfo'); NIEMSchematronSchema:=provisioningProfile.getOwnedStereotype('SchematronSchema'); NIEMXMLCatalog:=provisioningProfile.getOwnedStereotype('XMLCatalog'); NIEMRelaxNGSchema:=provisioningProfile.getOwnedStereotype('RelaxNGSchema'); NIEMConformanceReport:=provisioningProfile.getOwnedStereotype('ConformanceReport'); NIEMXMLSchemaDocument:=provisioningProfile.getOwnedStereotype('XMLSchemaDocument'); NIEMFile:=provisioningProfile.getOwnedStereotype('File'); NIEMFileType:=provisioningProfile.getOwnedStereotype('FileType'); packageCodeLiteralEnumeration:=provisioningProfile.packagedElement ->select(e|e.oclIsKindOf(UML::Enumeration)and (e.name='ModelPackageDescriptionClassCode')).oclAsType(UML::Enumeration) ->asSequence()->first(); defaultPackageCodeLiteral:=packageCodeLiteralEnumeration.getOwnedLiteral(defaultPackageCodeName); return; } // is this Classifier a subtype of specified Classifier? query UML::Classifier::isSubtypeOf(stereotype:UML::Classifier):Boolean= (self=stereotype) or (self.name=stereotype.name) or self.allParents()->select(g|(stereotype=g) or (stereotype.name=g.name))->notEmpty() ; // does this Classifier conform to specified Classifier? query UML::Classifier::conformsTo(other:UML::Classifier):Boolean= (self=other) or self.allParents()->includes(self); // same function as rfind helper String::lastIndexOf(match:String):Integer{ return self.rfind(match); } // get this instance's boolean value for given property name query UML::InstanceSpecification::getBooleanValue(tagName:String):Boolean= self.getValueSpecification(tagName).getBooleanValue()->select(v|(v<>null) and not(v.oclIsUndefined()))->asSequence()->first(); // get this instance's (any) value for given property name query UML::InstanceSpecification::getAnyValue(tagName:String):OclAny= self.getValueSpecification(tagName).getAnyValue()->select(v|(v<>null) and not(v.oclIsUndefined()))->asSequence()->first(); // get this instance's string value for given property name query UML::InstanceSpecification::getStringValue(tagName:String):String= self.getValueSpecification(tagName).getStringValue()->select(v|(v<>null) and not(v.oclIsUndefined()))->asSequence()->first(); // get this instance's list of string values for given property name query UML::InstanceSpecification::getStringValues(tagName:String):Sequence(String)= self.getValueSpecification(tagName).getStringValues()->select(v|(v<>null) and not(v.oclIsUndefined()))->asSequence(); // get this instance's instance values for given property name query UML::InstanceSpecification::getInstanceValues(tagName:String):Sequence(UML::InstanceSpecification)= self.getValueSpecification(tagName).getInstanceValues()->select(v|(v<>null) and not(v.oclIsUndefined()))->asSequence(); // get this valueSpecification's string value query UML::ValueSpecification::getStringValue():String= self->select(v|v.oclIsKindOf(UML::LiteralString)).oclAsType(UML::LiteralString) .value->asSequence()->first(); // get this valueSpecification's list of string values query UML::ValueSpecification::getStringValues():Sequence(String)= self->select(v|v.oclIsKindOf(UML::LiteralString)).oclAsType(UML::LiteralString) .value->asSequence(); // get this valueSpecification's instance value query UML::ValueSpecification::getInstanceValues():Sequence(UML::InstanceSpecification)= self->select(v|v.oclIsKindOf(UML::InstanceValue)).oclAsType(UML::InstanceValue) .instance->asSequence(); // get this valueSpecification's boolean value query UML::ValueSpecification::getBooleanValue():Boolean= self->select(v|v.oclIsKindOf(UML::LiteralBoolean)).oclAsType(UML::LiteralBoolean) .value->asSequence()->first(); // get this valueSpecification's (any) value query UML::ValueSpecification::getAnyValue():OclAny{ if(self.oclIsKindOf(UML::LiteralInteger))then {return self.oclAsType(UML::LiteralInteger).value;}else{}endif; if(self.oclIsKindOf(UML::LiteralBoolean))then {return self.oclAsType(UML::LiteralBoolean).value;}else{}endif; if(self.oclIsKindOf(UML::LiteralString))then {return self.oclAsType(UML::LiteralString).value;}else{}endif; if(self.oclIsKindOf(UML::LiteralUnlimitedNatural))then {return self.oclAsType(UML::LiteralUnlimitedNatural).value;}else{}endif; if(self.oclIsKindOf(UML::InstanceValue))then {return self.oclAsType(UML::InstanceValue).instance;}else{}endif; return null; } // get this instance's list of (any) values for specified property query UML::InstanceSpecification::getAnyValues(tagName:String):Sequence(OclAny)= self.getValueSpecification(tagName).getAnyValue()->select(v|(v<>null) and not(v.oclIsUndefined()))->asSequence(); // get this instance's integer value for specified property query UML::InstanceSpecification::getIntegerValue(tagName:String):Integer= self.getValueSpecification(tagName).getIntegerValue()->select(v|(v<>null) and not(v.oclIsUndefined()))->asSequence()->first(); // get this valueSpecification's integer value query UML::ValueSpecification::getIntegerValue():Integer= self->select(v|v.oclIsKindOf(UML::LiteralInteger)).oclAsType(UML::LiteralInteger) .value->asSequence()->first(); // clear values from specified Slot helper clearValue(inout slot: UML::Slot){ slot.value:=Sequence{}; return; } // create a LiteralString and add as value to specified Slot helper createLiteralString(inout slot: UML::Slot):UML::LiteralString{ var newValue:UML::LiteralString=new UML::LiteralString(); slot.value+=newValue; return newValue; } // create an InstanceValue of specified type and add as value to specified Slot helper createInstanceValue(inout slot: UML::Slot,in type:UML::Type):UML::InstanceValue{ var newValue:UML::InstanceValue=new UML::InstanceValue(); newValue.type:=type; slot.value+=newValue; return newValue; } // create an InstanceValue and add as value to specified Slot helper createInstanceValue(inout slot: UML::Slot):UML::InstanceValue{ var newValue:UML::InstanceValue=new UML::InstanceValue(); slot.value+=newValue; return newValue; } // add a classifier from the ModelPackageDescription Profile whose name is this String to the specified InstanceSpecification helper String::setInstanceClassifier(inout instanceSpecification:UML::InstanceSpecification){ instanceSpecification.classifier+=provisioningProfile.ownedType->select(t|t.name=self).oclAsType(UML::Classifier); return; } // create a LiteralBoolean and add as value to specified Slot helper createLiteralBoolean(inout slot: UML::Slot):UML::LiteralBoolean{ var newValue:UML::LiteralBoolean=new UML::LiteralBoolean(); slot.value+=newValue; return newValue; }