A (informative) RELAX NG compact schema
Note: The following RELAX NG compact schema may be found
online at
http://atoll.inria.fr/~clerger/MAF/maf.rnc
# $Id: maf.rnc,v 1.1 2005/09/06 08:38:02 clerger Exp $
default namespace = ""
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
## Preliminary Relax NG schema for MAF -- Morpho-syntactic Annotation Framework
## Eric de la Clergerie <Eric.De_La_Clergerie@inria.fr>
## The following is for Feature Structures
include "iso-fs-standalone.rnc"
start =
element maf {
( maf.document,
maf.addressing )? ,
tagset ?,
maf.metadata ?,
maf.flow
}
maf.document = attribute document { xsd:anyURI }
## To be defined in LAF
maf.addressing = attribute addressing { xsd:NMTOKEN }
## Global Metadata: to be completed
maf.metadata |= notAllowed # to be imported from OLAC
\token =
element token {
attribute id { xsd:ID }?,
token.information,
(
(
attribute from { DocumentLocation },
attribute to { DocumentLocation }
)
| ## DTD => ,
(
[ a:defaultValue = "no" ]
attribute join { "no" | "left" | "right" | "both" | "overlap" }?,
text
)
)
}
token.information &= attribute form { string }?
token.information &= attribute phonetic { string }?
token.information &= attribute transcription { string }?
token.information &= attribute transliteration { string }?
wordForm =
element wordForm {
wordForm.identification,
wordForm.tokens,
wordForm*,
wordForm.content ?
}
wordForm.tokens =
( attribute tokens { xsd:IDREFS }
| ## DTD => ,
\token*
)
wordForm.identification &= attribute entry { xsd:anyURI } ?
wordForm.identification &= attribute lemma { string } ?
wordForm.identification &= attribute form { string } ?
maf.flow = (\token | wordForm | wordForm.alt | fsm )+
fsm =
element fsm {
( attribute init { fsm.state },
attribute final { fsm.state } ) ?,
( attribute tinit { fsm.state },
attribute tfinal { fsm.state } )?,
transition+
}
fsm.state = xsd:Name
transition =
element transition {
attribute source { fsm.state },
attribute target { fsm.state },
(\token | wordForm | wordForm.alt)
}
wordForm.alt =
element wfAlt { wordForm+ }
wordForm.content =
( attribute tag { xsd:IDREFS }
| ## DTD => ,
fs
)
fs |= notAllowed # defined in iso-fs-standalone.rnc
tagset =
element tagset {
( attribute ref { xsd:anyURI }
| ## DTD => ,
(dcs* & fsd* & tagset.lib*)
)
}
dcs =
element dcs {
attribute local { xsd:NCName },
( attribute registered { xsd:anyURI },
attribute rel { "eq" | "subs" | "gen" } )?,
element description { text }*
}
fsd |= notAllowed # defined in future iso-fsd.rnc
tagset.lib |= fvLib
tagset.lib |= fLib
fLib |= notAllowed # defined in iso-fs-standalone.rnc
fvLib |= notAllowed # defined in iso-fs-standalone.rnc
DocumentLocation = xsd:NMTOKEN # defined in LAF
A.1 Validating MAF documents
For validating MAF document, the first step is to convert the RELAX NG
compact schema into an XML RELAX NG schema (for instance using
trang). Such a XML RELAX NG schema may be found at
http://atoll.inria.fr/~clerger/MAF/maf.rng
Then, the validation may be performed, for instance, using
xmllint (from libxml2).
xmllint --relaxng maf.rng mafdoc.xml
It should be noted that some semantics constraints of MAF are not
checked by the RELAX NG schema, in particular the constraint between
the word form and token paths expressed in
Section 9.3.2.