- From: Jeremy Carroll <jjc@hpl.hp.com>
- Date: Mon, 05 Dec 2005 22:49:31 +0000
- To: "'public-rdf-in-xhtml task force'" <public-rdf-in-xhtml-tf@w3.org>
Another issue with spec if head has an id and no about and a meta child
what happens.
===========
The heart of the implementation is the rules file:
Each rule is either a subject rule, a predicate rule or an object rule,
corresponding to some text in the spec.
The a:match attribute gives an XPath2 predicate that is true of XHTML
elements to which this rule applies.
The x:para attribute is a link into the spec.
The rdf: attributes appear in the XSLT as an attribute value template,
with the additional rule that if the value is "" then it is suppressed.
These are then output either on the rdf:Description element or on the
property element in the RDF/XML.
Other a: attributes are:
a:reversed invokes special behaviour for rev attribute
a:object one of 'literal' or 'resource' is used to line up predicate
rules and object rules.
Other x: attributes are:
x:literal which specifies the text node content of the property
element. This is typically an xpath expression, but can be the special
value '#copy' which does a deep copy of the current element content.
The a: attributes are processed in the first compile-time
transformation, the x: attributes are processed in the second
compile-time transformation
I'll give a textual gloss of some of the rules:
<rules
xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
xmlns:axml='file://xml.namespace.alias'
xmlns:x='file://attributes.to.be.stripped.in.second.pass'
xmlns:a='file://attributes.to.be.stripped.in.first.pass'
>
<!-- The subject of a triple is usually indicated using the about
attribute -->
<subject
rdf:about='my:resolve-uri-curie(@about,.)'
rdf:nodeID='my:bnode-uri-curie(@about)'
x:para='4.3.1'
a:match='[@about]'
/>
<!--
Note that this section does not apply to [RDF/A statement]s whose
predicates are defined in meta or link elements. Section 4.3.3 deals
with meta and link specifically.
If the [RDF/A statement] that includes the predicate attribute does not
have an about attribute, then the subject of the [triple] is determined
by the [context statement]'s about attribute. The resolution of the
about attribute is recursive: if the [context statement] has no such
attribute, then the processor must continue up the DOM tree to find the
closest ancestor with an about attribute.
-->
<subject
rdf:about='my:resolve-uri-curie(ancestor::*[@about][1]/@about,ancestor::*[@about][1])'
rdf:nodeID='my:bnode-uri-curie(ancestor::*[@about][1]/@about)'
x:para='4.3.2'
a:match='[not(self::xhtml2:meta)][not(self::xhtml2:link)][not(@about)][ancestor::*[@about]]'
/>
<!--
If no such parent is ever found all the way up the DOM tree, then the
default value for the about attribute is the empty string, which
effectively indicates the current document.
-->
<subject
rdf:about='my:resolve-uri-curie("",/)'
x:para='4.3.2'
a:match='[not(self::xhtml2:meta)][not(self::xhtml2:link)][not(ancestor-or-self::*[@about])]'
/>
<!--
If an [RDF/A statement] is generated by a predicate attribute of a
meta or link element, and this element does not contain an explicit
about attribute, subject resolution is slightly different. Only the
immediate [context statement] is considered, whether or not it has its
own about attribute.
If the [context statement] is a meta or link element itself, the [RDF/A
statement] represented by the [context statement] is reified as the
subject of this new [RDF/A statement]. More details on reification in
RDF/A are found in Section 5.3.
Otherwise, if the [context statement] is neither a meta nor a link, two
cases should be considered. The [context statement] may have an about
attribute, in which case the [RDF/A statement]'s subject is resolved as
the value of this attribute (exactly as if the current [RDF/A statement]
weren't a link or meta.)
also
A meta or link without its own about attribute and positioned directly
within the head of a document will automatically apply to the document
itself. Effectively, the head of an XHTML2 document contains an implicit
about="".
-->
<subject
rdf:about="my:resolve-uri-curie(../@about,..)"
rdf:nodeID="my:bnode-uri-curie(../@about)"
x:para='4.3.3'
a:match='[self::xhtml2:meta or self::xhtml2:link][not(@about)]
[not(parent::xhtml2:meta or parent::xhtml2:link)]
[../@about or parent::xhtml2:head]
[../@xml:id]'
/>
<!--
However, if the [context statement] does not have an about attribute,
the subject of the current [RDF/A statement] is the parent element itself.
-->
<subject
rdf:about="my:resolve-uri(concat('#',../@xml:id),base-uri(..))"
x:para='4.3.3'
a:match='[self::xhtml2:meta or self::xhtml2:link][not(@about)]
[not(parent::xhtml2:meta or parent::xhtml2:link)]
[not(../@about or parent::xhtml2:head)]
[../@xml:id]'
/>
<!--
If this parent element is not identified with xml:id, it is treated as a
[unique anonymous ID].
-->
<subject
rdf:nodeID="concat('g.',generate-id(..))"
x:para='4.3.3'
a:match='[self::xhtml2:meta or self::xhtml2:link][not(@about)]
[not(parent::xhtml2:meta or parent::xhtml2:link)]
[not(../@about or parent::xhtml2:head)]
[not(../@xml:id)]'
/>
<!--
A property attribute indicates a new statement whose predicate is the
value of that attribute. The subject of the triple will be decided using
subject resolution (Section 4.3). The object of the triple will be
decided using [literal] object resolution (Section 4.4).
-->
<predicate
a:object='literal'
x:para='4.2.1'
a:match='[@property]'
name='my:curie-to-qname(@property,.)'
/>
<!--
A rel attribute indicates a new statement whose predicate is the value
of that attribute. The subject of the triple will be decided using
subject resolution (Section 4.3). The object of the triple will be
decided using [URI reference] object resolution (Section 4.4).
-->
<predicate
a:object='resource'
x:para='4.2.2'
a:match='[@rel]'
name='my:curie-to-qname(@rel,.)'
/>
<!--
A rev attribute indicates a new statement whose predicate is the value
of that attribute. The subject of the triple will be decided using [URI
reference] object resolution (Section 4.4). The object of the triple
will be decided using subject resolution (Section 4.3).
-->
<predicate
a:reversed='true'
a:object='resource'
x:para='4.2.3'
a:match='[@rev]'
name='my:curie-to-qname(@rev,.)'
/>
<!-- TODO reification rules of 5.3 -->
<!--
The content attribute can be used to indicate a [plain literal]
In RDF/A the XML language attribute -- xml:lang -- is used to add this
information, whether the plain literal is designated by the content
attribute, or by a datatype value of plaintext:
Note that the value can be inherited as defined in [XML-LANG],
-->
<object
axml:lang='ancestor-or-self::*[@xml:lang][1]/@xml:lang'
x:literal='@content'
a:object='literal'
x:para='5.1.1.2'
a:match='[@content][not(@datatype)]'
/>
<!--
RDF allows [literal]s to be given a data type,
This can be represented in RDF/A
-->
<object
x:literal='@content'
a:object='literal'
x:para='5.1.2'
rdf:datatype="my:resolve-bare-curie(@datatype,.)"
a:match='[@content][@datatype]'
/>
<!--
RDF does, however, provide a datatype for indicating [XML literal]s.
RDF/A therefore adds this datatype to any [literal] that is indicated
using child text nodes on the [RDF/A statement].
-->
<object
x:literal='#copy'
rdf:parseType="'Literal'"
a:object='literal'
x:para='5.1.1.1'
a:match='[not(@content)][not(@datatype)]'
/>
<!--
If the datatype is specified, but no content attribute exists, then
the typed literal's value is determined as the concatenation of all
textual child elements.
-->
<object
x:literal='.//text()'
a:object='literal'
x:para='5.1.2.1'
rdf:datatype="my:resolve-bare-curie(@datatype,.)"
a:match='[not(@content)][@datatype]'
/>
<!--
The href attribute on the [RDF/A statement]'s element is used to
indicate the object as a [URI reference].
-->
<object
a:object='resource'
x:para='4.4.2'
rdf:resource="my:resolve-uri-curie(@href,.)"
rdf:nodeID="my:bnode-uri-curie(@href)"
a:match='[@href]'
/>
</rules>
Received on Monday, 5 December 2005 22:51:25 UTC