<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>CdmCL, a Specific Textual Constraint Language for Common Data Model</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Ahmed Ahmed</string-name>
          <email>alahmed4ever@yahoo.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Paola Vallejo</string-name>
          <email>vallejoco@univ-brest.fr</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Mickaël Kerboeuf</string-name>
          <email>kerboeuf@univ-brest.fr</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jean-Philippe Babau</string-name>
          <email>babau@univ-brest.fr</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Lab-STICC / UBO / UEB</institution>
          ,
          <addr-line>Brest</addr-line>
          ,
          <country country="FR">France</country>
        </aff>
      </contrib-group>
      <fpage>63</fpage>
      <lpage>72</lpage>
      <abstract>
        <p>Common Data Model is an abstract data model for scientific datasets that can be constrained by OCL. To hide complexity of OCL, CdmCL is proposed as a specific textual constraint language for CDM. CdmCL is based on the CDM structure and results in a set of constraint categories. CdmCL provides a user-friendly front end in order to define constraints which are subsequently translated to OCL. The conformity tool is based on an existing OCL checker integrated in EMF. CdmCL is experimented on the OceanSITES standard.</p>
      </abstract>
      <kwd-group>
        <kwd>OCL</kwd>
        <kwd>common data model</kwd>
        <kwd>conformity</kwd>
        <kwd>constraint generation</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
    </sec>
    <sec id="sec-2">
      <title>Common Data Model</title>
      <p>
        Unidata s Common Data Model (CDM) is an abstract data model for scientific
