From 973dbecd71fa6829bb884cae6351b29aa90be0b3 Mon Sep 17 00:00:00 2001 From: Eric Fayolle Date: Wed, 4 Dec 2019 10:42:10 +0100 Subject: [PATCH] MAJ docCatawriter MultipleCata --- .../Makefile | 0 .../XMLSchema11_local.xsd | 0 .../cata_CFD1.py | 0 .../cata_CFD2.py | 0 .../cata_CFDCommun.py | 0 .../cata_MD1.py | 0 .../cata_MD2.py | 0 .../cata_MDCommun.py | 2 +- .../cata_modeleCommun.py | 2 +- .../generateXSD.py | 0 .../prefs.py | 0 .../prefs_Test.py | 0 .../prefs_TestMultipleCata.py | 0 .../qtEficasTest.py | 0 .../xml.xsd | 0 docCataWriter/xsd_mapping.rst | 165 ++++++++++++++++-- 16 files changed, 157 insertions(+), 12 deletions(-) rename Tests/MappingAccasXsd/{TestMultipleCata => MultipleCata}/Makefile (100%) rename Tests/MappingAccasXsd/{TestMultipleCata => MultipleCata}/XMLSchema11_local.xsd (100%) rename Tests/MappingAccasXsd/{TestMultipleCata => MultipleCata}/cata_CFD1.py (100%) rename Tests/MappingAccasXsd/{TestMultipleCata => MultipleCata}/cata_CFD2.py (100%) rename Tests/MappingAccasXsd/{TestMultipleCata => MultipleCata}/cata_CFDCommun.py (100%) rename Tests/MappingAccasXsd/{TestMultipleCata => MultipleCata}/cata_MD1.py (100%) rename Tests/MappingAccasXsd/{TestMultipleCata => MultipleCata}/cata_MD2.py (100%) rename Tests/MappingAccasXsd/{TestMultipleCata => MultipleCata}/cata_MDCommun.py (91%) rename Tests/MappingAccasXsd/{TestMultipleCata => MultipleCata}/cata_modeleCommun.py (84%) rename Tests/MappingAccasXsd/{TestMultipleCata => MultipleCata}/generateXSD.py (100%) rename Tests/MappingAccasXsd/{TestMultipleCata => MultipleCata}/prefs.py (100%) rename Tests/MappingAccasXsd/{TestMultipleCata => MultipleCata}/prefs_Test.py (100%) rename Tests/MappingAccasXsd/{TestMultipleCata => MultipleCata}/prefs_TestMultipleCata.py (100%) rename Tests/MappingAccasXsd/{TestMultipleCata => MultipleCata}/qtEficasTest.py (100%) rename Tests/MappingAccasXsd/{TestMultipleCata => MultipleCata}/xml.xsd (100%) diff --git a/Tests/MappingAccasXsd/TestMultipleCata/Makefile b/Tests/MappingAccasXsd/MultipleCata/Makefile similarity index 100% rename from Tests/MappingAccasXsd/TestMultipleCata/Makefile rename to Tests/MappingAccasXsd/MultipleCata/Makefile diff --git a/Tests/MappingAccasXsd/TestMultipleCata/XMLSchema11_local.xsd b/Tests/MappingAccasXsd/MultipleCata/XMLSchema11_local.xsd similarity index 100% rename from Tests/MappingAccasXsd/TestMultipleCata/XMLSchema11_local.xsd rename to Tests/MappingAccasXsd/MultipleCata/XMLSchema11_local.xsd diff --git a/Tests/MappingAccasXsd/TestMultipleCata/cata_CFD1.py b/Tests/MappingAccasXsd/MultipleCata/cata_CFD1.py similarity index 100% rename from Tests/MappingAccasXsd/TestMultipleCata/cata_CFD1.py rename to Tests/MappingAccasXsd/MultipleCata/cata_CFD1.py diff --git a/Tests/MappingAccasXsd/TestMultipleCata/cata_CFD2.py b/Tests/MappingAccasXsd/MultipleCata/cata_CFD2.py similarity index 100% rename from Tests/MappingAccasXsd/TestMultipleCata/cata_CFD2.py rename to Tests/MappingAccasXsd/MultipleCata/cata_CFD2.py diff --git a/Tests/MappingAccasXsd/TestMultipleCata/cata_CFDCommun.py b/Tests/MappingAccasXsd/MultipleCata/cata_CFDCommun.py similarity index 100% rename from Tests/MappingAccasXsd/TestMultipleCata/cata_CFDCommun.py rename to Tests/MappingAccasXsd/MultipleCata/cata_CFDCommun.py diff --git a/Tests/MappingAccasXsd/TestMultipleCata/cata_MD1.py b/Tests/MappingAccasXsd/MultipleCata/cata_MD1.py similarity index 100% rename from Tests/MappingAccasXsd/TestMultipleCata/cata_MD1.py rename to Tests/MappingAccasXsd/MultipleCata/cata_MD1.py diff --git a/Tests/MappingAccasXsd/TestMultipleCata/cata_MD2.py b/Tests/MappingAccasXsd/MultipleCata/cata_MD2.py similarity index 100% rename from Tests/MappingAccasXsd/TestMultipleCata/cata_MD2.py rename to Tests/MappingAccasXsd/MultipleCata/cata_MD2.py diff --git a/Tests/MappingAccasXsd/TestMultipleCata/cata_MDCommun.py b/Tests/MappingAccasXsd/MultipleCata/cata_MDCommun.py similarity index 91% rename from Tests/MappingAccasXsd/TestMultipleCata/cata_MDCommun.py rename to Tests/MappingAccasXsd/MultipleCata/cata_MDCommun.py index 626e498e..ab29397d 100755 --- a/Tests/MappingAccasXsd/TestMultipleCata/cata_MDCommun.py +++ b/Tests/MappingAccasXsd/MultipleCata/cata_MDCommun.py @@ -5,7 +5,7 @@ if autonome : JdC = JDC_CATA ( code = 'MDCommun', ) - importedBy=('MD1','MD2','MDSpecific') + importedBy=('MD1','MD2') else : from cata_modeleCommun import * implement = 'MDCommun:modeleCommun' diff --git a/Tests/MappingAccasXsd/TestMultipleCata/cata_modeleCommun.py b/Tests/MappingAccasXsd/MultipleCata/cata_modeleCommun.py similarity index 84% rename from Tests/MappingAccasXsd/TestMultipleCata/cata_modeleCommun.py rename to Tests/MappingAccasXsd/MultipleCata/cata_modeleCommun.py index 06b44dd0..c562edbb 100755 --- a/Tests/MappingAccasXsd/TestMultipleCata/cata_modeleCommun.py +++ b/Tests/MappingAccasXsd/MultipleCata/cata_modeleCommun.py @@ -3,7 +3,7 @@ from Accas import * JdC = JDC_CATA ( code = 'modeleCommun', ) -importedBy=('MDCommun', 'CFDCommun', 'DomainSpecfic') +importedBy=('MDCommun', 'CFDCommun', 'DomainSpecific') Proc1DuModeleCommun=PROC(nom='Proc1DuModeleCommun', S1DuModeleCommun= SIMP(statut='o', typ='I', defaut = 1), diff --git a/Tests/MappingAccasXsd/TestMultipleCata/generateXSD.py b/Tests/MappingAccasXsd/MultipleCata/generateXSD.py similarity index 100% rename from Tests/MappingAccasXsd/TestMultipleCata/generateXSD.py rename to Tests/MappingAccasXsd/MultipleCata/generateXSD.py diff --git a/Tests/MappingAccasXsd/TestMultipleCata/prefs.py b/Tests/MappingAccasXsd/MultipleCata/prefs.py similarity index 100% rename from Tests/MappingAccasXsd/TestMultipleCata/prefs.py rename to Tests/MappingAccasXsd/MultipleCata/prefs.py diff --git a/Tests/MappingAccasXsd/TestMultipleCata/prefs_Test.py b/Tests/MappingAccasXsd/MultipleCata/prefs_Test.py similarity index 100% rename from Tests/MappingAccasXsd/TestMultipleCata/prefs_Test.py rename to Tests/MappingAccasXsd/MultipleCata/prefs_Test.py diff --git a/Tests/MappingAccasXsd/TestMultipleCata/prefs_TestMultipleCata.py b/Tests/MappingAccasXsd/MultipleCata/prefs_TestMultipleCata.py similarity index 100% rename from Tests/MappingAccasXsd/TestMultipleCata/prefs_TestMultipleCata.py rename to Tests/MappingAccasXsd/MultipleCata/prefs_TestMultipleCata.py diff --git a/Tests/MappingAccasXsd/TestMultipleCata/qtEficasTest.py b/Tests/MappingAccasXsd/MultipleCata/qtEficasTest.py similarity index 100% rename from Tests/MappingAccasXsd/TestMultipleCata/qtEficasTest.py rename to Tests/MappingAccasXsd/MultipleCata/qtEficasTest.py diff --git a/Tests/MappingAccasXsd/TestMultipleCata/xml.xsd b/Tests/MappingAccasXsd/MultipleCata/xml.xsd similarity index 100% rename from Tests/MappingAccasXsd/TestMultipleCata/xml.xsd rename to Tests/MappingAccasXsd/MultipleCata/xml.xsd diff --git a/docCataWriter/xsd_mapping.rst b/docCataWriter/xsd_mapping.rst index 5b07ef71..7016b675 100644 --- a/docCataWriter/xsd_mapping.rst +++ b/docCataWriter/xsd_mapping.rst @@ -757,7 +757,7 @@ The element declaration is : Understanding the XSD mapping for BLOC ______________________________________ -As explain in :ref:`bloc-label` section, the *BLOC* keyword provides a conditional way to make appear a group of elements. Apart of the *condition* eficas attribute, it's quite the same as the *FACT* keyword. +As explain in :ref:`bloc-label` section, the *BLOC* keyword provides a conditional way to activate a group of elements. Apart from the *condition* eficas attribute, it's quite the same as the *FACT* keyword. If we review the following catalog from the :ref:`fact-label` section : @@ -765,8 +765,8 @@ If we review the following catalog from the :ref:`fact-label` section : :language: python :start-after: Test_proc_5 :end-before: #Test_proc_5 - -You get the two xsd complex types using the **** xsd element : + +The xsd mapping provides two **** elements : .. literalinclude:: ../Tests/MappingAccasXsd/cata_1_genere.xsd :language: xml @@ -777,10 +777,8 @@ You get the two xsd complex types using the **** xsd element : :language: xml :start-at: name="T_frequ_not_every" :end-at: /xs:group - -The content of these groups may appear or not in the parent structure. If they appear, they will appear "as is", without any additionnal element definition. This mecanism comes from the use of the **group ref** xsd statement : - -The **group ref** declarations are : + +The parent xsd type uses **group ref** declarations : .. literalinclude:: ../Tests/MappingAccasXsd/cata_1_genere.xsd :language: xml @@ -788,9 +786,11 @@ The **group ref** declarations are : :start-after: name="T_Test_proc_5" :end-before: /xs:complexType -.. note:: Note that **minOccurs** is always 0 and **maxOccurs** is always 1. This is because *BLOC* does not have *min*,*max* eficas attributes. +The content of these groups may appear or not in the parent structure. +Using **group ref** allows the apparition of group content without any additionnal element level. +Considering the *BLOC* semantic, the **minOccurs** attribute is always 0 and **maxOccurs** is always 1. -.. note:: A ambiguity problem may appear if the an element with the same name is present in different group's content. +.. note:: An ambiguity problem may appear if an element with the same name is present in different group's contents. .. todo:: The *BLOC* xsd mapping must be refine. We may use **key**, **keyref** xsd element to restrict the possibility of activating only one branch of the conditional. However, the semantic of the *BLOC* keyword is wide. @@ -805,8 +805,153 @@ We may have that kind of usescases : Understanding the XSD mapping for included catalogs ___________________________________________________ +Eficas offers the possibility to include one catalog from an other. There will be a main catalog from which the *JdC* keyword is defined and non-main catalogs from which there is no *JdC* keyword. A catalog may be included mutiple times in different catalogs. Whatever the catalog is (main/non-main), it is mandatory to declare : + * from which the current catalog may be included using the *importedBy* keyword + * the code name for which the data model is implemented by the current catalog. This is done thanks to the *code* keyword in the *JdC* of the main catalog and thanks to the *implement* keyword non-main catalog. + +Here is an exemple with three levels of catalogs. + +First, the main common catalog : +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_modeleCommun.py + :language: python + +The *JdC* definition declares the main property of this catalog. + + +The given values in the *importedBy* keyword declare middle level/domain specific catalogs that may import this catalog. + +For each catalog declared in the *importedBy* keyword **one global xsd type and one global element declaration** are produced : + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_modeleCommun_genere.xsd + :language: xml + :start-at: name="T_MDCommun_Abstract" + :end-at: name="T_MDCommun_Abstract" + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_modeleCommun_genere.xsd + :language: xml + :start-at: name="MDCommun_Abstract" + :end-at: name="MDCommun_Abstract" + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_modeleCommun_genere.xsd + :language: xml + :start-at: name="T_CFDCommun_Abstract" + :end-at: name="T_CFDCommun_Abstract" + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_modeleCommun_genere.xsd + :language: xml + :start-at: name="CFDCommun_Abstract" + :end-at: name="CFDCommun_Abstract" + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_modeleCommun_genere.xsd + :language: xml + :start-at: name="T_DomainSpecific_Abstract" + :end-at: name="T_DomainSpecific_Abstract" + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_modeleCommun_genere.xsd + :language: xml + :start-at: name="DomainSpecific_Abstract" + :end-at: name="DomainSpecific_Abstract" + +The **abstract="true"** attribute implies that the xsd type have be be derivated in subsequent catalogs to be concretly defined. + +The abstract complex type says nothing about what will be the concrete type. + +.. note:: If *importedBy* keyword is not defined, there will be no generation of xsd abstract types. + +The root xsd is element type is : + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_modeleCommun_genere.xsd + :language: xml + :start-at: name="T_modeleCommun" + :end-at: /xs:complexType + +.. note:: The three *importedBy* catalogs appear as optional **element ref**. This give the possibility to complete the main root catalog with elements coming from subsequent catalogs knowing nothing about them. + +Second, the intermediate/domain specific catalog : +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This catalog finality is to gather common informations from a class of code. For example, it could be a "domain specific catalog". + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_MDCommun.py + :language: python + +* Since a catalog is a python script, it is possible to define an *autonome* variable to easily switch between a main/non-main catalog. +* A main catalog must declare a *JdC = JDC_CATA* definition as explained in :ref:`Defining-steps-in-a-catalog` (in our example, if *autonome* is True). +* In this example, the *importedBy* values declare the specific/final catalogs 'MD1', 'MD2' and 'MDSpecific' that may use this catalog. +* The *implement* keyword declares the abstract typename it implements and from which catalog. In this example, it implements the **T_MDCommun_Abstract** type from the *modeleCommun* catalog. + +For each catalog declared in the *importedBy* keyword we get global xsd types and global element declaration production (as for the upper level before) : + + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_MDCommun_genere.xsd + :language: xml + :start-at: name="T_MD1_Abstract" + :end-at: name="T_MD1_Abstract" + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_MDCommun_genere.xsd + :language: xml + :start-at: name="MD1_Abstract" + :end-at: name="MD1_Abstract" + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_MDCommun_genere.xsd + :language: xml + :start-at: name="T_MD2_Abstract" + :end-at: name="T_MD2_Abstract" + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_MDCommun_genere.xsd + :language: xml + :start-at: name="MD2_Abstract" + :end-at: name="MD2_Abstract" + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_MDCommun_genere.xsd + :language: xml + :start-at: name="T_MDSpecific_Abstract" + :end-at: name="T_MDSpecific_Abstract" + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_MDCommun_genere.xsd + :language: xml + :start-at: name="MDSpecific_Abstract" + :end-at: name="MDSpecific_Abstract" + +As in the main catalog, the **abstract="true"** attribute implies that the xsd type must be derivated in subsequent catalogs to be concretly defined. +The abstract complex type still says nothing about what will be the concrete type. + +The root xsd element type is : + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_MDCommun_genere.xsd + :language: xml + :start-at: name="T_MDCommun" + :end-at: /xs:complexType + +.. note:: Notice the presence of our three *importedBy* catalogs that appear as optional **element ref**. This give the possibility to complete the intermediate root catalog with elements coming from subsequent catalogs. Since the root main common catalog hosts itself intermediate elements, we have a sort of transitivity which allows to produce a unique xsd file combining different levels of description. + +Third, the final/specific catalog : +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In our three level exemple, this level is the final/fully specialized catalog. + + +Nobody includes it since *importedBy* is empty. + +This catalog finality is to describe all the informations that are not in the scope of the common model or domain specific codes but are specfic to a code. +Many code specific catalogs may use the same intermediate catalog or even directly the common catalog. + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_MD1.py + :language: python + +* The *importedBy* keyword is empty. It could be absent only in standalone catalogs. In this example, if the *importedBy* keyword is omitted, since the catalog imports (in the python way) the intermediate one, *importedBy* keyword would have the value defined in the intermediate catalog. +* The *implement* keyword still declares the abstract typename it implements and from which catalog. In this example, it implements the **T_MD1_Abstract** type from the *MDCommun* catalog. + +Since the *importedBy* keyword is empty, there is no abstract type production. + +.. literalinclude:: ../Tests/MappingAccasXsd/MultipleCata/cata_MD1_genere.xsd + :language: xml + :start-at: name="T_MD1" + :end-at: /xs:complexType - Understanding the XSD mapping for RULES _______________________________________ +.. todo:: Not implemented yet. -- 2.39.2