W3C

Editor's Draft of RDF/XML Syntax Specification (Revised)

Editor's Draft of W3C Working Draft 23 January 2 October 2003

This version:
<a href="http://www.w3.org/TR/2003/WD-rdf-syntax-grammar-20030123"> http://www.w3.org/TR/2003/WD-rdf-syntax-grammar-20030123 http://www.w3.org/2001/sw/RDFCore/TR/WD-rdf-syntax-grammar-20030117/
Latest Version: W3C version:
http://www.w3.org/TR/rdf-syntax-grammar
Previous Version: version:
<a href="http://www.w3.org/TR/2002/WD-rdf-syntax-grammar-20021108"> http://www.w3.org/TR/2002/WD-rdf-syntax-grammar-20021108 http://www.w3.org/TR/2003/WD-rdf-syntax-grammar-20030905
Editor:
Dave Beckett (University of Bristol)
Series editor:
Brian McBride (Hewlett Packard Labs)

Abstract

The Resource Description Framework ( RDF ) is a general-purpose language for representing information in the Web.

This document defines an XML syntax for RDF called RDF/XML in terms of deleted text: XML Namespaces in XML , the XML Information Set and XML Base . The formal grammar for the syntax is annotated with actions generating triples of the <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-rdf-graph"> RDF Graph graph as defined in <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/"> RDF Concepts and Abstract Syntax . This is done The triples are written using the <a href="http://www.w3.org/TR/2003/WD-rdf-testcases-20030123/#ntriples"> N-Triples RDF Graph graph serializing format which enables more precise recording of the mapping in a machine processable form. The mappings are recorded as tests cases, gathered and published in <a href="http://www.w3.org/TR/2003/WD-rdf-testcases-20030123/"> RDF Test Cases .

Status of this Document

@@ This is an editor's draft despite anything else said here. Please review the latest published version . @@

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This is a W3C <a href="http://www.w3.org/Consortium/Process-20010719/tr.html#last-call"> Last Call Working Draft of the RDF Core Working Group and has been produced as part of the W3C Semantic Web Activity ( Activity Statement ).

In this version the main changes are for parseType="Collection" to remove one generated triple per-item, the removal of rdf:bagID entirely and in the simplification of typed literals to remove language tags (such as from xml:lang ). The Working Group particularly seeks feedback on the impact of this change on the datatype rdf:XMLLiteral . Detailed changes from the previous 23 January 2003 last call working draft are described in the Appendix B . Changes since the previous 05 September 2003 working draft are given in Appendix C .

This document is Working Draft consolidates changes and editorial improvements undertaken in response to feedback received during the Last Call review period, publication of the RDFCore specifications which ends began on 21 February 23 January 2003 annd the working draft published 05 September 2003. A list of the Last Call issues addressed by the Working Group is also available . This document has been endorsed by the RDF Core Working Group.

This document deleted text: revises RDF/XML from the original definition in the <a href="http://www.w3.org/TR/1999/REC-rdf-syntax-19990222/#grammar"> grammar section </a> of <a href="http://www.w3.org/TR/1999/REC-rdf-syntax-19990222/"> RDF Model & Syntax </a> <a href="#ref-rdfms"> [RDF-MS] </a> W3C Recommendation after decisions made by the <a href="http://www.w3.org/2001/sw/RDFCore/"> RDF Core Working Group </a>. In particular, the <a href="#section-Infoset-Grammar"> formal grammar </a> is now 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>. </p> <p> In this revision, new support was added for <a href="http://www.w3.org/TR/2001/REC-xmlbase-20010627/"> XML Base </a> <a href="#ref-xml-base"> [XML-BASE] </a>, RDF Datatyping with <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-typed-literal"> Typed Literals </a> using <code> rdf:datatype </code>, <code> rdf:nodeID </code> to allow referencing of <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-blank-node"> Blank Nodes </a> and <code> rdf:parseType="Collection" </code> for expressing a collection of <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-node"> Nodes </a>. The revision removed <code> rdf:aboutEach </code> and <code> rdf:aboutEachPrefix </code> from the syntax (see RDF Core issues <a href="http://www.w3.org/2000/03/rdf-tracking/#rdfms-aboutEach-on-object"> rdfms-aboutEach-on-object </a> and <a href="http://www.w3.org/2000/03/rdf-tracking/#rdfms-abouteachprefix"> rdfms-abouteachprefix </a> ). </p> <p> The detailed changes from the previous <a href="http://www.w3.org/TR/2002/WD-rdf-syntax-grammar-20021108/"> 8 November 2002 working draft </a> are described in the <a href="#section-Changes"> Changes section </a>. </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 made affect existing implementations and content.

In conformance with W3C policy requirements, known patent and IPR constraints associated with this Working Draft are detailed on the RDF Core Working Group Patent Disclosure page.

Comments on this document are invited and should be sent to the public mailing list www-rdf-comments@w3.org . An archive of comments is available at http://lists.w3.org/Archives/Public/www-rdf-comments/ .

This is Publication as a deleted text: public W3C Last Call Working Draft for review does not imply endorsement by the W3C Members and other interested parties. Membership. This deleted text: section describes the status of this document at the time of its publication. It is a draft document and may be updated, replaced, replaced or obsoleted by other documents at any time. It is inappropriate to deleted text: use W3C Working Drafts as reference material or to cite this document as other than "work work in progress". progress. A list of current W3C Recommendations and other technical documents can be found at http://www.w3.org/TR/ .

Table of contents Contents

1 Introduction
2 An XML syntax Syntax for RDF
  2.1 Introduction
  2.2 Node Elements and Property Elements
  2.3 Multiple Property Elements
  2.4 Empty Property Elements
  2.5 Property Attributes
  2.6 Completing the Document - Document: Document Element and XML Declaration
  2.7 Languages - Languages: xml:lang
  2.8 XML Literals - Literals: rdf:parseType="Literal"
  2.9 Typed Literals - Literals: rdf:datatype
  2.10 Identifying Blank Nodes - Nodes: rdf:nodeID
  2.11 Omitting Blank Nodes - Nodes: rdf:parseType="Resource"
  2.12 Omitting Nodes - Nodes: Property Attributes on an empty Property Element
  2.13 Typed Node Elements
  2.14 Abbreviating URI References - References: rdf:ID and xml:base
  2.15 Container membership property elements - Membership Property Elements: rdf:li and rdf:_ n
  2.16 Collections - Collections: rdf:parseType="Collection"
  2.17 Reifying Statements - <code> rdf:bagID </code> and Statements: rdf:ID
deleted text:   2.18 <a href="#section-Syntax-more"> More Information </a> <br /> 3 Terminology
4 RDF MIME type, file extension Type, File Extension and Macintosh file type File Type
5 Global Issues
  5.1 The RDF Namespace and Vocabulary
  5.2 Identifiers
  5.3 Resolving URIs
  5.4 Constraints
  5.5 Conformance
6 Syntax Data Model
  6.1 Events
  6.2 Information Set Mapping
  6.3 Grammar Notation
7 RDF/XML Grammar
  7.1 Grammar Summary
  7.2 Grammar Productions
  7.3 Reification Rules
  7.4 List Expansion Rules
deleted text:   7.5 <a href="#section-Bag-Expand"> Bag Expansion Rules </a> <br /> 8 Serializing an RDF Graph to RDF/XML
9 Using RDF/XML in with HTML and XHTML
10 Using RDF/XML with SVG
11 Acknowledgments
11 12 References

Appendices

A Syntax Schemas (Informative)
  A.1 RELAX NG Compact Syntax Schema (Informative)
B Changes Revisions between Drafts 23 January and 05 September 2003 (Informative)
C Revisions since Working Draft 05 September 2003 (Informative)


1 Introduction

This document defines the XML [XML] syntax for RDF Graphs graphs which was originally defined in the RDF Model & Syntax [RDF-MS] W3C Recommendation. Subsequent implementations of this syntax and comparison of the resulting RDF Graphs graphs have shown that there was ambiguity - implementations generated different graphs and certain syntax forms were not widely implemented.

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 graph and XML syntax as recorded in the <a href="http://www.w3.org/2000/03/rdf-tracking/"> RDF Core Working Group issues list </a>. The Working Group invites feedback from the developer community on the effects of its proposals on existing implementations and documents. </p> <p> This document revises This document revises the original RDF/XML grammar in terms of XML Information Set [INFOSET] Information Items information items which moves away from the rather low-level details of XML, 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 Graph more clearly shown. The mapping to the RDF Graph graph is done by emitting statements in the form defined in the <a href="http://www.w3.org/TR/2003/WD-rdf-testcases-20030123/#ntriples"> N-Triples section of <a href="http://www.w3.org/TR/2003/WD-rdf-testcases-20030123/"> RDF Test Cases [RDF-TESTS] deleted text: Working Draft which creates an RDF Graph, graph, that has semantics defined by <a href="http://www.w3.org/TR/2003/WD-rdf-mt-20030123/"> RDF Semantics [RDF-SEMANTICS] </a> Working Draft. .

The complete specification of RDF consists of a number of documents:

For a longer introduction to the RDF/XML syntax with a historical perspective, see RDF: Understanding the Striped RDF/XML Syntax [STRIPEDRDF] .

2 An XML syntax Syntax for RDF

This section introduces the RDF/XML syntax, describes how it encodes RDF Graphs graphs and explains this with examples. If there is any conflict between this informal description and the formal description of the syntax and grammar in sections 6 Syntax Data Model and 7 RDF/XML Grammar , the latter two sections take precedence.

2.1 Introduction

The <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/"> RDF Concepts and Abstract Syntax [RDF-CONCEPTS] deleted text: working draft defines the <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#section-data-model"> RDF Graph data model (Section 3.1) and the <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-rdf-graph"> RDF Graph abstract syntax (Section 6.2). 6). Along with the <a href="http://www.w3.org/TR/2003/WD-rdf-mt-20030123/"> RDF Semantics [RDF-SEMANTICS] deleted text: working draft this provides an abstract syntax with a formal semantics for it. The RDF Graph graph has <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-node"> Nodes nodes and labeled directed Arcs arcs that link pairs of Nodes nodes and this is represented as a set of <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-rdf-triple"> RDF triples where each triple contains a Subject Node subject node , Property Arc predicate and Object Node object node . Nodes are <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references , <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-literal"> RDF Literals literals or are <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-blank-node"> Blank Nodes blank nodes . Blank Nodes nodes may be given a document-local, non- <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references identifier called a <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-blank-node-id"> Blank Node Identifier blank node identifier . <em> Arcs </em> Predicates are labeled with <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References </a>. The property arc references and can be interpreted as either a relationship between the two nodes or as defining an attribute value (object node) for some subject node.

In order to encode the graph in XML, the nodes and arcs predicates have to be represented by in XML terms — element names, attribute names, element content contents and attribute content. values. RDF/XML uses XML QNames as defined in Namespaces in XML [XML-NS] to represent <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references . The <a href="http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-Prefix"> All QNames have a namespace prefix name part of all QNames which is deleted text: associated with a URI Reference as defined in <a href="http://www.w3.org/TR/1999/REC-xml-names-19990114/"> XML Namespaces </a> <a href="#ref-namespaces"> [XML-NS] reference and a short local name . In addition, QNames can either have a short prefix or be declared with the default namespace declaration and have none (but still have a namespace name)

The <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference represented by a QName is determined by appending the local name part of the QName to the URI Reference associated with after the namespace prefix name (URI reference) part of the QName. This is used to shorten the <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references of all property arcs labels predicates and some nodes. <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references identifying subject and object nodes can also be stored as XML attribute values or XML element names via QNames. <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-literal"> values. RDF Literals </a> (which are literals , which can only be object nodes) nodes, become either XML element text content or XML attribute values.

A graph can be considered a collection of paths of the form Node, Arc, Node, Arc, Node, Arc, node, predicate arc, node, predicate arc, node, predicate arc, ... Node node which cover the entire graph. In RDF/XML these turn into sequences of elements inside elements which alternate between elements for Nodes nodes and Arcs. predicate arcs. This has been called a series of Node/Arc node/arc stripes. The Node node at the start of the sequence turns into the outermost element, the next predicate arc turns into a child element, and so on. The stripes generally start at the top of an RDF/XML document and always begin with nodes.

Several RDF/XML examples are given in the following sections building up to complete RDF/XML documents. Example 7 is the first complete RDF/XML document.

