Copyright © 2008 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
This document is a specification for a vocabulary to represent Content in RDF. This vocabulary is intended to provide a flexible framework within different usage scenarios to semantically represent any type of content, be it on the Web or in local storage media. For example, it can be used by Web accessibility evaluation tools to record a representation of the assessed Web content in an Evaluation And Report Language (EARL) 1.0 Schema evaluation report. The document contains introductory information on its usage and some examples.
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/.
@@@ CHANGE @@@This First Public Working Draft of the Representing Content in RDF document was published on 8 September 2008 by the Evaluation and Repair Tools Working Group (ERT WG). It presents an RDF approach for recording different representations of content on the Web or in local storage media. This document is part of the W3C Evaluation And Report Language (EARL). It is expected to be published as a W3C Working Group Note after further review and refinement.
[Editor's note: change text appropriately]
The RDF terms defined by this document can be used to extend the Evaluation And Report Language (EARL) 1.0 Schema, but can also be used separately to record different representations of content for any purpose. For example it can be used together with the HTTP Vocabulary in RDF to describe Web content that has been retrieved from a server using specific HTTP headers. The Working Group believes that this document is fairly stable despite being a first public working draft. The group encourages feedback about the approach, as well as about the completeness and maturity of this document by developers and researchers who have interest in representing content in RDF format. Feedback from the W3C Quality Assurance Interest Group, the W3C Semantic Web Interest Group, and the Protocol for Web Description Resources Working Group is particularly welcome. Please send comments on this document by @@@ CHANGE @@@29 September 2008 to the public mailing list of the working group public-wai-ert@w3.org. The archives of the working group mailing list are publicly available.
[Editor's note: change date for comments]
Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. The group does not expect this document to become a W3C Recommendation. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
This document is the specification for a vocabulary to represent Content in RDF. There is a wide variety of scenarios (see section below) where a representation of any type of content, either on the Web or in any local storage media, is necessary. This specification provides an RDF application that allows to present semantically such content. The vocabulary is built in a flexible manner, thus there are no limitations known at the time of writing this specification. It also provides opportunities for extensions to match particular needs of its users.
This document assumes the following background knowledge:
Although the concepts of the Semantic Web are simple, their abstraction with RDF is known to bring difficulties to beginners. It is recommended to read carefully the aforementioned references and other tutorials found on the Web. It must be also borne in mind that RDF is primarily targeted to be machine processable, and therefore, some of its expressions are not very intuitive for developers used to work with XML only. The examples will be serialized using the abbreviated RDF/XML notation.
The keywords must, required, recommended, should, may, and optional are used in accordance with [RFC2119].
For limitations of this vocabulary, see section 5.
Table 1 presents the namespaces typically used by this vocabulary. The core namespace has the URI http://www.w3.org/2008/content#
and the prefix cnt
. The prefix notation presents the typical conventions used in the Web and in this document to denote a given namespace, and can be freely modified.
Namespace prefix | Namespace URI | Description |
---|---|---|
cnt |
http://www.w3.org/2008/content# |
Namespace for Representing Content in RDF. |
rdf |
http://www.w3.org/1999/02/22-rdf-syntax-ns# |
Namespace for RDF [RDF]. |
As stated earlier, this framework is designed in an open way to facilitate different implementation scenarios. The origin of the application comes from vocabularies describing testing scenarios like EARL [EARL]. Typical applications could be:
This section presents a description of the classes of this RDF vocabulary. We present every class together with its subclasses. We also include whenever relevant short snippets and examples.
The cnt:Content
class is an over arching class for any content that could be found on the Web, in an Intranet or in local storage media, for example. It is recommended always to use one of its subclasses. There is no restriction within the vocabulary scope on what can be represented with this class: textual content, binary files (e.g., images or movies), XML files, etc.
There are three subclasses from the Content
class: cnt:Base64Content
, cnt:TextContent
and cnt:XMLContent
.
[Editor's note: Should we here suggest a way to connect cnt:TextContent/cnt:XMLContent resources to cnt:Base64Content resources, e.g. via dct:source?]
The cnt:Base64Content
class is a subclass of the cnt:Content
class for Base64 encoded binary content (as defined by [RFC2045]) and can be used for any type of content, although its more typical use case is for binary files.
Example 2.1: This example displays the representation of the W3C logo as a Base64Content
resource. (Note: due to its length, the encoded string has been chunked until {...}
.)
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cnt="http://www.w3.org/2008/content#"> <cnt:Base64Content rdf:about="http://www.w3.org/Icons/w3c_home.png"> <cnt:bytes>77+9UE5HDQoaCgAAAA1JSERSAAAASAAAADAIAwAAAO+{...}</cnt:bytes> </cnt:Base64Content> </rdf:RDF>
The cnt:TextContent
class is a subclass of the cnt:Content
class for any type of textual content.
Example 2.2: The following example represents a CSS file as a TextContent
resource.
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cnt="http://www.w3.org/2008/content#"> <cnt:TextContent rdf:about="http://example.org/example.css"> <cnt:characterEncoding>UTF-8</cnt:characterEncoding> <cnt:chars>body { color: #000; background: #fff } h1 { font-size: 1.6em } h2 { font-size: 1.3em }</cnt:chars> </cnt:TextContent> </rdf:RDF>
[Editor's note: We have to rename the class because the name starts with 'X', 'M', 'L'. Suggested name: WellformedContent]
The cnt:XMLContent
class is a subclass of the cnt:Content
class only for wellformed XML content.
See the Mapping between DOM and the Content-in-RDF vocabulary.
Example 2.3: The XHTML page with the following source code:
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>The title</title> </head> <body> <p>Some paragraph.</p> </body> </html>
could be represented as this XMLContent
resource.
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cnt="http://www.w3.org/2008/content#"> <cnt:XMLContent rdf:about="http://example.org/example203.html"> <cnt:xmlRest rdf:parseType="Literal"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>The title</title> </head> <body> <p>Some paragraph.</p> </body> </html> </cnt:xmlRest> </cnt:XMLContent> </rdf:RDF>
For the use of xmlDecl
, xmlLeadingMisc
and doctypeDecl
see Appendix A: A practical example.
[Editor's note: We have to rename the class because the name starts with 'X', 'M', 'L'. Suggested name: ???]
An XML declaration. This class is normally used in conjunction with the XMLContent
class, when the corresponding XML resource contains an XML declaration. The relation is expressed via the xmlDecl
property.
See the Mapping between DOM and the Content-in-RDF vocabulary.
Example 2.4: A typical XML declaration:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
Can be expressed as the following XMLDecl
resource:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cnt="http://www.w3.org/2008/content#"> <cnt:XMLDecl rdf:ID="xmld0"> <cnt:xmlStandalone>no</cnt:xmlStandalone> <cnt:xmlEncoding>UTF-8</cnt:xmlEncoding> <cnt:xmlVersion>1.0</cnt:xmlVersion> </cnt:XMLDecl> </rdf:RDF>
A document type declaration. Likewise XMLDecl
, this class is normally used in conjunction with the XMLContent
class, when the corresponding XML resource contains a document type declaration. The relation is expressed via the doctypeDecl
property.
See the Mapping between DOM and the Content-in-RDF vocabulary.
Example 2.5: A typical XHTML 1.0 Strict document type declaration:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
could be represented as
the following DoctypeDecl
resource:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cnt="http://www.w3.org/2008/content#"> <cnt:DoctypeDecl rdf:ID="dtd0"> <cnt:systemId>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</cnt:systemId> <cnt:publicId>-//W3C//DTD XHTML 1.0 Strict//EN</cnt:publicId> <cnt:doctypeName>html</cnt:doctypeName> </cnt:DoctypeDecl> </rdf:RDF>
This section presents a description of the properties of this RDF vocabulary.
Character string representing the Base64 encoded byte sequence of the given content.
cnt:Base64Content
The character encoding.
When used with Base64Content: If the byte sequence was created from a given character sequence this property can be used to store the character encoding that was applied to create the byte sequence.
When used with TextContent: If the character sequence was created from a given byte sequence this property can be used to store the character encoding that was applied to create the character sequence.
When used with XMLContent: If the parser's input character stream was created from a given byte stream this property can be used to store the character encoding that was applied to create the character stream. Note: This is the used character encoding, not the one declared in an XML declaration.
cnt:Content
The character sequence of the given content.
cnt:TextContent
This property relates an XML Content to its Document Type Declaration.
cnt:XMLContent
cnt:DoctypeDecl
The document type name.
cnt:DoctypeDecl
The internal subset of a document type declaration.
cnt:DoctypeDecl
The formal public identifier of a document type declaration.
cnt:DoctypeDecl
The system identifier of a document type declaration.
cnt:DoctypeDecl
[Editor's note: add link to XSD datatypes?]
[Editor's note: We have to rename the property because the name starts with 'x', 'm', 'l'. Suggested name: ???]
This property relates an XML Content to its XML Declaration.
cnt:XMLContent
cnt:XMLDecl
[Editor's note: We have to rename the property because the name starts with 'x', 'm', 'l'. Suggested name: ???]
The character encoding specified in the XML declaration.
cnt:XMLDecl
[Editor's note: We have to rename the property because the name starts with 'x', 'm', 'l'. Suggested name: ???]
The part of the XML (comments and processing instructions) following the XML declaration and preceding the document type declaration if there is one.
cnt:XMLContent
[Editor's note: We have to rename the property because the name starts with 'x', 'm', 'l'. Suggested name: ???]
It contains comments, processing instructions and the root element.
cnt:XMLContent
[Editor's note: We have to rename the property because the name starts with 'x', 'm', 'l'. Suggested name: ???]
The standalone document declaration.
cnt:XMLDecl
[Editor's note: We have to rename the property because the name starts with 'x', 'm', 'l'. Suggested name: ???]
The XML version specified in the XML declaration.
cnt:XMLDecl
This section describes conformance with this Content-in-RDF specification. It differentiates between the following entities:
[Editor's note: Need fancier word for "Content-in-RDF Graph".]
Graphs conforming to this Content-in-RDF specification must meet the following requirements:
cnt:bytes
)..cnt:characterEncoding
).cnt:chars
).cnt:characterEncoding
).cnt:xmlRest
).cnt:xmlDecl
).cnt:xmlLeadingMisc
).cnt:doctypeDecl
).cnt:characterEncoding
).cnt:xmlVersion
).cnt:xmlEncoding
).cnt:xmlStandalone
).cnt:doctypeName
).cnt:publicId
).cnt:systemId
).cnt:internalSubset
).Producers conforming to this Content-in-RDF specification must meet the following requirements:
Consumers conforming to this Content-in-RDF specification must meet the following requirements:
We have identified some situations to make clear when to create which type of content resources. The following are only recommendations and are non-normative:
This includes images, multimedia, or other non-text resources. The byte sequence is recorded in Base64 format and represented as a literal using the cnt:bytes
property of the cnt:Base64Content
. Non-text content should not be represented using cnt:TextContent
.
This includes HTML, CSS, client-side script, or other text-based resources. Given the byte sequence of text content (byteSeq) received from a Web server and an appropriate character encoding (ce). byteSeq is recorded in Base64 format and represented as a literal using the cnt:bytes
property of the cnt:Base64Content
.
After transforming the byteSeq to a character sequence charSeq using character encoding ce, charSeq is represented as a literal using the cnt:chars
property of the cnt:TextContent
and ce
as a literal usind the cnt:characterEncoding
property.
Given the byte sequence of text content (byteSeq) received from a Web server and an inappropriate character encoding (ce). byteSeq is recorded in Base64 format and represented as a literal using the cnt:bytes
property of the cnt:Base64Content
. Because transforming byteSeq to a character sequence charSeq using character encoding ce fails, no cnt:TextContent
resource can be created.
Given the character sequence of text content (charSeq) created in memory and an appropriate character encoding (ce). A cnt:TextContent
resource may be created with a cnt:chars
property with an object literal created from charSeq
. After transforming charSeq to byte sequence byteSeq using character encoding ce, a cnt:Base64Content
resource may be created with cnt:bytes
property with an object literal byteSeq and cnt:characterEncoding
property with an object literal ce.
Given the byte sequence of wellformed XML content (byteSeq) received from a Web server and an appropriate character encoding (ce). cnt:Base64Content
and cnt:TextContent
resources may be created as in situation B. Additionally, an cnt:XMLContent
resource may be created.
Given a DOM Document in memory, originally created by parsing some XML source, but afterwards changed by DOM operations. A cnt:XMLDecl
resource may be created from the information in the Document node itself (xmlVersion, xmlEncoding and xmlStandalone), and a cnt:DoctypeDecl
resource from the information in the DocumentType node. A cnt:XMLContent
resource may be created after serializing the relevant child nodes of the Document node to create object literals for cnt:xmlLeadingMisc
(serialize Comment and ProcessingInstruction nodes preceding a DocumentType node) and cnt:xmlRest
(serialize nodes following a DocumentType node). See the Mapping between DOM and the Content-in-RDF vocabulary.
The vocabulary provides a framework that allows the representation of any type of content. Of course, there are many possibilities for extensions that will allow the inclusion of additional metadata, like, e.g., that included in some multimedia formats. Typical scenarios for extensions could be:
However, at the point of writing this specification, the Working Group has decided to provide the basic framework that will support the immediate needs of vocabularies using this specification like EARL [EARL], leaving the room open for further extensions as new use cases are presented to us.
To understand the versatility of the vocabulary, let us assume we have a given XHTML page containing an XML declaration, a comment preceding a document type declaration and some XHTML elements.
Example 2.6: A typical XHTML page.
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <!-- this is a comment --> <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>The title</title> </head> <body> <p>Some paragraph.</p> </body> </html>
This page could be represented as simple TextContent
:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cnt="http://www.w3.org/2008/content#"> <cnt:TextContent rdf:about="http://example.org/example207.html"> <cnt:chars><?xml version="1.0" encoding="UTF-8" standalone="no" ?> <!-- this is a comment --> <!DOCTYPE html "-//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>The title</title> </head> <body> <p>Some paragraph.</p> </body> </html></cnt:chars> </cnt:TextContent> </rdf:RDF>
or likewise as XMLContent
. The information from the XML declaration is modelled as an XMLDecl
resource and refered to from the XMLContent
resource by the cnt:xmlDecl
property. As the comment <!-- this is a comment -->
precedes the document type declaration a cnt:xmlLeadingMisc
property is created with its object literal containing the comment. The document type declaration is modelled as a DoctypeDecl
resource and refered to from the cnt:XMLContent
resource by the cnt:doctypeDecl
property.
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cnt="http://www.w3.org/2008/content#" xml:base="http://example.org/example208.html"> <cnt:DoctypeDecl rdf:ID="dtd0"> <cnt:systemId>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</cnt:systemId> <cnt:publicId>-//W3C//DTD XHTML 1.0 Strict//EN</cnt:publicId> <cnt:doctypeName>html</cnt:doctypeName> </cnt:DoctypeDecl> <cnt:XMLDecl rdf:ID="xmld0"> <cnt:xmlStandalone>no</cnt:xmlStandalone> <cnt:xmlEncoding>UTF-8</cnt:xmlEncoding> <cnt:xmlVersion>1.0</cnt:xmlVersion> </cnt:XMLDecl> <cnt:XMLContent rdf:about="#"> <cnt:xmlLeadingMisc rdf:parseType="Literal"><!-- this is a comment --></cnt:xmlLeadingMisc> <cnt:doctypeDecl rdf:resource="#dtd0" /> <cnt:xmlDecl rdf:resource="#xmld0" /> <cnt:xmlRest rdf:parseType="Literal"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>The title</title> </head> <body> <p>Some paragraph.</p> </body> </html></cnt:xmlRest> </cnt:XMLContent> </rdf:RDF>
The following terms are defined by this specification:
Class name | Label | Comment | Refinements | Related properties |
---|---|---|---|---|
cnt:Content |
Content | The content. | cnt:Base64Content, cnt:TextContent, cnt:XMLContent | |
cnt:Base64Content |
Base64 Content | The base64 encoded content (can be used for binary content). | - | cnt:bytes, cnt:characterEncoding |
cnt:TextContent |
Text Content | The text content (can be used for text resources). | - | cnt:chars, cnt:characterEncoding |
cnt:XMLContent |
XML content | The XML content (can be used for XML-wellformed resources). | - | cnt:xmlDecl, cnt:xmlLeadingMisc, cnt:doctypeDecl, cnt:xmlRest, cnt:characterEncoding |
cnt:XMLDecl |
XML declaration | The XML declaration. | - | cnt:xmlEncoding, cnt:xmlStandalone, cnt:xmlVersion |
cnt:DoctypeDecl |
Document type declaration | The document type declaration. | - | cnt:doctypeName, cnt:internalSubset, cnt:publicId, cnt:systemId |
Property name | Label | Comment | Domain | Range |
---|---|---|---|---|
cnt:bytes |
Base64 encoded byte sequence | The Base64 encoded byte sequence of the content. | cnt:Base64Content |
RDF Literal |
cnt:characterEncoding |
Character encoding | The character encoding used create a character sequence from a byte sequence or vice versa. | cnt:Content |
RDF Literal |
cnt:chars |
Character sequence | The character sequence of the text content. | cnt:TextContent |
RDF Literal |
cnt:doctypeDecl |
Document type declaration | The document type declaration. | cnt:XMLContent |
cnt:DoctypeDecl |
cnt:doctypeName |
Document type name | The document type name. | cnt:DoctypeDecl |
RDF Literal |
cnt:internalSubset |
Internal DTD subset | The document type declarations's internal subset. | cnt:DoctypeDecl |
RDF Literal |
cnt:publicId |
Public ID | The document type declarations's public identifier. | cnt:DoctypeDecl |
RDF Literal |
cnt:systemId |
System ID | The document type declarations's system identifier (typed: xsd:anyURI) | cnt:DoctypeDecl |
RDF Literal |
cnt:xmlDecl |
XML declaration | The XML declaration. | cnt:XMLContent |
cnt:XMLDecl |
cnt:xmlEncoding |
XML character encoding | The XML character encoding. | cnt:XMLDecl |
RDF Literal |
cnt:xmlLeadingMisc |
XML leading misc | The XML content preceding the document type declaration. | cnt:XMLContent |
XML Literal |
cnt:xmlRest |
XML rest | The XML content following the document type declaration. | cnt:XMLContent |
XML Literal |
cnt:xmlStandalone |
XML standalone document declaration | The XML standalone document declaration. | cnt:XMLDecl |
RDF Literal |
cnt:xmlVersion |
XML version | The XML version. | cnt:XMLDecl |
RDF Literal |
An RDF Schema can be found at @@@TBD@@@.
[Editor's note: add link to RDF schema]
DOM property | Content-in-RDF property |
---|---|
Document.xmlVersion |
xmlVersion |
Document.xmlEncoding |
xmlEncoding |
Document.xmlStandalone |
xmlStandalone |
Document.doctype |
doctypeDecl |
DocumentType.name |
doctypeName |
DocumentType.publicId |
publicId |
DocumentType.systemId |
systemId |
DocumentType.internalSubset |
internalSubset |
[Editor's note: add changes from this version to WD-Content-in-RDF-20080908]
Since the 12 December 2008 editorial draft, the following changes have happened.:
http://www.w3.org/TR/EARL10/
http://www.w3.org/TR/1999/REC-rdf-syntax-19990222/
http://www.w3.org/TR/rdf-primer/
http://www.w3.org/TR/rdf-schema/
http://www.w3.org/TR/rdf-syntax-grammar/
http://www.ietf.org/rfc/rfc2119.txt
http://www.ietf.org/rfc/rfc2045.txt
http://www.w3.org/TR/owl-features/
http://www.w3.org/TR/xml/