On 11 Sep 2009, at 16:36, Shane McCarron wrote:
It is my belief that the following are NOT equivalent from a
processing perspective (assume the foaf prefix is declared, the blah
prefix is not):
• <span about="#shane" property="foaf:name" datatype="">Shane</span>
• <span about="#shane" property="foaf:name"
datatype="blah:blah">Shane</span>
The first item explicitly requests a text literal. The second item
requests a datatype that is undefined (illegal, invalid, whatever).
I maintain that in a conforming processor the second item would NOT
generate any triple.
I don't think that's what the spec currently says. An illegal value as
above causes an *attribute* that is present (ie there is a datatype
attribute there) and a value that is empty (because illegal CURIEs are
ignored). Step 9 says that a typed literal is created if:
"@datatype is present, and does not have an empty value, and is not
set to rdf:XMLLiteral."
In this case, datatype is present but it has an empty value, so we
don't create a typed literal.
The next possibility is that it's a plain literal, if it meets any of
the conditions:
• @content is present;
• or all children of the [current element] are text nodes;
• or there are no child nodes (in which case the literal value is the
empty string);
• or the body of the [current element] does have non-text child nodes
but @datatype is present, with an empty value.
In this case, all children of the current element are text nodes, so
the object is a plain literal and the triple should be:
<#shane> foaf:name "Shane" .
In the case where the element did contain elements:
<span about="#shane" property="foaf:name"
datatype="blah:blah"><em>Shane</em></span>
I think the fourth of the clauses -- "or the body of the [current
element] does have non-text child nodes but @datatype is present, with
an empty value." -- comes into action, because there is a datatype
attribute present but it has an empty value (because its value is
illegal). So we again get the triple:
<#shane> foaf:name "Shane" .
I don't think there's any language in the specification that indicates
that the entire triple will be omitted if the datatype attribute is
illegal. Creating a plain literal seems to be a reasonable fallback
when the datatype is unknown.
I think the same is true for our treatment of @property, @about, and
@resource. It is explicitly NOT true for @rel, @rev, and (maybe)
@typeof because of their ability to cause bnodes to be created. Do
you disagree? And can you answer in one page or less? :P
FWIW, I disagree about property, because it also has the power
(through the setting of [skip element] in step 4) to determine whether
or not bnodes are created to complete any hanging triples. This is
Philip's example. With no property attribute:
<p xmlns:ex="http://example.org/" about="http://example.com/"
rel="ex:rel1">
<span content="Content 1">
<span about="http://example.net/">Test 1</span>
</span>
</p>
we should generate:
<http://example.com/> <http://example.org/rel1> <http://example.net/
> .
With a legal property attribute:
<p xmlns:ex="http://example.org/" about="http://example.com/"
rel="ex:rel2">
<span property="ex:prop" content="Content 2">
<span about="http://example.net/">Test 2</span>
</span>
</p>
we should generate:
<http://example.com/> <http://example.org/rel2> _:bnode1 .
_:bnode1 <http://example.org/prop> "Content 2" .
The final example being an illegal property attribute which means that
the property is still *present* (causing the creation of a bnode) but
does not create triples of its own:
<p xmlns:ex="http://example.org/" about="http://example.com/"
rel="ex:rel3">
<span property="bogus:bogus" content="Content 3">
<span about="http://example.net/">Test 3</span>
</span>
</p>
we should generate:
<http://example.com/> <http://example.org/rel2> _:bnode2 .
For @about, @resource, @href and @src, the wording is "by using the
URI from @{attribute}, if present, obtained according to the section
on CURIE and URI Processing;". I think the "if present" here refers to
"the URI from @{attribute}" rather than just "@{attribute}", such that
if @about does not resolve to a URI there is no value present and it
is as if the entire attribute had not been there. So:
<p xmlns:ex="http://example.org/" about="http://example.com/">
<span about="[bogus:bogus]" property="ex:prop">Test</span>
</p>
results in the triple:
<http://example.com/> <http://example.org/prop> "Test" .
It would make things clearer all round if the specification used
phraseology that specifically included the possibility of illegal
values and made it explicit where it's talking about *values* being
present and where about *attributes* being present in relevant places,
such as:
"_the_ @datatype _attribute_ is present, and does not have an empty
_or illegal_ value, and is not set to rdf:XMLLiteral."
"or the body of the [current element] does have non-text child
nodes but _the_ @datatype _attribute_ is present, with an empty _or
illegal_ value."
"Additionally, if _the_ @property _attribute_ is not present then
the [skip element] flag is set to 'true';"
Cheers,
Jeni
--
Jeni Tennison
http://www.jenitennison.com