XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] 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@polimi.it>
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 (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-v0400 B2MML-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-v0400 B2MML-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-v0400 B2MML-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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS