diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/model/nsd.ecore b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/model/nsd.ecore index 4ed29cb8a11c82eb2926cbb0c8e4480e54c839b1..c3224cfb04b6b68d15a9a650ee8abb748f75e365 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/model/nsd.ecore +++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/model/nsd.ecore @@ -1,6 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> -<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="nsd" nsURI="http://www.iec.ch/61850/2016/NSD" nsPrefix="nsd"> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" + name="nsd" nsURI="http://www.iec.ch/61850/2016/NSD" nsPrefix="nsd"> + <eAnnotations source="http://www.eclipse.org/OCL/Import"> + <details key="ecore" value="http://www.eclipse.org/emf/2002/Ecore"/> + <details key="ecore.xml.type" value="http://www.eclipse.org/emf/2003/XMLType"/> + </eAnnotations> + <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore"> + <details key="invocationDelegates" value="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"/> + <details key="settingDelegates" value="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"/> + <details key="validationDelegates" value="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"/> + </eAnnotations> <eClassifiers xsi:type="ecore:EClass" name="AppliesToType" eSuperTypes="#//NsdObject #//AgNSIdentification"> <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData"> <details key="name" value="AppliesTo_._type"/> @@ -379,6 +388,12 @@ <details key="name" value="tCDC"/> <details key="kind" value="elementOnly"/> </eAnnotations> + <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore"> + <details key="constraints" value="uniqueCDCChild"/> + </eAnnotations> + <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"> + <details key="uniqueCDCChild" value="Tuple {
	message : String = 'For a CDC, there shall not be two sub-elements (SubDataObject or DataAttribute) with same name.',
	status : Boolean = 
			let names : Bag(String) = self.subDataObject.name->union(self.dataAttribute.name) in names->size() = names->asSet()->size()
}.status"/> + </eAnnotations> <eStructuralFeatures xsi:type="ecore:EReference" name="subDataObject" ordered="false" upperBound="-1" eType="#//SubDataObject" unsettable="true" containment="true" resolveProxies="false" eOpposite="#//SubDataObject/cDC"> @@ -526,6 +541,12 @@ <details key="name" value="tConstructedAttribute"/> <details key="kind" value="elementOnly"/> </eAnnotations> + <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore"> + <details key="constraints" value="uniqueSubDataAttribute"/> + </eAnnotations> + <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"> + <details key="uniqueSubDataAttribute" value="Tuple {
	message : String = 'For a ConstructedAttribute, there shall not be two SubDataAttribute sub-elements with same name',
	status : Boolean = 
			self.subDataAttribute->isUnique( s : SubDataAttribute | s.name )
}.status"/> + </eAnnotations> <eStructuralFeatures xsi:type="ecore:EReference" name="subDataAttribute" ordered="false" upperBound="-1" eType="#//SubDataAttribute" unsettable="true" containment="true" resolveProxies="false" eOpposite="#//SubDataAttribute/constructedAttribute"> @@ -807,6 +828,13 @@ <details key="name" value="tEnumeration"/> <details key="kind" value="elementOnly"/> </eAnnotations> + <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore"> + <details key="constraints" value="uniqueLiteralName uniqueLiteralVal"/> + </eAnnotations> + <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"> + <details key="uniqueLiteralName" value="Tuple {
	message : String = 'For an Enumeration, there shall not be two Literal sub-elements with same name.',
	status : Boolean = 
			-- TODO: inherited literals should be taken into account
			-- For this, explicit links have to be created first
			self.literal->isUnique( l : Literal | l.name )
}.status"/> + <details key="uniqueLiteralVal" value="Tuple {
	message : String = 'For an Enumeration, there shall not be two Literal sub-elements with same liiteralVal.',
	status : Boolean = 
			self.literal->isUnique( l : Literal | l.literalVal )
}.status"/> + </eAnnotations> <eStructuralFeatures xsi:type="ecore:EReference" name="literal" ordered="false" upperBound="-1" eType="#//Literal" unsettable="true" containment="true" resolveProxies="false" eOpposite="#//Literal/enumeration"> diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/CDC.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/CDC.java index 736f82b6f80435fad39cf710592876b4babe1fbe..51e6df9bc22bd4103d5e2f756f42361a416f9549 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/CDC.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/CDC.java @@ -45,6 +45,8 @@ import org.eclipse.emf.common.util.EList; * * @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.NsdPackage#getCDC() * @model extendedMetaData="name='tCDC' kind='elementOnly'" + * annotation="http://www.eclipse.org/emf/2002/Ecore constraints='uniqueCDCChild'" + * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot uniqueCDCChild='Tuple {\n\tmessage : String = \'For a CDC, there shall not be two sub-elements (SubDataObject or DataAttribute) with same name.\',\n\tstatus : Boolean = \n\t\t\tlet names : Bag(String) = self.subDataObject.name->union(self.dataAttribute.name) in names->size() = names->asSet()->size()\n}.status'" * @generated */ public interface CDC extends TitledClass { diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/ConstructedAttribute.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/ConstructedAttribute.java index 28375661f9bd48cd1095c688df995fe81ecf37ba..3b9576a057aeb521c121c1f7a12d4ec6de64630d 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/ConstructedAttribute.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/ConstructedAttribute.java @@ -38,6 +38,8 @@ import org.eclipse.emf.common.util.EList; * * @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.NsdPackage#getConstructedAttribute() * @model extendedMetaData="name='tConstructedAttribute' kind='elementOnly'" + * annotation="http://www.eclipse.org/emf/2002/Ecore constraints='uniqueSubDataAttribute'" + * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot uniqueSubDataAttribute='Tuple {\n\tmessage : String = \'For a ConstructedAttribute, there shall not be two SubDataAttribute sub-elements with same name\',\n\tstatus : Boolean = \n\t\t\tself.subDataAttribute->isUnique( s : SubDataAttribute | s.name )\n}.status'" * @generated */ public interface ConstructedAttribute extends TitledClass { diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Enumeration.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Enumeration.java index ac1a737331df4172a7dae01b1858e3ebd014d4ac..779acc12d13b1b7cba17cd812199802328b11cd3 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Enumeration.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Enumeration.java @@ -40,6 +40,8 @@ import org.eclipse.emf.common.util.EList; * * @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.NsdPackage#getEnumeration() * @model extendedMetaData="name='tEnumeration' kind='elementOnly'" + * annotation="http://www.eclipse.org/emf/2002/Ecore constraints='uniqueLiteralName uniqueLiteralVal'" + * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot uniqueLiteralName='Tuple {\n\tmessage : String = \'For an Enumeration, there shall not be two Literal sub-elements with same name.\',\n\tstatus : Boolean = \n\t\t\t-- TODO: inherited literals should be taken into account\n\t\t\t-- For this, explicit links have to be created first\n\t\t\tself.literal->isUnique( l : Literal | l.name )\n}.status' uniqueLiteralVal='Tuple {\n\tmessage : String = \'For an Enumeration, there shall not be two Literal sub-elements with same liiteralVal.\',\n\tstatus : Boolean = \n\t\t\tself.literal->isUnique( l : Literal | l.literalVal )\n}.status'" * @generated */ public interface Enumeration extends TitledClass { diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/NsdPackage.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/NsdPackage.java index 00e5de4609826bd4beaaeb5fc89be48a2cd0c4df..1f497d9a3ac5f5be6c4384f2acdccbc0eadd187b 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/NsdPackage.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/NsdPackage.java @@ -44,6 +44,8 @@ import org.eclipse.emf.ecore.EReference; * <!-- end-model-doc --> * @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.NsdFactory * @model kind="package" + * annotation="http://www.eclipse.org/OCL/Import ecore='http://www.eclipse.org/emf/2002/Ecore' ecore.xml.type='http://www.eclipse.org/emf/2003/XMLType'" + * annotation="http://www.eclipse.org/emf/2002/Ecore invocationDelegates='http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot' settingDelegates='http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot' validationDelegates='http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot'" * @generated */ public interface NsdPackage extends EPackage { diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/impl/NsdPackageImpl.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/impl/NsdPackageImpl.java index 402cf9cf9e8ce5ac3aaefc2541db7f28d0926e34..6d7c2a4fb168a9ae5470ae31ee0a8180c9de8b4c 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/impl/NsdPackageImpl.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/impl/NsdPackageImpl.java @@ -5218,8 +5218,44 @@ public class NsdPackageImpl extends EPackageImpl implements NsdPackage { createResource( eNS_URI ); // Create annotations + // http://www.eclipse.org/OCL/Import + createImportAnnotations(); + // http://www.eclipse.org/emf/2002/Ecore + createEcoreAnnotations(); // http:///org/eclipse/emf/ecore/util/ExtendedMetaData createExtendedMetaDataAnnotations(); + // http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot + createPivotAnnotations(); + } + + /** + * Initializes the annotations for <b>http://www.eclipse.org/OCL/Import</b>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void createImportAnnotations() { + String source = "http://www.eclipse.org/OCL/Import"; + addAnnotation( this, source, new String[] { "ecore", "http://www.eclipse.org/emf/2002/Ecore", "ecore.xml.type", + "http://www.eclipse.org/emf/2003/XMLType" } ); + } + + /** + * Initializes the annotations for <b>http://www.eclipse.org/emf/2002/Ecore</b>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void createEcoreAnnotations() { + String source = "http://www.eclipse.org/emf/2002/Ecore"; + addAnnotation( this, source, + new String[] { "invocationDelegates", "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", + "settingDelegates", "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "validationDelegates", + "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot" } ); + addAnnotation( cdcEClass, source, new String[] { "constraints", "uniqueCDCChild" } ); + addAnnotation( constructedAttributeEClass, source, new String[] { "constraints", "uniqueSubDataAttribute" } ); + addAnnotation( enumerationEClass, source, + new String[] { "constraints", "uniqueLiteralName uniqueLiteralVal" } ); } /** @@ -5542,4 +5578,22 @@ public class NsdPackageImpl extends EPackageImpl implements NsdPackage { addAnnotation( getAgNSdesc_DescID(), source, new String[] { "kind", "attribute", "name", "descID" } ); } + /** + * Initializes the annotations for <b>http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot</b>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void createPivotAnnotations() { + String source = "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"; + addAnnotation( cdcEClass, source, new String[] { "uniqueCDCChild", + "Tuple {\n\tmessage : String = \'For a CDC, there shall not be two sub-elements (SubDataObject or DataAttribute) with same name.\',\n\tstatus : Boolean = \n\t\t\tlet names : Bag(String) = self.subDataObject.name->union(self.dataAttribute.name) in names->size() = names->asSet()->size()\n}.status" } ); + addAnnotation( constructedAttributeEClass, source, new String[] { "uniqueSubDataAttribute", + "Tuple {\n\tmessage : String = \'For a ConstructedAttribute, there shall not be two SubDataAttribute sub-elements with same name\',\n\tstatus : Boolean = \n\t\t\tself.subDataAttribute->isUnique( s : SubDataAttribute | s.name )\n}.status" } ); + addAnnotation( enumerationEClass, source, new String[] { "uniqueLiteralName", + "Tuple {\n\tmessage : String = \'For an Enumeration, there shall not be two Literal sub-elements with same name.\',\n\tstatus : Boolean = \n\t\t\t-- TODO: inherited literals should be taken into account\n\t\t\t-- For this, explicit links have to be created first\n\t\t\tself.literal->isUnique( l : Literal | l.name )\n}.status", + "uniqueLiteralVal", + "Tuple {\n\tmessage : String = \'For an Enumeration, there shall not be two Literal sub-elements with same liiteralVal.\',\n\tstatus : Boolean = \n\t\t\tself.literal->isUnique( l : Literal | l.literalVal )\n}.status" } ); + } + } //NsdPackageImpl diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/util/NsdResourceSetImpl.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/util/NsdResourceSetImpl.java index 70e3c423d6c15eab740038909340434e53d44673..c30d5cf888946a16e2f9d706e4ea1183a606373b 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/util/NsdResourceSetImpl.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/util/NsdResourceSetImpl.java @@ -76,18 +76,27 @@ public class NsdResourceSetImpl extends ResourceSetImpl { * NSDoc: * Name: uniqueDocID Selector: nsd:Doc Field: @id * Within an NSDoc element, there shall not be two Doc sub-elements with same id. + * * CDCs/CDC: * Name: uniqueCDCChild Selector: * Field: @name * For a CDC, there shall not be two sub-elements (SubDataObject or DataAttribute) with same name. + * DONE + * * ConstructedAttributes/ConstructedAttribute: * Name: uniqueSubDataAttribute Selector: nsd:SubDataAttribute Field: @name * For a ConstructedAttribute, there shall not be two SubDataAttribute sub-elements with same name. + * DONE + * * Enumerations/Enumeration: * Name: uniqueLiteralName Selector: nsd:Literal Field: @name * For an Enumeration, there shall not be two Literal sub-elements with same name. + * DONE + * * Enumerations/Enumeration: * Name: uniqueLiteralVal Selector: nsd:Literal Field: @literalVal * For an Enumeration, there shall not be two Literal sub-elements with same liiteralVal. + * DONE + * * FunctionalConstraint/ApplicableServices: * Name: uniqueDataSetMemberOf Selector: nsd:DataSetMemberOf Field: @cb * FunctionalConstraint/ApplicableServices: diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/util/NsdValidator.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/util/NsdValidator.java index ce713aa08dec8bc3e180ec8d9db8c5d698ada89d..661219010712f4012bc72ce85daadd98c49a6393 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/util/NsdValidator.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/util/NsdValidator.java @@ -389,7 +389,42 @@ public class NsdValidator extends EObjectValidator { * @generated */ public boolean validateCDC( CDC cdc, DiagnosticChain diagnostics, Map< Object, Object > context ) { - return validate_EveryDefaultConstraint( cdc, diagnostics, context ); + if( !validate_NoCircularContainment( cdc, diagnostics, context ) ) return false; + boolean result = validate_EveryMultiplicityConforms( cdc, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryDataValueConforms( cdc, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryReferenceIsContained( cdc, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryBidirectionalReferenceIsPaired( cdc, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryProxyResolves( cdc, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_UniqueID( cdc, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryKeyUnique( cdc, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryMapEntryUnique( cdc, diagnostics, context ); + if( result || diagnostics != null ) result &= validateCDC_uniqueCDCChild( cdc, diagnostics, context ); + return result; + } + + /** + * The cached validation expression for the uniqueCDCChild constraint of '<em>CDC</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static final String CDC__UNIQUE_CDC_CHILD__EEXPRESSION = "Tuple {\n" + + "\tmessage : String = 'For a CDC, there shall not be two sub-elements (SubDataObject or DataAttribute) with same name.',\n" + + "\tstatus : Boolean = \n" + + "\t\t\tlet names : Bag(String) = self.subDataObject.name->union(self.dataAttribute.name) in names->size() = names->asSet()->size()\n" + + "}.status"; + + /** + * Validates the uniqueCDCChild constraint of '<em>CDC</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateCDC_uniqueCDCChild( CDC cdc, DiagnosticChain diagnostics, Map< Object, Object > context ) { + return validate( NsdPackage.Literals.CDC, cdc, diagnostics, context, + "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "uniqueCDCChild", CDC__UNIQUE_CDC_CHILD__EEXPRESSION, + Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0 ); } /** @@ -417,7 +452,48 @@ public class NsdValidator extends EObjectValidator { */ public boolean validateConstructedAttribute( ConstructedAttribute constructedAttribute, DiagnosticChain diagnostics, Map< Object, Object > context ) { - return validate_EveryDefaultConstraint( constructedAttribute, diagnostics, context ); + if( !validate_NoCircularContainment( constructedAttribute, diagnostics, context ) ) return false; + boolean result = validate_EveryMultiplicityConforms( constructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryDataValueConforms( constructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryReferenceIsContained( constructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryBidirectionalReferenceIsPaired( constructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryProxyResolves( constructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_UniqueID( constructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryKeyUnique( constructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryMapEntryUnique( constructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) + result &= validateConstructedAttribute_uniqueSubDataAttribute( constructedAttribute, diagnostics, context ); + return result; + } + + /** + * The cached validation expression for the uniqueSubDataAttribute constraint of '<em>Constructed Attribute</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static final String CONSTRUCTED_ATTRIBUTE__UNIQUE_SUB_DATA_ATTRIBUTE__EEXPRESSION = "Tuple {\n" + + "\tmessage : String = 'For a ConstructedAttribute, there shall not be two SubDataAttribute sub-elements with same name',\n" + + "\tstatus : Boolean = \n" + "\t\t\tself.subDataAttribute->isUnique( s : SubDataAttribute | s.name )\n" + + "}.status"; + + /** + * Validates the uniqueSubDataAttribute constraint of '<em>Constructed Attribute</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateConstructedAttribute_uniqueSubDataAttribute( ConstructedAttribute constructedAttribute, + DiagnosticChain diagnostics, Map< Object, Object > context ) { + return validate( NsdPackage.Literals.CONSTRUCTED_ATTRIBUTE, constructedAttribute, diagnostics, context, + "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "uniqueSubDataAttribute", + CONSTRUCTED_ATTRIBUTE__UNIQUE_SUB_DATA_ATTRIBUTE__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0 ); } /** @@ -506,7 +582,71 @@ public class NsdValidator extends EObjectValidator { */ public boolean validateEnumeration( Enumeration enumeration, DiagnosticChain diagnostics, Map< Object, Object > context ) { - return validate_EveryDefaultConstraint( enumeration, diagnostics, context ); + if( !validate_NoCircularContainment( enumeration, diagnostics, context ) ) return false; + boolean result = validate_EveryMultiplicityConforms( enumeration, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryDataValueConforms( enumeration, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryReferenceIsContained( enumeration, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryBidirectionalReferenceIsPaired( enumeration, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryProxyResolves( enumeration, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_UniqueID( enumeration, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryKeyUnique( enumeration, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryMapEntryUnique( enumeration, diagnostics, context ); + if( result || diagnostics != null ) + result &= validateEnumeration_uniqueLiteralName( enumeration, diagnostics, context ); + if( result || diagnostics != null ) + result &= validateEnumeration_uniqueLiteralVal( enumeration, diagnostics, context ); + return result; + } + + /** + * The cached validation expression for the uniqueLiteralName constraint of '<em>Enumeration</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static final String ENUMERATION__UNIQUE_LITERAL_NAME__EEXPRESSION = "Tuple {\n" + + "\tmessage : String = 'For an Enumeration, there shall not be two Literal sub-elements with same name.',\n" + + "\tstatus : Boolean = \n" + "\t\t\t-- TODO: inherited literals should be taken into account\n" + + "\t\t\t-- For this, explicit links have to be created first\n" + + "\t\t\tself.literal->isUnique( l : Literal | l.name )\n" + "}.status"; + + /** + * Validates the uniqueLiteralName constraint of '<em>Enumeration</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateEnumeration_uniqueLiteralName( Enumeration enumeration, DiagnosticChain diagnostics, + Map< Object, Object > context ) { + return validate( NsdPackage.Literals.ENUMERATION, enumeration, diagnostics, context, + "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "uniqueLiteralName", + ENUMERATION__UNIQUE_LITERAL_NAME__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0 ); + } + + /** + * The cached validation expression for the uniqueLiteralVal constraint of '<em>Enumeration</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static final String ENUMERATION__UNIQUE_LITERAL_VAL__EEXPRESSION = "Tuple {\n" + + "\tmessage : String = 'For an Enumeration, there shall not be two Literal sub-elements with same liiteralVal.',\n" + + "\tstatus : Boolean = \n" + "\t\t\tself.literal->isUnique( l : Literal | l.literalVal )\n" + "}.status"; + + /** + * Validates the uniqueLiteralVal constraint of '<em>Enumeration</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateEnumeration_uniqueLiteralVal( Enumeration enumeration, DiagnosticChain diagnostics, + Map< Object, Object > context ) { + return validate( NsdPackage.Literals.ENUMERATION, enumeration, diagnostics, context, + "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "uniqueLiteralVal", + ENUMERATION__UNIQUE_LITERAL_VAL__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0 ); } /** @@ -650,7 +790,26 @@ public class NsdValidator extends EObjectValidator { */ public boolean validateServiceConstructedAttribute( ServiceConstructedAttribute serviceConstructedAttribute, DiagnosticChain diagnostics, Map< Object, Object > context ) { - return validate_EveryDefaultConstraint( serviceConstructedAttribute, diagnostics, context ); + if( !validate_NoCircularContainment( serviceConstructedAttribute, diagnostics, context ) ) return false; + boolean result = validate_EveryMultiplicityConforms( serviceConstructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryDataValueConforms( serviceConstructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryReferenceIsContained( serviceConstructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryBidirectionalReferenceIsPaired( serviceConstructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryProxyResolves( serviceConstructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_UniqueID( serviceConstructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryKeyUnique( serviceConstructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryMapEntryUnique( serviceConstructedAttribute, diagnostics, context ); + if( result || diagnostics != null ) + result &= validateConstructedAttribute_uniqueSubDataAttribute( serviceConstructedAttribute, diagnostics, + context ); + return result; } /**