Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » XMI Schema Generation
XMI Schema Generation [message #18685] Fri, 11 April 2003 17:54 Go to next message
Eclipse UserFriend
Originally posted by: mgl_ca.yahoo.com

Hello,

I have few questions regarding XMI Schema Generation, based on Schema for
Example Library Model,

<xsd:complexType name="Writer">
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element name="name" nillable="true" type="xsd:string"/>
<xsd:element name="category" nillable="true"
type="org.eclipse.example.library:BookCategory"/>
<xsd:element name="books" type="org.eclipse.example.library:Book"/>
<xsd:element ref="xmi:Extension"/>
</xsd:choice>
<xsd:attribute ref="xmi:id"/>
<xsd:attributeGroup ref="xmi:ObjectAttribs"/>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="category"
type="org.eclipse.example.library:BookCategory"/>
<xsd:attribute name="books" type="xsd:string"/>
</xsd:complexType>
<xsd:element name="Writer" type="org.eclipse.example.library:Writer"/>

<xsd:complexType name="Book">
<xsd:complexContent>
<xsd:extension base="org.eclipse.example.library:Literature">
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element name="title" nillable="true"
type="xsd:string"/>
<xsd:element name="pages" nillable="true" type="xsd:int"/>
<xsd:element name="category" nillable="true"
type="org.eclipse.example.library:BookCategory"/>
<xsd:element name="author"
type="org.eclipse.example.library:Writer"/>
</xsd:choice>
<xsd:attribute name="title" type="xsd:string"/>
<xsd:attribute name="pages" type="xsd:int"/>
<xsd:attribute name="category"
type="org.eclipse.example.library:BookCategory"/>
<xsd:attribute name="author" type="xsd:string"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

Q1. Why the relationship 'books' from 'Writer to Book' was transformed to
String attribute <xsd:attribute name="books" type="xsd:string"/>?
Q2. Why the relationship "author" from Book to Writer transformed to String?
Q3. Does that mean that every ComplexType needs to be translatable to some
sort of String? or These attributes shouldn't be declared at all!

Looking at XMI 2.0 Specs I didn't find that an Attribute needs to be
declared, when the property is of type thats not standard XMI type. May be I
am missing some information. Following is something I found in XMI 2.0 Spec.

"For attributes whose types are string type and whose upper bound
multiplicity is 1, an XML attribute must also be declared in the XML element
corresponding to metamodel class "c", and the XML element must be put in the
content model of the XML element for class "c"; the declaration of "c"
appears as follows without multiplicity enforcement:"

"For multi-valued attributes, no XML attributes are declared; each value is
encoded as an XML element."

"If an attribute has enumerated values, an XML element and an XML attribute
is put in the complexType for the class "c"; their declaration is as
follows:
<xsd:element name="a" type="enumName"/>
<xsd:attribute name="a" type="enumName" use="optional"/>"

Thanks,
Maneesh
Re: XMI Schema Generation [message #18709 is a reply to message #18685] Mon, 14 April 2003 14:24 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Maneesh,

Q1. A reference can be serialized as an attribute in XMI, but only in the case
that it's an IDREF. An attribute type of IDREF or IDREFS would seem more
appropriate.
Q2. Same reason.
Q3. No. This reflects a reference, not a string serialized form...


Maneesh wrote:

> Hello,
>
> I have few questions regarding XMI Schema Generation, based on Schema for
> Example Library Model,
>
> <xsd:complexType name="Writer">
> <xsd:choice maxOccurs="unbounded" minOccurs="0">
> <xsd:element name="name" nillable="true" type="xsd:string"/>
> <xsd:element name="category" nillable="true"
> type="org.eclipse.example.library:BookCategory"/>
> <xsd:element name="books" type="org.eclipse.example.library:Book"/>
> <xsd:element ref="xmi:Extension"/>
> </xsd:choice>
> <xsd:attribute ref="xmi:id"/>
> <xsd:attributeGroup ref="xmi:ObjectAttribs"/>
> <xsd:attribute name="name" type="xsd:string"/>
> <xsd:attribute name="category"
> type="org.eclipse.example.library:BookCategory"/>
> <xsd:attribute name="books" type="xsd:string"/>
> </xsd:complexType>
> <xsd:element name="Writer" type="org.eclipse.example.library:Writer"/>
>
> <xsd:complexType name="Book">
> <xsd:complexContent>
> <xsd:extension base="org.eclipse.example.library:Literature">
> <xsd:choice maxOccurs="unbounded" minOccurs="0">
> <xsd:element name="title" nillable="true"
> type="xsd:string"/>
> <xsd:element name="pages" nillable="true" type="xsd:int"/>
> <xsd:element name="category" nillable="true"
> type="org.eclipse.example.library:BookCategory"/>
> <xsd:element name="author"
> type="org.eclipse.example.library:Writer"/>
> </xsd:choice>
> <xsd:attribute name="title" type="xsd:string"/>
> <xsd:attribute name="pages" type="xsd:int"/>
> <xsd:attribute name="category"
> type="org.eclipse.example.library:BookCategory"/>
> <xsd:attribute name="author" type="xsd:string"/>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
>
> Q1. Why the relationship 'books' from 'Writer to Book' was transformed to
> String attribute <xsd:attribute name="books" type="xsd:string"/>?
> Q2. Why the relationship "author" from Book to Writer transformed to String?
> Q3. Does that mean that every ComplexType needs to be translatable to some
> sort of String? or These attributes shouldn't be declared at all!
>
> Looking at XMI 2.0 Specs I didn't find that an Attribute needs to be
> declared, when the property is of type thats not standard XMI type. May be I
> am missing some information. Following is something I found in XMI 2.0 Spec.
>
> "For attributes whose types are string type and whose upper bound
> multiplicity is 1, an XML attribute must also be declared in the XML element
> corresponding to metamodel class "c", and the XML element must be put in the
> content model of the XML element for class "c"; the declaration of "c"
> appears as follows without multiplicity enforcement:"
>
> "For multi-valued attributes, no XML attributes are declared; each value is
> encoded as an XML element."
>
> "If an attribute has enumerated values, an XML element and an XML attribute
> is put in the complexType for the class "c"; their declaration is as
> follows:
> <xsd:element name="a" type="enumName"/>
> <xsd:attribute name="a" type="enumName" use="optional"/>"
>
> Thanks,
> Maneesh
Re: XMI Schema Generation [message #567861 is a reply to message #18685] Mon, 14 April 2003 14:24 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Maneesh,

Q1. A reference can be serialized as an attribute in XMI, but only in the case
that it's an IDREF. An attribute type of IDREF or IDREFS would seem more
appropriate.
Q2. Same reason.
Q3. No. This reflects a reference, not a string serialized form...


Maneesh wrote:

> Hello,
>
> I have few questions regarding XMI Schema Generation, based on Schema for
> Example Library Model,
>
> <xsd:complexType name="Writer">
> <xsd:choice maxOccurs="unbounded" minOccurs="0">
> <xsd:element name="name" nillable="true" type="xsd:string"/>
> <xsd:element name="category" nillable="true"
> type="org.eclipse.example.library:BookCategory"/>
> <xsd:element name="books" type="org.eclipse.example.library:Book"/>
> <xsd:element ref="xmi:Extension"/>
> </xsd:choice>
> <xsd:attribute ref="xmi:id"/>
> <xsd:attributeGroup ref="xmi:ObjectAttribs"/>
> <xsd:attribute name="name" type="xsd:string"/>
> <xsd:attribute name="category"
> type="org.eclipse.example.library:BookCategory"/>
> <xsd:attribute name="books" type="xsd:string"/>
> </xsd:complexType>
> <xsd:element name="Writer" type="org.eclipse.example.library:Writer"/>
>
> <xsd:complexType name="Book">
> <xsd:complexContent>
> <xsd:extension base="org.eclipse.example.library:Literature">
> <xsd:choice maxOccurs="unbounded" minOccurs="0">
> <xsd:element name="title" nillable="true"
> type="xsd:string"/>
> <xsd:element name="pages" nillable="true" type="xsd:int"/>
> <xsd:element name="category" nillable="true"
> type="org.eclipse.example.library:BookCategory"/>
> <xsd:element name="author"
> type="org.eclipse.example.library:Writer"/>
> </xsd:choice>
> <xsd:attribute name="title" type="xsd:string"/>
> <xsd:attribute name="pages" type="xsd:int"/>
> <xsd:attribute name="category"
> type="org.eclipse.example.library:BookCategory"/>
> <xsd:attribute name="author" type="xsd:string"/>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
>
> Q1. Why the relationship 'books' from 'Writer to Book' was transformed to
> String attribute <xsd:attribute name="books" type="xsd:string"/>?
> Q2. Why the relationship "author" from Book to Writer transformed to String?
> Q3. Does that mean that every ComplexType needs to be translatable to some
> sort of String? or These attributes shouldn't be declared at all!
>
> Looking at XMI 2.0 Specs I didn't find that an Attribute needs to be
> declared, when the property is of type thats not standard XMI type. May be I
> am missing some information. Following is something I found in XMI 2.0 Spec.
>
> "For attributes whose types are string type and whose upper bound
> multiplicity is 1, an XML attribute must also be declared in the XML element
> corresponding to metamodel class "c", and the XML element must be put in the
> content model of the XML element for class "c"; the declaration of "c"
> appears as follows without multiplicity enforcement:"
>
> "For multi-valued attributes, no XML attributes are declared; each value is
> encoded as an XML element."
>
> "If an attribute has enumerated values, an XML element and an XML attribute
> is put in the complexType for the class "c"; their declaration is as
> follows:
> <xsd:element name="a" type="enumName"/>
> <xsd:attribute name="a" type="enumName" use="optional"/>"
>
> Thanks,
> Maneesh


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:XMI Schema Generation
Next Topic:Find an XSD element
Goto Forum:
  


Current Time: Thu Apr 25 02:33:28 GMT 2024

Powered by FUDForum. Page generated in 0.03268 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top