2.2 Node Elements and Property Elements

Graph for RDF/XML Example
Figure 1: Graph for RDF/XML Example ( SVG version )

An RDF Graph graph is given in Figure 1 where the nodes are represented as ovals and contain their <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references where they have them, all the predicate arcs are labeled with <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references and <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-plain-literal"> Plain Literal plain literal nodes have been written in rectangles.

If we follow one Node, Arc node, predicate arc ... , Node node path through the graph shown in Figure 2 :

One Path Through the Graph
Figure 2: One Path Through the Graph ( SVG version )

This The left hand side of the Figure 2 graph corresponds to the Node/Arc node/predicate arc stripes:

  1. Node with <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference http://www.w3.org/TR/rdf-syntax-grammar
  2. Predicate Arc labeled with <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference http://example.org/terms/editor
  3. Node with no <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference
  4. Predicate Arc labeled with <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference http://example.org/terms/homePage
  5. Node with <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference http://purl.org/net/dajobe/

In RDF/XML, the sequence of 5 nodes and predicate arcs in on the left hand side of Figure 2 corresponds to the usage of 5 five XML elements of two types, for the graph nodes and predicate arcs. These are conventionally called Node Elements node elements and Property Elements property elements respectively. In the striping shown in Example 1 , rdf:Description is the node element (used 3 three times for the three nodes) and ex:editor and ex:homePage are the 2 two property elements.

<div style="align:center">
Example 1: Striped RDF/XML ( nodes and predicate arcs )
<rdf:Description>
   <ex:editor>
     <rdf:Description>
       <ex:homePage>
         <rdf:Description>
         </rdf:Description>
       </ex:homePage>
     </rdf:Description>
   </ex:editor>
</rdf:Description>

The Figure 2 graph consists of some nodes that are <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references (and others that are not) and this can be added to the RDF/XML using the rdf:about attribute on node elements to give the result in Example 2 :

<div style="align:center">
Example 2: Node Elements with RDF URI References references added
<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>

Adding the other two paths through the Figure 1 graph to the RDF/XML in Example 2 gives the result in Example 3 (this example fails to show that the blank node is shared between the two paths, see 2.10 ):

<div style="align:center">
Example 3: Complete description of all graph paths
<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>

<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar">
  <ex:editor>
    <rdf:Description>
      <ex:fullName>Dave Beckett</ex:fullName>
    </rdf:Description>
  </ex:editor>
</rdf:Description>

<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar">
  <dc:title>RDF/XML Syntax Specification (Revised)</dc:title>
</rdf:Description>

2.3 Multiple Property Elements

There are several abbreviations that can be used to make common uses easier to write down. In particular, it is common that a subject node in the RDF Graph graph has multiple outgoing predicate arcs. RDF/XML provides an abbreviation for the corresponding syntax when a node element about a resource has multiple property elements. This can be abbreviated by using multiple child property elements inside the node element describing the subject node.

Taking Example 3 , there are two node elements that can take multiple property elements. The subject node with URI Reference reference http://www.w3.org/TR/rdf-syntax-grammar has property elements ex:editor and ex:title and the node element for the blank node can take ex:homePage and ex:fullName . This abbreviation gives the result shown in Example 4 (this example does show that there is a single blank node):

<div style="align:center">
Example 4: Using multiple property elements on a node element
<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>
      <ex:fullName>Dave Beckett</ex:fullName>
    </rdf:Description>
  </ex:editor>
  <dc:title>RDF/XML Syntax Specification (Revised)</dc:title>
</rdf:Description>

2.4 Empty Property Elements

When an a predicate arc in an RDF Graph graph points to an object node which has no further predicate arcs, which appears in RDF/XML as an empty node element deleted text: sequence such as the pair <rdf:Description rdf:about="..."> </rdf:Description> </code>, (or <rdf:Description rdf:about="..." /> ) this form can be shortened. This is done by using the <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference of the object node as the value of an XML attribute rdf:resource on the containing property element and making the property element empty.

In this example, the property element ex:homePage contains an empty node element with the <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference http://purl.org/net/dajobe/ . This can be replaced with the empty property element form giving the result shown in Example 5 :

<div style="align:center">
Example 5: Empty property elements
<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar">
  <ex:editor>
    <rdf:Description>
      <ex:homePage rdf:resource="http://purl.org/net/dajobe/"/>
      <ex:fullName>Dave Beckett</ex:fullName>
    </rdf:Description>
  </ex:editor>
  <dc:title>RDF/XML Syntax Specification (Revised)</dc:title>
</rdf:Description>

2.5 Property Attributes

When a property element's content is string literal, it may be possible to use it as an XML attribute on the containing node element. This can be done for multiple properties on the same node element only if the property element name is not repeated (required by XML - attribute names are unique on an XML element) and any in-scope xml:lang on the property element's string literal (if any) are the same (see Section 2.7 ) This abbreviation is known as a Property Attribute and can be applied to any node element or with the rdf:parseType="Resource" form (see Section 2.11 ).

This abbreviation can also be used when the property element is rdf:type and it has an rdf:resource attribute the value of which is interpreted as a <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference object node.

In Example 5 :, there are two property elements with string literal content, the dc:title and ex:fullName property elements. These can be replaced with property attributes giving the result shown in Example 6 :

<div style="align:center">
Example 6: Replacing property elements with string literal content into property attributes
<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar"
                 dc:title="RDF/XML Syntax Specification (Revised)">
  <ex:editor>
    <rdf:Description ex:fullName="Dave Beckett">
      <ex:homePage rdf:resource="http://purl.org/net/dajobe/"/>
    </rdf:Description>
  </ex:editor>
</rdf:Description>

2.6 Completing the Document - Document: Document Element and XML Declaration

To create a complete RDF/XML document, the serialization of the graph into XML must be contained inside an rdf:RDF XML element which becomes the top-level XML document element. Conventionally the rdf:RDF element is also used to declare the XML namespaces that are used, although that is not required. The XML specification also permits an XML declaration at the top of the document with the XML version and possibly the XML content encoding (this is optional but recommended).

This Completing the RDF/XML could be done for any of the correct complete graph examples from Example 4 onwards but taking the smallest Example 6 and adding the final components, gives a complete RDF/XML representation of the original Figure 1 graph in Example 7 :

<div style="align:center">
Example 7: Complete RDF/XML description of Figure 1 graph ( example07.rdf output example07.nt )
<?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)">
    <ex:editor>
      <rdf:Description ex:fullName="Dave Beckett">
	<ex:homePage rdf:resource="http://purl.org/net/dajobe/" />
      </rdf:Description>
    </ex:editor>
  </rdf:Description>
</rdf:RDF>

2.7 Languages - Languages: xml:lang

RDF/XML permits the use of the xml:lang attribute as defined by 2.12 Language Identification of XML 1.0 [XML] to allow the identification of content language. This The xml:lang attribute can be used on any node element or property element to indicate that the included content is in the given language. Typed literals which includes XML literals are not affected by this attribute. The most specific in-scope language present (if any) is applied to property element string literal content or property attribute values. The xml:lang="" form indicates the absence of a language identifier.

Some examples of marking content languages for RDF properties are shown in Example 8 :

<div style="align:center">
Example 8: Complete example of xml:lang ( example08.rdf output example08.nt )
<?xml version="1.0" encoding="iso-8859-1"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:dc="http://purl.org/dc/elements/1.1/">
  <rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar">
    <dc:title>RDF/XML Syntax Specification (Revised)</dc:title>
    <dc:title xml:lang="en">RDF/XML Syntax Specification (Revised)</dc:title>
    <dc:title xml:lang="en-US">RDF/XML Syntax Specification (Revised)</dc:title>
  </rdf:Description>

  <rdf:Description rdf:about="http://example.org/buchen/baum" xml:lang="de">
    <dc:title>Das Baum</dc:title>
    <dc:description>Das Buch ist außergewöhnlich</dc:description>
    <dc:title xml:lang="en">The Tree</dc:title>
  </rdf:Description>
</rdf:RDF>

2.8 XML Literals - Literals: rdf:parseType="Literal"

RDF allows <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-rdf-XMLLiteral"> XML Literals literals ( [RDF-CONCEPTS] Section 5, XML Content within an RDF Graph graph ) to be given as the object node of arcs. a predicate. These are written in RDF/XML as content of a property element (not a property attribute) and indicated using the rdf:parseType="Literal" attribute on the containing property element.

An example of writing an XML literal is given in Example 9 where there is a single RDF triple with the subject node <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference http://example.org/item01 , the arc label <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> predicate RDF URI Reference reference http://example.org/stuff/1.0/prop (from ex:prop ) and the object node with XML Literal literal content beginning a:Box </code> .

<div style="align:center">
Example 9: Complete example of rdf:parseType="Literal" ( example09.rdf output example09.nt )
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:ex="http://example.org/stuff/1.0/">
  <rdf:Description rdf:about="http://example.org/item01">
    <ex:prop rdf:parseType="Literal"
             xmlns:a="http://example.org/a#"><a:Box required="true">
         <a:widget size="10" />
         <a:grommit id="23" /></a:Box>
    </ex:prop>
  </rdf:Description>
</rdf:RDF>

2.9 Typed Literals - Literals: rdf:datatype

RDF allows <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-typed-literal"> Typed Literals typed literals to be given as the object node of arcs. These a predicate. Typed literals consist of a literal string deleted text: (with optional language) and a datatype <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference . This is handled by These are written in RDF/XML using the same syntax for literal string nodes in the property element form (not property attribute) but with an additional rdf:datatype=" datatypeURI " attribute on the property element. Any <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference can be used in the attribute.

An example of an RDF <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-typed-literal"> Typed Literal typed literal is given in Example 10 where there is a single RDF triple with the subject node <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference http://example.org/item01 , the arc label <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> predicate RDF URI Reference reference http://example.org/stuff/1.0/size (from ex:size ) and the object node with the <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-typed-literal"> Typed Literal typed literal ("123", http://www.w3.org/2001/XMLSchema#int deleted text: </code>, no language <code> xml:lang="" ) deleted text: intending to be interpreted as a <a href="http://www.w3.org/TR/xmlschema-2/#int"> an W3C XML Schema [XML-SCHEMA2] datatype int </a>. int.

<div style="align:center">
Example 10: Complete example of rdf:datatype ( example10.rdf output example10.nt )
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:ex="http://example.org/stuff/1.0/">
  <rdf:Description rdf:about="http://example.org/item01">
    <ex:size rdf:datatype="http://www.w3.org/2001/XMLSchema#int">123</ex:size>
  </rdf:Description>
</rdf:RDF>

2.10 Identifying Blank Nodes - Nodes: rdf:nodeID

<a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-blank-node"> Blank Nodes nodes in the RDF Graph graph are distinct but have no <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference identifier. It is sometimes required that the same graph <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-blank-node"> Blank Node blank node is referred to in the RDF/XML in multiple places, such as at the subject and object of several RDF triples. In this case, a <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-blank-node-id"> Blank Node Identifier blank node identifier can be given to the <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-blank-node"> Blank Node blank node for identifying it in the document. Blank node identifiers in RDF/XML are scoped to the containing XML Information Set Document Information Item document information item . A <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-blank-node-id"> Blank Node Identifier blank node identifier is used on a node element to replace rdf:about=" RDF URI Reference reference " or on a property element to replace rdf:resource=" RDF URI Reference reference " with rdf:nodeID=" <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-blank-node-id"> Blank Node Identifier blank node identifier " in both cases.

Taking Example 7 and explicitly giving a <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-blank-node-id"> Blank Node Identifier blank node identifier of abc to the blank node in it gives the result shown in Example 11 . The second rdf:Description property element is about the blank node.

<div style="align:center">
Example 11: Complete RDF/XML description of graph using rdf:nodeID identifying the blank node ( example11.rdf output example11.nt )
<?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)">
    <ex:editor rdf:nodeID="abc"/>
  </rdf:Description>

  <rdf:Description rdf:nodeID="abc"
                   ex:fullName="Dave Beckett">
    <ex:homePage rdf:resource="http://purl.org/net/dajobe/"/>
  </rdf:Description>
</rdf:RDF>

2.11 Omitting Blank Nodes - Nodes: rdf:parseType="Resource"

