W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2004

deriving restriction types

From: gayathri veerarajan <gaytri_v@yahoo.co.in>
Date: Thu, 8 Apr 2004 13:55:13 +0100 (BST)
Message-ID: <20040408125513.43674.qmail@web8204.mail.in.yahoo.com>
To: xmlschema-dev@w3.org
 



Yahoo! India Matrimony: Find your partner online.

1)I declare a complex type "B" which is derived by restriction from base "A". In complexType "A" i have an element defined as "E1" of some type. now in complexType "B" i want to redefine this element "E1" of someother type. Will "E1" in "B" override the element "E1" in "A"?.
 
2)another circumstance is that ,In complexType "B" I want the element "E2" to have a fixed value and its minoccurs is "1". ie "E2" should appear atleast once with the fixed value specified. and it can occur any number of times with the type specified in complexType definition "A".(I have a global declarations for E1 and E2)  so can my schema construct be the following.

<xs:element name= "E2" type"some"/>

<xs:complexType name="A">
  <xs:element ref="E2" />
</xs:complexType>

<xs:complexType name="B">
  <xs:complexContent>
    <xs:restriction base="A">
     <xs:element name="E2" minOccurs="1" fixed="someValue" />
     <xs:element ref="E2"/>
    </xs:restriction>
   <xs:complexContent>
</xs:complexType>
  
please suggest me .
Thank u,
V.Gayathri.


Sir,
    Thank u very much for ur immediate response and kind  help.your mail gave me much more clear idea about the schema constructs.
    I was able to validate the xsd files using IBM schema quality checker.It validated successfully the corrected file which u sent me
But while validating this file using DecisionSoft tool it gave me the following error  .
The element 'http://www.xfront.com/owl/ontologies/camera/##body' may not have both type 'http://www.xfront.com/owl/ontologies/camera/##body_._type' and type 'http://www.xfront.com/owl/ontologies/camera/##body_._type', locationURI: null, line: 1, column: 1, node: [xsd:complexType: null], annotationURI: null 
I think this error occured because I had an element " body" declared  globally and referenced in the compleType "Camera" .and I have defined a complextype "Large-Format" which is extended from base "Camera",where I have defined an local element "body" of complexType. hence Large-Format had two "body"elements of different types.

My main purpose of this declaration is that Large-Format,SLR,and Digital are different types of Camera.hence in each of these types there are some elements that are common to Camera type and some are restricted. (for eg. in "Large-Format" the element "body" is restricted to contain only subelement "BodyWithNonAdjustableShutterSpeed").

Hence to avoid this error ,I changed the content model of "Large-Format to be of restriction( as in the attached file) still it gave me an error saying:
The restricted content type must accept a subset of the content accepted by the base type, locationURI: null, line: 1, column: 1, node: [xsd:complexType: null], annotationURI: null 

Cant we declare new elements while restricting a derived type.I have seen such constructs in the " A Schema for Schemas " available in Xml Schema part1 document . the Ontology classes   mostly deals with restricting  properties of thier superClasses. I need a solution  for this Sir, kindly help me.
thank u,
V.Gayathri.     


error while declaring fixed  value
MESSAGE
ThroughTheLens is not a valid default or fixed value for the element declaration
 :<xsd:element fixed="ThroughTheLens" maxOccurs="1" minOccurs="1"
    name="viewFinder" nillable="false" type="Viewer"/>

ontology example file:
http://www.daml.org/services/owl-s/1.0/examples.html


Using OWL to Avoid Syntactic Rigor Mortis
<SLR rdf:ID="Olympus-OM-10">
        <viewFinder>twin mirror</viewFinder>
        <optics>
               <Lens>
                   <focal-length>75-300mm zoom</focal-length>
                   <f-stop>4.0-4.5</f-stop>
               </Lens>
        </optics>
        <shutter-speed>1/2000 sec. to 10 sec.</shutter-speed>
</SLR>



Sir,
    I'm an M.tech of IIT Madras. we (lab members) are also trying to participate in Semantic Web.I found ur camera ontology very much helpful for my project.Since there is no complete instatiation of an individual and its properties in the camera.owl ,I am little confused regarding this.
In your article  "Using OWL to Avoid Syntactic Rigor Mortis" I found a physical expression as follows:
<SLR rdf:ID="Olympus-OM-10">
        <viewFinder>twin mirror</viewFinder>
        <optics>
               <Lens>
                   <focal-length>75-300mm zoom</focal-length>
                   <f-stop>4.0-4.5</f-stop>
               </Lens>
        </optics>
        <shutter-speed>1/2000 sec. to 10 sec.</shutter-speed>
