[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: B2MML schemas and definition of Equipment Classes

  • From: nico <ndebeiss@g...>
  • To: Marcello Urgo <marcello.urgo@p...>
  • Date: Thu, 22 Jan 2009 13:58:29 +0100

Re:  B2MML schemas and definition of Equipment Classes
Hello

You have to add <xsd:complexContent> like that :
<xsd:complexType name="GrindingMachineClassType">
    <xsd:complexContent>
                  <xsd:restriction base="EquipmentClassType">
                                <xsd:sequence>
                        <xsd:element name="EquipmentClassProperty" type="EquipmentClassPropertyType" minOccurs="0" maxOccurs="2"/>
                                </xsd:sequence>
                  </xsd:restriction>
            </xsd:complexContent>
        </xsd:complexType>
as written there : http://www.w3schools.com/Schema/el_restriction.asp

It is not clear if you have to rewrite all the elements of EquipmentClassType inside your restriction, I know there is a misunderstanding about that. In my opinion, you have to, so it is not very useful to extend an existing type, if you have to rewrite it all !

Regards
Nico
http://debeissat.nicolas.free.fr/


2009/1/19 Marcello Urgo <marcello.urgo@p...>
Dear all,
I am not so experienced with xml schemas but I am dealing with representation of industrial data using xml and I am tryong to use the B2mml xml schemas provided by the wbf (http://www.wbf.org/).
In particular I want to represent data for equipment. B2MML provides the Equipment.xsd schema:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.wbf.org/xml/b2mml-v0400" xmlns:Extended="http://www.wbf.org/xml/b2mml-v0400-extensions" targetNamespace="http://www.wbf.org/xml/b2mml-v0400" elementFormDefault="qualified" attributeFormDefault="unqualified">
         <!-- Include the Common schema   -->
         <xsd:include schemaLocation="B2MML-v0400-Common.xsd"/>
         <!-- Import the Extension Schema         -->
         <xsd:import namespace="http://www.wbf.org/xml/b2mml-v0400-extensions" schemaLocation="B2MML-v0400-Extensions.xsd"/>
        ...
         <!-- Elements -->
        ...
         <xsd:element name="Equipment" type="EquipmentType"/>
         <xsd:element name="EquipmentClass" type="EquipmentClassType"/>
        ....
         <xsd:complexType name="EquipmentType">
                  <xsd:sequence>
                          <xsd:element name="ID" type="IdentifierType"/>
                          <xsd:element name="Description" type="DescriptionType" minOccurs="0" maxOccurs="unbounded"/>
                          <xsd:element name="EquipmentProperty" type="EquipmentPropertyType" minOccurs="0" maxOccurs="unbounded"/>
                          <xsd:element name="Equipment" type="EquipmentType" minOccurs="0" maxOccurs="unbounded"/>
                          <xsd:element name="EquipmentClassID" type="EquipmentClassIDType" minOccurs="0" maxOccurs="unbounded"/>
                          <xsd:element name="MaintenanceRequestID" type="MaintenanceRequestIDType" minOccurs="0" maxOccurs="unbounded"/>
                          <xsd:element name="MaintenanceWorkOrderID" type="MaintenanceWorkOrderIDType" minOccurs="0" maxOccurs="unbounded"/>
                          <xsd:element name="Location" type="LocationType" minOccurs="0"/>
                          ...
                  </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="EquipmentClassType">
                  <xsd:sequence>
                          <xsd:element name="ID" type="IdentifierType"/>
                          <xsd:element name="Description" type="DescriptionType" minOccurs="0" maxOccurs="unbounded"/>
                          <xsd:element name="EquipmentClassProperty" type="EquipmentClassPropertyType" minOccurs="0" maxOccurs="unbounded"/>
                          <xsd:element name="EquipmentID" type="EquipmentIDType" minOccurs="0" maxOccurs="unbounded"/>
                          <xsd:group ref="Extended:EquipmentClass" minOccurs="0"/>
                          ...
                  </xsd:sequence>
         </xsd:complexType>

Let us suppose I want to represent a Grinding Machine and to attach some properties to it like the power and the length.
A first option could be using the EquipmentType with the EquipmentPropertyType to add the two properties.
Hence:

<Equipment xmlns="http://www.wbf.org/xml/b2mml-v0400" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wbf.org/xml/b2mml-v0400B2MML-V0400-Equipment.xsd">
         <ID>GM</ID>
         <Description>Grinding Machine</Description>
         <EquipmentProperty>
                  <ID>1</ID>
                  <Description>Power</Description>
                 <Value>
                           <ValueString>Power</ValueString>
                           <DataType>int</DataType>
                           <UnitOfMeasure>Watt</UnitOfMeasure>
                 </Value>
         </EquipmentProperty>
         <EquipmentProperty>
                  <ID>2</ID>
                  <Description>Length</Description>
                 <Value>
                           <ValueString>Length</ValueString>
                           <DataType>int</DataType>
                           <UnitOfMeasure>meter</UnitOfMeasure>
                 </Value>
         </EquipmentProperty>
</Equipment>

However I am not properly satisfied of this solution, in fact, since I have more than one grinding machine, I would like to have a default structure for the properties of all the grinding machines.
An idea is using the EquipmentClassType:

<EquipmentClass xmlns="http://www.wbf.org/xml/b2mml-v0400" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wbf.org/xml/b2mml-v0400B2MML-V0400-Equipment.xsd">
         <ID>GM</ID>
         <Description>Grinding Machine</Description>
         <EquipmentClassProperty>
                  <ID>1</ID>
                  <Description>Power</Description>
                 <Value>
                           <ValueString>Power</ValueString>
                           <DataType>int</DataType>
                           <UnitOfMeasure>Watt</UnitOfMeasure>
                 </Value>
         </EquipmentClassProperty>
         <EquipmentClassProperty>
                  <ID>2</ID>
                  <Description>Length</Description>
                 <Value>
                           <ValueString>Length</ValueString>
                           <DataType>int</DataType>
                           <UnitOfMeasure>meter</UnitOfMeasure>
                 </Value>
         </EquipmentClassProperty>
</EquipmentClass>

Now I can use an xml file to organize the data for different grinding machines:

<Equipment xmlns="http://www.wbf.org/xml/b2mml-v0400" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wbf.org/xml/b2mml-v0400B2MML-V0400-Equipment.xsd">
         <ID>GM1</ID>
         <Description>Grinding Machine 1</Description>
         <EquipmentClassID>GM</EquipmentClassID>
</Equipment>

My aim was to use a reference to an EquipmentClass to make available only a set of properties.
However I experienced some problem.
 I am not allowed to put the <Equipment> and the <EquipmentClass> in the same xml file, hence I am not able to verify consistence of data given some specification on the different Equipment Classes.

Is there another way to reach the same objective? As an example, could be possible to derive a new schema from the EquipmentClassType to define an "GrindingMachineType"?
How can I do this restricting the number and type of properties that should be considered? It is a complexType and I was not able to use xsd:restriction.

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.wbf.org/xml/b2mml-v0400" xmlns:Extended="http://www.wbf.org/xml/b2mml-v0400-extensions" targetNamespace="http://www.wbf.org/xml/b2mml-v0400" elementFormDefault="qualified" attributeFormDefault="unqualified">
                 
         <xsd:element name="GrindingMachineClass" type="GrindingMachineClassType"/>
        
         <xsd:complexType name="GrindingMachineClassType">
                  <xsd:restriction base="EquipmentClassType">
                 ...
                  </xsd:restriction>
         </xsd:complexType>
</xsd:schema>

I thank you for any suggestion.

Marcello





[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.