<a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-blank-node"> Blank Nodes nodes (not <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference nodes) in RDF Graphs graphs can be written in a form that allows the <rdf:Description> </rdf:Description> pair to be omitted. This can be The omission is done by putting an rdf:parseType="Resource" attribute on the containing property element that turns the property element into a property and node property-and-node element, which can itself have both property elements and property attributes. Property attributes and the rdf:nodeID attribute are not permitted on such property property-and-node elements.

Taking the earlier Example 7 , the contents of the ex:editor property element could be alternatively done in this fashion to give the form shown in Example 12 :

<div style="align:center">
Example 12: Complete example using rdf:parseType="Resource" ( example12.rdf output example12.nt )
<?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)">
    <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>

2.12 Omitting Nodes - Nodes: Property Attributes on an empty Property Element

If all of the property elements on a blank node element have string literal values with the same in-scope xml:lang value (if present) and each of these property elements appears at most once and there is at most one rdf:type property element with a <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference object node, these can be abbreviated by moving them to be property attributes on the containing property element which is made an empty element.

Taking the earlier Example 5 , the ex:editor property element contains a blank node element with two property elements ex:fullname and ex:homePage . ex:homePage is not suitable here since it does not have a string literal value, so it is being ignored </em>. for the purposes of this example. The abbreviated form moves removes the ex:fullName property element to be and adds a new property attribute deleted text: on the ex:editor ex:fullName with the string literal value of the deleted property element and to the ex:editor property element. The blank node element becomes implicit. implicit in the now empty ex:editor property element. The result is shown in Example 13 .

<div style="align:center">
Example 13: Complete example of property attributes on an empty property element ( example13.rdf output example13.nt )
<?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)">
    <ex:editor ex:fullName="Dave Beckett" />
    <!-- Note the ex:homePage property has been ignored for this example -->
  </rdf:Description>
</rdf:RDF>

2.13 Typed Node Elements

It is common for RDF Graphs graphs to have rdf:type arcs predicates from subject nodes. These are conventionally called Typed Nodes typed nodes in the graph, or Typed Node Elements typed node elements in the RDF/XML. RDF/XML allows this triple to be expressed more concisely. by replacing the rdf:Description node element name with the namespaced-element corresponding to the <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference of the value of the type relationship. There may, of course, be multiple rdf:type arcs predicates but only one can be used in this way, the others must remain as property elements or property attributes.

This form is also The typed node elements are commonly used in RDF/XML with the built-in classes in the deleted text: The RDF Namespace vocabulary : rdf:Seq , rdf:Bag , rdf:Alt , rdf:Statement , rdf:Property and rdf:List .

For example, the RDF/XML in Example 14 could be written as shown in Example 15 .

<div style="align:center">
Example 14: Complete example with rdf:type ( example14.rdf output example14.nt )
<?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://example.org/thing">
    <rdf:type rdf:resource="http://example.org/stuff/1.0/Document"/>
    <dc:title>A marvelous thing</dc:title>
  </rdf:Description>
</rdf:RDF>

<div style="align:center">
Example 15: Complete example using a Typed Node Element typed node element to replace an rdf:type ( example15.rdf output example15.nt )
<?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/">
  <ex:Document rdf:about="http://example.org/thing">
    <dc:title>A marvelous thing</dc:title>
  </ex:Document>
</rdf:RDF>

2.14 Abbreviating URIs - URIs: rdf:ID and xml:base

RDF/XML allows further abbreviating <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references in XML attributes in two ways. The XML Infoset provides a base URI attribute xml:base that sets the base URI for resolving relative <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references , otherwise the base URI is that of the document. This The base URI applies to all RDF/XML attributes that deal with <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references which are rdf:about , rdf:resource , rdf:ID deleted text: </code>, <code> rdf:bagID and rdf:datatype .

The rdf:ID attribute on a node element (not property element, that has another meaning) can be used instead of rdf:about and gives a relative <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference equivalent to # concatenated with the rdf:ID attribute value. So for example if rdf:ID="name" , that would be equivalent to rdf:about="#name" . This rdf:ID provides an additional check since the same name can only appear once in the scope of an xml:base value (or document, if none is given), so is useful for defining a set of distinct, related terms relative to the same <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference .

Both forms require a base URI to be known, either from an in-scope xml:base or from the URI of the RDF/XML document.

Example 16 shows abbreviating the node <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference of http://example.org/here/#snack using an xml:base of http://example.org/here/ and an rdf:ID on the rdf:Description node element. The object node of the ex:prop arc predicate is an absolute <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference resolved from the rdf:resource XML attribute content value using the in-scope base URI to give the <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference http://example.org/here/fruit/apple .

<div style="align:center">
Example 16: Complete example using rdf:ID and xml:base for shortening URis URIs ( example16.rdf output example16.nt )
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:ex="http://example.org/stuff/1.0/"
         xml:base="http://example.org/here/">
  <rdf:Description rdf:ID="snack">
    <ex:prop rdf:resource="fruit/apple"/>
  </rdf:Description>
</rdf:RDF>

2.15 Container membership property elements - Membership Property Elements: rdf:li and rdf:_ n

RDF has a set of container membership properties and corresponding property elements that are mostly used with instances of the rdf:Seq , rdf:Bag and rdf:Alt classes which may be written as typed node elements. The list properties are rdf:_1 , rdf:_2 etc. and can be written as property elements or property attributes as shown in Example 17 . There is an rdf:li special property element that is equivalent to rdf:_1 , rdf:_2 in order, explained in detail in section 7.4 . The mapping to the container membership properties is always done in the order that the rdf:li special property elements appear in XML — the document order is significant. The equivalent RDF/XML to Example 17 written in this form is shown in Example 18 .

<div style="align:center">
Example 17: Complex example using RDF list properties ( example17.rdf output example17.nt )
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Seq rdf:about="http://example.org/favourite-fruit">
    <rdf:_1 rdf:resource="http://example.org/banana"/>
    <rdf:_2 rdf:resource="http://example.org/apple"/>
    <rdf:_3 rdf:resource="http://example.org/pear"/>
  </rdf:Seq>
</rdf:RDF>
<div style="align:center">
Example 18: Complete example using rdf:li property element for list properties ( example18.rdf output example18.nt )
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Seq rdf:about="http://example.org/favourite-fruit">
    <rdf:li rdf:resource="http://example.org/banana"/>
    <rdf:li rdf:resource="http://example.org/apple"/>
    <rdf:li rdf:resource="http://example.org/pear"/>
  </rdf:Seq>
</rdf:RDF>

2.16 Collections - Collections: rdf:parseType="Collection"

RDF/XML allows an rdf:parseType="Collection" attribute on a property element to let it contain multiple node elements. These contained node elements give the set of subject nodes of the collection. This syntax form corresponds to a set of triples connecting the collection of subject nodes, the exact triples generated are described in detail in Section 7.2.19 Production parseTypeCollectionPropertyElt . The collection construction is always done in the order that the node elements appear in the XML document. Whether the order of the collection of nodes is significant is an application issue and not defined here.

Example 19 shows a collection of three nodes elements at the end of the ex:hasFruit property element using this form.

<div style="align:center">
Example 19: Complete example of a RDF collection of nodes using rdf:parseType="Collection" ( example19.rdf output example19.nt )
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:ex="http://example.org/stuff/1.0/">
  <rdf:Description rdf:about="http://example.org/basket">
    <ex:hasFruit rdf:parseType="Collection">
      <rdf:Description rdf:about="http://example.org/banana"/>
      <rdf:Description rdf:about="http://example.org/apple"/>
      <rdf:Description rdf:about="http://example.org/pear"/>
    </ex:hasFruit>
  </rdf:Description>
</rdf:RDF>

2.17 Reifying Statements - <code> rdf:bagID </code> and Statements: rdf:ID

The rdf:ID attribute can be used on a property element to reify the triple that it generates (See section 7.3 Reification Rules for the full details). The identifier for the triple should be constructed as a <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference made from the relative URI Reference reference # concatenated with the rdf:ID attribute value, resolved against the in-scope base URI. So for example if rdf:ID="triple" , that would be equivalent to the <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference formed from relative URI Reference reference #triple against the base URI. Each ( rdf:ID attribute value, base URI) pair has to be unique in an RDF/XML document and comes from the same set of values as the <code> rdf:bagID </code> attribute. See document, see constraint-id .

Example 20 shows a rdf:ID being used to reify a triple made from the ex:prop property element giving the reified triple the <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference http://example.org/triples/#triple1 .

<div style="align:center">
Example 20: Complete example of rdf:ID reifying a property element ( example20.rdf output example20.nt )
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:ex="http://example.org/stuff/1.0/"
         xml:base="http://example.org/triples/">
  <rdf:Description rdf:about="http://example.org/">
    <ex:prop rdf:ID="triple1">blah</ex:prop>
  </rdf:Description>
</rdf:RDF>

<p> The <code> rdf:bagID </code> attribute can be used on a node element or empty property element with property attributes,

3 Terminology

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to give an identifier be interpreted as described in RFC 2119 [KEYWORDS] .

4 RDF MIME Type, File Extension and Macintosh File Type

The Internet media type / MIME type for an RDF/XML is " rdf:Bag application/rdf+xml that lists " — see RFC 3032 [RFC-3023] section 8.18.

