RE: How does inheritance work in XML document instances and how do searches know about that inheritance?

You seem to be talking about inheritance at the instance level rather than
at the type level. I don't believe there's any explicit recognition of this
concept in XML Schema or in the XML family of specs generally.

The concept is used quite a bit in the design of specific XML vocabularies,
usually with attributes. xml:lang, xml:base, and xml:space are obvious
examples; in XSLT 2.0 there are attributes such as [xsl:]version and
[xsl:]default-collation that work this way, and XSL-FO has many more
examples. I haven't previously seen this design pattern used with elements
but there's no intrinsic reason not to.

Because this is an application-level design pattern rather than something
supported by the schema or the data model, it's up to application logic to
sort it out at query time. One good way of doing this in XQuery or XSLT 2.0
is through user-defined functions: instead of accessing xml:lang directly,
you write a function

<xsl:function name="f:get-xml-lang" as="xs:language?">
  <xsl:param name="e" as="element()"/>
  <xsl:sequence select="(ancestor::*/@xml:lang)[last()]"/>
</xsl:function>

and the application can then use expressions such as

if (f:get-xml-lang(.) = 'en') then ...

I think that libraries of such functions will increasingly become a standard
part of the definition of an XML vocabulary, closely associated with the
schema itself: any data model should have a behavioural part as well as a
structural part.

Michael Kay
http://www.saxonica.com/



> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of 
> John.Hockaday@ga.gov.au
> Sent: 29 April 2005 01:34
> To: xmlschema-dev@w3.org
> Subject: How does inheritance work in XML document instances 
> and how do searches know about that inheritance?
> 
> 
> Hi,
> 
> I'm working on an implementation of the ISO 19115 Metadata 
> Standard.  I know
> that ISO 19139 is an W3C XML Schema implementation of ISO 
> 19115.  What I want
> to know is how does inheritance work with XML document 
> instances and how do
> searches know about that inheritance?
> 
> In this example I am using elements from the ISO 19139 XSD 
> but it seems to me
> that it doesn't matter what XSD is used.  If it allows 
> inheritance then there
> must be a way for XML document instances to know the content 
> of its parents.
> 
> 
> For example, An XML metadata record for a "Series" 
> hierarchical Level will
> contain information about:
> organisation, 
> abstract, 
> bounding coordinates, 
> etc.  
> An XML metadata record for a "Dataset" hierarchical Level for 
> that "Series"
> will inherit some of these elements and will probably have 
> the content of
> other elements filled in.  For example; 
> the abstract will be different, 
> the attribute accuracy will be added, 
> other information will stay the same.
> 
> This would indicate that the parent (Series) XML record should be the
> authoritative list for the organisation and bounding 
> coordinates.  It also
> has content in the abstract but because the abstract is 
> redefined in the
> child (Dataset) XML record then the content of the child's abstract
> overwrites the content of the parent's abstract.  Are you 
> still with me? ;--)
> 
> When this is implemented.  Does the child (Dataset) XML 
> record contain the
> content of the organisation and bounding coordinates in the 
> actual XML record
> or does it use something like the "import" element to refer 
> to the content of
> those elements?  
> 
> If it is the former how does the child (Dataset) XML record obtain any
> changes made to the parent (Series) XML record?
> 
> If it is the latter how does an index of the child (Dataset) 
> XML record know
> about the content of the parent's (Series) elements when 
> someone is searching
> for those documents?  If the content of the parent's elements 
> are not part of
> the index of the child then any search for the parent's elements, eg.
> organisation, will not return the child record.
> 
> I hope that this is clear enough to define my problem. 
> 
> Thanks.
> 
> 
> John Hockaday
> Geoscience Australia
> GPO Box 378
> Canberra ACT 2601
> (02) 6249 9735
> http://www.ga.gov.au/ 
> john.hockaday\@ga.gov.au
> 
> 

Received on Friday, 29 April 2005 08:31:41 UTC