Changeset e45219a for spec/index.html
- Timestamp:
- 26/02/2012 00:07:37 (8 years ago)
- Branches:
- master
- Children:
- aeccbad
- Parents:
- e8e2fea
- git-author:
- Eric van der Vlist <vdv@…> (26/02/2012 00:07:37)
- git-committer:
- Eric van der Vlist <vdv@…> (26/02/2012 00:07:37)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
spec/index.html
re8e2fea re45219a 8 8 <h1>χίμαιραλ (chimeral) - the Chimera Language</h1> 9 9 <div> 10 <p>This Version: <a href="http://χίμαιραλ.com/0/1">V 0.1 (18th February 2012)</a></p> 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> 11 12 <p>Latest Version: <a href="http://χίμαιραλ.com">http://χίμαιραλ.com</a></p> 12 13 <p>This namespace: <a href="http://χίμαιραλ.com#">http://χίμαιραλ.com#</a></p> … … 31 32 civilizations.</p> 32 33 </div> 33 <div><h2>Examples</h2><p>The following JSON 34 object:</p><pre>{ 34 <div> 35 <h2>Examples</h2> 36 <div><h3>JSON objects</h3><p>The following JSON 37 object:</p><pre>{ 35 38 "firstName": "John", 36 39 "lastName" : "Smith", … … 55 58 ] 56 59 }</pre><p>imported 57 into XDM with the parse-json() function gives the following χίμαιραλ serialization:</p><pre><?xml version="1.0" encoding="UTF-8"?> 58 <χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 59 <χ:entry key="lastName" keyType="string" valueType="string">Smith</χ:entry> 60 into XDM with the parse-json() function gives the following χίμαιραλ 61 serialization:</p><pre><?xml version="1.0" encoding="UTF-8"?> 62 <χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 63 <χ:entry key="lastName" keyType="string"> 64 <χ:atomic-value type="string">Smith</χ:atomic-value> 65 </χ:entry> 60 66 <χ:entry key="phoneNumber" keyType="string"> 61 67 <χ:map> 62 68 <χ:entry key="1" keyType="number"> 63 69 <χ:map> 64 <χ:entry key="number" keyType="string" valueType="string">212 555-1234</χ:entry> 65 <χ:entry key="type" keyType="string" valueType="string">home</χ:entry> 70 <χ:entry key="number" keyType="string"> 71 <χ:atomic-value type="string">212 555-1234</χ:atomic-value> 72 </χ:entry> 73 <χ:entry key="type" keyType="string"> 74 <χ:atomic-value type="string">home</χ:atomic-value> 75 </χ:entry> 66 76 </χ:map> 67 77 </χ:entry> 68 78 <χ:entry key="2" keyType="number"> 69 79 <χ:map> 70 <χ:entry key="number" keyType="string" valueType="string">646 555-4567</χ:entry> 71 <χ:entry key="type" keyType="string" valueType="string">fax</χ:entry> 80 <χ:entry key="number" keyType="string"> 81 <χ:atomic-value type="string">646 555-4567</χ:atomic-value> 82 </χ:entry> 83 <χ:entry key="type" keyType="string"> 84 <χ:atomic-value type="string">fax</χ:atomic-value> 85 </χ:entry> 72 86 </χ:map> 73 87 </χ:entry> … … 76 90 <χ:entry key="address" keyType="string"> 77 91 <χ:map> 78 <χ:entry key="streetAddress" keyType="string" valueType="string">21 2nd Street</χ:entry> 79 <χ:entry key="postalCode" keyType="string" valueType="string">10021</χ:entry> 80 <χ:entry key="state" keyType="string" valueType="string">NY</χ:entry> 81 <χ:entry key="city" keyType="string" valueType="string">New York</χ:entry> 92 <χ:entry key="streetAddress" keyType="string"> 93 <χ:atomic-value type="string">21 2nd Street</χ:atomic-value> 94 </χ:entry> 95 <χ:entry key="postalCode" keyType="string"> 96 <χ:atomic-value type="string">10021</χ:atomic-value> 97 </χ:entry> 98 <χ:entry key="state" keyType="string"> 99 <χ:atomic-value type="string">NY</χ:atomic-value> 100 </χ:entry> 101 <χ:entry key="city" keyType="string"> 102 <χ:atomic-value type="string">New York</χ:atomic-value> 103 </χ:entry> 82 104 </χ:map> 83 105 </χ:entry> 84 <χ:entry key="age" keyType="string" valueType="number">25</χ:entry> 85 <χ:entry key="firstName" keyType="string" valueType="string">John</χ:entry> 106 <χ:entry key="age" keyType="string"> 107 <χ:atomic-value type="number">25</χ:atomic-value> 108 </χ:entry> 109 <χ:entry key="firstName" keyType="string"> 110 <χ:atomic-value type="string">John</χ:atomic-value> 111 </χ:entry> 86 112 </χ:map> 87 113 </pre> 88 <p>The map defined in XSLT as:</p> 89 <pre> <xsl:variable name="node"> 114 </div> 115 <div><h3>Map with two references to the same node</h3><p>The map defined in XSLT as:</p> 116 <pre> <xsl:variable name="node"> 90 117 <node> 91 118 <foo/> … … 98 125 map:entry('bat', $node)))"/> 99 126 </pre> 100 <p>gives the following χίμαιραλ127 <p>gives the following χίμαιραλ 101 128 serialization:</p><pre><?xml version="1.0" encoding="UTF-8"?> 102 129 <χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 103 <χ:entry key="5" keyType="number" valueType="string">foo</χ:entry> 130 <χ:entry key="5" keyType="number"> 131 <χ:atomic-value type="string">foo</χ:atomic-value> 132 </χ:entry> 104 133 <χ:entry key="bat" keyType="string"> 105 <χ:node set xml:id="d3">106 <node >134 <χ:node type="document" χ:id="d3"> 135 <node1> 107 136 <foo/> 108 137 <bar/> 109 </node> 110 </χ:nodeset> 138 </node1> 139 <node2/> 140 </χ:node> 111 141 </χ:entry> 112 142 <χ:entry key="bar" keyType="string"> 113 <χ:node set idref="d3"/>114 </χ:entry> 115 </χ:map> 116 </pre>< p>The117 118 as:</p><pre> <xsl:variable name="json" select="143 <χ:node χ:idref="d3" type="document"/> 144 </χ:entry> 145 </χ:map> 146 </pre></div> 147 <div><h3>Map representing a RDF triple</h3><p>The map defined in XSLT 148 as:</p><pre> <xsl:variable name="json" select=" 119 149 map { 120 150 xs:QName('rdf:subject') := xs:anyURI('http://www.example.org/index.html'), … … 126 156 xmlns:rdf="http://example.com/rdf/"/> 127 157 </pre><p>gives 128 the following χίμαιραλ129 serialization:</p><pre><?xml version="1.0" encoding="UTF-8"?>158 the following χίμαιραλ 159 serialization:</p><pre><?xml version="1.0" encoding="UTF-8"?> 130 160 <χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 131 161 <χ: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</χ:entry> 162 key="rdf:subject" 163 keyType="xs:QName"> 164 <χ:atomic-value type="xs:anyURI">http://www.example.org/index.html</χ:atomic-value> 165 </χ:entry> 135 166 <χ: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</χ:entry>139 < χ: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</χ:entry>167 key="rdf:predicate" 168 keyType="xs:QName"> 169 <χ:atomic-value type="xs:anyURI">http://purl.org/dc/elements/1.1/creator</χ:atomic-value> 170 </χ:entry> 171 <χ:entry xmlns:rdf="http://example.com/rdf/" key="rdf:object" keyType="xs:QName"> 172 <χ:atomic-value type="xs:anyURI">http://www.example.org/staffid/85740</χ:atomic-value> 173 </χ:entry> 143 174 </χ:map> 144 175 </pre></div> 145 <p>The map defined in XSLT as:</p>146 <pre> <xsl:variable name="node">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 177 as:</p><pre> <xsl:variable name="node"> 147 178 <node1> 148 179 <foo/> … … 156 187 map:entry(true(), false()), 157 188 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 <χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 162 <χ:entry key="true" keyType="boolean" valueType="boolean">false</χ:entry> 189 </pre><p>gives 190 the following χίμαιραλ 191 serialization:</p><pre><?xml version="1.0" encoding="UTF-8"?> 192 <χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 193 <χ:entry key="true" keyType="boolean"> 194 <χ:atomic-value type="boolean">false</χ:atomic-value> 195 </χ:entry> 163 196 <χ:entry key="5" keyType="number"> 164 <χ:sequence> 165 <χ:entry valueType="string">foo</χ:entry> 166 <χ:entry valueType="string">bar</χ:entry> 167 </χ:sequence> 197 <χ:atomic-value type="string">foo</χ:atomic-value> 198 <χ:atomic-value type="string">bar</χ:atomic-value> 168 199 </χ:entry> 169 200 <χ:entry key="sequence" keyType="string"> 170 <χ:sequence> 171 <χ:entry> 172 <χ:nodeset xml:id="d3"> 173 <node1> 174 <foo/> 175 <bar/> 176 </node1> 177 <node2/> 178 </χ:nodeset> 179 </χ:entry> 180 <χ:entry> 181 <χ:nodeset idref="d3"/> 182 </χ:entry> 183 <χ:entry valueType="number">2</χ:entry> 184 </χ:sequence> 185 </χ:entry> 186 </χ:map> 187 </pre> 201 <χ:node type="document" χ:id="d3"> 202 <node1> 203 <foo/> 204 <bar/> 205 </node1> 206 <node2/> 207 </χ:node> 208 <χ:node χ:idref="d3" type="document"/> 209 <χ:atomic-value type="number">2</χ:atomic-value> 210 </χ:entry> 211 </χ:map> 212 </pre></div> 213 <div><h3>Map with different types of nodes</h3><p>The map defined in XSLT 214 as:</p><pre> <xsl:variable name="nodes"> 215 <my-element xmlns:ns="http:example.com" ns:my-attribute="foo"> 216 <xsl:comment>A comment</xsl:comment> 217 <xsl:processing-instruction name="A">processing instruction</xsl:processing-instruction> 218 <ns:a-sub-element>bar</ns:a-sub-element> 219 <![CDATA[Some text]]> 220 </my-element> 221 </xsl:variable> 222 <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 ))"/> 232 </pre><p>gives 233 the following χίμαιραλ 234 serialization:</p><pre><?xml version="1.0" encoding="UTF-8"?> 235 <χ:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:χ="http://χίμαιραλ.com#"> 236 <χ:entry key="ns" keyType="string"> 237 <χ:node type="namespace" name="ns">http:example.com</χ:node> 238 <χ:node type="namespace" name="xs">http://www.w3.org/2001/XMLSchema</χ:node> 239 <χ:node type="namespace" name="χ">http://χίμαιραλ.com#</χ:node> 240 <χ:node type="namespace" name="xml">http://www.w3.org/XML/1998/namespace</χ:node> 241 </χ:entry> 242 <χ:entry key="text" keyType="string"> 243 <χ:node type="attribute"> 244 Some text 245 </χ:node> 246 </χ:entry> 247 <χ:entry key="doc" keyType="string"> 248 <χ:node type="document"> 249 <my-element xmlns:ns="http:example.com" χ:id="d3e1" ns:my-attribute="foo"><!--A comment--><?A processing instruction?><ns:a-sub-element>bar</ns:a-sub-element> 250 Some text 251 </my-element> 252 </χ:node> 253 </χ:entry> 254 <χ:entry key="att" keyType="string"> 255 <χ:node xmlns:ns="http:example.com" type="attribute" name="ns:my-attribute">foo</χ:node> 256 </χ:entry> 257 <χ:entry key="comment" keyType="string"> 258 <χ:node type="comment">A comment</χ:node> 259 </χ:entry> 260 <χ:entry key="pi" keyType="string"> 261 <χ:node type="processing-instruction" name="A">processing instruction</χ:node> 262 </χ:entry> 263 <χ:entry key="elt" keyType="string"> 264 <χ:node χ:idref="d3e1" type="element" name="my-element"/> 265 </χ:entry> 266 </χ: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> 271 </div> 272 188 273 <div> 189 274 <h2>The <a href="http://χίμαιραλ.com#">http://χίμαιραλ.com#</a> XML namespace</h2> … … 192 277 <h3>χ:map</h3> 193 278 <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 279 <div> 207 280 <h4>Attributes</h4> … … 226 299 <div> 227 300 <h4>Content</h4> 228 <p>(χ:map | χ: sequence | χ:nodeset) ?</p>301 <p>(χ:map | χ:node | χ:atomic-value) *</p> 229 302 <p>One of these elements are mandatory when the valueType attribute is omitted.</p> 230 303 </div> 231 304 </div> 232 <div id=" nodeset">233 <h3>χ: nodeset</h3>234 <p>An XDM nodeset</p>305 <div id="atomic-value"> 306 <h3>χ:atomic-value</h3> 307 <p>An XDM atomic value</p> 235 308 <div> 236 309 <h4>Attributes</h4> 237 310 <ul> 238 <li>xml:id: an identifier for the nodeset</li> 239 <li>idref: a reference to a nodeset identifier.</li> 311 <li>type: the type of the atomic value</li> 312 </ul> 313 </div> 314 <div> 315 <h4>Content</h4> 316 <p>The value</p> 317 </div> 318 </div> 319 <div id="node"> 320 <h3>χ:node</h3> 321 <p>An XDM nodeset</p> 322 <div> 323 <h4>Attributes</h4> 324 <ul> 325 <li>χ:id: an identifier for the node</li> 326 <li>χ:idref: a reference to a node identifier</li> 240 327 </ul> 241 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> 242 333 </div> 243 334 <div> 244 335 <h4>Content</h4> 245 <p>Any element from foreign namespaces</p> 246 </div> 247 </div> 336 <p>Depending on the node type: a value or a sequence of nodes.</p> 337 </div> 338 </div> 339 </div> 340 <div id="changelog"> 341 <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> 343 <p>Main changes:</p> 344 <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> 350 </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&limit=100&mode=stop_on_copy">RSS feed</a>.</p> 248 353 </div> 249 354 <div>
Note: See TracChangeset
for help on using the changeset viewer.