From 1ed977fc97be7881414aa158aa84f72d7e209d49 Mon Sep 17 00:00:00 2001
From: Dominique Marcadet <Dominique.Marcadet@centralesupelec.fr>
Date: Sat, 9 Feb 2019 18:31:40 +0100
Subject: [PATCH] last constraints added

---
 .../model/nsd.ecore                           |  41 ++-
 .../iec61850/nsd/Abbreviations.java           |   2 +
 .../riseclipse/iec61850/nsd/AnyLNClass.java   |   2 +-
 .../edf/riseclipse/iec61850/nsd/CDCs.java     |   2 +
 .../iec61850/nsd/ConstructedAttribute.java    |   2 +-
 .../iec61850/nsd/ConstructedAttributes.java   |   2 +
 .../riseclipse/iec61850/nsd/Enumerations.java |   2 +
 .../riseclipse/iec61850/nsd/LNClasses.java    |   2 +
 .../iec61850/nsd/PresenceConditions.java      |   2 +
 .../iec61850/nsd/impl/NsdPackageImpl.java     |  25 +-
 .../iec61850/nsd/util/NsdResourceSetImpl.java |  14 +-
 .../iec61850/nsd/util/NsdValidator.java       | 286 +++++++++++++++++-
 12 files changed, 367 insertions(+), 15 deletions(-)

diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/model/nsd.ecore b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/model/nsd.ecore
index 21d01e7..f44ebef 100644
--- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/model/nsd.ecore
+++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/model/nsd.ecore
@@ -136,6 +136,12 @@
       <details key="name" value="tAbbreviations"/>
       <details key="kind" value="elementOnly"/>
     </eAnnotations>
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="uniqueAbbreviation"/>
+    </eAnnotations>
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
+      <details key="uniqueAbbreviation" value="Tuple {&#xA;&#x9;message : String = 'There shall not be two Abbreviations elements with same name.',&#xA;&#x9;status : Boolean = &#xA;&#x9;&#x9;&#x9;self.abbreviation->isUnique( a : Abbreviation | a.name )&#xA;}.status"/>
+    </eAnnotations>
     <eStructuralFeatures xsi:type="ecore:EReference" name="abbreviation" ordered="false"
         upperBound="-1" eType="#//Abbreviation" unsettable="true" containment="true"
         resolveProxies="false" eOpposite="#//Abbreviation/abbreviations">
@@ -248,7 +254,7 @@
       <details key="constraints" value="uniqueDataObject"/>
     </eAnnotations>
     <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
-      <details key="uniqueDataObject" value="Tuple {&#xA;&#x9;message : String = 'For an AnyLNClass, there shall not be two DataObject sub-elements with same name.',&#xA;&#x9;status : Boolean = &#xA;&#x9;&#x9;&#x9;self.dataObject->isUnique( d : DataObject | d.name )&#xA;}.status"/>
+      <details key="uniqueDataObject" value="Tuple {&#xA;&#x9;message : String = 'For an AnyLNClass, there shall not be two DataObject sub-elements with same name.',&#xA;&#x9;status : Boolean = &#xA;&#x9;&#x9;&#x9;-- TODO: base AbstractLNClass should be taken into account&#xA;&#x9;&#x9;&#x9;-- For this, explicit links have to be created first&#xA;&#x9;&#x9;&#x9;self.dataObject->isUnique( d : DataObject | d.name )&#xA;}.status"/>
     </eAnnotations>
     <eOperations name="getName" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
     <eOperations name="getLNClasses" eType="#//LNClasses"/>
@@ -484,6 +490,12 @@
       <details key="name" value="tCDCs"/>
       <details key="kind" value="elementOnly"/>
     </eAnnotations>
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="uniqueCDC"/>
+    </eAnnotations>
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
+      <details key="uniqueCDC" value="Tuple {&#xA;&#x9;message : String = 'Within an NS, there shall not be two CDC sub-elements with same name and (if defined) variant.',&#xA;&#x9;status : Boolean = &#xA;&#x9;&#x9;&#x9;-- TODO: DependsOn NS should be taken into account ?&#xA;&#x9;&#x9;&#x9;-- For this, explicit links have to be created first&#xA;&#x9;&#x9;&#x9;-- Then, may be this constraint should be in NS and not in Enumerations ?&#xA;&#x9;&#x9;&#x9;self.cDC->select( c : CDC | c.variant = null )->isUnique( c : CDC | c.name )&#xA;&#x9;     or self.cDC->select( c : CDC | c.variant &lt;> null )->forAll( c1, c2 : CDC | c1 &lt;> c2 implies c1.name &lt;> c2.name or c1.variant &lt;> c2.variant )&#xA;}.status"/>
+    </eAnnotations>
     <eStructuralFeatures xsi:type="ecore:EReference" name="cDC" ordered="false" upperBound="-1"
         eType="#//CDC" unsettable="true" containment="true" resolveProxies="false"
         eOpposite="#//CDC/cDCs">
@@ -558,7 +570,7 @@
       <details key="constraints" value="uniqueSubDataAttribute"/>
     </eAnnotations>
     <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