datasets. It is based on three layers, data access layer, coordinate system layer and
scientific feature type layer. Our work focuses on data access layer also called syntactic
layer that handles data modeling part. The complete data model and detailed
description is given in [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. The main classes (see Figure 1) are:
      </p>
      <p>DataSet: a file, such as NetCDF file, characterized by a file name (location).
Group: a container for dimensions, attributes, variables and nested subGroups.
Dimension: the array shape of a Variable, characterized by a name and a length;
Variable: a container for data, characterized by a name, a dataType, a set of
dimensions that define its array shape, and optionally a set of attributes.</p>
      <p>Attribute: a metadata to characterize a Variable or a Group, characterized by a
name, a dataType and a value.</p>
      <p>
        OceanSITES [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] is a worldwide system for gathering and measuring scientific
data especially for time series sites, called ocean reference stations. It conforms to the
CDM model but with some constraints. The OceanSITES User Manual holds around
30 pages of constraints expressed in natural language. These constraints are of
different forms: naming conventions, possible attribute values, constraints on dimension
length and many others. As example, a DataSet should hold instances of Dimension
called TIME, LATITUDE, LONGITUDE, instances of Attributes called data_type and
format_version, and an instance of Variable called TIME. The variable TIME should
be of double datatype. Figure 2 illustrates a small excerpt of OceanSITES standard
from the manual to the left and a small excerpt of CDM data respecting the
OceanSITES standard to the right.
      </p>
      <p>
        To check the data conformity to OceanSITES, a Java tool already exists [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. Since
constraints are not formalized and the tool is hand-coded, there is no guaranty on
checking. Furthermore, for each different data format, a particular tool should be
developed. To avoid constraint edition ambiguity and to reduce conformity tool
development, we present now the CdmCL language.
      </p>
      <p>OceanSITES Manual</p>
      <p>CDM instance respecting OceanSITES</p>
    </sec>
    <sec id="sec-3">
      <title>CdmCL Language</title>
      <sec id="sec-3-1">
        <title>Concept References</title>
        <p>This work focuses on the automatic generation of OCL constraints from CdmCL.
On the one hand, the CdmCL front end needs to be human readable and close to the
classical standard. Therefore, Xtext has been used to define the textual grammar. On
the other hand, each CdmCL concept has a semantic expressed using OCL.</p>
        <p>In standards, most of the constraints are related to a specific instance of a named
CDM concept (Variable, Dimension and Attribute): the attribute named data_type
can hold either the value OceanSITES metadata, or OceanSITES profile data ; the
dimension of the variable named TIME is the dimension TIME . Thus, CdmCL is
structured by three abstract classes DimensionConstraint, VariableConstraint and
AttributeConstraint (see figure 3). Then, to express a constraint related to a specific
instance, CdmCL follows the three different scenarios, defining nine concrete
concepts:</p>
        <p>Constraint is applied to a specific CDM concept referenced by its name:
aDimensionConstraint, aVariableConstraint or anAttributeConstraint.</p>
        <p>Constraint is applied to items whose name matches a specific regular expression:
TemplateDimensionRegex, TemplateVariableRegex, or TemplateAttributeRegex.
Constraint is applied to a set of items, characterized by a set of names:
TemplateDimensionList, TemplateVariableList or TemplateAttributeList.</p>
        <p>The following section introduces the constraints that are common between
DimensionConstraint, VariableConstraint and AttributeConstraint.</p>
        <p>Mandatory: This constraint verifies that the name of the related concept exists. For
the template list concept, an extra Boolean attribute or permits to indicate whether
one of the items of the list is mandatory or all the items are mandatory. As an
example, figure 4 presents the CdmCL expressions and the corresponding OCL statements
for aDimension called DEPTH (a single dimension) and a TemplateDimensionList
(coordinate dimension list holding LATITUDE and LONGITUDE).</p>
        <p>The values between parentheses permit the definition of dimension length and are
explained in the next section. Figure 5 presents a CDM instance to the left respecting
the OceanSITES standard, thus the instance is valid, whereas the other instance is not
valid because the mandatory dimension LONGITUDE and the mandatory variable
TIME are missing, thus the OCL constraints
checkMandatory_dimension_LONGITUDE and checkMandatory_variables_TIME are violated.</p>
        <p>Repetition: This constraint checks that a name of a concept is never repeated.</p>
        <p>Format: This constraint verifies that names of a set of concept have a specific
format, either uppercase, lowercase or matches a specific regular expression.</p>
        <p>User Defined Constraints: This concept increases the flexibility of the language,
by allowing the user to enter manually an OCL statement. However, it is the user s
responsibility to verify the correctness of the OCL statement regarding the CDM
metamodel. These constraints are defined in the context of Group.
In addition, other constraints are related to specific concepts.</p>
        <p>· Dimensions length constraints: The length value for a dimension can be a
limited or unlimited (any positive value). For the limited length, it can be a
specific value, a value in a range, greater than or equal to a specific value,
smaller than or equal. To achieve these constraint objectives,
dimensionConstraint concept has two Integer attributes called minLength and maxLength
and one Boolean attribute called IsUnlimited (see table 1).
case
1
constraints are built all in the same way. The first part of the OCL constraint
(exists, select) defines the context of the specific concept (here the TIME
Dimension). Then, the second part expresses the constraint itself (forAll).
·
·
·
Variable shape constraint: A variable is characterized by a set of shapes
i.e. a set of dimensions (see figure 1). A variable can have a shape of the
same name as the variable s name. For example a variable named TIME is
associated with a dimension named TIME. Moreover, a variable can be
associated with a dimension or a set of dimensions. For example, a variable
named TIME_QC is associated with dimension named TIME. To
accomplish this type of verification, we have two concepts
SimilarDimensionConstraint and/or a set of PredefinedShape concept for a VariableConstraint.
On one hand SimilarDimensionConstraint concept allow the generation of an
OCL invariant that verifies that a variable is associated with a dimension of
same variable s name. On the other hand PredefinedShape concept permits
to verify that a variable is associated with any preexisting dimensions. Figure
7 illustrates the previous discussion and presents the CdmCL representation
along with the OCL to be generated.</p>
      </sec>
      <sec id="sec-3-2">
        <title>VariableConstraint and AttributeConstraint DataType: This constraint</title>
        <p>verifies that the variables and the attributes can have any data type from a list
of data types.</p>
        <p>Attribute Value Constraint: A constraint on the value of an Attribute, the
possible categories are given in table 2.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Conformity tool and experiment</title>
      <p>Based on CdmCL, we developed a conformity checker for netCDF1 files which
conform to CDM metamodel. The tool architecture is shown in figure 8. It is
developed in Java and based on the Eclipse Modeling Framework (EMF). First, the tool
transforms the CdmCL model into OCL statements in a separated file. This part
1 NetCDF (Network Common Data Form ) is a CDM compliant file serialization format
(CdmCL2OCL) uses Xtext API, and the library we developed for the transformation
of CdmCL expressions to OCL constraints. Then, the tool transforms a NetCDF file
into an instance of CDM model. This part (nc2CDM) is simply based on the Java
NetCDF API and on the CDM Java API (provided by EMF). Finally, the tool checks
the conformity of the CDM file to the CDM metamodel enriched with the generated
OCL file, and indicates whether it is valid or not. This part is based on the integrated
OCL checker of the EMF modeling tool.
The tool has been tested on OceanSITES. Due to the lack of space we express
only the OceanSITES global attributes standard given in figure 2 in CdmCL. The
CdmCL shown in figure 9 indicates that a global attribute named data_type is
mandatory, of type string and has any of the values presented by the list
dataTypeGlobalList. This list hold the values OceanSITES metadata, OceanSITES profile data,
OceanSITES time-series data or OceanSITES trajectory data. Furthermore, it
indicates that a global attribute named format_version, of type string and should hold the
value 1.1 . The CdmCL expressions and the generated OCL after using
CdmCL2OCL tool are given in figure 9.</p>
      <p>The generated OCL file is then used with the CDM model to check the conformity
of an input netCDF file. If the input file does not respect the constraints, a message
indicates that the input file does not conform to CDM model with the set of OCL
violated constraints. Figure 10 presents an excerpt of CDM data converted from a
netcdf file. These data are validated with this generated OCL. It is seen that the left
instance is valid whereas the right instance is invalid because the global attribute
format_version value constraint is violated.</p>
      <p>Figure 10 illustrates that the right version is invalid because format_version
constraints was violated, but in reality this global attribute can have the value of 1.2 and
even 1.3 since OceanSITES standard has been evaluated to the new version 1.3 with
backward compatibility. Therefore by just modifying the CdmCL format_version
value to hold the values (1.1, 1.2 or 1.3), we can have the new standard OCL
representation without any professional interference and the instance will be valid with
respect to OceanSITES version 1.3.</p>
      <p>Experimenting CdmCL on OceanSITES, it is observed that more than 90% percent
of the constraints are achieved in the CdmCL except the constraints that are related to
multiple CDM concepts at the same time. For example, a constraint verifies the
existence of either a variable named TIME with attribute named QC_indicator or a
variable named TIME_QC.</p>
      <p>For CdmCL syntax readability, the two global attributes of OceanSITES given in
figure 2 are represented by approximately eight lines in CdmCL expressions and
generate around 30 lines of OCL statements. One page of textual constraints from the
standard is expressed by around 25 lines in CdmCL and generates around 300 lines of
OCL.</p>
      <p>The language CdmCL was introduced to OceanSITES users (standard reader) and
they confirm the expressiveness and the readability of CdmCL.
6</p>
    </sec>
    <sec id="sec-5">
      <title>Related Works</title>
      <p>
        Several studies are proposed to support OCL integration on modeling processes.
The Dresden OCL Toolkit [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] proposes an OCL library and the recent version
provides an OCL-to-Java Code Generator. USE (UML-based Specification Environment)
[
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] is a tool to facilitate the validation of UML models with OCL constraints. USE
supports consistency, independence of constraints, and relevance of constraints
analysis. These OCL tools are complementary to the proposed approach and can be used to
facilitate the management of the generated OCL constraints.
      </p>
      <p>
        In the domain of OCL generation, [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] propose OCL automatic generation from
UML class diagrams. The approach aims at simplifying the process of generation of
OCL statements. The approach involves expressing constraints by a class diagram. In
the addressed domain, most of the constraints are related to specific instances.
Following this approach would result in too many classes (one per instance constrained),
and the class diagram syntax is far from the scientific standard edition.
      </p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ], the authors propose to convert natural language expressions to the
equivalent OCL statements. The expressions are constraints and pre/post conditions related
to UML diagrams. OCL generation is based on the Semantic Business Vocabulary
and Rules language (SBVR) to avoid inconsistencies. With CdmCL, we prefer to
define a DSL because, in a small and well identified domain, it promotes the
development of efficient and accurate solutions [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]. As a DSL, CdmCL disambiguates
scientific standard edition. And in addition, it is close enough to the natural language
so that its use does not require technical skills on OCL. However, the creation of a
DSL usually requires both domain knowledge and language development expertise
[
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]. But, the production cost of CdmCL is low since it relies directly on OCL
semantics, while hiding unnecessary OCL features. Thus, translation to OCL may be
directly done without considering SBVR intermediate level.
7
      </p>
    </sec>
    <sec id="sec-6">
      <title>Conclusion</title>
      <p>This paper proposes a domain specific constraint language for CDM. The language
structure is based on CDM structure and results in a set of constraint categories. These
categories permit to define constraints in a human readable language and serves in the
automatic generation of OCL. The approach hides the complexity of writing OCL
manually and increases the productivity by generating a large number of OCL
statements for few lines written in CdmCL. Furthermore, any standard edition and
conformity checking can be done easily without OCL and programming interference.</p>
      <p>In perspective, we are working on developing domain specific operators to
automate scientific data migration from a standard to another one.
8</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Unidata</surname>
          </string-name>
          ,
          <article-title>Common Data Model (CDM). Version 4</article-title>
          . http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/CDM/
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <source>OceanSITES User s Manual, Version</source>
          <volume>1</volume>
          .2. http://www.oceansites.org/
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3. Object Management Group:
          <article-title>Object Constraint Language (OCL) Specification</article-title>
          , Version,
          <volume>2</volume>
          .4, http://www.omg.org/spec/OCL/2.3.1/
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4. Meyer B.,
          <string-name>
            <surname>Object-Oriented Software</surname>
            <given-names>Construction</given-names>
          </string-name>
          , International Series in Computer Science, Second Edition, Prentice-Hall (
          <year>1997</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Linehan</surname>
            <given-names>M.</given-names>
          </string-name>
          ,
          <article-title>Ontologies and rules in Business Models</article-title>
          ,
          <source>in the 11h IEEE Enterprise Distributed Object Conference (EDOC)</source>
          ,
          <fpage>149</fpage>
          -
          <lpage>156</lpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Wahler</surname>
            <given-names>M.</given-names>
          </string-name>
          ,
          <article-title>Using Patterns to Develop Consistent Design Constraints</article-title>
          ,
          <source>PhD Thesis</source>
          , ETH Zurich, Switzerland,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>Eclipse</given-names>
            <surname>Modeling</surname>
          </string-name>
          <article-title>Framework (EMF)</article-title>
          . http://www.eclipse.org/modeling/emf/
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <article-title>OceanSITES file format checker</article-title>
          . http://www.coriolis.eu.org/Observing-theocean/
          <article-title>Observing-system-networks/OceanSITES/Access-to-data.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Schütze</surname>
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wilke</surname>
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Demut</surname>
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tool-Supported</surname>
          </string-name>
          Step-
          <article-title>By-Step Debugging for the Object Constraint Language</article-title>
          ,
          <source>In OCL@MODELS</source>
          <year>2013</year>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Gogolla</surname>
            <given-names>M.</given-names>
          </string-name>
          , et al.
          <article-title>USE: A UML-Based Specification Environment for Validating UML and OCL</article-title>
          ,
          <source>Science of Computer Programming</source>
          , Vol.
          <volume>69</volume>
          ,
          <fpage>27</fpage>
          -
          <lpage>34</lpage>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Li</surname>
            <given-names>Tan</given-names>
          </string-name>
          ,
          <article-title>Zongyuan Yang and Jinkui Xie, OCL Constraints Automatic Generation for UML Class Diagram</article-title>
          ,
          <source>IEEE International Conference on Software Engineering and Service Sciences (ICSESS) 392</source>
          <volume>395</volume>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Bajwa</surname>
            <given-names>I.S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bordbar</surname>
            <given-names>B.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Lee</surname>
            <given-names>M.G.</given-names>
          </string-name>
          ,
          <article-title>OCL Constraints Generation from Natural Language Specification</article-title>
          ,
          <source>in the 14th IEEE Enterprise Distributed Object Conference (EDOC)</source>
          ,
          <fpage>204</fpage>
          -
          <lpage>213</lpage>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Mernik</surname>
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Heering</surname>
            <given-names>J.</given-names>
          </string-name>
          and
          <article-title>Sloane A. When and how to develop domain-specific languages in ACM Computing Surveys</article-title>
          ,
          <volume>37</volume>
          (
          <issue>4</issue>
          ),
          <fpage>316</fpage>
          -
          <lpage>344</lpage>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>