Efecto de la biofertilización con Azospirillum en el crecimiento y producción de Jitomate
Experimento 3 (E3) Cultivo en suelo en campo
5.2 Resultados y discusión
In the following, we present the conversion algorithm, which receives as input a pre- processed XML Schema and produces as output an X-Entity schema. The first task of the algorithm is the creation of the entity type definitions. All global element declarations and
complex type definitions are analyzed in order to map elements composed by other elements or attributes into entity types. The next task, consists of defining the attributes and relationships for the entity types identified earlier. To do this, each complex type definition is evaluated again and elements with base types and attribute declarations are mapped to attributes. Additionally, a new containment relationship is created whenever an element declaration with a complex type is found. The final tasks are the mapping of choice groups to disjunction constraints and the conversion of key and keyref definitions. Figure 4.14 presents the X-Entity schema for the Computer Science Department XML Schema presented in Figure 4.12.
Conversion(pre-processed XML Schema)
/* Creation of the entities */
For each global element declaration
Apply Rule 1
For each complex type definition CT
For each element declaration LD ∈ CT.content
If LD.type is a complex type
Then apply Rule 1
/* Creation of attributes, relationships and disjunction constraints*/
For each complex type definition CT
For each element declaration LD ∈ CT.content
If LD.type is a base type
Then apply Rule 2 Else apply Rule 4
For each attribute declaration AD ∈ CT.content
Apply Rule 3
If there is a choice compositor C ∈ CT.content
Then apply Rule 5
/* Creation of key and keyref constraints */
For each key definition KD
Apply Rule 6
For each keyref definition FD
Apply Rule 7
Figure 4.14 Computer Science Department X-Entity schema
We also propose the use of an XML document to specify X-Entity schemas. Figure 4.14 shows the XML specification for the Computer Science Department X-Entity schema. The XML specification has one XENTITY_SCHEMA element (the root element), which is composed by ENTITY, CONTAINMENT_RELATIONSHIP and REFERENCE_RELATIONSHIP
firstName lastName refers csDepartment course contains name number name phone office description contains professor (0,N) (0,N)
elements. An ENTITY element describes the attributes, relationships and disjunction constraints associated with an entity type through the ATTRIBUTE, RELATIONSHIP_NAME and CHOICE elements, respectively. A CONTAINMENT_ RELATIONSHIP element is composed by two elements: ELEMENT_ENTITY and SUBELEMENT_ENTITY, which represent the entity types participating in the relationship. A REFERENCE_RELATIONSHIP is also composed by two elements representing the participating entity types: REFERENCING_ENTITY and REFERENCED_ENTITY elements. Additionally, a REFERENCE_RELATIONSHIP has a KEY and a KEYREF elements, which specify the attributes involved in the reference relationship.
<XENTITY_SCHEMA name = "csDepartment Description"> <ENTITY name="csDepartment"> <RELATIONSHIP_NAME name="csDepartment_professor"/> <RELATIONSHIP_NAME name="csDepartment_course"/> </ENTITY> <ENTITY name="professor"> <CHOICE>
<ATTRIBUTE name="name" type="string" cardMin ="1" cardMax="1"/> <GROUP>
<ATTRIBUTE name="firstName" cardMin ="1" cardMax="1"/> <ATTRIBUTE name="lastName" cardMin ="1" cardMax="1"/> </GROUP>
</CHOICE>
<ATTRIBUTE name="phone" type="string" cardMin ="1" cardMax="n"/> <ATTRIBUTE name="office" type="string" cardMin ="0" cardMax="1"/> <ATTRIBUTE name="level" type="string" cardMin ="1" cardMax="1"/>
<ATTRIBUTE name="courseNumber" type="string" cardMin ="1" cardMax="n"/> <RELATIONSHIP_NAME name="professor_ref_course"/>
</ENTITY>
<ENTITY name="course">
<ATTRIBUTE name="name" type="string" cardMin ="1" cardMax="1"/>
<ATTRIBUTE name="number"type="string" cardMin ="1" cardMax="1" key="key1"/> <ATTRIBUTE name="description" type="string" cardMin ="0" cardMax="1"/> <KEY name="key1"/>
</ENTITY>
<CONTAINMENT_RELATIONSHIP name="csDepartment_professor" cardMin ="1" cardMax="n"> <ELEMENT_ENTITY name="csDepartment"/>
<SUBELEMENT_ENTITY name="professor"/> </CONTAINMENT_RELATIONSHIP>
<CONTAINMENT_RELATIONSHIP name="csDepartment_course" cardMin ="1" cardMax="n"> <ELEMENT_ENTITY name="csDepartment"/> <SUBELEMENT_ENTITY name="course"/> </CONTAINMENT_RELATIONSHIP> <REFERENCE_RELATIONSHIP name="professor_ref_course"> <REFERENCING_ENTITY name="professor"/> <REFERENCED_ENTITY name="course"/> <KEY name="key1"> <ATTRIBUTE_NAME name="number"/> </KEY> <KEYREF name="keyref1"> <ATTRIBUTE_NAME name="courseNumber"/> </KEYREF> </REFERENCE_RELATIONSHIP> </XENTITY_SCHEMA>
4.4 Concluding remarks
This chapter presented X-Entity, a conceptual data model for XML schemas. The X-Entity model describes the hierarchical structure of XML schemas using a flat representation that highlights entities and the relationships among them. Such representation provides a cleaner description for XML schemas hiding implementation details and focusing on semantically relevant concepts. We also presented the process of converting an XML Schema to an X-Entity schema. The conversion process is based on a set of rules that consider element declarations and type definitions of an XML Schema and generates the corresponding conceptual elements. The X-Entity model extends the ER model so that one can explicitly represent important features of XML schemas, including: element and subelement relationships, occurrence constraints of elements and attributes, choice groups and references between elements. Other issues were not considered in our work, including: hierarchy of elements and attributes, cardinality of group of elements, elements with mixed content and order of elements imposed by a sequence compositor. However, our model can be easily extended with additional features and new rules can be developed for the conversion process.
One important advantage of using the X-Entity model is that each entity can be seen and manipulated as an individual concept even if it belongs to a nested structured. Instead of nested entities, each entity has a set of relationships that represents its association with other entities. This kind of representation facilitates mediation queries generation and maintenance.
The X-Entity model represents an XML Schema as a set of entity types and relationship types. This representation helps the identification of real world concepts, which will be used during user queries definition and therefore must be associated with a mediation query. Moreover, the X-Entity model makes distinction between entity types and attributes. During, mediation queries generation entity types and attributes are manipulated in different ways. In an XML schema there is no clear distinction when an information must be represented as an element or an attribute.
Some recent work have discussed the conceptual data modeling of XML schemas using the ER model. In [Psaila 2000] is proposed the ERX conceptual model, an evolution of the classical ER model which provides specific features suitable to model large collections of XML documents. More precisely, ERX extends the ER model to allow the representation of style sheets and a collection of documents conforming to a DTD. In [Passi et al. 2002] is proposed an object-oriented data model, called XSDM (XML Schema Data Model), to represent XML
step of the schema integration XML Schemas are translated into XSDM notation. [Psaila 2000] and [Passi et al. 2002] present conceptual models but they do not discuss XML schema conversion rules, which makes hard using the proposed conceptual models.
The work presented in [Mani et al. 2001] proposes a new notation, called XGrammar, to formalize the most important features from the proposed XML schema languages. Mani et. al. also extends the ER model with additional features (order in a binary relationship and element- subelement relationship) to support the XML model. [Mani et al. 2001] presents conversion rules from XGrammar to ER model extensions, but to use that approach it will be necessary to define an additional mapping from an XML schema to XGrammar. In [Mello et al. 2001] it is described a semi-automatic process for converting a DTD to a conceptual schema in a canonical conceptual model. A broadly discussion of the conversion from a DTD to its corresponding conceptual schema is presented, but they do not make distinction between entity types and attributes.