-      <details key="uniqueSubDataAttribute" value="Tuple {&#xA;&#x9;message : String = 'For a ConstructedAttribute, there shall not be two SubDataAttribute sub-elements with same name',&#xA;&#x9;status : Boolean = &#xA;&#x9;&#x9;&#x9;self.subDataAttribute->isUnique( s : SubDataAttribute | s.name )&#xA;}.status"/>
+      <details key="uniqueSubDataAttribute" value="Tuple {&#xA;&#x9;message : String = 'For a ConstructedAttribute, there shall not be two SubDataAttribute sub-elements with same name.',&#xA;&#x9;status : Boolean = &#xA;&#x9;&#x9;&#x9;self.subDataAttribute->isUnique( s : SubDataAttribute | s.name )&#xA;}.status"/>
     </eAnnotations>
     <eStructuralFeatures xsi:type="ecore:EReference" name="subDataAttribute" ordered="false"
         upperBound="-1" eType="#//SubDataAttribute" unsettable="true" containment="true"
@@ -588,6 +600,12 @@
       <details key="name" value="tConstructedAttributes"/>
       <details key="kind" value="elementOnly"/>
     </eAnnotations>
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="uniqueConstructedAttribute"/>
+    </eAnnotations>
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
+      <details key="uniqueConstructedAttribute" value="Tuple {&#xA;&#x9;message : String = 'Within an NS, there shall not be two ConstructedAttribute sub-elements with same name.',&#xA;&#x9;status : Boolean = &#xA;&#x9;&#x9;&#x9;-- TODO: DependsOn NS should be taken into account ?&#xA;&#x9;&#x9;&#x9;-- For this, explicit links have to be created first&#xA;&#x9;&#x9;&#x9;-- Then, may be this constraint should be in NS and not in Enumerations ?&#xA;&#x9;&#x9;&#x9;self.constructedAttribute->isUnique( c : ConstructedAttribute | c.name )&#xA;}.status"/>
+    </eAnnotations>
     <eStructuralFeatures xsi:type="ecore:EReference" name="constructedAttribute" ordered="false"
         upperBound="-1" eType="#//ConstructedAttribute" unsettable="true" containment="true"
         resolveProxies="false" eOpposite="#//ConstructedAttribute/constructedAttributes">
@@ -886,6 +904,12 @@
       <details key="name" value="tEnumerations"/>
       <details key="kind" value="elementOnly"/>
     </eAnnotations>
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="uniqueEnumeration"/>
+    </eAnnotations>
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
+      <details key="uniqueEnumeration" value="Tuple {&#xA;&#x9;message : String = 'Within an NS, there shall not be two Enumeration sub-elements with same name.',&#xA;&#x9;status : Boolean = &#xA;&#x9;&#x9;&#x9;-- TODO: DependsOn NS should be taken into account ?&#xA;&#x9;&#x9;&#x9;-- For this, explicit links have to be created first&#xA;&#x9;&#x9;&#x9;-- Then, may be this constraint should be in NS and not in Enumerations ?&#xA;&#x9;&#x9;&#x9;self.enumeration->isUnique( e : Enumeration | e.name )&#xA;}.status"/>
+    </eAnnotations>
     <eStructuralFeatures xsi:type="ecore:EReference" name="enumeration" upperBound="-1"
         eType="#//Enumeration" unsettable="true" containment="true" resolveProxies="false"
         eOpposite="#//Enumeration/enumerations">
@@ -1068,6 +1092,13 @@
       <details key="name" value="tLNClasses"/>
       <details key="kind" value="elementOnly"/>
     </eAnnotations>
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="uniqueAbstractLNClass uniqueLNClass"/>
+    </eAnnotations>
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
+      <details key="uniqueAbstractLNClass" value="Tuple {&#xA;&#x9;message : String = 'Within an NS, there shall not be two AbstractLNClass sub-elements with same name.',&#xA;&#x9;status : Boolean = &#xA;&#x9;&#x9;&#x9;self.abstractLNClass->isUnique( c : AbstractLNClass | c.name )&#xA;}.status"/>
+      <details key="uniqueLNClass" value="Tuple {&#xA;&#x9;message : String = 'Within an NS, there shall not be two LNClass sub-elements with same name.',&#xA;&#x9;status : Boolean = &#xA;&#x9;&#x9;&#x9;self.lNClass->isUnique( c : LNClass | c.name )&#xA;}.status"/>
+    </eAnnotations>
     <eStructuralFeatures xsi:type="ecore:EReference" name="abstractLNClass" ordered="false"
         upperBound="-1" eType="#//AbstractLNClass" unsettable="true" containment="true"
         resolveProxies="false" eOpposite="#//AbstractLNClass/lNClasses">
@@ -1298,6 +1329,12 @@
       <details key="name" value="tPresenceConditions"/>
       <details key="kind" value="elementOnly"/>
     </eAnnotations>
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
+      <details key="constraints" value="uniquePresenceCondition"/>
+    </eAnnotations>
+    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
+      <details key="uniquePresenceCondition" value="Tuple {&#xA;&#x9;message : String = 'There shall not be two PresenceCondition elements with same name.',&#xA;&#x9;status : Boolean = &#xA;&#x9;&#x9;&#x9;self.presenceCondition->isUnique( p : PresenceCondition | p.name )&#xA;}.status"/>
+    </eAnnotations>
     <eStructuralFeatures xsi:type="ecore:EReference" name="presenceCondition" ordered="false"
         upperBound="-1" eType="#//PresenceCondition" unsettable="true" containment="true"
         resolveProxies="false" eOpposite="#//PresenceCondition/presenceConditions">
diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Abbreviations.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Abbreviations.java
index 2999912..bd2d91b 100644
--- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Abbreviations.java
+++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Abbreviations.java
@@ -37,6 +37,8 @@ import org.eclipse.emf.common.util.EList;
  *
  * @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.NsdPackage#getAbbreviations()
  * @model extendedMetaData="name='tAbbreviations' kind='elementOnly'"
+ *        annotation="http://www.eclipse.org/emf/2002/Ecore constraints='uniqueAbbreviation'"
+ *        annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot uniqueAbbreviation='Tuple {\n\tmessage : String = \'There shall not be two Abbreviations elements with same name.\',\n\tstatus : Boolean = \n\t\t\tself.abbreviation-&gt;isUnique( a : Abbreviation | a.name )\n}.status'"
  * @generated
  */
 public interface Abbreviations extends NsdObject {
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 94db09f..e9a7e3d 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
@@ -39,7 +39,7 @@ import org.eclipse.emf.common.util.EList;
  * @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-&gt;isUnique( d : DataObject | d.name )\n}.status'"
+ *        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\t-- TODO: base AbstractLNClass should be taken into account\n\t\t\t-- For this, explicit links have to be created first\n\t\t\tself.dataObject-&gt;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/CDCs.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/CDCs.java
index cf27f94..eb996b3 100644
--- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/CDCs.java
+++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/CDCs.java
@@ -36,6 +36,8 @@ import org.eclipse.emf.common.util.EList;
  *
  * @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.NsdPackage#getCDCs()
  * @model extendedMetaData="name='tCDCs' kind='elementOnly'"
+ *        annotation="http://www.eclipse.org/emf/2002/Ecore constraints='uniqueCDC'"
+ *        annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot uniqueCDC='Tuple {\n\tmessage : String = \'Within an NS, there shall not be two CDC sub-elements with same name and (if defined) variant.\',\n\tstatus : Boolean = \n\t\t\t-- TODO: DependsOn NS should be taken into account ?\n\t\t\t-- For this, explicit links have to be created first\n\t\t\t-- Then, may be this constraint should be in NS and not in Enumerations ?\n\t\t\tself.cDC-&gt;select( c : CDC | c.variant = null )-&gt;isUnique( c : CDC | c.name )\n\t     or self.cDC-&gt;select( c : CDC | c.variant &lt;&gt; null )-&gt;forAll( c1, c2 : CDC | c1 &lt;&gt; c2 implies c1.name &lt;&gt; c2.name or c1.variant &lt;&gt; c2.variant )\n}.status'"
  * @generated
  */
 public interface CDCs extends NsdObject {
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 3b9576a..2a77887 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
@@ -39,7 +39,7 @@ 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-&gt;isUnique( s : SubDataAttribute | s.name )\n}.status'"
+ *        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-&gt;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/ConstructedAttributes.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/ConstructedAttributes.java
index 1d8f654..b68b7a1 100644
--- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/ConstructedAttributes.java
+++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/ConstructedAttributes.java
@@ -36,6 +36,8 @@ import org.eclipse.emf.common.util.EList;
  *
  * @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.NsdPackage#getConstructedAttributes()
  * @model extendedMetaData="name='tConstructedAttributes' kind='elementOnly'"
