Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


B2MML schemas and definition of Equipment Classes

From: Marcello Urgo <marcello.urgo@------.-->
To: xml-dev@-----.---.---
Date: 1/19/2009 10:01:00 PM
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">
<x-tab>        </x-tab>
<!-- Include the Common schema   -->
<x-tab>        </x-tab>
<xsd:include schemaLocation="B2MML-v0400-Common.xsd"/>
<x-tab>        </x-tab>
<!-- Import the Extension
Schema         -->
<x-tab>        </x-tab>
<xsd:import
namespace="http://www.wbf.org/xml/b2mml-v0400-extensions"
schemaLocation="B2MML-v0400-Extensions.xsd"/>
<x-tab>        </x-tab>...
<x-tab>        </x-tab>
<!-- Elements -->
<x-tab>        </x-tab>...
<x-tab>        </x-tab>
<xsd:element name="Equipment"
type="EquipmentType"/>
<x-tab>        </x-tab>
<xsd:element name="EquipmentClass"
type="EquipmentClassType"/>
<x-tab>        </x-tab>....
<x-tab>        </x-tab>
<xsd:complexType
name="EquipmentType">
<x-tab>        </x-tab><x-tab>
        </x-tab>
<xsd:sequence>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab><xsd:element
name="ID" type="IdentifierType"/>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab><xsd:element
name="Description" type="DescriptionType"
minOccurs="0" maxOccurs="unbounded"/>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab><xsd:element
name="EquipmentProperty" type="EquipmentPropertyType"
minOccurs="0" maxOccurs="unbounded"/>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab><xsd:element
name="Equipment" type="EquipmentType"
minOccurs="0" maxOccurs="unbounded"/>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab><xsd:element
name="EquipmentClassID" type="EquipmentClassIDType"
minOccurs="0" maxOccurs="unbounded"/>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab><xsd:element
name="MaintenanceRequestID"
type="MaintenanceRequestIDType" minOccurs="0"
maxOccurs="unbounded"/>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab><xsd:element
name="MaintenanceWorkOrderID"
type="MaintenanceWorkOrderIDType" minOccurs="0"
maxOccurs="unbounded"/>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab><xsd:element
name="Location" type="LocationType"
minOccurs="0"/>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab>...
<x-tab>        </x-tab><x-tab>
        </x-tab>
</xsd:sequence>
<x-tab>        </x-tab>
</xsd:complexType>
<x-tab>        </x-tab>
<xsd:complexType name="EquipmentClassType">
<x-tab>        </x-tab><x-tab>
        </x-tab>
<xsd:sequence>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab><xsd:element
name="ID" type="IdentifierType"/>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab><xsd:element
name="Description" type="DescriptionType"
minOccurs="0" maxOccurs="unbounded"/>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab><xsd:element
name="EquipmentClassProperty"
type="EquipmentClassPropertyType" minOccurs="0"
maxOccurs="unbounded"/>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab><xsd:element
name="EquipmentID" type="EquipmentIDType"
minOccurs="0" maxOccurs="unbounded"/>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab><xsd:group
ref="Extended:EquipmentClass" minOccurs="0"/>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab>...
<x-tab>        </x-tab><x-tab>
        </x-tab>
</xsd:sequence>
<x-tab>        </x-tab>
</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">
<x-tab>        </x-tab>
<ID>GM</ID>
<x-tab>        </x-tab>
<Description>Grinding Machine</Description>
<x-tab>        </x-tab>
<EquipmentProperty>
<x-tab>        </x-tab><x-tab>
        </x-tab>
<ID>1</ID>
<x-tab>        </x-tab><x-tab>
        </x-tab>
<Description>Power</Description>
<x-tab>        </x-tab><x-tab>
        </x-tab><Value>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab>
<ValueString>Power</ValueString>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab>
<DataType>int</DataType>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab>
<UnitOfMeasure>Watt</UnitOfMeasure>
<x-tab>        </x-tab><x-tab>
        </x-tab></Value>
<x-tab>        </x-tab>
</EquipmentProperty>
<x-tab>        </x-tab>
<EquipmentProperty>
<x-tab>        </x-tab><x-tab>
        </x-tab>
<ID>2</ID>
<x-tab>        </x-tab><x-tab>
        </x-tab>
<Description>Length</Description>
<x-tab>        </x-tab><x-tab>
        </x-tab><Value>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab>
<ValueString>Length</ValueString>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab>
<DataType>int</DataType>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab>
<UnitOfMeasure>meter</UnitOfMeasure>
<x-tab>        </x-tab><x-tab>
        </x-tab></Value>
<x-tab>        </x-tab>
</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">
<x-tab>        </x-tab>
<ID>GM</ID>
<x-tab>        </x-tab>
<Description>Grinding Machine</Description>
<x-tab>        </x-tab>
<EquipmentClassProperty>
<x-tab>        </x-tab><x-tab>
        </x-tab>
<ID>1</ID>
<x-tab>        </x-tab><x-tab>
        </x-tab>
<Description>Power</Description>
<x-tab>        </x-tab><x-tab>
        </x-tab><Value>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab>
<ValueString>Power</ValueString>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab>
<DataType>int</DataType>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab>
<UnitOfMeasure>Watt</UnitOfMeasure>
<x-tab>        </x-tab><x-tab>
        </x-tab></Value>
<x-tab>        </x-tab>
</EquipmentClassProperty>
<x-tab>        </x-tab>
<EquipmentClassProperty>
<x-tab>        </x-tab><x-tab>
        </x-tab>
<ID>2</ID>
<x-tab>        </x-tab><x-tab>
        </x-tab>
<Description>Length</Description>
<x-tab>        </x-tab><x-tab>
        </x-tab><Value>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab>
<ValueString>Length</ValueString>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab>
<DataType>int</DataType>
<x-tab>        </x-tab><x-tab>
        </x-tab><x-tab>
        </x-tab>
<UnitOfMeasure>meter</UnitOfMeasure>
<x-tab>        </x-tab><x-tab>
        </x-tab></Value>
<x-tab>        </x-tab>
</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">
<x-tab>        </x-tab>
<ID>GM1</ID>
<x-tab>        </x-tab>
<Description>Grinding Machine 1</Description>
<x-tab>        </x-tab>
<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">
<x-tab>        </x-tab><x-tab>
        </x-tab>
<x-tab>        </x-tab>
<xsd:element name="GrindingMachineClass"
type="GrindingMachineClassType"/>
<x-tab>        </x-tab>
<x-tab>        </x-tab>
<xsd:complexType name="GrindingMachineClassType">
<x-tab>        </x-tab><x-tab>
        </x-tab>
<xsd:restriction base="EquipmentClassType">
<x-tab>        </x-tab><x-tab>
        </x-tab>...
<x-tab>        </x-tab><x-tab>
        </x-tab>
</xsd:restriction>
<x-tab>        </x-tab>
</xsd:complexType>
</xsd:schema>


I thank you for any suggestion.


Marcello


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent