source: spec/index.html @ e8e2fea

Revision e8e2fea, 12.0 KB checked in by Eric van der Vlist <vdv@…>, 8 years ago (diff)

Renaming χ:item χ:entry to be coherent with the XPath terminology.

  • Property mode set to 100644
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<html xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <title>χίμαιραλ (chimeral) - the Chimera Language</title>
5    <link href="xrd.css" type="text/css" rel="stylesheet" />
6  </head>
7  <body>
8    <h1>χίμαιραλ (chimeral) - the Chimera Language</h1>
9    <div>
10      <p>This Version: <a href="http://χίμαιραλ.com/0/1">V 0.1 (18th February 2012)</a></p>
11      <p>Latest Version: <a href="http://χίμαιραλ.com">http://χίμαιραλ.com</a></p>
12      <p>This namespace: <a href="http://χίμαιραλ.com#">http://χίμαιραλ.com#</a></p>
13      <p>Editor:</p>
14      <ul>
15        <li><a href="mailto:vdv@dyomedea.com">Eric van der Vlist</a>, <a href="http://dyomedea.com">Dyomedea</a></li>
16      </ul>
17    </div>
18    <div>
19      <h2>About this page</h2>
20      <p>This page is the home page of the χίμαιραλ (chimeral) project and the documentation of the <a href="http://χίμαιραλ.com#">http://χίμαιραλ.com#</a> XML namespace.</p>
21      <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>
22      <p>The <a href="http://χίμαιραλ.com#">http://χίμαιραλ.com#</a> XML namespace defines a XML serialization format for XDM 3.0.</p>
23      <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"
24          >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
25        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
26        informations items borrowed to XML Schema and now JSON is a chimera and that some efforts are needed to make it viable!</p>
27      <p>The <a href="http://χίμαιραλ.com#">http://χίμαιραλ.com#</a> XML namespace is a first step in that direction. By providing a serialization format it gives some reality to the XDM that has been
28        a perfectly abstract concept so far. This serialization format is also useful to manipulate the XDM: the items recently imported into the model such as maps are not always considered as first
29        class citizens by XPath/XQuery/XSLT (you can't apply templates on map items for instance) and this serialization can help do that.</p>
30      <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
31        civilizations.</p>
32    </div>
33    <div><h2>Examples</h2><p>The following JSON
34        object:</p><pre>{
35     "firstName": "John",
36     "lastName" : "Smith",
37     "age"      : 25,
38     "address"  :
39     {
40         "streetAddress": "21 2nd Street",
41         "city"         : "New York",
42         "state"        : "NY",
43         "postalCode"   : "10021"
44     },
45     "phoneNumber":
46     [
47         {
48           "type"  : "home",
49           "number": "212 555-1234"
50         },
51         {
52           "type"  : "fax",
53           "number": "646 555-4567"
54         }
55     ]
56 }</pre><p>imported
57        into XDM with the parse-json() function gives the following χίμαιραλ serialization:</p><pre>&lt;?xml version="1.0" encoding="UTF-8"?>
58&lt;χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#">
59   &lt;χ:entry key="lastName" keyType="string" valueType="string">Smith&lt;/χ:entry>
60   &lt;χ:entry key="phoneNumber" keyType="string">
61      &lt;χ:map>
62         &lt;χ:entry key="1" keyType="number">
63            &lt;χ:map>
64               &lt;χ:entry key="number" keyType="string" valueType="string">212 555-1234&lt;/χ:entry>
65               &lt;χ:entry key="type" keyType="string" valueType="string">home&lt;/χ:entry>
66            &lt;/χ:map>
67         &lt;/χ:entry>
68         &lt;χ:entry key="2" keyType="number">
69            &lt;χ:map>
70               &lt;χ:entry key="number" keyType="string" valueType="string">646 555-4567&lt;/χ:entry>
71               &lt;χ:entry key="type" keyType="string" valueType="string">fax&lt;/χ:entry>
72            &lt;/χ:map>
73         &lt;/χ:entry>
74      &lt;/χ:map>
75   &lt;/χ:entry>
76   &lt;χ:entry key="address" keyType="string">
77      &lt;χ:map>
78         &lt;χ:entry key="streetAddress" keyType="string" valueType="string">21 2nd Street&lt;/χ:entry>
79         &lt;χ:entry key="postalCode" keyType="string" valueType="string">10021&lt;/χ:entry>
80         &lt;χ:entry key="state" keyType="string" valueType="string">NY&lt;/χ:entry>
81         &lt;χ:entry key="city" keyType="string" valueType="string">New York&lt;/χ:entry>
82      &lt;/χ:map>
83   &lt;/χ:entry>
84   &lt;χ:entry key="age" keyType="string" valueType="number">25&lt;/χ:entry>
85   &lt;χ:entry key="firstName" keyType="string" valueType="string">John&lt;/χ:entry>
86&lt;/χ:map>
87</pre>
88      <p>The map defined in XSLT as:</p>
89      <pre>        &lt;xsl:variable name="node">
90            &lt;node>
91                &lt;foo/>
92                &lt;bar/>
93            &lt;/node>
94        &lt;/xsl:variable>
95        &lt;xsl:variable name="json" select="map:new(
96               (map:entry(5, 'foo'),
97               map:entry('bar', $node),
98               map:entry('bat', $node)))"/>
99</pre>
100      <p>gives the following χίμαιραλ
101        serialization:</p><pre>&lt;?xml version="1.0" encoding="UTF-8"?>
102&lt;χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#">
103   &lt;χ:entry key="5" keyType="number" valueType="string">foo&lt;/χ:entry>
104   &lt;χ:entry key="bat" keyType="string">
105      &lt;χ:nodeset xml:id="d3">
106         &lt;node>
107            &lt;foo/>
108            &lt;bar/>
109         &lt;/node>
110      &lt;/χ:nodeset>
111   &lt;/χ:entry>
112   &lt;χ:entry key="bar" keyType="string">
113      &lt;χ:nodeset idref="d3"/>
114   &lt;/χ:entry>
115&lt;/χ:map>
116</pre><p>The
117        map defined in XSLT
118        as:</p><pre>        &lt;xsl:variable name="json" select="
119            map {
120                xs:QName('rdf:subject')   := xs:anyURI('http://www.example.org/index.html'),
121                xs:QName('rdf:predicate') := xs:anyURI('http://purl.org/dc/elements/1.1/creator'),
122                xs:QName('rdf:object')    := xs:anyURI('http://www.example.org/staffid/85740')
123            }
124           
125            "
126            xmlns:rdf="http://example.com/rdf/"/>
127</pre><p>gives
128        the following χίμαιραλ
129      serialization:</p><pre>&lt;?xml version="1.0" encoding="UTF-8"?>
130&lt;χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#">
131   &lt;χ:entry xmlns:rdf="http://example.com/rdf/"
132           key="rdf:subject"
133           keyType="xs:QName"
134           valueType="xs:anyURI">http://www.example.org/index.html&lt;/χ:entry>
135   &lt;χ:entry xmlns:rdf="http://example.com/rdf/"
136           key="rdf:predicate"
137           keyType="xs:QName"
138           valueType="xs:anyURI">http://purl.org/dc/elements/1.1/creator&lt;/χ:entry>
139   &lt;χ:entry xmlns:rdf="http://example.com/rdf/"
140           key="rdf:object"
141           keyType="xs:QName"
142           valueType="xs:anyURI">http://www.example.org/staffid/85740&lt;/χ:entry>
143&lt;/χ:map>
144</pre></div>
145    <p>The map defined in XSLT as:</p>
146    <pre>       &lt;xsl:variable name="node">
147            &lt;node1>
148                &lt;foo/>
149                &lt;bar/>
150            &lt;/node1>
151            &lt;node2/>
152        &lt;/xsl:variable>
153        &lt;xsl:variable name="json"
154            select="map:new((
155                map:entry(5, ('foo', 'bar')),
156                map:entry(true(), false()),
157                map:entry('sequence', ($node, $node, 2))))"/>
158</pre>
159    <p>gives the following χίμαιραλ serialization:</p>
160    <pre>?xml version="1.0" encoding="UTF-8"?>
161&lt;χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#">
162   &lt;χ:entry key="true" keyType="boolean" valueType="boolean">false&lt;/χ:entry>
163   &lt;χ:entry key="5" keyType="number">
164      &lt;χ:sequence>
165         &lt;χ:entry valueType="string">foo&lt;/χ:entry>
166         &lt;χ:entry valueType="string">bar&lt;/χ:entry>
167      &lt;/χ:sequence>
168   &lt;/χ:entry>
169   &lt;χ:entry key="sequence" keyType="string">
170      &lt;χ:sequence>
171         &lt;χ:entry>
172            &lt;χ:nodeset xml:id="d3">
173               &lt;node1>
174                  &lt;foo/>
175                  &lt;bar/>
176               &lt;/node1>
177               &lt;node2/>
178            &lt;/χ:nodeset>
179         &lt;/χ:entry>
180         &lt;χ:entry>
181            &lt;χ:nodeset idref="d3"/>
182         &lt;/χ:entry>
183         &lt;χ:entry valueType="number">2&lt;/χ:entry>
184      &lt;/χ:sequence>
185   &lt;/χ:entry>
186&lt;/χ:map>
187</pre>
188    <div>
189      <h2>The <a href="http://χίμαιραλ.com#">http://χίμαιραλ.com#</a> XML namespace</h2>
190      <p>The preferred prefix for this namespace is the greek letter "χ".The namespace is composed of the following elements:</p>
191      <div id="map">
192        <h3>χ:map</h3>
193        <p>An XDM 3.0 map.</p>
194        <div>
195          <h4>Attributes</h4>
196          <p>None</p>
197        </div>
198        <div>
199          <h4>Content</h4>
200          <p>χ:entry *</p>
201        </div>
202      </div>
203      <div id="sequence">
204        <h3>χ:sequence</h3>
205        <p>An XDM 3.0 sequence.</p>
206        <div>
207          <h4>Attributes</h4>
208          <p>None</p>
209        </div>
210        <div>
211          <h4>Content</h4>
212          <p>χ:entry *</p>
213        </div>
214      </div>
215      <div id="item">
216        <h3>χ:entry</h3>
217        <p>An XDM 3.0 map entry.</p>
218        <div>
219          <h4>Attributes</h4>
220          <ul>
221            <li>key (mandatory for map items): the value of the item key.</li>
222            <li>keyType (mandatory for map items): the type of the item key.</li>
223            <li>valueType (mandatory for atomic values): the type of the item value.</li>
224          </ul>
225        </div>
226        <div>
227          <h4>Content</h4>
228          <p>(χ:map | χ:sequence | χ:nodeset) ?</p>
229          <p>One of these elements are mandatory when the valueType attribute is omitted.</p>
230        </div>
231      </div>
232      <div id="nodeset">
233        <h3>χ:nodeset</h3>
234        <p>An XDM nodeset</p>
235        <div>
236          <h4>Attributes</h4>
237          <ul>
238            <li>xml:id: an identifier for the nodeset</li>
239            <li>idref: a reference to a nodeset identifier.</li>
240          </ul>
241          <p>These attributes are mutually exclusive.</p>
242        </div>
243        <div>
244          <h4>Content</h4>
245          <p>Any element from foreign namespaces</p>
246        </div>
247      </div>
248    </div>
249    <div>
250      <h2>Legal Statement</h2>
251      <p>Copyright (c) 2012 Eric van der Vlist</p>
252      <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without
253        restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
254        Software is furnished to do so, subject to the following conditions:</p>
255      <ol>
256        <li>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. </li>
257        <li>The name of the authors when specified in the source files shall be kept unmodified.</li>
258      </ol>
259      <p>THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
260        NONINFRINGEMENT. IN NO EVENT SHALL ERIC VAN DER VLIST BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
261        CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
262    </div>
263  </body>
264</html>
Note: See TracBrowser for help on using the repository browser.