OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

emix message

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


Subject: RE: [emix] Trouble in Schema Town


Here is the corrected XSD with the changes listed below:

 

  • Incorrect namespace prefix
    • emix:itemBase changed to poo:itemBase
    • emix:ItemBaseType changed to poo:ItemBaseType

 

  • Missing data type definition
    • Missing “type” (see below).
    • I would be expecting to see the UnitSymbol and UnitMultiplier enumerators that we discussed. Is that where you are trying to with these changes?

 

            <xs:element name="powerReactive" type="poo:PowerReactiveType" substitutionGroup="poo:powerItem"/>

            <xs:complexType name="PowerReactiveType" mixed="false">

                        <xs:annotation>

                                    <xs:documentation>Reactive power, measured in volt-amperes reactive (VAR)</xs:documentation>

                        </xs:annotation>

                        <xs:complexContent mixed="false">

                                    <xs:restriction base="poo:PowerItemType">

                                                <xs:sequence>

                                                            <xs:element name="itemDescription" type="xs:string"/>

                                                            <xs:element name="itemUnits" type="xs:string" fixed="VAR"/>

                                                            <xs:element name="scale" type="poo:SiScaleType"/>

                                                            <xs:element ref="poo:powerAttributes"/>

                                                </xs:sequence>

                                    </xs:restriction>

                        </xs:complexContent>

            </xs:complexType>

 

Bruce Bartell

Xtensible Solutions

Mobile: +1.321.258.6500

bbartell@xtensible.net  |   www.xtensible.net


From: Considine, Toby (Campus Services IT) [mailto:Toby.Considine@unc.edu]
Sent: Monday, March 28, 2011 10:52 AM
To: Bartell, Bruce; William Cox; EMIX TC
Cc: Toby.Considine@gmail.com
Subject: RE: [emix] Trouble in Schema Town

 

If you take the last published schemas, (EMIX only) and work this smaller extract from Power against them, you can see the problem…

 

And maybe propose the solution.

 

Thanks

 

tc

 


"It is the theory that decides what can be observed."   - Albert Einstein


Toby Considine

Chair, OASIS oBIX Technical Committee
U.S. National Inst. of Standards and Tech. Smart Grid Architecture Committee

Facilities Technology Office
University of North Carolina
Chapel Hill, NC

  

Email: Toby.Considine@ unc.edu
Phone: (919)962-9073

http://www.oasis-open.org

blog: www.NewDaedalus.com

 

 

From: Bartell, Bruce [mailto:bbartell@xtensible.net]
Sent: Monday, March 28, 2011 10:37 AM
To: William Cox; EMIX TC
Cc: Toby.Considine@gmail.com
Subject: RE: [emix] Trouble in Schema Town

 

Toby, can you send the versions that are causing the problem?

 

I thought changing the elementFormDefault to “unqualified” for both schemas might help, but with the imports that might make things worse.

 

Bruce Bartell

Xtensible Solutions

Mobile: +1.321.258.6500

bbartell@xtensible.net  |   www.xtensible.net


From: William Cox [mailto:wtcox@CoxSoftwareArchitects.com]
Sent: Monday, March 28, 2011 10:13 AM
To: EMIX TC
Cc: Toby.Considine@gmail.com
Subject: Re: [emix] Trouble in Schema Town

 

All --

This is similar to the solution using EmixBaseType where we have an abstract base type for all EMIX artifacts.

The proposal is a common pattern; the only slight twist is that the abstract class is empty. I don't have a problem with that, as it simplifies the typing model (more later) so you can validate artifacts using shared schemas in the XML space efficiently rather than by evaluating constraint rules.

So I like it.

If anyone has a better suggestion for the XML, please speak up.

Thanks!

bill
--

William Cox
Email: wtcox@CoxSoftwareArchitects.com
Web: http://www.CoxSoftwareArchitects.com
+1 862 485 3696 mobile
+1 908 277 3460 fax

 

I am having an issue with cross-schema restrictions. I can work around it, but if anyone  can suggest a solution, that would be nice.

 

In EMIX.XSD we have

 

            <xs:element name="itemBase" type="emix:ItemBaseType" abstract="true"/>

            <xs:complexType name="ItemBaseType" abstract="true" mixed="false">

                        <xs:annotation>

                                    <xs:documentation>Abstract base class for units for EMIX Product delivery, measurement, and warrants. Item as in PO Item, Requisition Item, Invoice Item, Lading Item. Item does not include Quantity or Price, because a single product description or transaction may have multiple quantities or prices associated with a single item.</xs:documentation>

                        </xs:annotation>

                        <xs:sequence>

                                    <xs:element name="itemDescription" type="xs:string"/>

                                    <xs:element name="itemUnits" type="xs:string"/>

                                    <xs:element name="scale" type="emix:SiScaleType"/>

                        </xs:sequence>

            </xs:complexType>

 

