Changeset aeccbad for spec/index.html


Ignore:
Timestamp:
29/02/2012 21:52:59 (8 years ago)
Author:
Eric van der Vlist <vdv@…>
Branches:
master
Parents:
e45219a
git-author:
Eric van der Vlist <vdv@…> (29/02/2012 21:52:59)
git-committer:
Eric van der Vlist <vdv@…> (29/02/2012 21:52:59)
Message:

Version 0.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • spec/index.html

    re45219a raeccbad  
    33  <head> 
    44    <title>χίμαιραλ (chimeral) - the Chimera Language</title> 
    5     <link href="xrd.css" type="text/css" rel="stylesheet" /> 
     5    <link href="xrd.css" type="text/css" rel="stylesheet"/> 
    66  </head> 
    77  <body> 
    88    <h1>χίμαιραλ (chimeral) - the Chimera Language</h1> 
    99    <div> 
    10       <p>This Version: <a href="http://χίμαιραλ.com/0/2">V 0.2 (TBD)</a></p> 
    11       <p>Previous Version: <a href="http://χίμαιραλ.com/0/1">http://χίμαιραλ.com/0/1</a></p> 
     10      <p>This Version: <a href="http://χίμαιραλ.com/0/3">V 0.3 (29th February 2012)</a></p> 
     11      <p>Previous Version: <a href="http://χίμαιραλ.com/0/2/">http://χίμαιραλ.com/0/2/</a></p> 
    1212      <p>Latest Version: <a href="http://χίμαιραλ.com">http://χίμαιραλ.com</a></p> 
    1313      <p>This namespace: <a href="http://χίμαιραλ.com#">http://χίμαιραλ.com#</a></p> 
     
    2222      <p>The goal of χίμαιραλ (chimeral) is to facilitate the use of the XPath/XQuery/XSLT 3.0 data model aka <a href="http://www.w3.org/TR/xpath-datamodel-30/">XDM 3.0</a>.</p> 
    2323      <p>The <a href="http://χίμαιραλ.com#">http://χίμαιραλ.com#</a> XML namespace defines a XML serialization format for XDM 3.0.</p> 
    24       <p>The name and the idea of this project comes from the <a href="http://www.xmlprague.cz/2012/sessions.html#Opening-Keynote-%E2%80%93-Collisions-Chimera-and-Consonance-in-Web-Content" 
    25           >presentation</a> given by Jeni Tennison at XML Prague 2012: I was going to show that XDM is a foundation on which the whole XML ecosystem is built and Jeni, giving her opening keynote just 
     24      <p>The name and the idea of this project comes from the <a href="http://www.xmlprague.cz/2012/sessions.html#Opening-Keynote-%E2%80%93-Collisions-Chimera-and-Consonance-in-Web-Content">presentation</a> given by Jeni Tennison at XML Prague 2012: I was going to show that XDM is a foundation on which the whole XML ecosystem is built and Jeni, giving her opening keynote just 
    2625        before my presentation explained why we should take care of chimeras, “ugly, foolish or impossible fantasies”. This made me realize that XDM, a data model that aggregates the XML infoset and 
    2726        informations items borrowed to XML Schema and now JSON is a chimera and that some efforts are needed to make it viable!</p> 
     
    3130      <p>The namespace URI itself (<a href="http://χίμαιραλ.com#">http://χίμαιραλ.com#</a>) is a chimera, composed of letters from two different alphabets and merging concepts from two different 
    3231        civilizations.</p> 
     32    </div> 
     33    <div> 
     34      <h2>Basic Principles</h2> 
     35      <p>The design goals of this vocabulary are:</p> 
     36      <ul> 
     37        <li>Be as close as possible to the XDM and its terminology</li> 
     38        <li>Allow round-trips (an XDM model serialized as χίμαιραλ should give a XDML model identical to the original one when de-serialized)</li> 
     39        <li>Represent XML nodes as... XML nodes.</li> 
     40        <li>Be easy to process using XPath/XQuery/XSLT.</li> 
     41      </ul> 
     42      <p>The XDM makes a clear distinction between nodes and other item types (atomic values, functions and maps).</p> 
     43      <p>Fidelity to the XDM commands that χίμαιραλ keeps this distinction. </p> 
     44      <p>When a map entry has a node value, this value is a reference to the node in its full context and the complete document to which the node belongs can be accessed through this node.</p> 
     45      <p>To keep this behavior, χίμαιραλ copies the documents that are referenced by nodes in <code>χ:instance</code> elements. Like for XDM, map entries node values are references to the nodes in 
     46        these instances and to be non intrusive, these references are made using XPath expressions.</p> 
     47      <p>Another important property of XDM is the lightweight character of sequences: sequences are not considered as an item type they are just repetitions of items. Similarly, χίμαιραλ has no 
     48        sequence elements and sequences are just repetitions of items.</p> 
     49      <p>χίμαιραλ does not support functions (yet?) and is thus left with three types of items:</p> 
     50      <ul> 
     51        <li><code>χ:node</code> for XML nodes</li> 
     52        <li><code>χ:atomic-value</code> for... atomic values</li> 
     53        <li><code>χ:map</code> for (you'll have guessed) maps.</li> 
     54      </ul> 
     55      <p>One of the major differences between XDM and χίμαιραλ is a fourth object<code> χ:entry</code> used to contain map entries which have no incarnation in XDM.</p> 
    3356    </div> 
    3457    <div> 
     
    6083          into XDM with the parse-json() function gives the following χίμαιραλ 
    6184        serialization:</p><pre>&lt;?xml version="1.0" encoding="UTF-8"?> 
    62 &lt;χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 
    63    &lt;χ:entry key="lastName" keyType="string"> 
    64       &lt;χ:atomic-value type="string">Smith&lt;/χ:atomic-value> 
    65    &lt;/χ:entry> 
    66    &lt;χ:entry key="phoneNumber" keyType="string"> 
    67       &lt;χ:map> 
    68          &lt;χ:entry key="1" keyType="number"> 
    69             &lt;χ:map> 
    70                &lt;χ:entry key="number" keyType="string"> 
    71                   &lt;χ:atomic-value type="string">212 555-1234&lt;/χ:atomic-value> 
    72                &lt;/χ:entry> 
    73                &lt;χ:entry key="type" keyType="string"> 
    74                   &lt;χ:atomic-value type="string">home&lt;/χ:atomic-value> 
    75                &lt;/χ:entry> 
    76             &lt;/χ:map> 
    77          &lt;/χ:entry> 
    78          &lt;χ:entry key="2" keyType="number"> 
    79             &lt;χ:map> 
    80                &lt;χ:entry key="number" keyType="string"> 
    81                   &lt;χ:atomic-value type="string">646 555-4567&lt;/χ:atomic-value> 
    82                &lt;/χ:entry> 
    83                &lt;χ:entry key="type" keyType="string"> 
    84                   &lt;χ:atomic-value type="string">fax&lt;/χ:atomic-value> 
    85                &lt;/χ:entry> 
    86             &lt;/χ:map> 
    87          &lt;/χ:entry> 
    88       &lt;/χ:map> 
    89    &lt;/χ:entry> 
    90    &lt;χ:entry key="address" keyType="string"> 
    91       &lt;χ:map> 
    92          &lt;χ:entry key="streetAddress" keyType="string"> 
    93             &lt;χ:atomic-value type="string">21 2nd Street&lt;/χ:atomic-value> 
    94          &lt;/χ:entry> 
    95          &lt;χ:entry key="postalCode" keyType="string"> 
    96             &lt;χ:atomic-value type="string">10021&lt;/χ:atomic-value> 
    97          &lt;/χ:entry> 
    98          &lt;χ:entry key="state" keyType="string"> 
    99             &lt;χ:atomic-value type="string">NY&lt;/χ:atomic-value> 
    100          &lt;/χ:entry> 
    101          &lt;χ:entry key="city" keyType="string"> 
    102             &lt;χ:atomic-value type="string">New York&lt;/χ:atomic-value> 
    103          &lt;/χ:entry> 
    104       &lt;/χ:map> 
    105    &lt;/χ:entry> 
    106    &lt;χ:entry key="age" keyType="string"> 
    107       &lt;χ:atomic-value type="number">25&lt;/χ:atomic-value> 
    108    &lt;/χ:entry> 
    109    &lt;χ:entry key="firstName" keyType="string"> 
    110       &lt;χ:atomic-value type="string">John&lt;/χ:atomic-value> 
    111    &lt;/χ:entry> 
    112 &lt;/χ:map> 
     85&lt;χ:data-model xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 
     86   &lt;χ:map> 
     87      &lt;χ:entry key="lastName" keyType="string"> 
     88         &lt;χ:atomic-value type="string">Smith&lt;/χ:atomic-value> 
     89      &lt;/χ:entry> 
     90      &lt;χ:entry key="phoneNumber" keyType="string"> 
     91         &lt;χ:map> 
     92            &lt;χ:entry key="1" keyType="number"> 
     93               &lt;χ:map> 
     94                  &lt;χ:entry key="number" keyType="string"> 
     95                     &lt;χ:atomic-value type="string">212 555-1234&lt;/χ:atomic-value> 
     96                  &lt;/χ:entry> 
     97                  &lt;χ:entry key="type" keyType="string"> 
     98                     &lt;χ:atomic-value type="string">home&lt;/χ:atomic-value> 
     99                  &lt;/χ:entry> 
     100               &lt;/χ:map> 
     101            &lt;/χ:entry> 
     102            &lt;χ:entry key="2" keyType="number"> 
     103               &lt;χ:map> 
     104                  &lt;χ:entry key="number" keyType="string"> 
     105                     &lt;χ:atomic-value type="string">646 555-4567&lt;/χ:atomic-value> 
     106                  &lt;/χ:entry> 
     107                  &lt;χ:entry key="type" keyType="string"> 
     108                     &lt;χ:atomic-value type="string">fax&lt;/χ:atomic-value> 
     109                  &lt;/χ:entry> 
     110               &lt;/χ:map> 
     111            &lt;/χ:entry> 
     112         &lt;/χ:map> 
     113      &lt;/χ:entry> 
     114      &lt;χ:entry key="address" keyType="string"> 
     115         &lt;χ:map> 
     116            &lt;χ:entry key="streetAddress" keyType="string"> 
     117               &lt;χ:atomic-value type="string">21 2nd Street&lt;/χ:atomic-value> 
     118            &lt;/χ:entry> 
     119            &lt;χ:entry key="postalCode" keyType="string"> 
     120               &lt;χ:atomic-value type="string">10021&lt;/χ:atomic-value> 
     121            &lt;/χ:entry> 
     122            &lt;χ:entry key="state" keyType="string"> 
     123               &lt;χ:atomic-value type="string">NY&lt;/χ:atomic-value> 
     124            &lt;/χ:entry> 
     125            &lt;χ:entry key="city" keyType="string"> 
     126               &lt;χ:atomic-value type="string">New York&lt;/χ:atomic-value> 
     127            &lt;/χ:entry> 
     128         &lt;/χ:map> 
     129      &lt;/χ:entry> 
     130      &lt;χ:entry key="age" keyType="string"> 
     131         &lt;χ:atomic-value type="number">25&lt;/χ:atomic-value> 
     132      &lt;/χ:entry> 
     133      &lt;χ:entry key="firstName" keyType="string"> 
     134         &lt;χ:atomic-value type="string">John&lt;/χ:atomic-value> 
     135      &lt;/χ:entry> 
     136   &lt;/χ:map> 
     137&lt;/χ:data-model> 
    113138</pre> 
    114139      </div> 
    115       <div><h3>Map with two references to the same node</h3><p>The map defined in XSLT as:</p> 
    116         <pre>        &lt;xsl:variable name="node"> 
    117             &lt;node> 
    118                 &lt;foo/> 
    119                 &lt;bar/> 
    120             &lt;/node> 
    121         &lt;/xsl:variable> 
    122         &lt;xsl:variable name="json" select="map:new( 
    123                (map:entry(5, 'foo'),  
    124                map:entry('bar', $node),  
    125                map:entry('bat', $node)))"/> 
    126 </pre> 
    127         <p>gives the following χίμαιραλ 
    128         serialization:</p><pre>&lt;?xml version="1.0" encoding="UTF-8"?> 
    129 &lt;χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 
    130    &lt;χ:entry key="5" keyType="number"> 
    131       &lt;χ:atomic-value type="string">foo&lt;/χ:atomic-value> 
    132    &lt;/χ:entry> 
    133    &lt;χ:entry key="bat" keyType="string"> 
    134       &lt;χ:node type="document" χ:id="d3"> 
    135          &lt;node1> 
    136             &lt;foo/> 
    137             &lt;bar/> 
    138          &lt;/node1> 
    139          &lt;node2/> 
    140       &lt;/χ:node> 
    141    &lt;/χ:entry> 
    142    &lt;χ:entry key="bar" keyType="string"> 
    143       &lt;χ:node χ:idref="d3" type="document"/> 
    144    &lt;/χ:entry> 
    145 &lt;/χ:map> 
    146 </pre></div> 
    147140      <div><h3>Map representing a RDF triple</h3><p>The map defined in XSLT 
    148141          as:</p><pre>        &lt;xsl:variable name="json" select=" 
     
    158151          the following χίμαιραλ 
    159152        serialization:</p><pre>&lt;?xml version="1.0" encoding="UTF-8"?> 
    160 &lt;χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 
    161    &lt;χ:entry xmlns:rdf="http://example.com/rdf/" 
    162             key="rdf:subject" 
    163             keyType="xs:QName"> 
    164       &lt;χ:atomic-value type="xs:anyURI">http://www.example.org/index.html&lt;/χ:atomic-value> 
    165    &lt;/χ:entry> 
    166    &lt;χ:entry xmlns:rdf="http://example.com/rdf/" 
    167             key="rdf:predicate" 
    168             keyType="xs:QName"> 
    169       &lt;χ:atomic-value type="xs:anyURI">http://purl.org/dc/elements/1.1/creator&lt;/χ:atomic-value> 
    170    &lt;/χ:entry> 
    171    &lt;χ:entry xmlns:rdf="http://example.com/rdf/" key="rdf:object" keyType="xs:QName"> 
    172       &lt;χ:atomic-value type="xs:anyURI">http://www.example.org/staffid/85740&lt;/χ:atomic-value> 
    173    &lt;/χ:entry> 
    174 &lt;/χ:map> 
     153&lt;χ:data-model xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 
     154   &lt;χ:map> 
     155      &lt;χ:entry xmlns:rdf="http://example.com/rdf/" 
     156               key="rdf:subject" 
     157               keyType="xs:QName"> 
     158         &lt;χ:atomic-value type="xs:anyURI">http://www.example.org/index.html&lt;/χ:atomic-value> 
     159      &lt;/χ:entry> 
     160      &lt;χ:entry xmlns:rdf="http://example.com/rdf/" 
     161               key="rdf:predicate" 
     162               keyType="xs:QName"> 
     163         &lt;χ:atomic-value type="xs:anyURI">http://purl.org/dc/elements/1.1/creator&lt;/χ:atomic-value> 
     164      &lt;/χ:entry> 
     165      &lt;χ:entry xmlns:rdf="http://example.com/rdf/" key="rdf:object" keyType="xs:QName"> 
     166         &lt;χ:atomic-value type="xs:anyURI">http://www.example.org/staffid/85740&lt;/χ:atomic-value> 
     167      &lt;/χ:entry> 
     168   &lt;/χ:map> 
     169&lt;/χ:data-model> 
    175170</pre></div> 
    176       <div><h3>Map with two instances of the same node, atomic values and other types of keys</h3><p>The map defined in XSLT 
     171      <div><h3>Map with two references to the same document node</h3><p>The map defined in XSLT as:</p> 
     172        <pre>        &lt;xsl:variable name="node"> 
     173            &lt;node> 
     174                &lt;foo/> 
     175                &lt;bar/> 
     176            &lt;/node> 
     177        &lt;/xsl:variable> 
     178        &lt;xsl:variable name="json" select=" 
     179             map{ 
     180                5     := 'foo',  
     181                'bar' := $node,  
     182                'bat' := $node 
     183               }"/> 
     184 
     185</pre> 
     186        <p>gives the following χίμαιραλ 
     187        serialization:</p><pre>&lt;?xml version="1.0" encoding="UTF-8"?> 
     188&lt;χ:data-model xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 
     189   &lt;χ:instance id="d3"> 
     190      &lt;node1> 
     191         &lt;foo/> 
     192         &lt;bar/> 
     193      &lt;/node1> 
     194      &lt;node2/> 
     195   &lt;/χ:instance> 
     196   &lt;χ:map> 
     197      &lt;χ:entry key="5" keyType="number"> 
     198         &lt;χ:atomic-value type="string">foo&lt;/χ:atomic-value> 
     199      &lt;/χ:entry> 
     200      &lt;χ:entry key="bat" keyType="string"> 
     201         &lt;χ:node type="document" instance="d3" ref="/"/> 
     202      &lt;/χ:entry> 
     203      &lt;χ:entry key="bar" keyType="string"> 
     204         &lt;χ:node type="document" instance="d3" ref="/"/> 
     205      &lt;/χ:entry> 
     206   &lt;/χ:map> 
     207&lt;/χ:data-model> 
     208</pre></div> 
     209      <div><h3>Map with two instances of the same node, atomic values and sequences</h3><p>The map defined in XSLT 
    177210          as:</p><pre>       &lt;xsl:variable name="node"> 
    178211            &lt;node1> 
     
    183216        &lt;/xsl:variable> 
    184217        &lt;xsl:variable name="json" 
    185             select="map:new(( 
    186                 map:entry(5, ('foo', 'bar')),  
    187                 map:entry(true(), false()), 
    188                 map:entry('sequence', ($node, $node, 2))))"/> 
     218            select=" 
     219                map{ 
     220                    5 := ('foo', 'bar'),  
     221                    true() :=  false(), 
     222                    'sequence' := ($node, $node/*, 2) 
     223                 }"/> 
    189224</pre><p>gives 
    190225          the following χίμαιραλ 
    191226        serialization:</p><pre>&lt;?xml version="1.0" encoding="UTF-8"?> 
    192 &lt;χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 
    193    &lt;χ:entry key="true" keyType="boolean"> 
    194       &lt;χ:atomic-value type="boolean">false&lt;/χ:atomic-value> 
    195    &lt;/χ:entry> 
    196    &lt;χ:entry key="5" keyType="number"> 
    197       &lt;χ:atomic-value type="string">foo&lt;/χ:atomic-value> 
    198       &lt;χ:atomic-value type="string">bar&lt;/χ:atomic-value> 
    199    &lt;/χ:entry> 
    200    &lt;χ:entry key="sequence" keyType="string"> 
    201       &lt;χ:node type="document" χ:id="d3"> 
    202          &lt;node1> 
    203             &lt;foo/> 
    204             &lt;bar/> 
    205          &lt;/node1> 
    206          &lt;node2/> 
    207       &lt;/χ:node> 
    208       &lt;χ:node χ:idref="d3" type="document"/> 
    209       &lt;χ:atomic-value type="number">2&lt;/χ:atomic-value> 
    210    &lt;/χ:entry> 
    211 &lt;/χ:map> 
     227&lt;χ:data-model xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 
     228   &lt;χ:instance id="d3"> 
     229      &lt;node1> 
     230         &lt;foo/> 
     231         &lt;bar/> 
     232      &lt;/node1> 
     233      &lt;node2/> 
     234   &lt;/χ:instance> 
     235   &lt;χ:map> 
     236      &lt;χ:entry key="true" keyType="boolean"> 
     237         &lt;χ:atomic-value type="boolean">false&lt;/χ:atomic-value> 
     238      &lt;/χ:entry> 
     239      &lt;χ:entry key="sequence" keyType="string"> 
     240         &lt;χ:node type="document" instance="d3" ref="/"/> 
     241         &lt;χ:node type="element" instance="d3" path="/&amp;#34;&amp;#34;:node1[1]" name="node1"/> 
     242         &lt;χ:node type="element" instance="d3" path="/&amp;#34;&amp;#34;:node2[1]" name="node2"/> 
     243         &lt;χ:atomic-value type="number">2&lt;/χ:atomic-value> 
     244      &lt;/χ:entry> 
     245      &lt;χ:entry key="5" keyType="number"> 
     246         &lt;χ:atomic-value type="string">foo&lt;/χ:atomic-value> 
     247         &lt;χ:atomic-value type="string">bar&lt;/χ:atomic-value> 
     248      &lt;/χ:entry> 
     249   &lt;/χ:map> 
     250&lt;/χ:data-model> 
    212251</pre></div> 
    213       <div><h3>Map with different types of nodes</h3><p>The map defined in XSLT 
     252      <div><h3>Map with all the different types of nodes</h3><p>The map defined in XSLT 
    214253          as:</p><pre>        &lt;xsl:variable name="nodes"> 
    215254            &lt;my-element xmlns:ns="http:example.com" ns:my-attribute="foo"> 
     
    221260        &lt;/xsl:variable> 
    222261        &lt;xsl:variable name="json" 
    223             select="map:new(( 
    224             map:entry('doc',  $nodes),  
    225             map:entry('elt',  $nodes/my-element), 
    226             map:entry('att',  $nodes/my-element/@* ), 
    227             map:entry('text', $nodes/my-element/text() ), 
    228             map:entry('pi',   $nodes/my-element/processing-instruction() ), 
    229             map:entry('comment', $nodes/my-element/comment() ), 
    230             map:entry('ns', $nodes/my-element/namespace::* ) 
    231             ))"/> 
     262            select=" 
     263            map { 
     264                'doc':=  $nodes,  
     265                'elt':=  $nodes/my-element, 
     266                'att':=  $nodes/my-element/@* , 
     267                'text':= $nodes/my-element/text() , 
     268                'pi':=   $nodes/my-element/processing-instruction(), 
     269                'comment':= $nodes/my-element/comment(), 
     270                'ns':= $nodes/my-element/namespace::*  
     271            }"/> 
    232272</pre><p>gives 
    233273          the following χίμαιραλ 
    234274          serialization:</p><pre>&lt;?xml version="1.0" encoding="UTF-8"?> 
    235 &lt;χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 
    236    &lt;χ:entry key="ns" keyType="string"> 
    237       &lt;χ:node type="namespace" name="ns">http:example.com&lt;/χ:node> 
    238       &lt;χ:node type="namespace" name="xs">http://www.w3.org/2001/XMLSchema&lt;/χ:node> 
    239       &lt;χ:node type="namespace" name="χ">http://χίμαιραλ.com#&lt;/χ:node> 
    240       &lt;χ:node type="namespace" name="xml">http://www.w3.org/XML/1998/namespace&lt;/χ:node> 
    241    &lt;/χ:entry> 
    242    &lt;χ:entry key="text" keyType="string"> 
    243       &lt;χ:node type="attribute"> 
     275&lt;χ:data-model xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 
     276   &lt;χ:instance id="d3"> 
     277      &lt;my-element xmlns:ns="http:example.com" ns:my-attribute="foo">&lt;!--A comment-->&lt;?A processing instruction?>&lt;ns:a-sub-element>bar&lt;/ns:a-sub-element> 
     278                Some text 
     279            &lt;/my-element> 
     280   &lt;/χ:instance> 
     281   &lt;χ:map> 
     282      &lt;χ:entry key="ns" keyType="string"> 
     283         &lt;χ:node type="namespace" 
     284                 instance="d3" 
     285                 path="/&amp;#34;&amp;#34;:my-element[1]/namespace::ns" 
     286                 name="ns">http:example.com&lt;/χ:node> 
     287         &lt;χ:node type="namespace" 
     288                 instance="d3" 
     289                 path="/&amp;#34;&amp;#34;:my-element[1]/namespace::xs" 
     290                 name="xs">http://www.w3.org/2001/XMLSchema&lt;/χ:node> 
     291         &lt;χ:node type="namespace" 
     292                 instance="d3" 
     293                 path="/&amp;#34;&amp;#34;:my-element[1]/namespace::χ" 
     294                 name="χ">http://χίμαιραλ.com#&lt;/χ:node> 
     295         &lt;χ:node type="namespace" 
     296                 instance="d3" 
     297                 path="/&amp;#34;&amp;#34;:my-element[1]/namespace::xml" 
     298                 name="xml">http://www.w3.org/XML/1998/namespace&lt;/χ:node> 
     299      &lt;/χ:entry> 
     300      &lt;χ:entry key="text" keyType="string"> 
     301         &lt;χ:node type="text" instance="d3" path="/&amp;#34;&amp;#34;:my-element[1]/text()[1]"> 
    244302                Some text 
    245303            &lt;/χ:node> 
    246    &lt;/χ:entry> 
    247    &lt;χ:entry key="doc" keyType="string"> 
    248       &lt;χ:node type="document"> 
    249          &lt;my-element xmlns:ns="http:example.com" χ:id="d3e1" ns:my-attribute="foo">&lt;!--A comment-->&lt;?A processing instruction?>&lt;ns:a-sub-element>bar&lt;/ns:a-sub-element> 
     304      &lt;/χ:entry> 
     305      &lt;χ:entry key="doc" keyType="string"> 
     306         &lt;χ:node type="document" instance="d3" ref="/"/> 
     307      &lt;/χ:entry> 
     308      &lt;χ:entry key="att" keyType="string"> 
     309         &lt;χ:node xmlns:ns="http:example.com" 
     310                 type="attribute" 
     311                 instance="d3" 
     312                 path="/&amp;#34;&amp;#34;:my-element[1]/@&amp;#34;http:example.com&amp;#34;:my-attribute" 
     313                 name="ns:my-attribute">foo&lt;/χ:node> 
     314      &lt;/χ:entry> 
     315      &lt;χ:entry key="comment" keyType="string"> 
     316         &lt;χ:node type="comment" instance="d3" path="/&amp;#34;&amp;#34;:my-element[1]/comment()[1]">A comment&lt;/χ:node> 
     317      &lt;/χ:entry> 
     318      &lt;χ:entry key="pi" keyType="string"> 
     319         &lt;χ:node type="processing-instruction" 
     320                 instance="d3" 
     321                 path="/&amp;#34;&amp;#34;:my-element[1]/processing-instruction(&amp;#34;A&amp;#34;)[1]" 
     322                 name="A">processing instruction&lt;/χ:node> 
     323      &lt;/χ:entry> 
     324      &lt;χ:entry key="elt" keyType="string"> 
     325         &lt;χ:node type="element" 
     326                 instance="d3" 
     327                 path="/&amp;#34;&amp;#34;:my-element[1]" 
     328                 name="my-element"/> 
     329      &lt;/χ:entry> 
     330   &lt;/χ:map> 
     331&lt;/χ:data-model> 
     332</pre><p>Note 
     333          that the node type, name and value are indicative. </p></div> 
     334      <div><h3>Map with nodes from different instances</h3><p>The map defined in XSLT 
     335          as:</p><pre>        &lt;xsl:variable name="json" 
     336            select="map{ 
     337                'elt1'       := $nodes/my-element, 
     338                'att'        := $nodes/my-element/@*, 
     339                'elt2'       := $node/node1, 
     340            }"/> 
     341</pre><p>gives 
     342          the following χίμαιραλ 
     343        serialization:</p><pre>&lt;?xml version="1.0" encoding="UTF-8"?> 
     344&lt;χ:data-model xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 
     345   &lt;χ:instance id="d3"> 
     346      &lt;node1> 
     347         &lt;foo/> 
     348         &lt;bar/> 
     349      &lt;/node1> 
     350      &lt;node2/> 
     351   &lt;/χ:instance> 
     352   &lt;χ:instance id="d4"> 
     353      &lt;my-element xmlns:ns="http:example.com" ns:my-attribute="foo">&lt;!--A comment-->&lt;?A processing instruction?>&lt;ns:a-sub-element>bar&lt;/ns:a-sub-element> 
    250354                Some text 
    251355            &lt;/my-element> 
    252       &lt;/χ:node> 
    253    &lt;/χ:entry> 
    254    &lt;χ:entry key="att" keyType="string"> 
    255       &lt;χ:node xmlns:ns="http:example.com" type="attribute" name="ns:my-attribute">foo&lt;/χ:node> 
    256    &lt;/χ:entry> 
    257    &lt;χ:entry key="comment" keyType="string"> 
    258       &lt;χ:node type="comment">A comment&lt;/χ:node> 
    259    &lt;/χ:entry> 
    260    &lt;χ:entry key="pi" keyType="string"> 
    261       &lt;χ:node type="processing-instruction" name="A">processing instruction&lt;/χ:node> 
    262    &lt;/χ:entry> 
    263    &lt;χ:entry key="elt" keyType="string"> 
    264       &lt;χ:node χ:idref="d3e1" type="element" name="my-element"/> 
    265    &lt;/χ:entry> 
    266 &lt;/χ:map> 
    267 </pre><p>This 
    268           last example is a good illustration of the issues we have when we want to mix items such as maps that have no identity nor context and nodes. To some extent it is possible to use 
    269             <code>id/idref</code> to avoid to duplicate nodes (like we've done here with the element with <code>χ:id="d3e1"</code>) but when we need the same feature for non element nodes that becomes 
    270           much tickier since these nodes can't carry attributes.</p></div> 
     356   &lt;/χ:instance> 
     357   &lt;χ:map> 
     358      &lt;χ:entry key="att" keyType="string"> 
     359         &lt;χ:node xmlns:ns="http:example.com" 
     360                 type="attribute" 
     361                 instance="d4" 
     362                 path="/&amp;#34;&amp;#34;:my-element[1]/@&amp;#34;http:example.com&amp;#34;:my-attribute" 
     363                 name="ns:my-attribute">foo&lt;/χ:node> 
     364      &lt;/χ:entry> 
     365      &lt;χ:entry key="elt1" keyType="string"> 
     366         &lt;χ:node type="element" 
     367                 instance="d4" 
     368                 path="/&amp;#34;&amp;#34;:my-element[1]" 
     369                 name="my-element"/> 
     370      &lt;/χ:entry> 
     371      &lt;χ:entry key="elt2" keyType="string"> 
     372         &lt;χ:node type="element" instance="d3" path="/&amp;#34;&amp;#34;:node1[1]" name="node1"/> 
     373      &lt;/χ:entry> 
     374   &lt;/χ:map> 
     375&lt;/χ:data-model> 
     376</pre></div> 
    271377    </div> 
    272378     
     
    274380      <h2>The <a href="http://χίμαιραλ.com#">http://χίμαιραλ.com#</a> XML namespace</h2> 
    275381      <p>The preferred prefix for this namespace is the greek letter "χ".The namespace is composed of the following elements:</p> 
     382      <div id="data-model"> 
     383        <h3>χ:data-model</h3> 
     384        <p>An XDM 3.0 data model</p> 
     385        <div> 
     386          <h4>Attributes</h4> 
     387          <p>None</p> 
     388        </div> 
     389        <div> 
     390          <h4>Content</h4> 
     391          <p>χ:instance*, χ:map*</p> 
     392        </div> 
     393      </div> 
     394      <div id="instance"> 
     395        <h3>χ:instance</h3> 
     396        <p>An XML instance</p> 
     397        <div> 
     398          <h4>Attributes</h4> 
     399          <ul> 
     400            <li>id (mandatory): the instance id</li> 
     401          </ul> 
     402        </div> 
     403        <div> 
     404          <h4>Content</h4> 
     405          <p>Any element from any other namespace.</p> 
     406        </div> 
     407      </div> 
    276408      <div id="map"> 
    277409        <h3>χ:map</h3> 
     
    323455          <h4>Attributes</h4> 
    324456          <ul> 
    325             <li>χ:id: an identifier for the node</li> 
    326             <li>χ:idref: a reference to a node identifier</li> 
     457            <li>instance: the id of the instance holding the node</li> 
     458            <li>path: an XPath expression selecting the node in its instance</li> 
     459             <li>type (indicative): node type</li> 
     460            <li>name (when applicable, indicative): name of the node</li> 
    327461          </ul> 
    328           <p>These attributes are mutually exclusive.</p> 
    329           <ul> 
    330             <li>type (mandatory): node type</li> 
    331             <li>name (when applicable): name of the node</li> 
    332           </ul> 
    333         </div> 
    334         <div> 
    335           <h4>Content</h4> 
    336           <p>Depending on the node type: a value or a sequence of nodes.</p> 
     462        </div> 
     463        <div> 
     464          <h4>Content</h4> 
     465          <p>Depending on the node type: its value (indicative).</p> 
    337466        </div> 
    338467      </div> 
     
    340469    <div id="changelog"> 
    341470      <h2>Changelog</h2> 
    342       <p>This version (0.2) tries to bring the serialization closer to the terms and concepts as they have been defined in the W3C XPath specifications.</p> 
     471      <p>This version (0.3) takes a new approach to represent nodes in map entries using XPath expressions rather than id/irdefs.</p> 
    343472      <p>Main changes:</p> 
    344473      <ul> 
    345         <li><code>χ:item</code> has been renamed <code>χ:entry</code> to match the terminology used by W3C XPath specifications.</li> 
    346         <li><code>χ:sequence</code> did not match any item type in XDM. It has been suppressed and as a consequence, a new element have been added: <code>χ:atomic-value</code>.</li> 
    347         <li>There is no such thing as a node-set in XDM 3.0. The <code>χ:nodeset</code> element has been removed and replaced by a <code>χ:node</code> element.</li> 
    348         <li>Replacement of <code>xml:id</code> attributes by <code>χ:id</code> attributes to avoid possible conflicts with existing xml:id in XML fragments. To be coherent, <code>idref</code> have 
    349           also been renamed <code>χ:idref</code>.</li> 
     474        <li>An <code>χ:data-model</code> root element has been added</li> 
     475        <li>An <code>χ:instance</code> element has been added to enclose XML instances.</li> 
     476        <li>The <code>χ:node</code> element looses its id/idref attributes in favor of instance and path attributes.</li> 
    350477      </ul> 
    351       <p>A detailed changelog is available at <a href="http://χίμαιραλ.com/trac/log/spec/index.html">http://χίμαιραλ.com/trac/log/spec/index.html</a> as a web page and as a <a 
    352         href="http://χίμαιραλ.com/trac/log/spec/index.html?format=rss&amp;limit=100&amp;mode=stop_on_copy">RSS feed</a>.</p> 
     478      <p>A detailed changelog is available at <a href="http://χίμαιραλ.com/trac/log/spec/index.html">http://χίμαιραλ.com/trac/log/spec/index.html</a> as a web page and as a <a href="http://χίμαιραλ.com/trac/log/spec/index.html?format=rss&amp;limit=100&amp;mode=stop_on_copy">RSS feed</a>.</p> 
    353479    </div> 
    354480    <div> 
Note: See TracChangeset for help on using the changeset viewer.