</SLR>

 in the ontology file it could be declared as follows
<SLR rdf:ID="Olympus-OM-10">
   <viewFinder rdf:resource="#twin mirror"/>
   <optics rdf:resource="#some individual from its range Lens"/>
   <body rdf:resource="#some individual from its range Body"/>
</SLR>

but  how to capture the value of focal- length,f-stop in the same SLR individual declaration.
when we consider the property body it is of type Body which has a property called shutter-speed of type Range.
with respect to this I thought of  capturing  the physical expression as follows:
<SLR rdf:ID="Olympus-OM-10">
        <viewFinder>twin mirror</viewFinder>
        <optics>
               <Lens rdf:ID="Lens 1">
                   <focal-length>75-300mm zoom</focal-length>
                   <f-stop>4.0-4.5</f-stop>
               </Lens>
        </optics>
        <body>
              <Body rdf:ID= "some Body individual">
                    <shutter-speed>1/2000 sec. to 10 sec.</shutter-speed>
              </Body>
       </body>
</SLR>
is this expression correct.
Since my project deals with Xml schema Translation ,I need some clarification  regarding the physical expression. could u please help me Sir.
Thank u,

V.Gayathri. 

I just read the Xml Schema Second Edition .In the section of substitution group it has been said that both the head element and the substitutable elements must be declared global.
If the substitutable element happens to appear in the content model of a complexType definition then while deriving a new complex type by restriction,this element could not be restricted (by its type) if it is declared globally.
hence there should be a possibility to declare the substitutable element locally also.
any comments regarding this.

regards,
V.Gayathri.


I would like to know whether this is a valid restriction

<xsd:complexType name="WineGrape">
 <xsd:choice>
  <xsd:element ref="WineGrape" minOccurs="0" maxOccurs="unbounded" /> 
  <xsd:element ref="CabernetFrancGrape" minOccurs="0" maxOccurs="unbounded" /> 
  <xsd:element ref="CabernetSauvignonGrape" minOccurs="0" maxOccurs="unbounded" /> 
  <xsd:element ref="ChardonnayGrape" minOccurs="0" maxOccurs="unbounded" /> 
  <xsd:element ref="CheninBlancGrape" minOccurs="0" maxOccurs="unbounded" /> 
  <xsd:element ref="ZinfandelGrape" minOccurs="0" maxOccurs="unbounded" /> 
  <xsd:element ref="GamayGrape" minOccurs="0" maxOccurs="unbounded" /> 
 </xsd:choice>
</xsd:complexType>

I want to derive a new complex type restricted from wineGrape where I expect the element  CabernetFrancGrape to appear atleast once.
so I tried deriving as follows ,but it gave me an error.

<xsd:complexType name="WineGrape_hasValue_CabernetFrancGrape">
- <xsd:complexContent>
-   <xsd:restriction base="vin:WineGrape">
-     <xsd:sequence>
        <xsd:element ref="CabernetFrancGrape" minOccurs="1" maxOccurs="unbounded" /> 
        <xsd:element ref="CabernetSauvignonGrape" minOccurs="0" maxOccurs="unbounded" /> 
        <xsd:element ref="ChardonnayGrape" minOccurs="0" maxOccurs="unbounded" /> 
        <xsd:element ref="CheninBlancGrape" minOccurs="0" maxOccurs="unbounded" /> 
        <xsd:element ref="ZinfandelGrape" minOccurs="0" maxOccurs="unbounded" /> 
        <xsd:element ref="GamayGrape" minOccurs="0" maxOccurs="unbounded" /> 
     </xsd:sequence>
  </xsd:restriction>
 </xsd:complexContent>
</xsd:complexType>

Is this because of the sequence construct in place of choice.
If I give choice then only the element CabernetFrancGrape would appear each time when this type is referenced(because its minoccurs is 1). Is my assumption correct?

and also I dont think that sequence construct in place of choice is a problem, because the code mentioned below  got validated

<xsd:complexType name="WineGrape_ZinfandelGrape">
- <xsd:complexContent>
- <xsd:restriction base="vin:WineGrape">
- <xsd:sequence>
  <xsd:element ref="ZinfandelGrape" /> 
  </xsd:sequence>
  </xsd:restriction>
  </xsd:complexContent>
  </xsd:complexType>

please suggest how to do this.

regards,
V.gayathri.   
Received on Thursday, 8 April 2004 08:55:16 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:15:11 UTC