[OAI-implementers] Validating ListMetadataFormats

Hussein Suleman hussein@vt.edu
Sun, 10 Feb 2002 17:37:02 -0500


This is a multi-part message in MIME format.
--------------020008060509010109040009
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

hi

sounds like an interesting problem for a sunday afternoon :)

i don't believe that XML Schema has the declarative power to 
differentiate between two tags with the same tag name and different 
content. so, i will stick my head out and suggest that it can't be done.

fwiw, XSLT comes to mind since XPath can handle content as well as 
structure. maybe you could just ask that people run their XML through an 
XSL script for checking - or maybe an XSL transformation and then schema 
validation ? its not exactly what u're looking for, but its more useful 
in that people implementing the OLAC format would have XSLT processors 
on their machines with much greater likelihood than any XML validators 
(at least at this point in time).

(i have attached 2 quickly hacked together XSL checkers)

as another suggestion, how about a repository-explorer-like web-based 
compliance test ... you can get compliance-checking code from me or 
Donna and then customize it ...

ttfn
----hussein

Steven Bird wrote:

> I would like to use an XML validation language (e.g. XML Schema) to test
> that the document returned by ListMetadataFormats includes a specific
> format.  The return typically lists multiple formats, and I just want to
> check that the list includes one specific format, e.g.:
> 
> <ListMetadataFormats>
>   ...
>   <metadataFormat>
>     <metadataPrefix>olac</metadataPrefix>
>     <schema>http://www.language-archives.org/OLAC/0.4/olac.xsd</schema>
>     <metadataNamespace>http://www.language-archives.org/OLAC/0.4/</metadataNamespace>
>   </metadataFormat>
>   ...
> </ListMetadataFormats>
> 
> The ListMetadataFormats container is supposed to have set semantics.  I
> guess I need a set-membership test, and it also needs to work on element
> content (not just element names, attribute names, or attribute values).
> 
> Of course it is trivial to write a program to do the test, but I was hoping
> to find a fully declarative solution, so that our formal requirements
> [http://www.language-archives.org/OLAC/protocol.html] can be accompanied by
> one or more XML documents which more or less transparently implement them.
> 
> I would be grateful for any advice about how to test for set membership
> using an XML validation language.
> 
> Thanks,
> Steven Bird
> 
> --
> Steven.Bird@ldc.upenn.edu  http://www.ldc.upenn.edu/sb
> Assoc Director, LDC; Adj Assoc Prof, CIS & Linguistics
> Linguistic Data Consortium, University of Pennsylvania
> 3615 Market St, Suite 200, Philadelphia, PA 19104-2608
> 
> 
> 
> _______________________________________________
> OAI-implementers mailing list
> OAI-implementers@oaisrv.nsdl.cornell.edu
> http://oaisrv.nsdl.cornell.edu/mailman/listinfo/oai-implementers
> 


-- 
======================================================================
hussein suleman - hussein@vt.edu - vtcs - http://www.husseinsspace.com
======================================================================

--------------020008060509010109040009
Content-Type: text/xml;
 name="testmdf1.xsl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="testmdf1.xsl"

<?xml version="1.0"?>

<!-- 
  check for presence of one or more metadata formats in an OAI 
   ListMetadataFormats response v1
  hussein suleman, VT-DLRL, 10 feb 2001
-->

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:oai="http://www.openarchives.org/OAI/1.1/OAI_ListMetadataFormats"
>

 <xsl:output method="text"/>
 
 <xsl:variable name="olac02">http://www.language-archives.org/OLAC/olac-0.2.xsd</xsl:variable>
 <xsl:variable name="olac04">http://www.language-archives.org/OLAC/0.4/olac.xsd</xsl:variable>
 
 <xsl:template match="oai:ListMetadataFormats">
    <xsl:apply-templates select="oai:metadataFormat/oai:schema"/>
 </xsl:template>
 
 <xsl:template match="oai:metadataFormat/oai:schema[.=$olac02]">
    <xsl:text>Got OLAC v0.2 metadata</xsl:text>
 </xsl:template>

 <xsl:template match="oai:metadataFormat/oai:schema[.=$olac04]">
    <xsl:text>Got OLAC v0.4 metadata</xsl:text>
 </xsl:template>
 
 <xsl:template match="*"/>
 
</xsl:stylesheet> 

--------------020008060509010109040009
Content-Type: text/xml;
 name="testmdf2.xsl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="testmdf2.xsl"

<?xml version="1.0"?>

<!-- 
  check for presence of one or more metadata formats in an OAI 
   ListMetadataFormats response v2
  hussein suleman, VT-DLRL, 10 feb 2001
-->

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:oai="http://www.openarchives.org/OAI/1.1/OAI_ListMetadataFormats"
>

 <xsl:output method="text"/>
 
 <xsl:variable name="olac02">http://www.language-archives.org/OLAC/olac-0.2.xsd</xsl:variable>
 <xsl:variable name="olac04">http://www.language-archives.org/OLAC/0.4/olac.xsd</xsl:variable>
 
 <xsl:template match="oai:ListMetadataFormats">
    <xsl:choose>
       <xsl:when test="count(oai:metadataFormat/oai:schema[.=$olac02]) > 0">
          <xsl:text>Got OLAC v0.2 metadata</xsl:text>
       </xsl:when>
       <xsl:when test="count(oai:metadataFormat/oai:schema[.=$olac04]) > 0">
          <xsl:text>Got OLAC v0.4 metadata</xsl:text>
       </xsl:when>
       <xsl:otherwise>
          <xsl:text>No OLAC format</xsl:text>
       </xsl:otherwise>
    </xsl:choose>
 </xsl:template>
 
</xsl:stylesheet> 

--------------020008060509010109040009--