more examples of namespaces needed in output (was: Re: call a week from today, right?)

[Sighs and gives in to top posting.]

OK, two reasonably good examples.  Thank you; they help me think about the problem.

The example of MathML as a target seems suggestive:  I wouldn’t want to try to make a general ixml grammar for everything one could express in MathML, but I could certainly imagine a project defining a syntax for certain kinds of expressions and translating them into (a subset of) MathML.  And similarly I could imagine a set of simple conventions that could be used for data capture of other specialized notations.  So in the interests of concreteness, here are some more concrete examples:

1 Citations.  Perhaps we tell the project participants to tag bibliographic entries as <book>, <article>, <talk>, or <complicated>, and then we parse the data into more elaborate markup like those of tei:biblStruct or JATS element-citation, if we can.  Lots of citations are too complicated for auto-tagging, but lots of books and journal articles and conference talks are very simple.  So we start with

    <article>Alka-Seltzer, L. Untersuchungen über die tomatostaltische Reflexe beim Walküre. *Bayreuth Monatschr. f. exp. Biol.* 184, 34-43, 1815.</article>
    ...
    <book>Hun, O. & Deu, I. *Tonic, diatonic, & catatonic stage-distress syndromes.* Basel, Karger, 1960.</book>

and use simple grammars to parse these into a richer tagging.  (Trying to show how these would be tagged, I realize I can’t get these into TEI on a single pass, because the TEI output wants <title level=“j”> for article titles, <title level=“j”> for journal titles, and <title level=“m”> for book titles, and we don’t have any literal “a”, “j”, or “m” in the data to use to populate the ‘level’ attribute. I would have to project <article-title>, <journal-title>, and <book-title> and then write a second pass in XSLT to turn these into the TEI equivalents.  So TEI citations are a non-example:  if a second pass is already necessary, it could be used to put the material into the appropriate namespace.  JATS would work, probably, but by default JATS doesn’t use namespaces.  

So, maybe not a great example.  (You see why I asked?)

2 SVG.  One of my rainy-day activities is to work on an electronic version of Frege’s book Begriffsschrift (Concept notation), which is essentially a two-dimensional notation for first-order predicate calculus.  To make transcription of the expressions easier, I have developed a simple notation that is easy (or easy-ish) to type and which a parser can turn into SVG.  For example, the diagram
can be transcribed as 

    a if b if c if d if (g if f)

It would be nice to be able to generate the SVG in the SVG namespace.  

Hmm.  On reflection, this is probably also a mare’s nest.  The structure of the SVG I want is nothing like the parse structure of the input, and the input does not include information the renderer needs to calculate, like the positions of the various lines.  All I can expect of an ixml parser is that it produce something in a workable XML format, which I can process to turn into the desired SVG.  

So, maybe a second non-great example.  I’m trying, really I am.

3 Ad hoc special notations.  Actually, in a TEI encoding of Frege, I don’t want to embed SVG.  I want to embed an XML representation of the expression, perhaps in something similar to conventional logical notation.  Something like this, using a specialized vocabulary I sketched a few years ago to make it less error prone to put complex logical expressions into a paper I was trying to write at the time:

<fopc>
  <implies>
    <implies>
      <atomic><pred>f</pred></atomic>
      <atomic><pred>g</pred></atomic>
    </implies>
    <implies>
      <atomic><pred>d</pred></atomic>
      <implies>
 <atomic><pred>c</pred></atomic>
 <implies>
   <atomic><pred>b</pred></atomic>
   <atomic><pred>a</pred></atomic>
 </implies>
      </implies>
    </implies>
  </implies>
</fopc>

If I want to embed this in a TEI document, it would be better practice for it to be identified as being in a particular namespace.  So:  it would be good if the ixml parser could emit it that way.

The only problem is — once more, this is not structurally similar to the input, and I can’t produce that output (with or without namespace declarations) from ixml.  (I can’t reorder things in an ixml grammar.  The XSugar people have it easier; they can.  But they pay for that by using BNF unextended with repeat0, repeat1, opt, or nested alts.  If you haven’t read the XSugar paper(s), you should.  They may be the closest thing ixml has to competition.)

Maybe what I need is a particular notation for Begriffsschrift:

<bgs xmlns="http://mlcd.blackmesatech.com/2015/W/tip/bgs">
  <_if_>
    <_if_>
      <_if_>
 <_if_>
   <atomic><pred>a</pred></atomic>
   <atomic><pred>b</pred></atomic>
 </_if_>
 <atomic><pred>c</pred></atomic>
      </_if_>
      <atomic><pred>d</pred></atomic>
    </_if_>
    <_if_>
      <atomic><pred>f</pred></atomic>
      <atomic><pred>g</pred></atomic>
    </_if_>
  </_if_>
</bgs>

OK.  It would be convenient to put this into a namespace.  

So - only one out of my four examples actually works as a use case for namespace support in ixml.   All the others are going to require a transformation of some kind downstream (in my case, almost certainly XSLT or XQuery), and the namespace injection could happen then.

I wonder whether namespace support is a potential use case for some kind of generic annotation syntax that will be processed by processors that understand the annotations and ignored by others.  XQuery has a reasonably well developed escape hatch of this kind, though I don’t understand its details.  I spent some time thinking about it last fall, but all the details have seeped away again.

Michael


> On 12,Apr2021, at 3:48 PM, Tom Hillman <tom@expertml.com> wrote:
> 
> Well, any grammar that describes an XML instance with namespace support; how about converting to xhtml 5 using a grammar for markdown?
> 
> Or grammars for converting mathematic expressions in mathml?
> 
> Using a prefix as the non terminal name isn’t really enough on its own: there needs to be a way of associating a URI for the namespace.
> 
> I would support extending the attribute syntax, in a way which mirrors the XML syntax; something like:
> xmlns:   “http://www.w3.org/1999/xhtml”
> xmlns:m: “http://www.w3.org/1998/Math/MathML”
> 
> Other elements or attributes can then be associated with a namespace by the existence (or otherwise) of a prefix.
> 
> This is potentially significant for parsers, since to correctly create the required element, the namespace declarations will have to be parsed first.
> 
> Like many things namespace, there's clearly a lot of potential for ugliness here.  But I feel that's an argument to tie things down now rather than leave it much longer!
> 
> Tom
> 
> _________________
> Tomos Hillman
> eXpertML Ltd
> +44 7793 242058
> On 12 Apr 2021, 6:52 PM +0100, C. M. Sperberg-McQueen , wrote:
>> 
>> 
>>> On 12,Apr2021, at 4:49 AM, Tom Hillman <tom@expertml.com> wrote:
>>> 
>>> I may be a little late tomorrow, but could we make some time to talk about specifying namespaces/declarations? I feel that this is a necessary (if ugly) feature that is currently conspicuous by its absence from the spec!
>> 
>> 
>> Do you have a motivating example? Concrete cases might help think of non-ugly ways to provide the necessities.
>> 
>> Michael
>> 
>> ********************************************
>> C. M. Sperberg-McQueen
>> Black Mesa Technologies LLC
>> cmsmcq@blackmesatech.com
>> http://www.blackmesatech.com
>> ********************************************
>> 

********************************************
C. M. Sperberg-McQueen
Black Mesa Technologies LLC
cmsmcq@blackmesatech.com
http://www.blackmesatech.com
********************************************

Received on Tuesday, 13 April 2021 01:54:34 UTC