[OAI-implementers] Validating ListMetadataFormats

Steven Bird Steven Bird <sb@ldc.upenn.edu>
Wed, 20 Feb 2002 16:32:41 EST


I 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).


Leigh Dodds replied:
> You should take a look at Schematron [1] which is an validation language
> implemented using XSLT.  ... Schematron provides the kinds of constraints
> checking that you require ...


Actually, I don't believe that it possible to implement a set-membership
test using schematron.  As I understand it, schematron only lets you assert
implication relations between xpath expressions.

Here is a simpler statement of the problem.  Check that one of the
elements in the following list is OLAC (two versions):

<set>
  <elt>a</elt>
  <elt>b</elt>
  <elt>c</elt>
  <elt>olac</elt>
  <elt>d</elt>
</set>

<set>
  <elt><a/></elt>
  <elt><b/></elt>
  <elt><c/></elt>
  <elt><olac/></elt>
  <elt><d/></elt>
</set>

The schematron rule context is just "/set", and the assertion (which cannot
be expressed in schematron) is that one of the <elt> elements contains
"olac" or <olac/>.

All of the other OLAC requirements can be checked with schematron, and
here is the schematron code I wrote a couple of weeks ago:
[http://www.ldc.upenn.edu/sb/schematron/olac-pmh.xml]

Thus, I think we are left writing programs to validate the response to the
Identify and ListMetadataFormats requests.  I'd be glad to be proven wrong,
so please let me know if schematron or some other XML validation language
can do a set-membership test.

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