[tmcl-wg] Topic Map Constraint Language and Schematron

Robert Barta tmcl-wg@isotopicmaps.org
Wed, 14 May 2003 09:23:28 +1000


On Mon, May 12, 2003 at 07:44:09PM +1000, Rick Jelliffe wrote:
> WG members may be interested in a possible tie-in between Schematron and TMCL.
...
> The basic overview of Schematron is
> 
> schema
>     pattern  
>         rule@context
>             assert@test

Rick,

That is pretty much how AsTMa![1] works, although - by design - it tries
to avoid the angle-brackitis (that is called XML :-):

   forall [ $a (programming-language)          # condition clause
            bn: /language/i ]
   => exists [ (compiler-for-the-language)     # existence quantified constraint
               compiler : *
               language : $a ]


> A schema contains patterns. By default, all patterns are checked
> against.  A pattern contains rules. The first rule (lexically) in
> each pattern whose context matches the candidate information item
> being validated fires.  When a rule fires, all the assertions in it
> are tested.

Yes, that almost describes the language (which is not surprising as I
'borrowed' the paradigm).

> The context and the test attributes can use any query language, over
> any domain of information items. What they provide is a convenient
> way of simplifying or factoring out complex assertions.

I did not realize that Schematron was so generic. Does this mean that
the above could be rewritten as

<schema ...>
   <pattern name="every language has a compiler">
      <rule context="[ $a (programming-language)
                       bn: /language/i ]">
         <assert test="(compiler-for-the-language)     # existence quantified constraint
                       compiler : *
                       language : $a ]">Damn, no compiler, no fun</assert>
      </rule>
   </pattern>
</schema>

? What about the variable $a that is shared between the context and
the test?

> A simple <let> mechanism allows the definition of variables to
> further simplify tests.

Does Schematron have here a semantics? I could not find anything in

   http://www.ascc.net/xml/resource/schematron/Schematron2000.html

\rho

[1] http://astma.it.bond.edu.au/constraining.xsp