In Power.XSd, we extend this (showing Power only)

 

            <!-- ==================================================== -->

            <!-- 9.9.5 Base Power Item Type -->

            <!-- ==================================================== -->

            <xs:element name="powerItem" type="power:PowerItemType"/>

            <xs:complexType name="PowerItemType" abstract="true" mixed="false">

                        <xs:annotation>

                                    <xs:documentation>Denominations for the measurement of Power</xs:documentation>

                        </xs:annotation>

                        <xs:complexContent mixed="false">

                                    <xs:extension base="emix:ItemBaseType">

                                                <xs:sequence>

                                                            <xs:element ref="power:powerAttributes"/>

                                                </xs:sequence>

                                    </xs:extension>

                        </xs:complexContent>

            </xs:complexType>

            <!-- ==================================================== -->

            <xs:element name="powerAttributes" type="power:PowerAttributesType"/>

            <xs:complexType name="PowerAttributesType">

                        <xs:sequence>

                                    <xs:element name="hertz" type="xs:decimal"/>

                                    <xs:element name="voltage" type="xs:decimal"/>

                                    <xs:element name="ac" type="xs:boolean"/>

                        </xs:sequence>

            </xs:complexType>

 

 

And then restrict them as follows

 

            <!-- ==================================================== -->

            <xs:element name="powerReal" type="power:PowerRealType" substitutionGroup="power:powerItem"/>

            <xs:complexType name="PowerRealType" mixed="false">

                        <xs:annotation>

                                    <xs:documentation>Real power measured in Watts (W) or Joules/second (J/s)</xs:documentation>

                        </xs:annotation>

                        <xs:complexContent mixed="false">

                                    <xs:restriction  base="power:PowerItemType">

                                                <xs:sequence>

                                                            <xs:element name="itemDescription" type="xs:string" fixed="RealPower"/>

                                                            <xs:element name="itemUnits">

                                                                        <xs:simpleType>

                                                                                    <xs:restriction base="xs:token">

                                                                                                <xs:enumeration value="W"/>

                                                                                                <xs:enumeration value="J/s"/>

                                                                                    </xs:restriction>

                                                                        </xs:simpleType>

                                                            </xs:element>

                                                            <xs:element name="scale" type="emix:SiScaleType"/>

                                                            <xs:element ref="power:powerAttributes"/>

                                                </xs:sequence>

                                                </xs:restriction>

                        </xs:complexContent>

            </xs:complexType>

 

This should produce correct results.  It validates in many tools, but not in XMLSpy. In XML Spy, this is invalid as it sees:

 

Type 'power:PowerRealType' is not a valid restriction of type 'power:PowerItemType'. (see Details)

                Error location: xs:schema / xs:complexType / xs:complexContent / xs:restriction / @base

                Details

                                rcase-NameAndTypeOK.1: The declarations' {name}s and {target namespace}s are not the same: restriction element is <xs:element name="itemDescription"> and base element is <xs:element name="itemDescription">.

                                rcase-Recurse.2.2: Mandatory <xs:element name="itemDescription"> is missing in the <sequence>.

 

Several other tools validate it as OK. It seems to be an edge case that was much discussed during the development of the current draft of XSD. I am not even certain that it is invalid. Still, if XMLspy is the tool folks will use to validate, this is a problem.

 

For now, I can work around it by making Item a null abstract class, and doing all the typing inside Power. This will give correct XML that validates in XMLSpy, and I can fix it to be what I would prefer when someone suggests a work-around.

 

Some of the examples shared on this list recently have been very informative. We have to shy away from non-recommended standards such as SAWSDL which are not fully conformant with WSDL 2. Perhaps we can accomplish the same type of semantic typing with CAM as we go forward. I would welcome a volunteer for that effort.

 

tc

 

 

 

 

 


“The single biggest problem in communication is the illusion that it has taken place.”
– George Bernard Shaw.


Toby Considine
TC9, Inc

TC Chair: oBIX & WS-Calendar

TC Editor: EMIX, EnergyInterop

U.S. National Inst. of Standards and Tech. Smart Grid Architecture Committee

  

Email: Toby.Considine@gmail.com
Phone: (919)619-2104

http://www.tcnine.com/
blog: www.NewDaedalus.com

 

 

Scrap-BB.xsd



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