Registration Note (Informative): For the reifications state of the statements generated by the property elements or attributes. This allows statements to be made about MIME type registration, consult IANA MIME Media Types [ [IANA-MEDIA-TYPES]

It is recommended that bag. The identifier RDF/XML files have the extension ".rdf" (all lowercase) on all platforms.

It is constructed as recommended that RDF/XML files stored on Macintosh HFS file systems be given a relative <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference </a> file type of # "rdf " concatenated (all lowercase, with a space character as the fourth letter).

5 Global Issues

5.1 The RDF Namespace and Vocabulary

Note (Informative): The names rdf:bagID aboutEach attribute value, resolved against the in-scope base URI to give an <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference </a>. So for example if and rdf:bagID="bag" </code>, that would be equivalent to aboutEachPrefix were removed from the <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference </a> formed from relative URI Reference <code> #bag </code> against language and the base URI. Each ( <code> rdf:bagID </code> attribute value, base URI) has to be unique in RDF vocabulary by the RDF/XML document and from RDF Core Working Group. See the same set resolution of names as <code> rdf:ID </code>. See <a href="#constraint-id"> constraint-id </a>. issues rdfms-abouteach and rdfms-abouteachprefix for further information.

<a href="#example21"> Example 21 </a> shows a Note (Informative): The names rdf:Bag List , first , rest with <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference </a> and http://example.org/bags/#bag1 nil being made of the triples from inside the were added for issue rdfms-seq-representation . The names rdf:Description XMLLiteral node element. </p> <div class="exampleOuter"> <div style="align:center"> <a id="example21" name="example21"> Example 21: Complete example of and rdf:bagID datatype describing triples from a node element </a> ( <a href="example21.rdf"> example21.rdf </a> output <a href="example21.nt"> example21.nt were added to support RDF datatyping. The name nodeID was added for issue rdfms-syntax-incomplete . See the RDF Core Issues List ) </div> <div class="exampleInner"> <pre> <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ex="http://example.org/stuff/1.0/" xml:base="http://example.org/bags/"> <rdf:Description rdf:about="http://example.org/" rdf:bagID="bag1"> <ex:prop1>blah</ex:prop1> <ex:prop2 rdf:resource="http://example.org/elsewhere/"/> </rdf:Description> </rdf:RDF> for further information.

deleted text: </pre>
deleted text: </div> <h3> <a id="section-Syntax-more" name="section-Syntax-more"> 2.18 More Information </a> (Informative) </h3>

The RDF Core Working Group has developed an <a href="http://www.w3.org/TR/2003/WD-rdf-primer-20030123/"> RDF Primer </a> <a href="#ref-rdfprimer"> [RDF-PRIMER] namespace URI reference that goes into detail introducing RDF (or namespace name) is http://www.w3.org/1999/02/22-rdf-syntax-ns# and its applications. </p> <p> For a longer introduction to the RDF/XML <em> striped </em> syntax is typically used in XML with deleted text: 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> <h2> <a id="section-Terminology" name="section-Terminology"> 3 Terminology </a> </h2> <p> The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to prefix rdf although other prefix strings may be interpreted as described in <a href="http://www.ietf.org/rfc/rfc2119.txt"> RFC 2119 </a> <a href="#ref-keywords"> [KEYWORDS] </a>. </p> <h2> used. The <a id="section-MIME-Type" name="section-MIME-Type"> 4 RDF MIME type, file extension and Macintosh file type Vocabulary </h2> <p> The Internet Media Type / MIME type for RDF is " <code> application/rdf+xml </code> " - see <a href="http://www.ietf.org/rfc/rfc3023.txt"> RFC 3032 </a> ( <a href="#ref-rfc3023"> RFC-3023 </a> ) section 8.18. </p> <div class="note"> <p> <strong> Registration Note: </strong> The RDF Core Working Group will register this type with the IETF after identified by this document has passed the Working Draft state, possibly after <a href="http://www.w3.org/Consortium/Process/Process-19991111/tr.html#RecsW3C"> Recommendation </a>, using the <cite> application/rdf+xml Media Type Registration </cite> Internet Draft <a href="#ref-rdf-mimetype-id"> [RDF-MIMETYPE-ID] </a> already published namespace name and maintained. consists of the following names only:

</div>
Syntax names — not concepts

deleted text: It is recommended that RDF files have the extension ".rdf" RDF Description ID about parseType resource li nodeID datatype deleted text: (all lowercase) on all platforms.

Class names

deleted text: It is recommended that RDF files stored on Macintosh HFS file systems be given a file type of "rdf " Seq Bag Alt Statement Property XMLLiteral List deleted text: (all lowercase, with a space character as the fourth letter).

<h2> <a id="section-Global" name="section-Global"> 5 Global Issues </a> </h2> <h3> <a id="section-Namespace" name="section-Namespace"> 5.1 The RDF Namespace </a> </h3> <div class="note"> <p> <strong> Note: </strong> The
Property names

aboutEach </code> and <code> aboutEachPrefix </code> were removed from the language and the RDF namespace by the RDF Core Working Group. See the resolution of issues <a href="http://www.w3.org/2000/03/rdf-tracking/#rdfms-abouteach"> rdfms-abouteach </a> and <a href="http://www.w3.org/2000/03/rdf-tracking/#rdfms-abouteachprefix"> rdfms-abouteachprefix </a> for further information. </p> </div> <div class="note"> <p> <strong> Note: </strong> The names <code> List </code>, <code> first </code>, <code> rest </code> and <code> nil </code> were added for issue <a href="http://www.w3.org/2000/03/rdf-tracking/#rdfms-seq-representation"> rdfms-seq-representation </a>. The names <code> XMLLiteral </code> and <code> datatype </code> were added to support RDF datatyping. The name <code> nodeID </code> was added for issue <a href="http://www.w3.org/2000/03/rdf-tracking/#rdfms-syntax-incomplete"> rdfms-syntax-incomplete </a>. See the <a href="http://www.w3.org/2000/03/rdf-tracking/"> RDF Core Issues List </a> for further information. </p> </div> <div class="note"> <p> <strong> Note: </strong> The Working Group invites feedback from the community on the effects of the removals and additions of these terms on existing implementations and documents and on the costs and benefits of adopting a new namespace URI to reflect this change (currently not proposed by the Working Group). </p> </div> <p> The <span class="termdef"> <a id="rdf-ns-uri" name="rdf-ns-uri"> RDF Namespace URI Reference </a> </span> is <code> http://www.w3.org/1999/02/22-rdf-syntax-ns# </code> and is typically used in XML with the prefix <code> rdf </code> although other prefix strings may be used. The namespace contains the following names only: </p> <dl> <dt> Syntax names - not concepts </dt> <dd> <p> <code> RDF Description ID about bagID parseType resource li nodeID datatype </code> </p> </dd> <dt> Class names </dt> <dd> <p> <code> Seq Bag Alt Statement Property XMLLiteral List </code> </p> </dd> <dt> Property names </dt> <dd> <p> <code> subject predicate object type value first rest _ subject predicate object type value first rest _ n
where n is a decimal integer greater than zero with no leading zeros.

Resource names

nil

Any other names are not defined and SHOULD generate a warning when encountered, but should otherwise behave normally.

Within RDF/XML documents it is not permitted to use XML namespaces whose namespace URI name is deleted text: either: </p> <ul> <li> the · RDF Namespace namespace URI Reference reference · concatenated with additional characters. <strong> or </strong> </li> <li> the <a href="http://www.w3.org/TR/REC-xml-names/#nsc-NSDeclared"> XML Namespace URI reference </a> concatenated with additional characters. </li> </ul>

Throughout this document the terminology rdf: name will be used to indicate name is from the RDF namespace vocabulary and it has a <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference of the concatenation of the · RDF Namespace namespace URI Reference reference · and name . For example, rdf:type has the <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference http://www.w3.org/1999/02/22-rdf-syntax-ns#type

5.2 Identifiers

The <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-rdf-graph"> RDF Graph ( <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/"> RDF Concepts and Abstract Syntax Section 3) defines three types of nodes and one type of arc: predicate:

<a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference nodes and arcs predicates

<a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references ( <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/"> RDF Concepts and Abstract Syntax Section 3.1) can be either either:

Within RDF/XML, XML QNames are transformed into <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references by appending the XML local name to the namespace URI. name (URI reference). For example, if the XML Namespace namespace prefix foo has URI namespace name (URI reference) http://example.org/somewhere/ then the QName foo:bar would correspond to the RDF URI reference http://example.org/somewhere/bar . Note that this restricts which <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references can be made and the same URI can be given in multiple ways.

The rdf:ID deleted text: and <a href="#bagIdAttr"> <code> rdf:bagID </code> </a> values are transformed into an <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references by appending the attribute value to the result of appending "#" to the in-scope base URI which is defined in Section 5.3 Resolving URIs

Literal nodes (always object nodes)

<a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-literal"> RDF Literals literals ( <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/"> RDF Concepts and Abstract Syntax 6.5) are either <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-plain-literal"> Plain Literals plain literals (ibid), or <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-typed-literal"> Typed Literals typed literals (ibid). The latter includes <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-rdf-XMLLiteral"> XML Literals literals (ibid section 5, XML Content within an RDF Graph graph ).

Blank Node Identifiers

<a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-blank-node"> Blank Nodes nodes have distinct identity in the RDF Graph. graph. When the graph is written in a syntax such as RDF/XML, these blank nodes may need graph-local identifiers and a syntax in order to preserve this distinction. These local identifiers are called <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-blank-node-id"> Blank Node Identifiers blank node identifiers and are used in RDF/XML as values of the rdf:nodeID attribute with the syntax given in Production nodeIdAttr . Blank node identifiers in RDF/XML are scoped to the XML Information Set Document Information Item document information item .

These identifiers may also be generated If no blank node identifier is given explicitly as part of the mapping from the RDF/XML an rdf:nodeID attribute value then one will need to the graph for new distinct blank nodes. be generated (using generated-blank-node-id, see section 6.3.3 ). Such generated blank node identifiers must not clash with any blank node identifiers derived from rdf:nodeID attribute values. This can be implemented by any method that preserves the distinct identity of all the blank nodes in the graph. graph, that is, the same blank node identifier is not given for different blank nodes. One possible method would be to add a constant prefix to all the rdf:nodeID attribute values and ensure no generated blank node identifiers ever used that prefix. Another would be to map all rdf:nodeID attribute values to new generated blank node identifiers and perform that mapping on all such values in the RDF/XML document.

5.3 Resolving URIs

RDF/XML supports XML Base [XML-BASE] which defines a · base-uri · accessor for each · root event · and · element event · . Relative URI References references are resolved into <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references according to the algorithm specified in XML Base [XML-BASE] (and RFC 2396). These specifications do not specify an algorithm for resolving a fragment identifier alone, such as #foo , or the empty string "" into an <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference . In RDF/XML, a fragment identifier is transformed into a <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference by appending the fragment identifier to the in-scope base URI. The empty string is transformed into an <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference by substituting the in-scope base URI.

Test: Indicated by test001.rdf and test001.nt

Test: Indicated by test004.rdf and test004.nt

Test: Indicated by test008.rdf and test008.nt

Test: Indicated by test013.rdf and test013.nt

Test: Indicated by test016.rdf and test016.nt

An empty same document reference "" resolves against the URI part of the Base base URI; any fragment part is ignored. See Uniform Resource Identifiers (URI) [URIS] section 4.2

Test: Indicated by test013.rdf and test013.nt

Implementor Note: Implementation Note (Informative): When using a hierarchical base URI that has no path component (/), it must be added before using as a base URI for resolving.

Test: Indicated by test011.rdf and test011.nt

5.4 Constraints

constraint-id

Each application of productions production idAttr and <a href="#bagIdAttr"> bagIdAttr </a> match matches an attribute. The pair formed by the · string-value · accessor of the matched attribute and the · base-uri · accessor of the matched attribute is unique within a single RDF/XML document.

The syntax of the names must match the rdf-id production </a> .

Test: Indicated by test014.rdf and test014.nt

<h2> <a id="section-Data-Model" name="section-Data-Model"> 6 Syntax Data Model

5.5 Conformance </h2> <p> This document specifies the syntax of RDF/XML as a grammar on an

Definition:
An RDF Document is a serialization of an RDF Graph into a concrete syntax.
Definition:
An RDF/XML Document is an RDF Document written in the recommended XML transfer syntax for RDF as defined in this document.
Conformance:
An RDF/XML Document is a conforming RDF/XML document if it adheres to the specification defined in this document.

6 Syntax Data Model

This document specifies the syntax of RDF/XML as a grammar on an alphabet of symbols. The symbols are called Events events in the style of the [XPATH]   Information Set Mapping . A sequence of events is normally derived from an XML document, in which case they are in document order as defined below in Section 6.2 Information Set Mapping . This The sequence of these events formed form are intended to be similar to the sequence of events produced by the [SAX2] XML API from the same XML document. Sequences of events may be checked against the grammar to determine whether they are or are not syntactically well formed well-formed RDF/XML.

The grammar productions may include actions which fire when the production is recognised. recognized. Taken together these actions define a transformation from any syntactically well formed well-formed RDF/XML sequence of events into an RDF Graph graph represented in the <a href="http://www.w3.org/TR/2003/WD-rdf-testcases-20030123/#ntriples"> N-Triples language.

This The model given here illustrates one way to create a representation of an <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-rdf-graph"> RDF Graph from an RDF/XML document. It does not mandate any implementation method - any other method that results in a representation of the same <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-rdf-graph"> RDF Graph may be used.

In particular:

The syntax does not support non-well-formed XML documents, nor documents that otherwise do not have an XML Information Set; for example, that do not conform to deleted text: XML Namespaces in XML [XML-NS] .

The Infoset requires support for XML Base [XML-BASE] . RDF/XML uses the information item property [base URI], discussed in section 5.3

This specification requires an XML Information Set [INFOSET] which supports at least the following information items and properties for RDF/XML:

Document Information Item document information item
[document element], [children], [base URI]
Element Information Item element information item
[local name], [namespace name], [children], [attributes], [parent], [base URI]
Attribute Information Item attribute information item
[local name], [namespace name], [normalized value]
Character Information Item character information item
[character code]

There is no mapping of the following items to data model events:

Processing Instruction Information Item processing instruction information item
Unexpanded Entity Reference Information Item unexpanded entity reference information item
Comment Information Item comment information item
Document Type Declaration Information Item document type declaration information item
Unparsed Entity Information Item unparsed entity information item
Notation Information Item notation information item
Namespace Information Item namespace information item

Other information items and properties have no mapping to syntax data model events.

