From e8cd485854a8e6a7ad916c51bed56923653858db Mon Sep 17 00:00:00 2001 From: Dominique Marcadet <Dominique.Marcadet@centralesupelec.fr> Date: Fri, 8 Feb 2019 18:41:29 +0100 Subject: [PATCH] 4 more constraints --- .../model/nsd.ecore | 24 ++- .../riseclipse/iec61850/nsd/AnyLNClass.java | 2 + .../iec61850/nsd/ApplicableServices.java | 2 + .../riseclipse/iec61850/nsd/Enumeration.java | 2 +- .../iec61850/nsd/FunctionalConstraints.java | 2 + .../edf/riseclipse/iec61850/nsd/Literal.java | 3 - .../iec61850/nsd/impl/NsdPackageImpl.java | 15 +- .../iec61850/nsd/util/NsdResourceSetImpl.java | 12 +- .../iec61850/nsd/util/NsdValidator.java | 187 +++++++++++++++++- 9 files changed, 233 insertions(+), 16 deletions(-) diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/model/nsd.ecore b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/model/nsd.ecore index c3224cf..21d01e7 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/model/nsd.ecore +++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/model/nsd.ecore @@ -244,6 +244,12 @@ <details key="name" value="tAnyLNClass"/> <details key="kind" value="elementOnly"/> </eAnnotations> + <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore"> + <details key="constraints" value="uniqueDataObject"/> + </eAnnotations> + <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"> + <details key="uniqueDataObject" value="Tuple {
	message : String = 'For an AnyLNClass, there shall not be two DataObject sub-elements with same name.',
	status : Boolean = 
			self.dataObject->isUnique( d : DataObject | d.name )
}.status"/> + </eAnnotations> <eOperations name="getName" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/> <eOperations name="getLNClasses" eType="#//LNClasses"/> <eStructuralFeatures xsi:type="ecore:EReference" name="dataObject" ordered="false" @@ -300,6 +306,13 @@ <details key="name" value="tApplicableServices"/> <details key="kind" value="elementOnly"/> </eAnnotations> + <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore"> + <details key="constraints" value="uniqueDataSetMemberOf uniqueService"/> + </eAnnotations> + <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"> + <details key="uniqueDataSetMemberOf" value="Tuple {
	message : String = 'For an ApplicableServices, there shall not be two DataSetMemberOf sub-elements with same cb.',
	status : Boolean = 
			self.dataSetMemberOf->isUnique( d : DataSetMemberOf | d.cb )
}.status"/> + <details key="uniqueService" value="Tuple {
	message : String = 'For an ApplicableServices, there shall not be two ServiceType sub-elements with same name.',
	status : Boolean = 
			self.service->isUnique( s : ServiceType | s.name )
}.status"/> + </eAnnotations> <eStructuralFeatures xsi:type="ecore:EReference" name="service" ordered="false" upperBound="-1" eType="#//ServiceType" unsettable="true" containment="true" resolveProxies="false" eOpposite="#//ServiceType/applicableServices"> @@ -833,7 +846,7 @@ </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"/> + <details key="uniqueLiteralVal" value="Tuple {
	message : String = 'For an Enumeration, there shall not be two Literal sub-elements with same literalVal.',
	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" @@ -932,6 +945,12 @@ <details key="name" value="tFunctionalConstraints"/> <details key="kind" value="elementOnly"/> </eAnnotations> + <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore"> + <details key="constraints" value="uniqueFunctionalConstraint"/> + </eAnnotations> + <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"> + <details key="uniqueFunctionalConstraint" value="Tuple {
	message : String = 'There shall not be two FunctionalConstraint elements with same abbreviation.',
	status : Boolean = 
			self.functionalConstraint->isUnique( f : FunctionalConstraint | f.abbreviation )
}.status"/> + </eAnnotations> <eStructuralFeatures xsi:type="ecore:EReference" name="functionalConstraint" ordered="false" upperBound="-1" eType="#//FunctionalConstraint" unsettable="true" containment="true" resolveProxies="false" eOpposite="#//FunctionalConstraint/functionalConstraints"> @@ -1005,9 +1024,6 @@ </eStructuralFeatures> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" unsettable="true"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="Name of the enumeration's literal."/> - </eAnnotations> <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData"> <details key="kind" value="attribute"/> <details key="name" value="name"/> diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/AnyLNClass.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/AnyLNClass.java index 32154f7..94db09f 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/AnyLNClass.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/AnyLNClass.java @@ -38,6 +38,8 @@ import org.eclipse.emf.common.util.EList; * @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.NsdPackage#getAnyLNClass() * @model abstract="true" * extendedMetaData="name='tAnyLNClass' kind='elementOnly'" + * annotation="http://www.eclipse.org/emf/2002/Ecore constraints='uniqueDataObject'" + * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot uniqueDataObject='Tuple {\n\tmessage : String = \'For an AnyLNClass, there shall not be two DataObject sub-elements with same name.\',\n\tstatus : Boolean = \n\t\t\tself.dataObject->isUnique( d : DataObject | d.name )\n}.status'" * @generated */ public interface AnyLNClass extends TitledClass { diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/ApplicableServices.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/ApplicableServices.java index 2a30022..22bc32e 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/ApplicableServices.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/ApplicableServices.java @@ -37,6 +37,8 @@ import org.eclipse.emf.common.util.EList; * * @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.NsdPackage#getApplicableServices() * @model extendedMetaData="name='tApplicableServices' kind='elementOnly'" + * annotation="http://www.eclipse.org/emf/2002/Ecore constraints='uniqueDataSetMemberOf uniqueService'" + * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot uniqueDataSetMemberOf='Tuple {\n\tmessage : String = \'For an ApplicableServices, there shall not be two DataSetMemberOf sub-elements with same cb.\',\n\tstatus : Boolean = \n\t\t\tself.dataSetMemberOf->isUnique( d : DataSetMemberOf | d.cb )\n}.status' uniqueService='Tuple {\n\tmessage : String = \'For an ApplicableServices, there shall not be two ServiceType sub-elements with same name.\',\n\tstatus : Boolean = \n\t\t\tself.service->isUnique( s : ServiceType | s.name )\n}.status'" * @generated */ public interface ApplicableServices extends NsdObject { 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 779acc1..70c4fc8 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 @@ -41,7 +41,7 @@ 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'" + * 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 literalVal.\',\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/FunctionalConstraints.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/FunctionalConstraints.java index 9727267..2124736 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/FunctionalConstraints.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/FunctionalConstraints.java @@ -37,6 +37,8 @@ import org.eclipse.emf.common.util.EList; * * @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.NsdPackage#getFunctionalConstraints() * @model extendedMetaData="name='tFunctionalConstraints' kind='elementOnly'" + * annotation="http://www.eclipse.org/emf/2002/Ecore constraints='uniqueFunctionalConstraint'" + * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot uniqueFunctionalConstraint='Tuple {\n\tmessage : String = \'There shall not be two FunctionalConstraint elements with same abbreviation.\',\n\tstatus : Boolean = \n\t\t\tself.functionalConstraint->isUnique( f : FunctionalConstraint | f.abbreviation )\n}.status'" * @generated */ public interface FunctionalConstraints extends NsdObject { diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Literal.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Literal.java index fc7c5d3..050a7d6 100644 --- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Literal.java +++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Literal.java @@ -92,9 +92,6 @@ public interface Literal extends DocumentedClass { * Returns the value of the '<em><b>Name</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * Name of the enumeration's literal. - * <!-- end-model-doc --> * @return the value of the '<em>Name</em>' attribute. * @see #isSetName() * @see #unsetName() 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 6d7c2a4..56004cf 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 @@ -5252,10 +5252,15 @@ public class NsdPackageImpl extends EPackageImpl implements NsdPackage { 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( anyLNClassEClass, source, new String[] { "constraints", "uniqueDataObject" } ); + addAnnotation( applicableServicesEClass, source, + new String[] { "constraints", "uniqueDataSetMemberOf uniqueService" } ); addAnnotation( cdcEClass, source, new String[] { "constraints", "uniqueCDCChild" } ); addAnnotation( constructedAttributeEClass, source, new String[] { "constraints", "uniqueSubDataAttribute" } ); addAnnotation( enumerationEClass, source, new String[] { "constraints", "uniqueLiteralName uniqueLiteralVal" } ); + addAnnotation( functionalConstraintsEClass, source, + new String[] { "constraints", "uniqueFunctionalConstraint" } ); } /** @@ -5586,6 +5591,12 @@ public class NsdPackageImpl extends EPackageImpl implements NsdPackage { */ protected void createPivotAnnotations() { String source = "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"; + addAnnotation( anyLNClassEClass, source, new String[] { "uniqueDataObject", + "Tuple {\n\tmessage : String = \'For an AnyLNClass, there shall not be two DataObject sub-elements with same name.\',\n\tstatus : Boolean = \n\t\t\tself.dataObject->isUnique( d : DataObject | d.name )\n}.status" } ); + addAnnotation( applicableServicesEClass, source, new String[] { "uniqueDataSetMemberOf", + "Tuple {\n\tmessage : String = \'For an ApplicableServices, there shall not be two DataSetMemberOf sub-elements with same cb.\',\n\tstatus : Boolean = \n\t\t\tself.dataSetMemberOf->isUnique( d : DataSetMemberOf | d.cb )\n}.status", + "uniqueService", + "Tuple {\n\tmessage : String = \'For an ApplicableServices, there shall not be two ServiceType sub-elements with same name.\',\n\tstatus : Boolean = \n\t\t\tself.service->isUnique( s : ServiceType | s.name )\n}.status" } ); 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", @@ -5593,7 +5604,9 @@ public class NsdPackageImpl extends EPackageImpl implements NsdPackage { 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" } ); + "Tuple {\n\tmessage : String = \'For an Enumeration, there shall not be two Literal sub-elements with same literalVal.\',\n\tstatus : Boolean = \n\t\t\tself.literal->isUnique( l : Literal | l.literalVal )\n}.status" } ); + addAnnotation( functionalConstraintsEClass, source, new String[] { "uniqueFunctionalConstraint", + "Tuple {\n\tmessage : String = \'There shall not be two FunctionalConstraint elements with same abbreviation.\',\n\tstatus : Boolean = \n\t\t\tself.functionalConstraint->isUnique( f : FunctionalConstraint | f.abbreviation )\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 c30d5cf..21395b0 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 @@ -94,22 +94,32 @@ public class NsdResourceSetImpl extends ResourceSetImpl { * * Enumerations/Enumeration: * Name: uniqueLiteralVal Selector: nsd:Literal Field: @literalVal - * For an Enumeration, there shall not be two Literal sub-elements with same liiteralVal. + * For an Enumeration, there shall not be two Literal sub-elements with same literalVal. * DONE * * FunctionalConstraint/ApplicableServices: * Name: uniqueDataSetMemberOf Selector: nsd:DataSetMemberOf Field: @cb + * DONE + * * FunctionalConstraint/ApplicableServices: * Name: uniqueService Selector: nsd:Service Field: @name + * DONE + * * LNClasses/AbstractLNClass: * Name: uniqueDataObjectAbstractLNClass Selector: nsd:DataObject Field: @name * For a AbstractLNClass, there shall not be two DataObject sub-elements with same name. + * DONE + * * LNClasses/LNClass: * Name: uniqueDataObject Selector: nsd:DataObject Field: @name * For a LNClass, there shall not be two DataObject sub-elements with same name. + * DONE + * * NS/FunctionalConstraints: * Name: uniqueFunctionalConstraint Selector: nsd:FunctionalConstraint Field: @abbreviation * There shall not be two FunctionalConstraint elements with same abbreviation. + * DONE + * * NS/PresenceConditions: * Name: uniquePresenceCondition Selector: nsd:PresenceCondition Field: @name * There shall not be two PresenceCondition elements with same name. 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 6612190..07b0f14 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 @@ -330,7 +330,23 @@ public class NsdValidator extends EObjectValidator { */ public boolean validateAbstractLNClass( AbstractLNClass abstractLNClass, DiagnosticChain diagnostics, Map< Object, Object > context ) { - return validate_EveryDefaultConstraint( abstractLNClass, diagnostics, context ); + if( !validate_NoCircularContainment( abstractLNClass, diagnostics, context ) ) return false; + boolean result = validate_EveryMultiplicityConforms( abstractLNClass, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryDataValueConforms( abstractLNClass, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryReferenceIsContained( abstractLNClass, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryBidirectionalReferenceIsPaired( abstractLNClass, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryProxyResolves( abstractLNClass, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_UniqueID( abstractLNClass, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryKeyUnique( abstractLNClass, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryMapEntryUnique( abstractLNClass, diagnostics, context ); + if( result || diagnostics != null ) + result &= validateAnyLNClass_uniqueDataObject( abstractLNClass, diagnostics, context ); + return result; } /** @@ -340,7 +356,44 @@ public class NsdValidator extends EObjectValidator { */ public boolean validateAnyLNClass( AnyLNClass anyLNClass, DiagnosticChain diagnostics, Map< Object, Object > context ) { - return validate_EveryDefaultConstraint( anyLNClass, diagnostics, context ); + if( !validate_NoCircularContainment( anyLNClass, diagnostics, context ) ) return false; + boolean result = validate_EveryMultiplicityConforms( anyLNClass, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryDataValueConforms( anyLNClass, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryReferenceIsContained( anyLNClass, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryBidirectionalReferenceIsPaired( anyLNClass, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryProxyResolves( anyLNClass, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_UniqueID( anyLNClass, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryKeyUnique( anyLNClass, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryMapEntryUnique( anyLNClass, diagnostics, context ); + if( result || diagnostics != null ) + result &= validateAnyLNClass_uniqueDataObject( anyLNClass, diagnostics, context ); + return result; + } + + /** + * The cached validation expression for the uniqueDataObject constraint of '<em>Any LN Class</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static final String ANY_LN_CLASS__UNIQUE_DATA_OBJECT__EEXPRESSION = "Tuple {\n" + + "\tmessage : String = 'For an AnyLNClass, there shall not be two DataObject sub-elements with same name.',\n" + + "\tstatus : Boolean = \n" + "\t\t\tself.dataObject->isUnique( d : DataObject | d.name )\n" + "}.status"; + + /** + * Validates the uniqueDataObject constraint of '<em>Any LN Class</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateAnyLNClass_uniqueDataObject( AnyLNClass anyLNClass, DiagnosticChain diagnostics, + Map< Object, Object > context ) { + return validate( NsdPackage.Literals.ANY_LN_CLASS, anyLNClass, diagnostics, context, + "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "uniqueDataObject", + ANY_LN_CLASS__UNIQUE_DATA_OBJECT__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0 ); } /** @@ -360,7 +413,73 @@ public class NsdValidator extends EObjectValidator { */ public boolean validateApplicableServices( ApplicableServices applicableServices, DiagnosticChain diagnostics, Map< Object, Object > context ) { - return validate_EveryDefaultConstraint( applicableServices, diagnostics, context ); + if( !validate_NoCircularContainment( applicableServices, diagnostics, context ) ) return false; + boolean result = validate_EveryMultiplicityConforms( applicableServices, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryDataValueConforms( applicableServices, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryReferenceIsContained( applicableServices, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryBidirectionalReferenceIsPaired( applicableServices, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryProxyResolves( applicableServices, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_UniqueID( applicableServices, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryKeyUnique( applicableServices, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryMapEntryUnique( applicableServices, diagnostics, context ); + if( result || diagnostics != null ) + result &= validateApplicableServices_uniqueDataSetMemberOf( applicableServices, diagnostics, context ); + if( result || diagnostics != null ) + result &= validateApplicableServices_uniqueService( applicableServices, diagnostics, context ); + return result; + } + + /** + * The cached validation expression for the uniqueDataSetMemberOf constraint of '<em>Applicable Services</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static final String APPLICABLE_SERVICES__UNIQUE_DATA_SET_MEMBER_OF__EEXPRESSION = "Tuple {\n" + + "\tmessage : String = 'For an ApplicableServices, there shall not be two DataSetMemberOf sub-elements with same cb.',\n" + + "\tstatus : Boolean = \n" + "\t\t\tself.dataSetMemberOf->isUnique( d : DataSetMemberOf | d.cb )\n" + + "}.status"; + + /** + * Validates the uniqueDataSetMemberOf constraint of '<em>Applicable Services</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateApplicableServices_uniqueDataSetMemberOf( ApplicableServices applicableServices, + DiagnosticChain diagnostics, Map< Object, Object > context ) { + return validate( NsdPackage.Literals.APPLICABLE_SERVICES, applicableServices, diagnostics, context, + "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "uniqueDataSetMemberOf", + APPLICABLE_SERVICES__UNIQUE_DATA_SET_MEMBER_OF__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0 ); + } + + /** + * The cached validation expression for the uniqueService constraint of '<em>Applicable Services</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static final String APPLICABLE_SERVICES__UNIQUE_SERVICE__EEXPRESSION = "Tuple {\n" + + "\tmessage : String = 'For an ApplicableServices, there shall not be two ServiceType sub-elements with same name.',\n" + + "\tstatus : Boolean = \n" + "\t\t\tself.service->isUnique( s : ServiceType | s.name )\n" + "}.status"; + + /** + * Validates the uniqueService constraint of '<em>Applicable Services</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateApplicableServices_uniqueService( ApplicableServices applicableServices, + DiagnosticChain diagnostics, Map< Object, Object > context ) { + return validate( NsdPackage.Literals.APPLICABLE_SERVICES, applicableServices, diagnostics, context, + "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "uniqueService", + APPLICABLE_SERVICES__UNIQUE_SERVICE__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0 ); } /** @@ -633,7 +752,7 @@ public class NsdValidator extends EObjectValidator { * @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" + + "\tmessage : String = 'For an Enumeration, there shall not be two Literal sub-elements with same literalVal.',\n" + "\tstatus : Boolean = \n" + "\t\t\tself.literal->isUnique( l : Literal | l.literalVal )\n" + "}.status"; /** @@ -676,7 +795,50 @@ public class NsdValidator extends EObjectValidator { */ public boolean validateFunctionalConstraints( FunctionalConstraints functionalConstraints, DiagnosticChain diagnostics, Map< Object, Object > context ) { - return validate_EveryDefaultConstraint( functionalConstraints, diagnostics, context ); + if( !validate_NoCircularContainment( functionalConstraints, diagnostics, context ) ) return false; + boolean result = validate_EveryMultiplicityConforms( functionalConstraints, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryDataValueConforms( functionalConstraints, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryReferenceIsContained( functionalConstraints, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryBidirectionalReferenceIsPaired( functionalConstraints, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryProxyResolves( functionalConstraints, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_UniqueID( functionalConstraints, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryKeyUnique( functionalConstraints, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryMapEntryUnique( functionalConstraints, diagnostics, context ); + if( result || diagnostics != null ) + result &= validateFunctionalConstraints_uniqueFunctionalConstraint( functionalConstraints, diagnostics, + context ); + return result; + } + + /** + * The cached validation expression for the uniqueFunctionalConstraint constraint of '<em>Functional Constraints</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static final String FUNCTIONAL_CONSTRAINTS__UNIQUE_FUNCTIONAL_CONSTRAINT__EEXPRESSION = "Tuple {\n" + + "\tmessage : String = 'There shall not be two FunctionalConstraint elements with same abbreviation.',\n" + + "\tstatus : Boolean = \n" + + "\t\t\tself.functionalConstraint->isUnique( f : FunctionalConstraint | f.abbreviation )\n" + "}.status"; + + /** + * Validates the uniqueFunctionalConstraint constraint of '<em>Functional Constraints</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateFunctionalConstraints_uniqueFunctionalConstraint( + FunctionalConstraints functionalConstraints, DiagnosticChain diagnostics, Map< Object, Object > context ) { + return validate( NsdPackage.Literals.FUNCTIONAL_CONSTRAINTS, functionalConstraints, diagnostics, context, + "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "uniqueFunctionalConstraint", + FUNCTIONAL_CONSTRAINTS__UNIQUE_FUNCTIONAL_CONSTRAINT__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, + 0 ); } /** @@ -703,7 +865,20 @@ public class NsdValidator extends EObjectValidator { * @generated */ public boolean validateLNClass( LNClass lnClass, DiagnosticChain diagnostics, Map< Object, Object > context ) { - return validate_EveryDefaultConstraint( lnClass, diagnostics, context ); + if( !validate_NoCircularContainment( lnClass, diagnostics, context ) ) return false; + boolean result = validate_EveryMultiplicityConforms( lnClass, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryDataValueConforms( lnClass, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryReferenceIsContained( lnClass, diagnostics, context ); + if( result || diagnostics != null ) + result &= validate_EveryBidirectionalReferenceIsPaired( lnClass, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryProxyResolves( lnClass, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_UniqueID( lnClass, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryKeyUnique( lnClass, diagnostics, context ); + if( result || diagnostics != null ) result &= validate_EveryMapEntryUnique( lnClass, diagnostics, context ); + if( result || diagnostics != null ) + result &= validateAnyLNClass_uniqueDataObject( lnClass, diagnostics, context ); + return result; } /** -- GitLab