+ *        annotation="http://www.eclipse.org/emf/2002/Ecore constraints='uniqueConstructedAttribute'"
+ *        annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot uniqueConstructedAttribute='Tuple {\n\tmessage : String = \'Within an NS, there shall not be two ConstructedAttribute sub-elements with same name.\',\n\tstatus : Boolean = \n\t\t\t-- TODO: DependsOn NS should be taken into account ?\n\t\t\t-- For this, explicit links have to be created first\n\t\t\t-- Then, may be this constraint should be in NS and not in Enumerations ?\n\t\t\tself.constructedAttribute-&gt;isUnique( c : ConstructedAttribute | c.name )\n}.status'"
  * @generated
  */
 public interface ConstructedAttributes extends NsdObject {
diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Enumerations.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Enumerations.java
index 040d613..f9d5811 100644
--- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Enumerations.java
+++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/Enumerations.java
@@ -36,6 +36,8 @@ import org.eclipse.emf.common.util.EList;
  *
  * @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.NsdPackage#getEnumerations()
  * @model extendedMetaData="name='tEnumerations' kind='elementOnly'"
+ *        annotation="http://www.eclipse.org/emf/2002/Ecore constraints='uniqueEnumeration'"
+ *        annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot uniqueEnumeration='Tuple {\n\tmessage : String = \'Within an NS, there shall not be two Enumeration sub-elements with same name.\',\n\tstatus : Boolean = \n\t\t\t-- TODO: DependsOn NS should be taken into account ?\n\t\t\t-- For this, explicit links have to be created first\n\t\t\t-- Then, may be this constraint should be in NS and not in Enumerations ?\n\t\t\tself.enumeration-&gt;isUnique( e : Enumeration | e.name )\n}.status'"
  * @generated
  */
 public interface Enumerations extends NsdObject {
diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/LNClasses.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/LNClasses.java
index a5b2fb8..7abdfac 100644
--- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/LNClasses.java
+++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/LNClasses.java
@@ -37,6 +37,8 @@ import org.eclipse.emf.common.util.EList;
  *
  * @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.NsdPackage#getLNClasses()
  * @model extendedMetaData="name='tLNClasses' kind='elementOnly'"
+ *        annotation="http://www.eclipse.org/emf/2002/Ecore constraints='uniqueAbstractLNClass uniqueLNClass'"
+ *        annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot uniqueAbstractLNClass='Tuple {\n\tmessage : String = \'Within an NS, there shall not be two AbstractLNClass sub-elements with same name.\',\n\tstatus : Boolean = \n\t\t\tself.abstractLNClass-&gt;isUnique( c : AbstractLNClass | c.name )\n}.status' uniqueLNClass='Tuple {\n\tmessage : String = \'Within an NS, there shall not be two LNClass sub-elements with same name.\',\n\tstatus : Boolean = \n\t\t\tself.lNClass-&gt;isUnique( c : LNClass | c.name )\n}.status'"
  * @generated
  */
 public interface LNClasses extends NsdObject {
diff --git a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/PresenceConditions.java b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/PresenceConditions.java
index ea010d2..a0b5819 100644
--- a/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/PresenceConditions.java
+++ b/fr.centralesupelec.edf.riseclipse.iec61850.nsd/src/fr/centralesupelec/edf/riseclipse/iec61850/nsd/PresenceConditions.java
@@ -37,6 +37,8 @@ import org.eclipse.emf.common.util.EList;
  *
  * @see fr.centralesupelec.edf.riseclipse.iec61850.nsd.NsdPackage#getPresenceConditions()
  * @model extendedMetaData="name='tPresenceConditions' kind='elementOnly'"
+ *        annotation="http://www.eclipse.org/emf/2002/Ecore constraints='uniquePresenceCondition'"
+ *        annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot uniquePresenceCondition='Tuple {\n\tmessage : String = \'There shall not be two PresenceCondition elements with same name.\',\n\tstatus : Boolean = \n\t\t\tself.presenceCondition-&gt;isUnique( p : PresenceCondition | p.name )\n}.status'"
  * @generated
  */
 public interface PresenceConditions extends NsdObject {
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 56004cf..21b48d7 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,15 +5252,22 @@ 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( abbreviationsEClass, source, new String[] { "constraints", "uniqueAbbreviation" } );
         addAnnotation( anyLNClassEClass, source, new String[] { "constraints", "uniqueDataObject" } );
         addAnnotation( applicableServicesEClass, source,
                 new String[] { "constraints", "uniqueDataSetMemberOf uniqueService" } );
         addAnnotation( cdcEClass, source, new String[] { "constraints", "uniqueCDCChild" } );
+        addAnnotation( cdCsEClass, source, new String[] { "constraints", "uniqueCDC" } );
         addAnnotation( constructedAttributeEClass, source, new String[] { "constraints", "uniqueSubDataAttribute" } );
+        addAnnotation( constructedAttributesEClass, source,
+                new String[] { "constraints", "uniqueConstructedAttribute" } );
         addAnnotation( enumerationEClass, source,
                 new String[] { "constraints", "uniqueLiteralName uniqueLiteralVal" } );
+        addAnnotation( enumerationsEClass, source, new String[] { "constraints", "uniqueEnumeration" } );
         addAnnotation( functionalConstraintsEClass, source,
                 new String[] { "constraints", "uniqueFunctionalConstraint" } );
+        addAnnotation( lnClassesEClass, source, new String[] { "constraints", "uniqueAbstractLNClass uniqueLNClass" } );
+        addAnnotation( presenceConditionsEClass, source, new String[] { "constraints", "uniquePresenceCondition" } );
     }
 
     /**
@@ -5591,22 +5598,36 @@ public class NsdPackageImpl extends EPackageImpl implements NsdPackage {
      */
     protected void createPivotAnnotations() {
         String source = "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot";
+        addAnnotation( abbreviationsEClass, source, new String[] { "uniqueAbbreviation",
+                "Tuple {\n\tmessage : String = \'There shall not be two Abbreviations elements with same name.\',\n\tstatus : Boolean = \n\t\t\tself.abbreviation->isUnique( a : Abbreviation | a.name )\n}.status" } );
         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" } );
+                "Tuple {\n\tmessage : String = \'For an AnyLNClass, there shall not be two DataObject sub-elements with same name.\',\n\tstatus : Boolean = \n\t\t\t-- TODO: base AbstractLNClass should be taken into account\n\t\t\t-- For this, explicit links have to be created first\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( cdCsEClass, source, new String[] { "uniqueCDC",
+                "Tuple {\n\tmessage : String = \'Within an NS, there shall not be two CDC sub-elements with same name and (if defined) variant.\',\n\tstatus : Boolean = \n\t\t\t-- TODO: DependsOn NS should be taken into account ?\n\t\t\t-- For this, explicit links have to be created first\n\t\t\t-- Then, may be this constraint should be in NS and not in Enumerations ?\n\t\t\tself.cDC->select( c : CDC | c.variant = null )->isUnique( c : CDC | c.name )\n\t     or self.cDC->select( c : CDC | c.variant <> null )->forAll( c1, c2 : CDC | c1 <> c2 implies c1.name <> c2.name or c1.variant <> c2.variant )\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" } );
+                "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( constructedAttributesEClass, source, new String[] { "uniqueConstructedAttribute",
+                "Tuple {\n\tmessage : String = \'Within an NS, there shall not be two ConstructedAttribute sub-elements with same name.\',\n\tstatus : Boolean = \n\t\t\t-- TODO: DependsOn NS should be taken into account ?\n\t\t\t-- For this, explicit links have to be created first\n\t\t\t-- Then, may be this constraint should be in NS and not in Enumerations ?\n\t\t\tself.constructedAttribute->isUnique( c : ConstructedAttribute | c.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 literalVal.\',\n\tstatus : Boolean = \n\t\t\tself.literal->isUnique( l : Literal | l.literalVal )\n}.status" } );
+        addAnnotation( enumerationsEClass, source, new String[] { "uniqueEnumeration",
+                "Tuple {\n\tmessage : String = \'Within an NS, there shall not be two Enumeration sub-elements with same name.\',\n\tstatus : Boolean = \n\t\t\t-- TODO: DependsOn NS should be taken into account ?\n\t\t\t-- For this, explicit links have to be created first\n\t\t\t-- Then, may be this constraint should be in NS and not in Enumerations ?\n\t\t\tself.enumeration->isUnique( e : Enumeration | e.name )\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" } );
+        addAnnotation( lnClassesEClass, source, new String[] { "uniqueAbstractLNClass",
+                "Tuple {\n\tmessage : String = \'Within an NS, there shall not be two AbstractLNClass sub-elements with same name.\',\n\tstatus : Boolean = \n\t\t\tself.abstractLNClass->isUnique( c : AbstractLNClass | c.name )\n}.status",
+                "uniqueLNClass",
+                "Tuple {\n\tmessage : String = \'Within an NS, there shall not be two LNClass sub-elements with same name.\',\n\tstatus : Boolean = \n\t\t\tself.lNClass->isUnique( c : LNClass | c.name )\n}.status" } );
+        addAnnotation( presenceConditionsEClass, source, new String[] { "uniquePresenceCondition",
+                "Tuple {\n\tmessage : String = \'There shall not be two PresenceCondition elements with same name.\',\n\tstatus : Boolean = \n\t\t\tself.presenceCondition->isUnique( p : PresenceCondition | p.name )\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 21395b0..be4362b 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
@@ -64,7 +64,7 @@ public class NsdResourceSetImpl extends ResourceSetImpl {
         }
         NS ns = ( NS ) root.getNS();
         if( nsdResources.get( ns.getId() ) != null ) {
-            AbstractRiseClipseConsole.getConsole().error( "There is already an NSD file with is " + ns.getId() + ", " + resource.getURI() + "is ignored" );
+            AbstractRiseClipseConsole.getConsole().error( "There is already an NSD file with is " + ns.getId() + ", " + resource.getURI() + " is ignored" );
             this.getResources().remove( resource );
             return;
         }
@@ -123,23 +123,35 @@ public class NsdResourceSetImpl extends ResourceSetImpl {
      *   NS/PresenceConditions:
      *     Name: uniquePresenceCondition               Selector: nsd:PresenceCondition             Field: @name
      *     There shall not be two PresenceCondition elements with same name.
+     *   DONE
+     *     
      *   NS/Abbreviations:
      *     Name: uniqueAbbreviation                    Selector: nsd:Abbreviation                  Field: @name
      *     There shall not be two Abbreviations elements with same name.
+     *   DONE
+     *     
      *   NS/Enumerations:
      *     Name: uniqueEnumeration                     Selector: nsd:Enumeration                   Field: @name
      *     Within an NS, there shall not be two Enumeration sub-elements with same name.
+     *   DONE
+     *     
      *   NS/ConstructedAttributes
      *     Name: uniqueConstructedAttribute            Selector: nsd:ConstructedAttribute          Field: @name
      *     Within an NS, there shall not be two ConstructedAttribute sub-elements with same name.
+     *   DONE
+     *     
      *   NS/CDCs:
      *     Name: uniqueCDC                             Selector: nsd:CDC                           Field: @name @variant
      *     Within an NS, there shall not be two CDC sub-elements with same name and (if defined) variant.
+     *   DONE
+     *     
      *   NS/LNClasses:
      *     Name: uniqueAbstractLNClass                 Selector: nsd:AbstractLNClass               Field: @name
      *     Within an NS, there shall not be two AbstractLNClass sub-elements with same name.
      *     Name: uniqueLNClass              Selector: nsd:LNClass        Field: @name
      *     Within an NS, there shall not be two LNClass sub-elements with same name.
+     *   DONE
+     *     
      *   ServiceCDCs/ServiceCDC:
      *     Name: uniqueServiceCDCChild                 Selector: nsd:ServiceDataAttribute          Field: @name
      *     For a CDC, there shall not be two ServiceDataAttribute sub-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 07b0f14..13993e8 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
@@ -320,7 +320,47 @@ public class NsdValidator extends EObjectValidator {
      */
     public boolean validateAbbreviations( Abbreviations abbreviations, DiagnosticChain diagnostics,
             Map< Object, Object > context ) {
-        return validate_EveryDefaultConstraint( abbreviations, diagnostics, context );
+        if( !validate_NoCircularContainment( abbreviations, diagnostics, context ) ) return false;
+        boolean result = validate_EveryMultiplicityConforms( abbreviations, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryDataValueConforms( abbreviations, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryReferenceIsContained( abbreviations, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryBidirectionalReferenceIsPaired( abbreviations, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryProxyResolves( abbreviations, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_UniqueID( abbreviations, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_EveryKeyUnique( abbreviations, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryMapEntryUnique( abbreviations, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validateAbbreviations_uniqueAbbreviation( abbreviations, diagnostics, context );
+        return result;
+    }
+
+    /**
+     * The cached validation expression for the uniqueAbbreviation constraint of '<em>Abbreviations</em>'.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    protected static final String ABBREVIATIONS__UNIQUE_ABBREVIATION__EEXPRESSION = "Tuple {\n"
+            + "\tmessage : String = 'There shall not be two Abbreviations elements with same name.',\n"
+            + "\tstatus : Boolean = \n" + "\t\t\tself.abbreviation->isUnique( a : Abbreviation | a.name )\n"
+            + "}.status";
+
+    /**
+     * Validates the uniqueAbbreviation constraint of '<em>Abbreviations</em>'.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public boolean validateAbbreviations_uniqueAbbreviation( Abbreviations abbreviations, DiagnosticChain diagnostics,
+            Map< Object, Object > context ) {
+        return validate( NsdPackage.Literals.ABBREVIATIONS, abbreviations, diagnostics, context,
+                "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "uniqueAbbreviation",
+                ABBREVIATIONS__UNIQUE_ABBREVIATION__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0 );
     }
 
     /**
@@ -381,7 +421,9 @@ public class NsdValidator extends EObjectValidator {
      */
     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";
+            + "\tstatus : Boolean = \n" + "\t\t\t-- TODO: base AbstractLNClass should be taken into account\n"
+            + "\t\t\t-- For this, explicit links have to be created first\n"
+            + "\t\t\tself.dataObject->isUnique( d : DataObject | d.name )\n" + "}.status";
 
     /**
      * Validates the uniqueDataObject constraint of '<em>Any LN Class</em>'.
@@ -552,7 +594,45 @@ public class NsdValidator extends EObjectValidator {
      * @generated
      */
     public boolean validateCDCs( CDCs cdCs, DiagnosticChain diagnostics, Map< Object, Object > context ) {
-        return validate_EveryDefaultConstraint( cdCs, diagnostics, context );
+        if( !validate_NoCircularContainment( cdCs, diagnostics, context ) ) return false;
+        boolean result = validate_EveryMultiplicityConforms( cdCs, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_EveryDataValueConforms( cdCs, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_EveryReferenceIsContained( cdCs, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryBidirectionalReferenceIsPaired( cdCs, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_EveryProxyResolves( cdCs, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_UniqueID( cdCs, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_EveryKeyUnique( cdCs, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_EveryMapEntryUnique( cdCs, diagnostics, context );
+        if( result || diagnostics != null ) result &= validateCDCs_uniqueCDC( cdCs, diagnostics, context );
+        return result;
+    }
+
+    /**
+     * The cached validation expression for the uniqueCDC constraint of '<em>CD Cs</em>'.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    protected static final String CD_CS__UNIQUE_CDC__EEXPRESSION = "Tuple {\n"
+            + "\tmessage : String = 'Within an NS, there shall not be two CDC sub-elements with same name and (if defined) variant.',\n"
+            + "\tstatus : Boolean = \n" + "\t\t\t-- TODO: DependsOn NS should be taken into account ?\n"
+            + "\t\t\t-- For this, explicit links have to be created first\n"
+            + "\t\t\t-- Then, may be this constraint should be in NS and not in Enumerations ?\n"
+            + "\t\t\tself.cDC->select( c : CDC | c.variant = null )->isUnique( c : CDC | c.name )\n"
+            + "\t     or self.cDC->select( c : CDC | c.variant <> null )->forAll( c1, c2 : CDC | c1 <> c2 implies c1.name <> c2.name or c1.variant <> c2.variant )\n"
+            + "}.status";
+
+    /**
+     * Validates the uniqueCDC constraint of '<em>CD Cs</em>'.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public boolean validateCDCs_uniqueCDC( CDCs cdCs, DiagnosticChain diagnostics, Map< Object, Object > context ) {
+        return validate( NsdPackage.Literals.CD_CS, cdCs, diagnostics, context,
+                "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "uniqueCDC", CD_CS__UNIQUE_CDC__EEXPRESSION,
+                Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0 );
     }
 
     /**
@@ -598,7 +678,7 @@ public class NsdValidator extends EObjectValidator {
      * @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"
+            + "\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";
 
@@ -622,7 +702,52 @@ public class NsdValidator extends EObjectValidator {
      */
     public boolean validateConstructedAttributes( ConstructedAttributes constructedAttributes,
             DiagnosticChain diagnostics, Map< Object, Object > context ) {
-        return validate_EveryDefaultConstraint( constructedAttributes, diagnostics, context );
+        if( !validate_NoCircularContainment( constructedAttributes, diagnostics, context ) ) return false;
+        boolean result = validate_EveryMultiplicityConforms( constructedAttributes, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryDataValueConforms( constructedAttributes, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryReferenceIsContained( constructedAttributes, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryBidirectionalReferenceIsPaired( constructedAttributes, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryProxyResolves( constructedAttributes, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_UniqueID( constructedAttributes, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryKeyUnique( constructedAttributes, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryMapEntryUnique( constructedAttributes, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validateConstructedAttributes_uniqueConstructedAttribute( constructedAttributes, diagnostics,
+                    context );
+        return result;
+    }
+
+    /**
+     * The cached validation expression for the uniqueConstructedAttribute constraint of '<em>Constructed Attributes</em>'.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    protected static final String CONSTRUCTED_ATTRIBUTES__UNIQUE_CONSTRUCTED_ATTRIBUTE__EEXPRESSION = "Tuple {\n"
+            + "\tmessage : String = 'Within an NS, there shall not be two ConstructedAttribute sub-elements with same name.',\n"
+            + "\tstatus : Boolean = \n" + "\t\t\t-- TODO: DependsOn NS should be taken into account ?\n"
+            + "\t\t\t-- For this, explicit links have to be created first\n"
+            + "\t\t\t-- Then, may be this constraint should be in NS and not in Enumerations ?\n"
+            + "\t\t\tself.constructedAttribute->isUnique( c : ConstructedAttribute | c.name )\n" + "}.status";
+
+    /**
+     * Validates the uniqueConstructedAttribute constraint of '<em>Constructed Attributes</em>'.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public boolean validateConstructedAttributes_uniqueConstructedAttribute(
+            ConstructedAttributes constructedAttributes, DiagnosticChain diagnostics, Map< Object, Object > context ) {
+        return validate( NsdPackage.Literals.CONSTRUCTED_ATTRIBUTES, constructedAttributes, diagnostics, context,
+                "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "uniqueConstructedAttribute",
+                CONSTRUCTED_ATTRIBUTES__UNIQUE_CONSTRUCTED_ATTRIBUTE__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE,
+                0 );
     }
 
     /**
@@ -775,7 +900,48 @@ public class NsdValidator extends EObjectValidator {
      */
     public boolean validateEnumerations( Enumerations enumerations, DiagnosticChain diagnostics,
             Map< Object, Object > context ) {
-        return validate_EveryDefaultConstraint( enumerations, diagnostics, context );
+        if( !validate_NoCircularContainment( enumerations, diagnostics, context ) ) return false;
+        boolean result = validate_EveryMultiplicityConforms( enumerations, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryDataValueConforms( enumerations, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryReferenceIsContained( enumerations, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryBidirectionalReferenceIsPaired( enumerations, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_EveryProxyResolves( enumerations, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_UniqueID( enumerations, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_EveryKeyUnique( enumerations, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryMapEntryUnique( enumerations, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validateEnumerations_uniqueEnumeration( enumerations, diagnostics, context );
+        return result;
+    }
+
+    /**
+     * The cached validation expression for the uniqueEnumeration constraint of '<em>Enumerations</em>'.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    protected static final String ENUMERATIONS__UNIQUE_ENUMERATION__EEXPRESSION = "Tuple {\n"
+            + "\tmessage : String = 'Within an NS, there shall not be two Enumeration sub-elements with same name.',\n"
+            + "\tstatus : Boolean = \n" + "\t\t\t-- TODO: DependsOn NS should be taken into account ?\n"
+            + "\t\t\t-- For this, explicit links have to be created first\n"
+            + "\t\t\t-- Then, may be this constraint should be in NS and not in Enumerations ?\n"
+            + "\t\t\tself.enumeration->isUnique( e : Enumeration | e.name )\n" + "}.status";
+
+    /**
+     * Validates the uniqueEnumeration constraint of '<em>Enumerations</em>'.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public boolean validateEnumerations_uniqueEnumeration( Enumerations enumerations, DiagnosticChain diagnostics,
+            Map< Object, Object > context ) {
+        return validate( NsdPackage.Literals.ENUMERATIONS, enumerations, diagnostics, context,
+                "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "uniqueEnumeration",
+                ENUMERATIONS__UNIQUE_ENUMERATION__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0 );
     }
 
     /**
@@ -888,7 +1054,70 @@ public class NsdValidator extends EObjectValidator {
      */
     public boolean validateLNClasses( LNClasses lnClasses, DiagnosticChain diagnostics,
             Map< Object, Object > context ) {
-        return validate_EveryDefaultConstraint( lnClasses, diagnostics, context );
+        if( !validate_NoCircularContainment( lnClasses, diagnostics, context ) ) return false;
+        boolean result = validate_EveryMultiplicityConforms( lnClasses, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryDataValueConforms( lnClasses, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryReferenceIsContained( lnClasses, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryBidirectionalReferenceIsPaired( lnClasses, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_EveryProxyResolves( lnClasses, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_UniqueID( lnClasses, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_EveryKeyUnique( lnClasses, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_EveryMapEntryUnique( lnClasses, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validateLNClasses_uniqueAbstractLNClass( lnClasses, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validateLNClasses_uniqueLNClass( lnClasses, diagnostics, context );
+        return result;
+    }
+
+    /**
+     * The cached validation expression for the uniqueAbstractLNClass constraint of '<em>LN Classes</em>'.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    protected static final String LN_CLASSES__UNIQUE_ABSTRACT_LN_CLASS__EEXPRESSION = "Tuple {\n"
+            + "\tmessage : String = 'Within an NS, there shall not be two AbstractLNClass sub-elements with same name.',\n"
+            + "\tstatus : Boolean = \n" + "\t\t\tself.abstractLNClass->isUnique( c : AbstractLNClass | c.name )\n"
+            + "}.status";
+
+    /**
+     * Validates the uniqueAbstractLNClass constraint of '<em>LN Classes</em>'.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public boolean validateLNClasses_uniqueAbstractLNClass( LNClasses lnClasses, DiagnosticChain diagnostics,
+            Map< Object, Object > context ) {
+        return validate( NsdPackage.Literals.LN_CLASSES, lnClasses, diagnostics, context,
+                "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "uniqueAbstractLNClass",
+                LN_CLASSES__UNIQUE_ABSTRACT_LN_CLASS__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0 );
+    }
+
+    /**
+     * The cached validation expression for the uniqueLNClass constraint of '<em>LN Classes</em>'.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    protected static final String LN_CLASSES__UNIQUE_LN_CLASS__EEXPRESSION = "Tuple {\n"
+            + "\tmessage : String = 'Within an NS, there shall not be two LNClass sub-elements with same name.',\n"
+            + "\tstatus : Boolean = \n" + "\t\t\tself.lNClass->isUnique( c : LNClass | c.name )\n" + "}.status";
+
+    /**
+     * Validates the uniqueLNClass constraint of '<em>LN Classes</em>'.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public boolean validateLNClasses_uniqueLNClass( LNClasses lnClasses, DiagnosticChain diagnostics,
+            Map< Object, Object > context ) {
+        return validate( NsdPackage.Literals.LN_CLASSES, lnClasses, diagnostics, context,
+                "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "uniqueLNClass",
+                LN_CLASSES__UNIQUE_LN_CLASS__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0 );
     }
 
     /**
@@ -935,7 +1164,48 @@ public class NsdValidator extends EObjectValidator {
      */
     public boolean validatePresenceConditions( PresenceConditions presenceConditions, DiagnosticChain diagnostics,
             Map< Object, Object > context ) {
-        return validate_EveryDefaultConstraint( presenceConditions, diagnostics, context );
+        if( !validate_NoCircularContainment( presenceConditions, diagnostics, context ) ) return false;
+        boolean result = validate_EveryMultiplicityConforms( presenceConditions, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryDataValueConforms( presenceConditions, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryReferenceIsContained( presenceConditions, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryBidirectionalReferenceIsPaired( presenceConditions, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryProxyResolves( presenceConditions, diagnostics, context );
+        if( result || diagnostics != null ) result &= validate_UniqueID( presenceConditions, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryKeyUnique( presenceConditions, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validate_EveryMapEntryUnique( presenceConditions, diagnostics, context );
+        if( result || diagnostics != null )
+            result &= validatePresenceConditions_uniquePresenceCondition( presenceConditions, diagnostics, context );
+        return result;
+    }
+
+    /**
+     * The cached validation expression for the uniquePresenceCondition constraint of '<em>Presence Conditions</em>'.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    protected static final String PRESENCE_CONDITIONS__UNIQUE_PRESENCE_CONDITION__EEXPRESSION = "Tuple {\n"
+            + "\tmessage : String = 'There shall not be two PresenceCondition elements with same name.',\n"
+            + "\tstatus : Boolean = \n" + "\t\t\tself.presenceCondition->isUnique( p : PresenceCondition | p.name )\n"
+            + "}.status";
+
+    /**
+     * Validates the uniquePresenceCondition constraint of '<em>Presence Conditions</em>'.
+     * <!-- begin-user-doc -->
+     * <!-- end-user-doc -->
+     * @generated
+     */
+    public boolean validatePresenceConditions_uniquePresenceCondition( PresenceConditions presenceConditions,
+            DiagnosticChain diagnostics, Map< Object, Object > context ) {
+        return validate( NsdPackage.Literals.PRESENCE_CONDITIONS, presenceConditions, diagnostics, context,
+                "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "uniquePresenceCondition",
+                PRESENCE_CONDITIONS__UNIQUE_PRESENCE_CONDITION__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0 );
     }
 
     /**
-- 
GitLab