Information Element information items contained inside with reserved XML elements matching the <a href="#parseTypeLiteralPropertyElt"> parseTypeLiteralPropertyElt Names (See Name production form <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-rdf-XMLLiteral"> in XML Literals 1.0 and do ) are not follow this mapping. See <a href="#parseTypeLiteralPropertyElt"> parseTypeLiteralPropertyElt </a> for further information. </p> <p> This section is intended mapped to satisfy the data model element events. These are all those with property [prefix] beginning with xml (case independent comparison) and all those with [prefix] property having no value and which have [local name] beginning with xml (case independent comparison).

All information items contained inside XML elements matching the parseTypeLiteralPropertyElt production form XML literals and do not follow this mapping. See parseTypeLiteralPropertyElt for further information.

This section is intended to satisfy the requirements for Conformance in the [INFOSET] specification. It specifies the information items and properties that are needed to implement this specification.

6.1 Events

There are six nine types of event defined in the following subsections. Most events are constructed from an Infoset information item (except for Identifier URI reference , blank node , Plain Literal plain literal and Typed Literal typed literal ). The effect of an event constructor is to create a new event with a unique identity, distinct from all other events. Events have accessor operations on them. them and all most have the string-value accessor that may be a static value or computed.

6.1.1 Root Event

Constructed from a Document Information Item document information item and takes the following accessors and values.

document-element
Set to the value of document information item property document-element. [document-element].
children
Set to the value of document information item property [children].
base-uri
Set to the value of document information item property [base URI].
language
Set to the empty string.

6.1.2 Element Event

Constructed from an Element Information Item element information item and takes the following accessors and values:

local-name
Set to the value of element information item property [local name].
namespace-name
Set to the value of element information item property [namespace name].
children
Set to the value of element information item property [children].
base-uri
Set to the value of element information item property [base URI].
attributes

Set to Made from the value of element information item property [attributes]. [attributes] which is a set of attribute information items.

If the value this set contains an attribute event information item xml:lang (that is, the <a href="#eventterm-attribute-local-name" class="termref"> <span class="arrow"> · </span> local-name <span class="arrow"> · </span> </a> accessor of ( [namespace name] property with the deleted text: attribute has value "lang" "http://www.w3.org/XML/1998/namespace" and the <a href="#eventterm-attribute-namespace-name" class="termref"> <span class="arrow"> · </span> namespace-name <span class="arrow"> · </span> </a> accessor of the attribute has [local name] property value "http://www.w3.org/XML/1998/namespace"), "lang") it is removed from the list set of attributes attribute information items and the · language · accessor is set to the string-value [normalized-value] property of the attribute. attribute information item.

All other attributes remaining reserved XML Names (See Name in XML 1.0 ) are now removed from the set. These are, all attribute information items in the set with property [prefix] beginning with xml are then removed (that is, (case independent comparison) and all attributes attribute information items with <a href="#eventterm-attribute-namespace-name" class="termref"> <span class="arrow"> · </span> namespace-name <span class="arrow"> · </span> </a> accessors values [prefix] property having no value and which have [local name] beginning with "http://www.w3.org/XML/1998/namespace"). Note: xml (case independent comparison) are removed. Note that the base URI [base URI] accessor is computed by XML Base before any xml:base attribute information item is deleted.

</dd> <dt> <span class="termdef"> <a id="eventterm-element-URI" name="eventterm-element-URI"> URI </a> </span> <br />

The remaining set of attribute information items are then used to construct a new set of Attribute Events which is assigned as the value of this accessor.

URI
Set to the string value of the concatenation of the value of the namespace-name accessor and the value of the local-name accessor.
li-counter
Set to the integer value 1.
deleted text: <a id="eventterm-element-bag-li-counter" name="eventterm-element-bag-li-counter"> bag-li-counter </a> </span> <br /> </dt> <dd> set to the integer value 1. </dd> <dt> <span class="termdef"> language
Set from the · attributes · as described above. If no value is given from the attributes, the value is set to the value of the language accessor on the parent event (either a Root Event or an Element Event ), which may be the empty string.
subject
Has no initial value. Takes a value that is an Identifier event. This accessor is used on elements that deal with one node in the RDF Graph, graph, this generally being the subject of a statement.

6.1.3 End Element Event

Has no accessors. Marks the end of the containing element in the sequence.

6.1.4 Attribute Event

Constructed from an Attribute Information Item attribute information item and takes the following accessors and values:

local-name
Set to the value of attribute information item property [local name].
namespace-name
Set to the value of attribute information item property [namespace name].
string-value
set Set to the value of the attribute information item property [normalized value] as specified by [XML] (if an attribute whose normalized value is a zero-length string, then the string-value is also a zero-length string).
URI

If · namespace-name · is present, set to a string value of the concatenation of the value of the · namespace-name · accessor and the value of the · local-name · accessor. Otherwise if · local-name · is ID , deleted text: bagID </code>, <code> about , resource , parseType or type , set to a string value of the concatenation of the · RDF Namespace namespace URI Reference reference · and the value of the · local-name · accessor. Other non-namespaced · local-name · accessor values are forbidden.

This The support for a limited set of non-namespaced names is REQUIRED and intended to allow RDF/XML documents specified in [RDF-MS] to remain valid; new documents SHOULD NOT use these unqualified attributes and applications MAY choose to warn when the unqualified form is seen in a document.

The construction of <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references from XML attributes can generate the same <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references from different XML attributes. This can cause ambiguity in the grammar when matching attribute events (such as when rdf:about and about XML attributes are both present). Documents that have this are illegal.

6.1.5 Text Event

Constructed from a sequence of one or more consecutive Character Information Items character information items . Has the single accessor:

string-value
Set to the value of the string made from concatenating the [ character code ] property of each of the character information items.

6.1.6 URI Reference Event

An event for a <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references which has the following accessors:

identifier
Takes a string value.
string-value

The value is the concatenation of "<", the value of the · identifier · accessor and ">"

The <>-quoted · identifier · accessor value must use the N-Triples escapes for URI references as described in 3.3 URI References .

These events are constructed by giving a value for the · identifier · accessor.

For further information on identifiers in the RDF Graph, graph, see section 5.2 .

6.1.7 Blank Node Identifier Event

An event for a <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-blank-node-id"> Blank Node Identifier blank node identifier which has the following accessors:

identifier
Takes a string value.
string-value
The value is the concatenation a function of deleted text: "_:" and the value of the · identifier · accessor. The value begins with "_:" and the entire value MUST match the N-Triples nodeID production. The function MUST preserve distinct blank node identity as discussed in in section 5.2 Identifiers .

These events are constructed by giving a value for the · identifier · accessor.

For further information on identifiers in the RDF Graph, graph, see section 5.2 .

6.1.8 Plain Literal Event

An event for a <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-plain-literal"> Plain Literal plain literal which can have the following accessors:

literal-value
Takes a string value.
literal-language
Takes a string value.
string-value

The value is calculated from the other accessors as follows.

If · literal-language · is the empty string then the value is the concatenation of """ (1 double quote), the value of the 2 · literal-value · accessor and """ (1 double quote).

Otherwise the value is the concatenation of """ (1 double quote), the value of the · literal-value · accessor ""@" (1 double quote and a '@'), and the value of the · literal-language · accessor.

Note that the The double-quoted · literal-value · string accessor value must use the N-Triples <a href="http://www.w3.org/TR/2003/WD-rdf-testcases-20030123/#ntrip_strings"> string escapes for strings as described in 3.2 Strings for escaping certain characters such as ".

These events are constructed by giving values for the · literal-value · and · literal-language · accessors.

Note: Interoperability Note (Informative): Literals beginning with a Unicode combining character are allowed however they may cause interoperability problems. See [CHARMOD] for further information.

6.1.9 Typed Literal Event

An event for a <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-typed-literal"> Typed Literal typed literal which can have the following accessors:

literal-value
Takes a string value.
deleted text: <a id="eventterm-xmlliteral-literal-language" name="eventterm-xmlliteral-literal-language"> </a> <span class="termdef"> <a id="eventterm-typedliteral-literal-language" name="eventterm-typedliteral-literal-language"> literal-language </a> </span> <br /> </dt> <dd> Takes a string value. </dd> <dt> literal-datatype
Takes a string value used as an absolute URI reference..
string-value

The value is deleted text: calculated from the other accessors as follows. </p> <p> If <a href="#eventterm-typedliteral-literal-language" class="termref"> concatenation of the following in this order """ (1 double quote), the value of the · literal-language literal-value · is the empty string then the value is the concatenation of accessor, """ (1 double quote), "^^<", the value of the <a href="#eventterm-typedliteral-literal-value" class="termref"> · literal-value literal-datatype · accessor and """ (1 double quote). ">".

Otherwise the value is the concatenation of """ (1 double quote), the value of the The double-quoted · literal-value · accessor deleted text: ""@" (1 double quote and a '@') and the value of must use the <a href="#eventterm-typedliteral-literal-language" class="termref"> <span class="arrow"> · </span> literal-language <span class="arrow"> · </span> N-Triples accessor. </p> <p> Finally, if <a href="#eventterm-typedliteral-literal-datatype" class="termref"> <span class="arrow"> · </span> literal-datatype <span class="arrow"> · </span> escapes for strings as described in 3.2 Strings is not empty then append to the value calculated above "^^<" concatenated with the value of the for escaping certain characters such as ". The <>-quoted · literal-datatype · accessor concatenated with ">". </p> <p> Note that the double-quoted literal-value string value must use the N-Triples deleted text: <a href="http://www.w3.org/TR/2003/WD-rdf-testcases-20030123/#ntrip_strings"> string escapes escapes for escaping certain characters such URI references as ". described in 3.3 URI References .

These events are constructed by giving values for the · literal-value · deleted text: </a>, <a href="#eventterm-typedliteral-literal-language" class="termref"> <span class="arrow"> · </span> literal-language <span class="arrow"> · </span> and · literal-datatype · accessors.

Note: Interoperability Note (Informative): Literals beginning with a Unicode combining character are allowed however they may cause interoperability problems. See [CHARMOD] for further information.

Implementation Note (Informative): In XML Schema (part 1) [XML-SCHEMA1] , white space normalization occurs during validation according to the value of the whiteSpace facet. The syntax mapping used in this document occurs after this, so the whiteSpace facet formally has no further effect.

6.2 Information Set Mapping

To transform the Infoset into the sequence of events in document order , each information item is transformed as described above to generate a tree of events with accessors and values. Each element event is then replaced as described below to turn the tree of events into a sequence in document order.

  1. The original element event
  2. The value of the children accessor recursively transformed, a possibly empty ordered list of events.
  3. An end element event

6.3 Grammar Notation

The following notation is used for to describe matching the sequence of data model events deleted text: generated as described given in Section 6 and deleted text: describing the actions to perform for the matches. The RDF/XML grammar is defined deleted text: here in terms of its mapping from these matched data model events, events to triples, using statements notation of the form:

number event-type event-content

action ...

<a href="http://www.w3.org/TR/2003/WD-rdf-testcases-20030123/#ntriples"> N-Triples

where the event-content is an expression, which may refer to other expression matching event-types (as defined in Section 6.1 ), using constructs of the form notation given in the following table. sections. The number is used for reference purposes. The grammar action may include generating new triples to the graph, written in <a href="http://www.w3.org/TR/2003/WD-rdf-testcases-20030123/#ntriples"> N-Triples format.

<table border="1" summary="This table describes the notation used in the following sections to match sequences of events and perform grammar actions."> <caption> Notation

The following sections describe the general notation used and that for event matching deleted text: events and deleted text: grammar actions. </caption> <tr> <th colspan="2">

6.3.1 Grammar General Notation </th> </tr>

<tr> <th colspan="2">
Grammar General Notation.
Notation Meaning
event . accessor The value of an event accessor.
rdf: X A URI as defined in section 5.1 .
"ABC" A Unicode string of characters A, B, C in order.

6.3.2 Grammar Event Matching Notation for

<tr> <th colspan="2"> Notation for
Grammar Event Matching Events </th> </tr> Notation.
Notation Meaning
A == B Event accessor A is equal to matches expression B.
A != B A is not equal to B.
A | B | ... The A, B, ... terms are alternatives.
A - B The term terms in A but not excluding all the term terms in B.
anyURI . Any URI.
anyString . Any string.
list(item1, item2, ...); list() An ordered list of events. An empty list.
set(item1, item2, ...); set() An unordered set of events. An empty set.
* Zero or more of preceding term.
? Zero or one of preceding term.
+ One or more of preceding term.
root(acc1 == value1,
    acc2 == value2, ...)
Match a Root Event with accessors.
start-element(acc1 == value1,
    acc2 == value2, ...)
children
end-element()
Match a sequence of Element Event with accessors, a possibly empty list of events as element content and an End Element Event .
attribute(acc1 == value1,
    acc2 == value2, ...)
Match an Attribute Event with accessors.
text() Match a Text Event .

6.3.3 Grammar Actions </th> </tr> Action Notation

Grammar Action Notation.
Notation Meaning
A := B Assigns A the value B.
concat(A, B, ..) A string created by concatenating the terms in order.
resolve( e , s ) A string created by interpreting s as a relative URI reference to the · base-uri · accessor of · Element Event · e as defined in Section 5.3 Resolving URIs . The resulting string represents an <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI Reference reference .
generated-blank-node-id() A string value for a new distinct generated <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-blank-node-id"> Blank Node Identifier blank node identifier as defined in section 5.2 Identifiers .
event . accessor := value Sets an event accessor to the given value.
uri(identifier := value) Create a new URI Reference Event .
bnodeid(identifier := value) Create a new Blank Node blank node Identifier Event . See also section 5.2 Identifiers .
literal(literal-value := string,
    literal-language := language, ...)
Create a new Plain Literal Event .
typed-literal(literal-value := string, deleted text: <br />     literal-language := language, ...) Create a new Typed Literal Event .

7 RDF/XML Grammar

7.1 Grammar summary

7.2.2 coreSyntaxTerms rdf:RDF | rdf:ID | rdf:about | deleted text: rdf:bagID </code> | rdf:parseType </code> | rdf:resource | rdf:nodeID | rdf:datatype
7.2.3 syntaxTerms coreSyntaxTerms | rdf:Description | rdf:li
7.2.4 oldTerms rdf:aboutEach | rdf:aboutEachPrefix | rdf:bagID
7.2.5 nodeElementURIs anyURI - ( coreSyntaxTerms | rdf:li | oldTerms )
7.2.6 propertyElementURIs anyURI - ( coreSyntaxTerms | rdf:Description | oldTerms )
7.2.7 propertyAttributeURIs anyURI - ( coreSyntaxTerms | rdf:Description | rdf:li | oldTerms )
7.2.8 doc root( document-element == RDF , children == list( RDF ))
7.2.9 RDF start-element( URI == rdf:RDF , attributes == set())
nodeElementList
end-element()
7.2.10 nodeElementList ws * ( nodeElement ws * )*
7.2.11 nodeElement start-element( URI == nodeElementURIs
     attributes == set(( idAttr | nodeIdAttr | aboutAttr  )?, deleted text: <a href="#bagIdAttr"> bagIdAttr </a> ?, propertyAttr *))
propertyEltList
end-element()
7.2.12 ws A text event matching white space defined by [XML] definition White Space Rule [3] S in section Common Syntactic Constructs
7.2.13 propertyEltList ws * ( propertyElt ws * ) *
7.2.14 propertyElt resourcePropertyElt | literalPropertyElt | parseTypeLiteralPropertyElt | parseTypeResourcePropertyElt | parseTypeCollectionPropertyElt | parseTypeOtherPropertyElt | emptyPropertyElt
7.2.15 resourcePropertyElt start-element( URI == propertyElementURIs ), attributes == set( idAttr ?))
ws * nodeElement ws *
end-element()
7.2.16 literalPropertyElt start-element( URI == propertyElementURIs ), attributes == set( idAttr ?, datatypeAttr ?))
text()
end-element()
7.2.17 parseTypeLiteralPropertyElt start-element( URI == propertyElementURIs ), attributes == set( idAttr ?, parseLiteral ))
literal
end-element()
7.2.18 parseTypeResourcePropertyElt start-element( URI == propertyElementURIs ), attributes == set( idAttr ?, parseResource ))
propertyEltList
end-element()
7.2.19 parseTypeCollectionPropertyElt start-element( URI == propertyElementURIs ), attributes == set( idAttr ?, parseCollection ))
nodeElementList
end-element()
7.2.20 parseTypeOtherPropertyElt start-element( URI == propertyElementURIs ), attributes == set( idAttr ?, parseOther ))
propertyEltList
end-element()
7.2.21 emptyPropertyElt start-element( URI == propertyElementURIs ), attributes == set( idAttr ?, ( resourceAttr | nodeIdAttr )?, deleted text: <a href="#bagIdAttr"> bagIdAttr </a> ?, propertyAttr *))
end-element()
7.2.22 idAttr attribute( URI == rdf:ID , string-value == rdf-id )
7.2.23 nodeIdAttr attribute( URI == rdf:nodeID , string-value == rdf-id )
7.2.24 aboutAttr attribute( URI == rdf:about , string-value == URI-reference )
deleted text: <a href="#bagIdAttr"> 7.2.25 </a> <a href="#bagIdAttr"> bagIdAttr </a> </td> <td> attribute( <a href="#eventterm-attribute-URI"> URI </a> == <code> rdf:bagID </code>, <a href="#eventterm-attribute-string-value"> string-value </a> == <a href="#rdf-id"> rdf-id </a> ) </td> </tr> <tr valign="top"> <td> 7.2.26 7.2.25 propertyAttr attribute( URI == propertyAttributeURIs , string-value == anyString )
7.2.27 7.2.26 resourceAttr attribute( URI == rdf:resource , string-value == URI-reference )
7.2.28 7.2.27 datatypeAttr attribute( URI == rdf:datatype , string-value == URI-reference )
7.2.29 7.2.28 parseLiteral attribute( URI == rdf:parseType , string-value == "Literal")
7.2.30 7.2.29 parseResource attribute( URI == rdf:parseType , string-value == "Resource")
7.2.31 7.2.30 parseCollection attribute( URI == rdf:parseType , string-value == "Collection")
7.2.32 7.2.31 parseOther attribute( URI == rdf:parseType , string-value == anyString - ("Resource" | "Literal") "Literal" | "Collection") )
7.2.33 7.2.32 URI-reference An attribute · string-value · interpreted as an RDF URI Reference reference .
7.2.34 7.2.33 literal Any XML element content that is allowed according to [XML] definition Content of Elements Rule [43] content . in section 3.1 Start-Tags, End-Tags, and Empty-Element Tags
7.2.35 7.2.34 rdf-id An attribute · string-value · matching any legal [XML-NS] token NCName

7.2 Grammar Productions

7.2.1 Grammar start

If the RDF/XML is a standalone XML document (known (identified by having been given the presentation as an application/rdf+xml RDF MIME Type type ) object, or by some other means) then the grammar starts with Root Event   doc .

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 Element Event   RDF (only when an element is legal at that point in the XML) or at production nodeElementList (only when element content is legal, since this is a list of elements). For such embedded RDF/XML, the · base-uri · value on the outermost element must be initialized from the containing XML since no Root Event   will be available. Note that if such embedding occurs, the grammar may be entered several times but no state is expected to be preserved.

7.2.2 Production coreSyntaxTerms

rdf:RDF | rdf:ID | rdf:about | deleted text: rdf:bagID </code> | rdf:parseType </code> | rdf:resource | rdf:nodeID | rdf:datatype

A subset of the syntax terms from the RDF Namespace vocabulary in section 5.1 which are used in RDF/XML.

7.2.3 Production syntaxTerms

coreSyntaxTerms | rdf:Description | rdf:li

All the syntax terms from the RDF Namespace vocabulary in section 5.1 which are used in deleted text: the RDF/XML.

7.2.4 Production oldTerms

rdf:aboutEach | rdf:aboutEachPrefix | rdf:bagID

These are the names from the RDF Namespace vocabulary that have been withdrawn from the language. See the resolutions of the Issue rdfms-aboutEach-on-object and , Issue rdfms-abouteachprefix issues and Last Call Issue timbl-01 for further information.

Error Test: Indicated by error001.rdf and error002.rdf

deleted text:

Note: The Working Group invites feedback from the community on the effects of the removal of these terms on existing implementations and documents and on the costs and benefits of adopting a new namespace URI to reflect this change (currently not proposed by the Working Group).

<h4> <a id="nodeElementURIs" name="nodeElementURIs"> 7.2.5 Production nodeElementURIs </a> </h4> <div class="productionOuter"> <div class="productionInner"> <p> <a href="#anyURI"> anyURI </a> - ( <a href="#coreSyntaxTerms"> coreSyntaxTerms </a> | rdf:li | oldTerms )

The <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references that are allowed on node elements.

7.2.6 Production propertyElementURIs

anyURI - ( coreSyntaxTerms | rdf:Description | oldTerms )

The URIs that are allowed on property elements.

7.2.7 Production propertyAttributeURIs

anyURI - ( coreSyntaxTerms | rdf:Description | rdf:li | oldTerms )

The <a href="http://www.w3.org/TR/2003/WD-rdf-concepts-20030123/#dfn-URI-reference"> RDF URI References references that are allowed on property attributes.

7.2.8 Production doc

root( document-element == RDF ,
     children == list( RDF ))

7.2.9 Production RDF

start-element( URI == rdf:RDF ,
     attributes == set())
nodeElementList
end-element()

7.2.10 Production nodeElementList

7.2.11 Production nodeElement

start-element( URI == nodeElementURIs
     attributes == set(( idAttr | nodeIdAttr | aboutAttr  )?, deleted text: <a href="#bagIdAttr"> bagIdAttr </a> ?, propertyAttr *))
propertyEltList
end-element()

For node element e , the processing of some of the attributes has to be done before other work such as dealing with children events or other attributes. These can be processed in any order:

If e . subject is empty, then e . subject := bnodeid( identifier := generated-blank-node-id()).

The following can then be performed in any order:

7.2.12 Production ws

If an attribute A text event matching white space defined by [XML] definition a White Space with <em> a </em>. <a href="#eventterm-attribute-URI"> URI Rule [3] S deleted text: == <code> rdf:bagID </code> is present, <em> n </em> := uri( <a href="#eventterm-identifier-identifier"> identifier </a> := resolve( <em> e </em>, concat("#", <em> a </em>. <a href="#eventterm-attribute-string-value"> string-value </a> ))) then in any order: section Common Syntactic Constructs

deleted text: <ul> <li> <p>

<a id="nodeElementStatement5" name="nodeElementStatement5"> S5 7.2.13 Production propertyEltList deleted text: Add the following statement to the graph: </p> <div class="ntripleOuter"> <div class="ntripleInner">

<p> <code>
<em> n </em>. <a href="#eventterm-identifier-string-value"> string-value

ws <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag> . </code> * ( propertyElt ws * ) *

</li> <li> <p> For the generated statements above (excluding <a href="#nodeElementStatement5"> S5 </a> ) in the following order </p> <ol> <li>

<a href="#nodeElementStatement1"> S1 7.2.14 Production propertyElt </li> <li> Statements from <a href="#nodeElementStatement2"> S2

resourcePropertyElt and <a href="#nodeElementStatement3"> S3 | literalPropertyElt in any order

  • Statements generated by the propertyEltList | parseTypeLiteralPropertyElt children by S4 | parseTypeResourcePropertyElt in document order
  • If the statement was generated by S4 | parseTypeCollectionPropertyElt from a propertyElt | parseTypeOtherPropertyElt and has an existing identifier e . subject | emptyPropertyElt then

    If element s e := has e . subject . Otherwise s := bnodeid( identifier := generated-blank-node-id())

    Then reify the statement with event s using the reification rules in section 7.3 URI and = rdf:li then apply the bag list expansion rules on element e .parent in section 7.5 7.4 deleted text: on event n to give a new URI u . Then the following statement is added to the graph:

    7.2.12 Production ws

    A text event matching white space defined by [XML] definition White Space Rule [3] S in section Common Syntactic Constructs

    7.2.13 Production propertyEltList

    7.2.14 Production propertyElt

    If element e has e . URI = rdf:li then apply the list expansion rules on element e .parent in section 7.4 to give a new URI u and e and e . URI := u .

    deleted text: NOTE: The action of this production must be done before the actions of any sub-matches ( <a href="#resourcePropertyElt"> resourcePropertyElt </a> ... <a href="#emptyPropertyElt"> emptyPropertyElt </a> ). Alternatively the result must be equivalent to as if it this action was performed first, such as performing as the first action of all of the sub-matches. </p> <h4> <a id="resourcePropertyElt" name="resourcePropertyElt"> 7.2.15 Production resourcePropertyElt </a> </h4> <div class="productionOuter"> <div class="productionInner"> <p> start-element( <a href="#eventterm-element-URI"> URI </a> == <a href="#propertyElementURIs"> propertyElementURIs </a> ), <br />      <a href="#eventterm-element-attributes"> attributes </a> == set( <a href="#idAttr"> idAttr </a> ?)) <br /> <a href="#ws"> ws </a> * <a href="#nodeElement"> nodeElement </a> <a href="#ws"> ws </a> * <br /> end-element() </p> </div> </div> <p> For element <em> e </em>, and the single contained nodeElement <em> n , first n must be processed using production nodeElement . Then the following statement is added to the graph:

    If the rdf:ID attribute a is given, the above statement is reified with i := uri( identifier := resolve( e , concat("#", a . string-value ))) using the reification rules in section 7.3 and e . subject := i

    7.2.16 Production literalPropertyElt

    start-element( URI == propertyElementURIs ),
         attributes == set( idAttr ?, datatypeAttr ?))
    text()
    end-element()

    deleted text:
    <p> Note: The Note that the empty literal case is defined in production emptyPropertyElt .

    deleted text:
    <p> For element <em> e </em>, and the text event <em> t </em>. The Unicode [UNICODE] string t . string-value MUST be in Normal Form C [NFC] . If the rdf:datatype attribute d is given then o := typed-literal( literal-value := t . string-value , literal-language literal-datatype := e . language , literal-datatype := a d . string-value ) otherwise o := literal( literal-value := t . string-value , literal-language := e . language ) and the following statement is added to the graph:

    If the rdf:ID attribute a is given, the above statement is reified with i := uri( identifier := resolve( e , concat("#", a . string-value ))) using the reification rules in section 7.3 and e . subject := i .

    7.2.17 Production parseTypeLiteralPropertyElt

    start-element( URI == propertyElementURIs ),
         attributes == set( idAttr ?, parseLiteral ))
    literal
    end-element()

    For element e and the literal l , then that is the rdf:parseType="Literal" content. l is not transformed by the syntax data model mapping into events (as noted in 6 Syntax Data Model ) but remains an XML Infoset of XML Information items.

    l is transformed into the lexical form of an XML literal in the RDF graph x (a Unicode string) by the following algorithm. This does not mandate any implementation method — any other method that gives the same result may be used.

    1. Use l to construct an XPath [XPATH] node-set (a document subset )
    2. Apply Exclusive XML Canonicalization [ XML-XC14N ]) with comments and with empty InclusiveNamespaces PrefixList to this node-set to give a sequence of octets s
    3. This sequence of octets s can be considered to be a UTF-8 encoding of some Unicode string x (sequence of Unicode characters)
    4. The Unicode string x is used as the lexical form of l
    5. This string x MUST be in Unicode [UNICODE] NFC Normal Form C [NFC]

    Then o := typed-literal( literal-value := l . string-value , literal-language := e . language , x , literal-datatype := http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral ) and the following statement is added to the graph:

    Test: Empty literal case indicated by test009.rdf and test009.nt

    If the rdf:ID attribute a is given, the above statement is reified with i := uri( identifier := resolve( e , concat("#", a . string-value ))) using the reification rules in section 7.3 and e . subject := i .

    The result of a literal

    7.2.18 Production parseTypeResourcePropertyElt from rdf:parseType="Literal" content is an XML Literal .

    This specification allows some freedom to choose exactly what string is used as the lexical form of an XML Literal. Whatever string is used, it MUST correspond to an XML document when enclosed within a start and end element tag, and its canonicalization (without comments, as defined in Exclusive XML Canonicalization [ XML-XC14N ]) MUST be the same as the same canonicalization of the literal text l . It is often acceptable to use l without any changes but this is incorrect if, for example, l uses entity references or namespace prefixes defined in the outer XML document.

    7.2.18 Production parseTypeResourcePropertyElt

    start-element( URI == propertyElementURIs ),
         attributes == set( idAttr ?, parseResource ))
    propertyEltList
    end-element()

    For element e with possibly empty element content c .

    n := bnodeid( identifier := generated-blank-node-id()).

    Add the following statement to the graph:

    Test: Indicated by test004.rdf and test004.nt

    If the rdf:ID attribute a is given, the statement above is reified with i := uri( identifier := resolve( e , concat("#", a . string-value ))) using the reification rules in section 7.3 and e . subject := i .

    If the element content c is not empty, then use event n to create a new sequence of events as follows:

    start-element( URI := rdf:Description ,
         subject := n ,
         attributes := set())
    c
    end-element()

    Then process the resulting sequence using production nodeElement .

    7.2.19 Production parseTypeCollectionPropertyElt

    For element event e with possibly empty nodeElementList l . Set s :=list().

    For each element event f in l , n := bnodeid( identifier := generated-blank-node-id()) and append n to s to give a sequence of events.

    If s is not empty, n is the first event identifier in s and the following statement is added to the graph:

    otherwise the following statement is added to the graph:

    e .parent. subject . string-value < e . URI > <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .

    If the rdf:ID attribute a is given, either of the the above statement statements is reified with i := uri( identifier := resolve( e , concat("#", a . string-value ))) using the reification rules in section 7.3 .

    If s is empty, no further work is performed.

    For each event n in s deleted text: , the following statement is added to the graph:

    n . string-value <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> .

    For each event n in s </em> and the corresponding element event <em> f </em> in <em> l </em>, the following statement is added to the graph: </p> <div class="ntripleOuter"> <div class="ntripleInner"> <p> <code> <em> n </em>. <a href="#eventterm-identifier-string-value"> string-value </a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <em> f </em>. <a href="#eventterm-identifier-string-value"> string-value </a> . </code> </p> </div> </div> <p> For each consecutive, consecutive and overlapping pairs pair of events ( n , o ) in s , the following statement is added to the graph:

    n . string-value <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> o . string-value .

    If s is not empty, n is the last event identifier in s , the following statement is added to the graph:

    n . string-value <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .

    7.2.20 Production parseTypeOtherPropertyElt

    start-element( URI == propertyElementURIs ),
         attributes == set( idAttr ?, parseOther ))
    propertyEltList
    end-element()

    All rdf:parseType attribute values other than the strings "Resource", "Literal" or "Collection" are treated as if the value was "Literal". This production matches and acts as if production parseTypeLiteralPropertyElt was matched. No extra triples are generated for other rdf:parseType values.

    7.2.21 Production emptyPropertyElt

    start-element( URI == propertyElementURIs ),
         attributes == set( idAttr ?, ( resourceAttr | nodeIdAttr )?, deleted text: <a href="#bagIdAttr"> bagIdAttr </a> ?, propertyAttr *))
    end-element()

    • If there are no attributes or only the optional rdf:ID attribute i then o := literal( literal-value :="", literal-language := e . language ) and the following statement is added to the graph:

      and then if i is given, the above statement is reified with uri( identifier := resolve( e , concat("#", i . string-value ))) using the reification rules in section 7.3 .

      Test: Indicated by test002.rdf and test002.nt

      Test: Indicated by test005.rdf and test005.nt

    • Otherwise

      deleted text: If optional <code> rdf:bagID </code> attribute <em> b </em> is given, <em> n </em> := uri( <a href="#eventterm-identifier-identifier"> identifier </a> := resolve( <em> e </em>, concat("#", <em> b </em>. <a href="#eventterm-attribute-string-value"> string-value </a> ))) </p> <p> The following are done in any order:

      • For all propertyAttr attributes a (in any order)

        If event <em> n </em> was created, then for each statement above: <em> s </em> := bnodeid( <a href="#eventterm-identifier-identifier"> identifier Test: Indicated by test013.rdf := generated-blank-node-id()), reify and test013.nt

        Test: Indicated by test014.rdf and test014.nt

      • Add the statement with event <em> s </em> using the reification rules in <a href="#section-Reification"> section 7.3 </a>, apply the bag expansion rules in <a href="#section-Bag-Expand"> section 7.5 </a> on event <em> n </em> to give URI <em> u </em> and add the following statement is added to the graph: </p> <div class="ntripleOuter"> <div class="ntripleInner"> <p> <code> <em> n </em>. <a href="#eventterm-identifier-string-value"> string-value </a> < <em> u </em> > <em> s </em>. <a href="#eventterm-identifier-string-value"> string-value </a> ; . </code> </p> </div> </div> <div class="note"> <p> <strong> Test: </strong> Indicated by <a href="http://www.w3.org/2000/10/rdf-tests/rdfcore/rdfms-empty-property-elements/test013.rdf"> test013.rdf </a> and <a href="http://www.w3.org/2000/10/rdf-tests/rdfcore/rdfms-empty-property-elements/test013.nt"> test013.nt </a> </p> </div> <div class="note"> <p> <strong> Test: </strong> Indicated by <a href="http://www.w3.org/2000/10/rdf-tests/rdfcore/rdfms-empty-property-elements/test014.rdf"> test014.rdf </a> and <a href="http://www.w3.org/2000/10/rdf-tests/rdfcore/rdfms-empty-property-elements/test014.nt"> test014.nt </a> </p> </div> </li> <li> <p> Add the following following statement to the graph:

        and then if rdf:ID attribute i is given, the above statement is reified with uri( identifier := resolve( e , concat("#", i . string-value ))) using the reification rules in section 7.3 .

      • deleted text: <li> <p> If event <em> n </em> was created, add the following statement to the graph: </p> <div class="ntripleOuter"> <div class="ntripleInner"> <p> <code> <em> n </em>. <a href="#eventterm-identifier-string-value"> string-value </a> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag> . </code> </p> </div> </div> </li>

    7.2.22 Production idAttr

    attribute( URI == rdf:ID ,
         string-value == rdf-id )

    Constraint: : constraint-id applies to the values of rdf:ID attributes

    7.2.23 Production nodeIdAttr

    attribute( URI == rdf:nodeID ,
         string-value == rdf-id )

    7.2.24 Production aboutAttr

    attribute( URI == rdf:about ,
         string-value == URI-reference )

    deleted text: <a id="bagIdAttr" name="bagIdAttr"> 7.2.25 Production bagIdAttr </a> </h4> <div class="productionOuter"> <div class="productionInner"> <p> attribute( <a href="#eventterm-attribute-URI"> URI </a> == <code> rdf:bagID </code>, <br />      <a href="#eventterm-attribute-string-value"> string-value </a> == <a href="#rdf-id"> rdf-id </a> ) </p> </div> </div> <p> <strong> Constraint: </strong>: <a href="#constraint-id"> constraint-id </a> applies to the values of <code> rdf:bagID </code> attributes </p> <h4> 7.2.26 7.2.25 Production propertyAttr

    7.2.27 7.2.26 Production resourceAttr

    attribute( URI == rdf:resource ,
         string-value == URI-reference )

    7.2.28 7.2.27 Production datatypeAttr

    attribute( URI == rdf:datatype ,
         string-value == URI-reference )

    7.2.29 7.2.28 Production parseLiteral

    attribute( URI == rdf:parseType ,
         string-value == "Literal")

    7.2.30 7.2.29 Production parseResource

    attribute( URI == rdf:parseType ,
         string-value == "Resource")

    7.2.31 7.2.30 Production parseCollection

    attribute( URI == rdf:parseType ,
         string-value == "Collection")

    7.2.32 7.2.31 Production parseOther

    attribute( URI == rdf:parseType ,
         string-value == anyString - ("Resource" | "Literal") "Literal" | "Collection") )

    7.2.33 7.2.32 Production URI-reference

    7.2.34 7.2.33 Production literal

    Any XML element content that is allowed according to [XML] definition Content of Elements Rule [43] content . in section 3.1 Start-Tags, End-Tags, and Empty-Element Tags

    The string-value for the resulting event is discussed in section 7.2.17 .

    7.2.35 7.2.34 Production rdf-id

    An attribute · string-value · matching any legal [XML-NS] token NCName

    7.3 Reification Rules

    For the given URI reference event r and the statement with terms s , p and o corresponding to the N-Triples:

    s p o .

    add the following statements to the graph:

    r . string-value <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> s .
    r . string-value <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> p .
    r . string-value <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> o .
    r . string-value <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> .

    7.4 List Expansion Rules

    For the given element e , create a new RDF URI Reference reference u := concat("http://www.w3.org/1999/02/22-rdf-syntax-ns#_", e . li-counter ), increment the e . li-counter property by 1 and return u .

    deleted text:

    7.5 Bag Expansion Rules

    For the given element e , create a new RDF URI Reference u := concat("http://www.w3.org/1999/02/22-rdf-syntax-ns#_", e . bag-li-counter ), increment the e . bag-li-counter property by 1 and return u .

    <h2> <a id="section-Serialising" name="section-Serialising"> 8 Serializing an RDF Graph to RDF/XML </a> </h2> <p> There are some RDF Graphs as defined in the RDF Concepts and Abstract Syntax deleted text: Working Draft. that cannot be serialized in RDF/XML. These are those that: </p> <dl> <dt> Use property names that cannot be turned into XML namespace-qualified names. <br /> </dt> <dd> An XML namespace-qualified name ( <a href="http://www.w3.org/TR/REC-xml-names/#dt-qname"> QName </a> ) has restrictions on the legal characters such that not all property URIs can be expressed as these names. It is recommended that implementors of RDF serializers, in order to break a URI into a namespace name and a local name, split it after the last XML non- <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName"> NCName </a> character, ensuring that the first character of the name is a <a href="http://www.w3.org/TR/REC-xml#NT-Letter"> Letter </a> or '_'. If the URI ends in a non- <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName"> NCName </a> character then throw a "this graph cannot be serialized in RDF/XML" exception or error. </dd> <dt> Use inappropriate reserved names as properties <br /> </dt> <dd> For example, a property with the same URI as any of the <a href="#syntaxTerms"> syntaxTerms </a> production. </dd> </dl>

    A more detailed discussion of the issues of serializing the Implementation Note (Informative): When an RDF Graph graph is serialized to RDF/XML is given and has an XML Schema Datatype (XSD), it SHOULD be written in [UNPARSING] . This describes using the original syntax without the subsequently added rdf:nodeID attribute a form that now allows all graphs with blank nodes to be serialized. does not require whitespace processing. XSD support is NOT required by RDF or RDF/XML so this is optional.

    9 Using RDF/XML with HTML and XHTML

    If RDF/XML is embedded inside HTML or XHTML this can add many new elements and attributes, many of which will not be in the appropriate DTD. This embedding causes validation against the DTD to fail. The obvious solution of changing or extending the DTD is not practical for most uses. This problem has been analyzed extensively by Sean B. Palmer in RDF in HTML: Approaches deleted text: <a href="#ref-rdf-in-xhtml"> [RDF-IN-XHTML] </a> and it concludes that there is no single embedding method that satisfies all applications and remains simple. </p> <p> The recommended approach is to not embed RDF/XML in HTML/XHTML but rather to use <code> <link> </code> element in the <code> <head> </code> element of the HTML/HTML to point at a separate RDF/XML document. This approach has been used for several years by the Dublin Core Metadata Initiative (DCMI) on its Web site.

    To use this technique, the <link> element href should point at the URI of the RDF/XML content and the type attribute should be used with the value of "application/rdf+xml" , the proposed MIME Type type for RDF/XML, see Section 4

    The value of the rel attribute may also be set to indicate the relationship; this is an application dependent value. The DCMI has used and recommended rel="meta" when linking in RFC 2731 - Encoding Dublin Core Metadata in HTML [RFC-2731] however rel="alternative" rel="alternate" may also be appropriate. See HTML 4.01 link types and , XHTML Modularization - — LinkTypes and XHTML 2.0 — LinkTypes for further information. information on the values that may be appropriate for the different versions of HTML.

    Example 21 shows using this method with the link tag inside an XHTML document to link to an external RDF/XML document.

    <?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" xml:lang="en" lang="en">
      <head>
        <title>My document</title>
        <meta http-equiv="Content-type" content='text/html; charset="iso-8859-1"' />
        <link rel="alternate" type="application/rdf+xml" title="RDF Version" href="example21.rdf" />
      </head>
      <body>
        <h1>My document</h1>
    
      </body>
    </html>
    
    

    10 Acknowledgments Using RDF/XML with SVG (Informative)

    The following people provided valuable contributions to There is a standardized approach for associating RDF compatible metadata with SVG — the document:

    7.2.31 Production parseOther (was 7.2.32 in previous draft) added the case "Collection" which had been mistakenly omitted after the comment by Patel-Schneider , 2003-05-09.
    RELAX NG sufixes
    Renamed the informative RELAX NG schemas in A.1 RELAX NG Compact Schema deleted text: for RDF/XML </a> to use suffixes .rnc (compact version) and .rng (XML version) after comment by Prud'hommeaux , 2003-05-06.
    Citing Namespaces in XML
    #
    # RELAX NG Compact Schema for RDF/XML Syntax
    #
    # This schema is for information only and NON-NORMATIVE
    #
    # It is based on one originally written by James Clark in
    # http://lists.w3.org/Archives/Public/www-rdf-comments/2001JulSep/0248.html
    # and updated with later changes.
    #
    
    namespace local = ""
    namespace rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
    
    
    start = doc
    
    
    # I cannot seem to do this in RNGC so they are expanded in-line
    
    # coreSyntaxTerms = rdf:RDF | rdf:ID | rdf:about | rdf:bagID | rdf:parseType | rdf:resource | rdf:nodeID | rdf:datatype
    # syntaxTerms = coreSyntaxTerms | rdf:Description | rdf:li
    # oldTerms    = rdf:aboutEach | rdf:aboutEachPrefix
    # nodeElementURIs       = * - ( coreSyntaxTerms | rdf:li | oldTerms )
    # propertyElementURIs   = * - ( coreSyntaxTerms | rdf:Description | oldTerms )
    # propertyAttributeURIs = * - ( coreSyntaxTerms | rdf:Description | rdf:li | oldTerms )
    
    # Also needed to allow rdf:li on all property element productions
    # since we can't capture the rdf:li rewriting to rdf_<n> in relaxng
    
    # Need to add these explicitly
    xmllang = attribute xml:lang { text }
    xmlbase = attribute xml:base { text }
    # and to forbid every other xml:* attribute, element
    
    doc = 
      RDF
    
    RDF =
      element rdf:RDF { 
         xmllang?, xmlbase?, nodeElementList
    }
    
    nodeElementList = 
      nodeElement*
    
      # Should be something like:
      #  ws* , (  nodeElement , ws* )*
      # but RELAXNG does this by default, ignoring whitespace separating tags.
    
    
    
    
    nodeElement = element * - ( rdf:RDF | rdf:ID | rdf:about | rdf:bagID | rdf:parseType | rdf:resource | rdf:nodeID | rdf:datatype | rdf:li | rdf:aboutEach | rdf:aboutEachPrefix | xml:* ) { (idAttr | nodeIdAttr | aboutAttr )?, bagIdAttr?, xmllang?, xmlbase?, propertyAttr*, propertyEltList }
    Throughout, changed to use the correct document title Namespaces in XML after a private editorial comment to the editor 2003-05-04.
    Editorial comments 4.3 from XML Schema WG
    # It is not possible to say "and not things # beginning with _ in the rdf: namespace" in RELAX NG.
    ws = " " 2.4 Empty Property Elements first sentence modified after editorial comments in section 4.3 of XML Schema WG comments on RDF documents
    Editorial comments ( syntaxLCC-001 )
    # Not used in this RELAX NG schema; but should be any legal XML # whitespace defined by http://www.w3.org/TR/2000/REC-xml-20001006#NT-S
    Spellings, grammar, CSS style and suggested rewordings after editorial comments from Lesch, 2003-02-25 . In particular the small two-paragraph informative section 2.18 has been merged into section 1 introduction . Many excessive capitalizations were removed.
    Minor editorial
    1 letter change after comment from Dürst, 2003-01-30
    Blank node identifier clarification
    propertyEltList = propertyElt*
    Additional clarification added to 5.2 , 6.1.7 and 6.3 (bnodeid definition) as described 2003-01-30 after coment by Patel-Schneider, 2003-01-28 .

    Appendix B.3: Issues requiring no document revisions

    # Should be something like: # ws* , ( propertyElt , ws* )* # but RELAXNG does this by default, ignoring whitespace separating tags. chas-01 — aboutEachPrefix
    propertyElt = resourcePropertyElt | literalPropertyElt | parseTypeLiteralPropertyElt | parseTypeResourcePropertyElt | parseTypeCollectionPropertyElt | parseTypeOtherPropertyElt | emptyPropertyElt
    resourcePropertyElt = element * - ( rdf:RDF | rdf:ID | rdf:about | rdf:bagID | rdf:parseType | rdf:resource | rdf:nodeID | rdf:datatype | rdf:Description | rdf:aboutEach | rdf:aboutEachPrefix | xml:* ) { idAttr?, xmllang?, xmlbase?, nodeElement } not accepted literalPropertyElt = element * - ( rdf:RDF | rdf:ID | rdf:about | rdf:bagID | rdf:parseType | rdf:resource | rdf:nodeID | rdf:datatype | rdf:Description | rdf:aboutEach | rdf:aboutEachPrefix | xml:* ) { (idAttr | datatypeAttr )?, xmllang?, xmlbase?, text }
    parseTypeLiteralPropertyElt = element * - ( rdf:RDF | rdf:ID | rdf:about | rdf:bagID | rdf:parseType | rdf:resource | rdf:nodeID | rdf:datatype | rdf:Description | rdf:aboutEach | rdf:aboutEachPrefix | xml:* ) { idAttr?, parseLiteral, xmllang?, xmlbase?, literal } krech-01 — emptyPropertyElt ambiguity ( syntaxLCC-003 )
    parseTypeResourcePropertyElt = element * - ( rdf:RDF | rdf:ID | rdf:about | rdf:bagID | rdf:parseType | rdf:resource | rdf:nodeID | rdf:datatype | rdf:Description | rdf:aboutEach | rdf:aboutEachPrefix | xml:* ) { idAttr?, parseResource, xmllang?, xmlbase?, propertyEltList }
    After rdf:bagID was removed from the language for last call issue timbl-01 , this comment by Krech required no action.
    parseTypeCollectionPropertyElt = element * - ( rdf:RDF | rdf:ID | rdf:about | rdf:bagID | rdf:parseType | rdf:resource | rdf:nodeID | rdf:datatype | rdf:Description | rdf:aboutEach | rdf:aboutEachPrefix ) { idAttr?, xmllang?, xmlbase?, parseCollection, nodeElementList } hendler-01 — literals in parsetype collection
    parseTypeOtherPropertyElt = element * - ( rdf:RDF | rdf:ID | rdf:about | rdf:bagID | rdf:parseType | rdf:resource | rdf:nodeID | rdf:datatype | rdf:Description | rdf:aboutEach | rdf:aboutEachPrefix | xml:* ) { idAttr?, xmllang?, xmlbase?, parseOther, any }
    emptyPropertyElt = element * - ( rdf:RDF | rdf:ID | rdf:about | rdf:bagID | rdf:parseType | rdf:resource | rdf:nodeID | rdf:datatype | rdf:Description | rdf:aboutEach | rdf:aboutEachPrefix | xml:* ) { idAttr?, (resourceAttr | nodeIdAttr)?, bagIdAttr?, xmllang?, xmlbase?, propertyAttr* } postponed idAttr = attribute rdf:ID { IDsymbol }
    nodeIdAttr = attribute rdf:nodeID { IDsymbol } xmlsch-08 — xsi:type
    aboutAttr = attribute rdf:about { URI-reference }
    bagIdAttr = attribute rdf:bagID { IDsymbol } accepted with explanation propertyAttr = attribute * - ( rdf:RDF | rdf:ID | rdf:about | rdf:bagID | rdf:parseType | rdf:resource | rdf:nodeID | rdf:datatype | rdf:li | rdf:Description | rdf:aboutEach | rdf:aboutEachPrefix | xml:* ) { string }
    resourceAttr = attribute rdf:resource { URI-reference } xmlsch-10 — cannonical syntax
    datatypeAttr = attribute rdf:datatype { URI-reference }
    parseLiteral = attribute rdf:parseType { "Literal" } postponed parseResource = attribute rdf:parseType { "Resource" }
    parseCollection = attribute rdf:parseType { "Collection" } xmlsch-11 — layering on xml
    parseOther = attribute rdf:parseType { text }
    URI-reference = string clarification given literal = any
    IDsymbol = xsd:NMTOKEN xmlsch-12 — capricious syntax
    any = mixed { element * { attribute * { text }*, any }* }
    postponed

    B Changes C Revisions since Working Draft 05 September 2003 (Informative)

    Changes since the 8 November 2002 05 September 2003 working draft

    (Newest at top)

    Previous changes there are listed in restrictions on those generated names. Change made consequent to discussion after the changes section review by Jeremy Carroll 2003-09-22 of the previous 8 November 2002

    Appendix C.2: Editorial Revisions working draft.

    None
    None