/
index.html
2715 lines (2199 loc) · 126 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta name="rcsid" content="$Id: index.html,v 1.2 2001/12/18 19:17:59 dom Exp $"/>
<title>RDF/XML Syntax Specification (Revised)</title>
<style type="text/css">
.added {
color: green;
text-decoration: underline;
background: white;
}
.removed {
color: red;
background: white;
text-decoration: line-through;
}
.actionLabel {
font-weight: bold
}
.actionDecision {
color: black;
background: #99ffff;
}
div.issue,
div.block,
div.note { margin-left: 2em; }
div.productionOuter {
/*
border: 4px double gray;
*/
margin: 0em;
padding: 0em;
}
div.productionInner {
color: black;
/* tan */
/* background-color: #d2b48c; */
/* cyan */
/* background-color: #99ffff; */
/* mauve */
background-color: #efeff8;
/*
border-top-style: double;
border-top-color: #d3d3d3;
border-bottom-width: 4px;
border-bottom-style: double;
border-bottom-color: #d3d3d3;
*/
padding: 0.5em;
margin: 0em;
}
div.productionInner p {
margin-left: 0em;
margin-top: 0em;
margin-bottom: 0em
}
div.ntripleOuter {
/*
border: 4px double gray;
*/
margin: 0em;
padding: 0em;
}
div.ntripleInner {
color: black;
/* tan */
/* background-color: #d2b48c; */
/* cyan */
/* background-color: #99ffff; */
/* mauve */
/* background-color: #efeff8; */
/* LightGoldenrod1 */
background-color: #ffec8b;
/*
border-top-style: double;
border-top-color: #d3d3d3;
border-bottom-width: 4px;
border-bottom-style: double;
border-bottom-color: #d3d3d3;
*/
padding: 0.5em;
margin: 0em;
}
div.ntripleInner p {
margin-left: 0em;
margin-top: 0em;
margin-bottom: 0em
}
div.exampleOuter {
border: 4px double gray;
margin: 0em;
padding: 0em;
}
div.exampleInner {
color: black;
/* tan */
background-color: #d2b48c;
/* cyan */
/* background-color: #99ffff; */
/* mauve */
/* background-color: #efeff8; */
border-top-style: double;
border-top-color: #d3d3d3;
border-bottom-width: 4px;
border-bottom-style: double;
border-bottom-color: #d3d3d3;
padding: 4px;
margin: 0em;
}
div.exampleInner pre {
margin-left: 0em;
margin-top: 0em;
margin-bottom: 0em;
font-family: monospace;
/* font-size: smaller */
}
</style>
<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-WD" />
</head>
<body>
<div class="head"><a href="http://www.w3.org/"><img height="48"
width="72" alt="W3C" src="http://www.w3.org/Icons/w3c_home" /></a>
<h1 id="title">RDF/XML Syntax Specification (Revised)</h1>
<h2 id="doctype">W3C Working Draft 18 December 2001</h2>
<dl>
<dt>This version:</dt>
<dd><a href="http://www.w3.org/TR/2001/WD-rdf-syntax-grammar-20011218">http://www.w3.org/TR/2001/WD-rdf-syntax-grammar-20011218</a><br />
</dd>
<dt>Latest version:</dt>
<dd><a href="http://www.w3.org/TR/rdf-syntax-grammar">http://www.w3.org/TR/rdf-syntax-grammar</a><br />
</dd>
<dt>Previous version:</dt>
<dd><a href="http://www.w3.org/TR/2001/WD-rdf-syntax-grammar-20010906">http://www.w3.org/TR/2001/WD-rdf-syntax-grammar-20010906</a>
</dd>
<dt>Editor:</dt>
<dd>Dave Beckett (University of Bristol)</dd>
</dl>
<p class="copyright">
<a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Copyright">
Copyright</a> ©2001 <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup>
(<a href="http://www.lcs.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
<a href="http://www.inria.fr/"><abbr lang="fr" title="Institut National de Recherche en Informatique et Automatique">INRIA</abbr></a>,
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#Legal_Disclaimer">liability</a>,
<a href="http://www.w3.org/Consortium/Legal/ipr-notice-20000612#W3C_Trademarks">trademark</a>,
<a href="http://www.w3.org/Consortium/Legal/copyright-documents-19990405">document use</a> and
<a href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">software licensing</a> rules apply.</p>
<hr title="Separator for header" />
</div>
<h2 class="nonum">
<a id="abstract" name="abstract">Abstract</a>
</h2>
<p>This W3C Working Draft revises the specification of the XML syntax
of RDF as originally described in
<a href="http://www.w3.org/TR/1999/REC-rdf-syntax-19990222/">RDF Model & Syntax</a>.
This document presents the syntax as amended and clarified by the
<a href="http://www.w3.org/2001/sw/RDFCore/">RDF Core Working Group</a>
with the specification now based on the
<a href="http://www.w3.org/TR/2001/REC-xml-infoset-20011024">XML Information Set</a>
along with mapping rules for creating RDF models as described in the
<a href="http://www.w3.org/TR/2001/WD-rdf-mt-20010925">RDF Model Theory</a>
W3C Working Draft.
</p>
<h2 class="nonum">
<a id="status" name="status">Status of this Document</a>
</h2>
<p><em>This section describes the status of this document at the time
of its publication. Other documents may supersede this document. The
latest status of this document series is maintained at the W3C.</em></p>
<p>This is a W3C Working Draft for the
<a href="http://www.w3.org/2001/sw/RDFCore/">RDF Core Working Group</a>
produced as part of the W3C
<a href="http://www.w3.org/2001/sw/">Semantic Web Activity</a>.
It incorporates decisions made by the Working Group
updating the XML syntax for RDF from the original
<a href="http://www.w3.org/TR/1999/REC-rdf-syntax-19990222">RDF Model & Syntax</a> (<a href="#ref-rdfms">[RDFMS])</a> document
and includes a re-representing of the syntax in terms
of the
<a href="http://www.w3.org/TR/2001/REC-xml-infoset-20011024">XML Information Set</a>
with rules for generation of RDF models.
</p>
<p>This document is being released for review by W3C members and
other interested parties to encourage feedback and comments,
especially with regard to how the changes affect existing
implementations. This is the current state of an ongoing work on the
syntax and mapping process and may not yet record all of the work
in the
<a href="http://www.w3.org/TR/1999/REC-rdf-syntax-19990222/#grammar">grammar section</a>
of the original document.
</p>
<p>
This is a draft document and may be updated, replaced, or obsoleted by
other documents at any time. It is inappropriate to use it as reference
material or to cite as other than "work in progress". A list of current
W3C Recommendations and other technical documents can be found at <a
href="/TR/">http://www.w3.org/TR/</a>.
</p>
<p>Comments on this document are invited and should be sent to the
public mailing list
<a href="mailto:www-rdf-comments@w3.org">www-rdf-comments@w3.org</a>.
An archive of comments is available at
<a href="http://lists.w3.org/Archives/Public/www-rdf-comments/">http://lists.w3.org/Archives/Public/www-rdf-comments/</a>.
</p>
<div class="toc">
<h2 class="nonum">
<a id="contents" name="contents">Table of contents</a>
</h2>
<p class="toc">
1 <a href="#section-Introduction">Introduction</a><br />
2 <a href="#section-Syntax">An XML syntax for RDF</a><br />
3 <a href="#section-Data-Model">Data Model</a><br />
  3.1 <a href="#section-root-node">Root Node</a><br />
  3.2 <a href="#section-element-node">Element Node</a><br />
  3.3 <a href="#section-end-element-node">End Element Node</a><br />
  3.4 <a href="#section-attribute-node">Attribute Node</a><br />
  3.5 <a href="#section-text-node">Text Node</a><br />
  3.6 <a href="#section-identifier-node">Identifier Node</a><br />
  3.7 <a href="#section-Infoset-Mapping">Information Set Mapping</a><br />
  3.8 <a href="#section-Namespace">The RDF Namespace</a><br />
  3.9 <a href="#section-Identifiers">Identifiers</a><br />
4 <a href="#section-Notation">Notation</a><br />
  4.1 <a href="#section-Terminology">Terminology</a><br />
  4.2 <a href="#section-Infoset-Grammar-Notation">Grammar Notation</a><br />
  4.3 <a href="#section-Notation-Forms">Notation Forms</a><br />
5 <a href="#section-Infoset-Grammar">RDF/XML Grammar</a><br />
6 <a href="#section-Serialising">Serialising an RDF Graph to RDF/XML</a><br />
7 <a href="#section-Acknowledgments">Acknowledgments</a><br />
8 <a href="#section-References">References</a></p>
<h3><a id="section-Appendices-TOC" name="section-Appendices-TOC">Appendices</a></h3>
<p class="toc">
A <a href="#section-Updated-Grammar-changes">Issues affecting RDF/XML Syntax</a> (Non-Normative)<br />
  A.1 <a href="#section-Doc-Issues">Document Issues / Tasks</a> (Non-Normative)<br />
  A.2 <a href="#section-Open-Issues">RDF Core WG Open Issues affecting RDF/XML Syntax</a> (Non-Normative)<br />
  A.3 <a href="#section-Decided-Issues">RDF Core WG Decided Issues affecting RDF/XML Syntax</a> (Non-Normative)<br />
  A.4 <a href="#section-Postponed-Issues">RDF Core WG Postponed Issues affecting RDF/XML Syntax</a> (Non-Normative)<br />
B <a href="#section-Schemas">Syntax Schemas</a> (Non-Normative)<br />
  B.1 <a href="#section-RELAXNG-Schema">RELAX NG Syntax Schema</a> (Non-Normative)<br />
  B.2 <a href="#section-Other-Schemas">Other Syntax Schemas</a> (Non-Normative)<br />
C <a href="#section-Grammar">Original Grammar</a> (Non-Normative)<br />
D <a href="#section-Updated-Grammar">Updated Grammar after RDF Core decisions</a> (Non-Normative)<br />
E <a href="#section-Changes">Changes</a> (Non-Normative)
</p>
</div>
<hr />
<h2>
<a id="section-Introduction" name="section-Introduction">1 Introduction</a>
</h2>
<p>This document describes the
<a href="http://www.w3.org/TR/2000/REC-xml-20001006">XML</a>
(<a href="#ref-xml">[XML]</a>)
syntax for RDF as
originally defined in the
<a href="http://www.w3.org/TR/1999/REC-rdf-syntax-19990222">RDF Model & Syntax</a> (<a href="#ref-rdfms">[RDFMS]</a>) W3C
Recommendation. Subsequent implementations of this syntax and
comparison of the resulting RDF models have shown that there was
ambiguity - implementations generated different models and certain
syntax forms were not widely implemented. These issues were
generally made as either feedback to the
<a href="mailto:www-rdf-comments@w3.org">www-rdf-comments@w3.org</a>
(<a href="http://lists.w3.org/Archives/Public/www-rdf-comments/">archive</a>)
or from discussions on the RDF Interest Group list
<a href="mailto:www-rdf-interest@w3.org">www-rdf-interest@w3.org</a>
(<a href="http://lists.w3.org/Archives/Public/www-rdf-interest/">archive</a>)
.</p>
<p>The
<a href="http://www.w3.org/2001/sw/RDFCore/">RDF Core Working Group</a>
is <a href="http://www.w3.org/2001/sw/RDFCoreWGCharter">chartered</a>
to respond to the need for a number of fixes, clarifications and
improvements to the specification of RDF's abstract model and XML
syntax. The working group invites feedback from the developer
community on the effects of its proposals on existing implementations
and documents.</p>
<p>Several decisions including amendments and deletions to the
grammar are referred to
<a href="#section-Updated-Grammar-changes">below</a>.
The definitive record of the decisions is the
<a href="http://www.w3.org/2000/03/rdf-tracking/">RDF Core WG issues list</a>.
</p>
<p>This document re-represents the original EBNF grammar in terms of
the <a href="http://www.w3.org/TR/2001/REC-xml-infoset-20011024">XML Information Set</a>
(<a href="#ref-xml-infoset">[INFOSET]</a>) items which moves
from the rather low-level details, such as particular forms of empty
elements. This allows the grammar to be more precisely recorded and
the mapping from the XML syntax to the RDF model more clearly shown.
The mapping to the RDF model (a graph) is done by emitting statements
in the form defined in the
<a href="http://www.w3.org/TR/rdf-testcases/#ntriples">N-Triples</a>
section of
<a href="http://www.w3.org/TR/2001/WD-rdf-testcases-20011115/">RDF Test Cases</a> (<a href="#ref-test-cases">[RDF-TESTS]</a>) Working Draft
which creates an RDF model, that has semantics defined by
<a href="http://www.w3.org/TR/2001/WD-rdf-mt-20010925">RDF Model Theory</a> (<a href="#ref-rdf-model">[RDF-MODEL]</a>) Working Draft.
</p>
<p>This document illustrates one way to create triples from the XML -
any other method that results in the same RDF graph may be used.</p>
<p>In particular:</p>
<ul>
<li>triples may be generated in any order</li>
<li>duplicates may be eliminated at any point</li>
<li>there is no requirement to support N-Triples in any way</li>
</ul>
<h2>
<a id="section-Syntax" name="section-Syntax">2 An XML syntax for RDF</a>
</h2>
<p>The
<a href="http://www.w3.org/TR/2001/WD-rdf-mt-20010925">RDF Model Theory</a> (<a href="#ref-rdf-model">[RDF-MODEL]</a>) provides a formal description
of RDF. This can be thought of as a graph consisting of <em>nodes</em>
and <em>arcs</em>. The <em>node</em>
describe resources that can be labelled with URIs, string literals
or are blank. The <em>arcs</em> connect the nodes and are all
labelled with URIs. This graph is more precisely called a directed
edge-labelled graph; each edge is an arc with a direction (an arrow)
connecting two nodes. These edges can be described as triples of
<em>subject node</em>, at the blunt end of the arrow/arc,
<em>property arc</em> and an <em>object node</em> at the sharp end of
the arrow/arc. The property arc is also interpreted as an attribute,
relationship or predicate of the resource with a value given by the
object node content.</p>
<p>In order to encode the graph in XML, the nodes and arcs are turned
into XML elements, attributes, element content and attribute values.
The URI labels for properties and object nodes are written in XML via
<a href="http://www.w3.org/TR/1999/REC-xml-names-19990114">XML Namespaces</a> (<a href="#ref-namespaces">[XML-NS]</a>)
which gives a namespace URI for a short prefix
along with namespace-qualified elements and attributes names
called local names. The (namespace URI, local name) pair
are chosen such that concatenating them forms the original node URI.
The URIs labelling subject nodes are stored in XML attribute values.
The nodes labelled by string literals (which are always
object nodes) become element text content or attribute values.</p>
<p>This transformation turns paths in the graph of the form
Node, Arc, Node, Arc, Node, Arc, ...
into sequences of elements inside elements. This
results in a <em>striping</em> when the elements are written down;
alternating between <a href="#nodeElement">node elements</a> and
<a href="#propertyElt">property elements</a>. The Node at the
start of the sequence is always a subject node and turns into
a containing element called an <code>rdf:Description</code> that
is written at the top level of RDF/XML, below the XML document element
(in this case <code>rdf:RDF</code>). So the chains of stripes
start at the top of an RDF/XML document and always begin with nodes.
</p>
<p>For example, here is a graph written as ASCII saying "there exists
a document (this one) with a title, RDF/XML Syntax Specification (Revised)" and
"this document has an editor, the editor has a name "Dave Beckett"
and a home page http://purl.org/net/dajobe/.
<code>[URI]</code> is used for a node with a URI,
<code>[]</code> for a blank node, and
<code>--[property]--></code> is used for an arc.</p>
<pre>
[http://www.w3.org/TR/rdf-syntax-grammar] --[has a title] -> "RDF/XML Syntax Specification (Revised)"
--[has an editor]-> [] --[has a name] -> "Dave Beckett"
--[has a home page]-> [http://purl.org/net/dajobe/]
</pre>
<p>Taking one path through the graph:</p>
<pre>
[http://www.w3.org/TR/rdf-syntax-grammar]
--[has an editor]-> []
--[has a home page]-> [http://purl.org/net/dajobe/]
</pre>
<p>This corresponds to the node/arc stripes:</p>
<ol>
<li>Node <code>[http://www.w3.org/TR/rdf-syntax-grammar]</code></li>
<li>Arc <code>-[has an editor]-></code></li>
<li>Node <code>[]</code></li>
<li>Arc <code>-[has a home page]-></code></li>
<li>Node <code>[http://purl.org/net/dajobe/]</code></li>
</ol>
<p>In RDF/XML this sequence of 5 nodes and arcs correponds to 5
XML elements:</p>
<pre>
<rdf:Description>
<ex:editor>
<rdf:Description>
<ex:homePage>
<rdf:Description>
</rdf:Description>
</ex:homePage>
</rdf:Description>
</ex:editor>
</rdf:Description>
</pre>
<p>Which consists of some nodes with known URIs that can be filled in
and others that remain blank:</p>
<pre>
<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar">
<ex:editor>
<rdf:Description>
<ex:homePage>
<rdf:Description rdf:about="http://purl.org/net/dajobe/">
</rdf:Description>
</ex:homePage>
</rdf:Description>
</ex:editor>
</rdf:Description>
</pre>
<p>There are several abbreviations that can be used to make very
common uses more easy to write down. It is typical for the same
resource to be described with multiple properties and values at the
same time, so multiple child elements can be put inside
<code>rdf:Description</code>, all of which are properties of that
node.</p>
<p>When the property value is a string it can be encoded more simply
as an XML attribute and value, as an attribute of the node element.
This is known as a <a href="#propertyAttr">property attribute</a>.</p>
<p>Another very common use is when a node is an instance of a class
with <code>rdf:type</code> relationship, usually called a <em>typed
node</em>. This shorthand is done by replacing the
<code>rdf:Description</code> element name with the namespaced-element
corresponding to the URI of the value of the type relationship.</p>
<p>The above forms the basis of the RDF/XML syntax and although there
are some other abbreviated forms, such as for generating the RDF list
properties and for skipping having to write down a blank element
node, which breaks the striping but is useful for, amongst other
uses, encoding properties with multiple-values.</p>
<p>The example above filled out and completed, using some
abbreviations gives:</p>
<pre>
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:ex="http://example.org/stuff/1.0/">
<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar">
<dc:title>RDF/XML Syntax Specification (Revised)</dc:title>
<ex:editor rdf:parseType="Resource">
<ex:fullName>Dave Beckett</ex:fullName>
<ex:homePage rdf:resource="http://purl.org/net/dajobe/" />
</ex:editor>
</rdf:Description>
</rdf:RDF>
</pre>
<p>For a longer introduction to the RDF/XML <em>striped</em> syntax
with a historical perspective, see <a href="http://www.w3.org/2001/10/stripes/">RDF: Understanding the Striped RDF/XML Syntax</a> (<a href="#ref-stripedrdf">[STRIPEDRDF]</a>).</p>
<div class="note"><p><strong>Note:</strong>
This section is still under development and the working group
is working on an RDF primer document.
</p></div>
<h2>
<a id="section-Data-Model" name="section-Data-Model">3 Data Model</a>
</h2>
<p>This syntax operates on an XML document as a sequence of nodes
in document order in the style of
<a href="#ref-xpath">[XPATH]</a> 
<a href="http://www.w3.org/TR/xpath#infoset">Information Set Mapping</a>
serialised into document-order.
The resulting nodes are intended to be similar to the events that are
produced by the <a href="#ref-sax">[SAX2]</a> XML API.
This model is conceptual only and does not mandate any
implementation method; in particular <a href="#ref-xpath">[XPATH]</a>
is not required.</p>
<p>The syntax does not support non-well-formed XML documents, nor
documents that otherwise don't have an XML Information Set; for
example, that don't conform to
<a href="http://www.w3.org/TR/1999/REC-xml-names-19990114">XML Namespaces</a>
W3C Recommendation (<a href="#ref-namespaces">[XML-NS]</a>).
</p>
<p>This specification requires an information set as defined in
<a href="#ref-xml-infoset">[INFOSET]</a>
which supports at least the following information items and
properties:</p>
<dl>
<dt><a href="http://www.w3.org/TR/xml-infoset/#infoitem.document">Document Information Item</a></dt>
<dd>[document element], [children], [base URI]</dd>
<dt><a href="http://www.w3.org/TR/xml-infoset/#infoitem.element">Element Information Item</a></dt>
<dd>[local name], [namespace name], [children], [attributes], [parent]</dd>
<dt><a href="http://www.w3.org/TR/xml-infoset/#infoitem.attribute">Attribute Information Item</a></dt>
<dd>[local name], [namespace name], [normalized value], [owner element]</dd>
<dt><a href="http://www.w3.org/TR/xml-infoset/#infoitem.character">Character Information Item</a></dt>
<dd>[character code]</dd>
</dl>
<p>This specification does not require any destructive alterations to
the input information set; no items are added, removed or modified..</p>
<p>This section is intended to satisfy the requirements for
<a href="http://www.w3.org/TR/xml-infoset/#conformance">Conformance</a>
in the <a href="#ref-xml-infoset">[INFOSET]</a> specification.
</p>
<p>There are six types of node defined in the following subsections.
Most nodes are constructed from an Infoset information item (except
for <a href="#section-identifier-node">Identifier</a>). The effect
of a node constructor is to create a new node with a unique identity,
distinct from all other nodes. Nodes have properties, and all have
the <em>string-value</em> property that may be part of the node or
computed from the <em>string-value</em> of contained nodes.</p>
<h3>
<a id="section-root-node" name="section-root-node">3.1 Root Node</a>
</h3>
<p>Created from an
<a href="http://www.w3.org/TR/xml-infoset/#infoitem.document">Document Information Item</a>
and takes the following properties and their values from the element
information item:
<a name="nodeterm-document-element">document-element</a>,
<a name="nodeterm-children">children</a> and
<a name="nodeterm-base-uri">base-uri</a>.
</p>
<h3>
<a id="section-element-node" name="section-element-node">3.2 Element Node</a>
</h3>
<p>Created from an
<a href="http://www.w3.org/TR/xml-infoset/#infoitem.element">Element Information Item</a>
and takes the following properties and their values from the element
information item: local-name, namespace-name, children,
<a name="nodeterm-attributes">attributes</a> and parent. When this node is created from such values, the
<a name="nodeterm-URI">URI</a> property
is defined with a string value of the concatenation of the
value of the namespace-name property and the value of the
local-name property.
On creation the <a name="nodeterm-liCounter">li-counter</a>
property is added with initial integer value 1.</p>
<p>The <a name="nodeterm-subject">subject</a>
property may be added and takes the value of an
<a href="#section-identifier-node">Identifier</a> node.
This is used on elements that deal with one node in the RDF model,
this generally being the subject of a statement.</p>
<h3>
<a id="section-end-element-node" name="section-end-element-node">3.3 End Element Node</a>
</h3>
<p>Takes no properties but marks the end of the containing element in
the sequence.</p>
<h3>
<a id="section-attribute-node" name="section-attribute-node">3.4 Attribute Node</a>
</h3>
<p>Created from an
<a href="http://www.w3.org/TR/xml-infoset/#infoitem.attribute">Attribute Information Item</a>
and takes the properties
local-name, namespace-name and owner element
and their values from respective element information item properties.
When this node is created from such values, two properties and values
are defined. Firstly the
<a name="nodeterm-string-value">string-value</a> property
is defined with the normalized value as specified by
<a href="#ref-xml">[XML]</a>. An attribute whose normalized
value is a zero-length string is not treated specially: it results in
an attribute node whose string-value is a zero-length string.
Secondly the
<a href="#nodeterm-URI">URI</a> property
is defined with a string value of the concatenation of the
value of the namespace-name property and the value of the
local-name property.
</p>
<h3>
<a id="section-text-node" name="section-text-node">3.5 Text Node</a>
</h3>
<p>Created from a sequence of one or more consecutive
<a href="http://www.w3.org/TR/xml-infoset/#infoitem.character">Character Information Items</a>.
Has the single property
<a href="#nodeterm-string-value">string-value</a>
which has the value of the string made from concatenating the
<a href="http://www.w3.org/TR/xml-infoset/#infoitem.character">character code</a> property of each of the character information items.
[NOTE: Identical to XPath.]
</p>
<h3>
<a id="section-identifier-node" name="section-identifier-node">3.6 Identifier Node</a>
</h3>
<p>A node for a typed identifier which can have the following three properties:
<a href="#nodeterm-identifier">identifier</a> and
<a name="nodeterm-identifier-type">identifier-type</a> and
<a href="#nodeterm-string-value">string-value</a>.
These nodes are created by giving two values
for the <a href="#nodeterm-identifier">identifier</a> and
<a href="#nodeterm-identifier-type">identifier-type</a> properties.
The <a name="nodeterm-identifier">identifier</a>
property takes a string value and the
<a name="nodeterm-identifierType">identifier-type</a>
property can take values "URI" or "bnodeID".</p>
<p>The <a href="#nodeterm-string-value">string-value</a> property
is defined from the other properties as follows: If
<a href="#nodeterm-identifier-type">identifier-type</a> is "URI"
then the value is the concatenation of "<",
the value of the
<a href="#nodeterm-identifier-type">identifier</a> property
and ">". If
<a href="#nodeterm-identifier-type">identifier-type</a> is "bnodeID"
then the value is the concatenation of "_:" and
the value of the <a href="#nodeterm-identifier-type">identifier</a>
property.
</p>
<p>For further information on identifiers in the RDF model, see
<a href="#section-Identifiers">section 3.9</a>.</p>
<h3>
<a id="section-Infoset-Conformance" name="section-Infoset-Conformance"></a>
<a id="section-Infoset-Mapping" name="section-Infoset-Mapping">3.7 Information Set Mapping</a>
</h3>
<p>To transform the Infoset into the sequence of nodes, each
information item is transformed as described above to generate a
tree of nodes with properties and values. Each element node is
then replaced as described below to turn the tree of nodes
into a sequence in document order.</p>
<ol>
<li>The original <a href="#section-element-node">element node</a></li>
<li>The value of the
<a href="http://www.w3.org/TR/xml-infoset/#infoitem.element">children</a>
property, a possibly empty ordered list of nodes.</li>
<li>An <a href="#section-end-element-node">end element node</a></li>
</ol>
<h3><a id="section-Namespace" name="section-Namespace">3.8 The RDF Namespace</a></h3>
<p>The RDF Namespace URI is
<a name="rdf-ns-uri">http://www.w3.org/1999/02/22-rdf-syntax-ns#</a>
and is typically used in XML with the prefix <code>rdf</code> although
this is not required. The namespace contains the following names only:</p>
<div class="block"><p>
RDF Description<br />
ID about bagID parseType resource<br />
subject predicate object<br />
Seq Bag Alt Statement Property<br />
type value<br />
li _<em>n</em><br />
</p></div>
<p>where <em>n</em> is a non-negative integer.</p>
<p>Throughout this document the terminology rdf:<em>name</em>
will be used to indicate <em>name</em> is from the RDF namespace
and it has a URI of the concatenation of the
<a href="#rdf-ns-uri">RDF Namespace URI</a> and <em>name</em>.
For example, rdf:type has the URI
http://www.w3.org/1999/02/22-rdf-syntax-ns#type</p>
<div class="note"><p><strong>Implementors Note:</strong>
The names aboutEach and aboutEachPrefix were removed
from the language by the RDF Core WG - see the issues
<a href="#rdfms-abouteach">rdfms-abouteach</a> and
<a href="#rdfms-abouteachprefix">rdfms-abouteachprefix</a>
for further information.
</p></div>
<h3><a id="section-Identifiers" name="section-Identifiers">3.9 Identifiers</a></h3>
<p>The RDF model uses three types of identifiers (or labels) for
nodes and arcs in the graph - absolute URI references, literals and
unlabelled or blank nodes. The latter are given local identifiers
in the N-Triples serialisation of the model in order to represent
the graph correctly. These identifiers can be generated and must
match the <a href="http://www.w3.org/TR/rdf-testcases/#name">name</a>
production in
<a href="http://www.w3.org/TR/rdf-testcases/#ntriples">N-Triples</a>.
</p>
<p>The URI references can be either given as absolute URIs, relative
URIs that have to be resolved from the document URI, or constructed.
The constructed URIs in RDF are either made from XML Namespace
qualified element or attributes names (QNames) or from the value of
rdf:ID or rdf:bagID attribute values.</p>
<p>XML QNames give URIs by concatenating the namespace URI and
the XML local name. For example, if the XML Namespace prefix
<code>foo</code> has URI http://example.org/somewhere/ then the QName
<code>foo:bar</code> would correspond to the URI
http://example.org/somewhere/bar. Note that this restricts which
URIs can be made and the same URI can be given in multiple ways.</p>
<p>The rdf:ID and rdf:bagID values generate URIs by considering them
as equivalent to the relative URI "#" concatenated with the attribute
value. This can then be resolved relative to the document URI to
give the absolute URI.</p>
<h2>
<a id="section-Notation" name="section-Notation">4 Notation</a>
</h2>
<h3>
<a id="section-Terminology" name="section-Terminology">4.1 Terminology</a>
</h3>
<p>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in
this document are to be interpreted as described in
<a href="http://www.ietf.org/rfc/rfc2119.txt">RFC 2119</a>
(<a href="#ref-keywords">[KEYWORDS]</a>).</p>
<h3>
<a id="section-Infoset-Grammar-Notation" name="section-Infoset-Grammar-Notation">4.2 Grammar Notation</a>
</h3>
<p>The following notation is used for describing the nodes and grammar EBNF.</p>
<table border="1" summary="This table describes the notation used in the following sections to describe the grammar in nodes along with the meaning of that notation.">
<caption>Notation for nodes and grammar EBNF.</caption>
<tr>
<th>Notation</th>
<th>Meaning</th>
</tr>
<tr>
<td>property=value</td>
<td>A node property with a given value</td>
</tr>
<tr>
<td><em>node</em>.<em>property</em></td>
<td>Returns the value of the given node property</td>
</tr>
<tr>
<td>root(prop1=value1,<br />
    prop2=value2, ...)</td>
<td>A <a href="#section-root-node">root node</a> with properties
</td>
</tr>
<tr>
<td>start_element(prop1=value1,<br />
    prop2=value2, ...)<br />
<em>children</em><br />
end_element()</td>
<td>A sequence of
<a href="#section-element-node">element node</a> with properties,
a possibly empty list of nodes as element content and an
<a href="#section-end-element-node">end element node</a>
</td>
</tr>
<tr>
<td>attribute(prop1=value1,<br />
    prop2=value2, ...)</td>
<td>An <a href="#section-attribute-node">attribute node</a>
with properties</td>
</tr>
<tr>
<td>identifier(prop1=value1,<br />
    prop2=value2, ...)</td>
<td>An <a href="#section-identifier-node">identifier node</a>
with properties</td>
</tr>
<tr>
<td>text()</td>
<td>A <a href="#section-text-node">text node</a></td>
</tr>
<tr>
<td>base-uri</td>
<td>The value of the <a href="#nodeterm-base-uri">base-uri</a> property of the <a href="#section-root-node">root node</a></td>
</tr>
<tr>
<td>list(item1, item2, ...); list()</td>
<td>An ordered list of items in document order; an empty list</td>
</tr>
<tr>
<td>set(item1, item2, ...); set()</td>
<td>An unordered set of items; an empty set</td>
</tr>
<tr>
<td>*</td>
<td>Zero or more of preceding term</td>
</tr>
<tr>
<td>?</td>
<td>Zero or one of preceding term</td>
</tr>
<tr>
<td>+</td>
<td>One or more of preceding term</td>
</tr>
<tr>
<td>A | B | ...</td>
<td>The A, B, ... terms are alternatives.</td>
</tr>
<tr>
<td>A - B</td>
<td>The term A but not the term B</td>
</tr>
<tr>
<td>"ABC"</td>
<td>A string of characters A, B, C in order.</td>
</tr>
<tr>
<td>concat(A, B, ..)</td>
<td>A string created by concatenating the terms in order.</td>
</tr>
<tr>
<td><a name="anyURI">anyURI</a></td>
<td>Any legal URI.</td>
</tr>
<tr>
<td><a name="anyString">anyString</a></td>
<td>Any string.</td>
</tr>
<tr>
<td>rdf:<em>X</em></td>
<td>See <a href="#section-Namespace">section 3.8</a></td>
</tr>
</table>
<h3>
<a id="section-Notation-Forms" name="section-Notation-Forms">4.3 Notation Forms</a>
</h3>
<p>The following notation forms are used to indicate</p>
<div class="productionOuter"><div class="productionInner"><p>
A grammar production over a sequence of nodes derived from the
<a href="http://www.w3.org/TR/xpath#infoset">Infoset</a>
in the notation described in section
<a href="#section-Infoset-Grammar-Notation">4.2</a>.
</p></div></div>
<p> </p>
<div class="ntripleOuter"><div class="ntripleInner"><p>
<tt>
A sequence of lines of
<a href="http://www.w3.org/TR/rdf-testcases/#ntriples">N-Triples</a> output
from a grammar production adding to an RDF model.
</tt>
</p></div></div>
<h2>
<a id="section-Infoset-Grammar" name="section-Infoset-Grammar">5 RDF/XML Grammar</a>
</h2>
<h3><a id="start" name="start">5.1 Grammar start</a></h3>
<p>If the RDF/XML is a standalone XML content, then
the grammar starts with <a href="#section-root-node">Root Node</a> 
<a href="#doc">doc</a>.</p>
<p>If the content is known to be RDF/XML by context, such as when
RDF/XML is embedded inside other XML content, then the grammar
can either start
at <a href="#section-element-node">Element Node</a> 
<a href="#RDF">RDF</a>
(only when an element is legal at that point in the XML)
or at production <a href="#nodeElementList">nodeElementList</a>
(only when element content is legal, since this is a list of elements).
For such embedded RDF/XML, the <a href="#nodeterm-base-uri">base-uri</a>
value must be initialised from the containing XML since no
<a href="#section-root-node">Root Node</a>  will be available.
Note that if such embedding occurs, the grammar may be entered
several times but no state is expected to be preserved.
</p>
<h3><a id="doc" name="doc">5.2 Production doc</a></h3>
<div class="productionOuter"><div class="productionInner"><p>
root(<a href="#nodeterm-document-element">document-element</a>=<a href="#RDF">RDF</a>,<br />
    <a href="#nodeterm-children">children</a>=list(<a href="#RDF">RDF</a>))
</p></div></div>
<h3><a id="RDF" name="RDF">5.3 Production RDF</a></h3>
<div class="productionOuter"><div class="productionInner"><p>
start_element(<a href="#nodeterm-URI">URI</a> = rdf:RDF,<br />
    <a href="#nodeterm-attributes">attributes</a>=set())<br />
<a href="#nodeElementList">nodeElementList</a><br />
end_element()
</p></div></div>
<h3><a id="nodeElementList" name="nodeElementList">5.4 Production nodeElementList</a></h3>
<div class="productionOuter"><div class="productionInner"><p>
<a href="#ws">ws</a>* (<a href="#nodeElement">nodeElement</a> <a href="#ws">ws</a>* )*
</p></div></div>
<h3><a id="nodeElement" name="nodeElement">5.5 Production nodeElement</a><a id="description" name="description"></a><a id="typedNode" name="typedNode"></a></h3>
<div class="productionOuter"><div class="productionInner"><p>
start_element(<a href="#nodeterm-URI">URI</a>=<a href="#anyURI">anyURI</a>,<br />
    <a href="#nodeterm-attributes">attributes</a>=set((<a href="#idAttr">idAttr</a> | <a href="#aboutAttr">aboutAttr</a> )?, <a href="#bagIdAttr">bagIdAttr</a>?, <a href="#propertyAttr">propertyAttr</a>*))<br />
<a href="#propertyEltList">propertyEltList</a><br />
end_element()
</p></div></div>
<p>The processing of some of the attributes have to be done before other
work such as dealing with children nodes or other attributes.
These can be processed in any order:</p>
<ul>
<li>If there is an attribute <em>a</em> with
<em>a</em>.<a href="#nodeterm-URI">URI</a> = rdf:ID,
set <em>e</em>.<a href="#nodeterm-subject">subject</a> to
identifier(<a href="#nodeterm-identifier">identifier</a>=concat(<a href="#nodeterm-base-uri">base-uri</a>, "#", <em>a</em>.<a href="#nodeterm-string-value">string-value</a>), <a href="#nodeterm-identifier-type">identifier-type</a>="URI").</li>
<li>If there is an attribute <em>a</em> with
<em>a</em>.<a href="#nodeterm-URI">URI</a> = rdf:about,
set <em>e</em>.<a href="#nodeterm-subject">subject</a> to
identifier(<a href="#nodeterm-identifier">identifier</a>=<em>a</em>.<a href="#nodeterm-string-value">string-value</a>, <a href="#nodeterm-identifier-type">identifier-type</a>="URI").</li>
<li>If <em>e</em>.<a href="#nodeterm-subject">subject</a>
is empty, generate a local blank node identifier <em>i</em>
and use it to create a new node <em>n</em> with the value of identifier(<a href="#nodeterm-identifier">identifier</a>=<em>i</em>, <a href="#nodeterm-identifier-type">identifier-type</a>="bnodeID"). Set <em>e</em>.<a href="#nodeterm-subject">subject</a> to be <em>n</em>.</li>
</ul>
<p>The following can then be performed in any order:</p>