Re: how to address RDF fragment

At 11:48 AM 4/19/2000 -0400, Hidetaka Ohto wrote:
-> http://lists.w3.org/Archives/Public/www-rdf-comments/2000AprJun/0013.html

>I am working on CC/PP WG which plans to use RDF 
>for describing device capabilities.

Statements about physical devices and their capabilities fit very
well within the sorts of applications that we envisioned for RDF,
so I am especially interested in your feedback as you work through
the details of applying RDF to CC/PP.

>I would like to know how a RDF resource which is created
>in a document should be annotated by another RDF description
>which is in another document.

By way of preface, after writing most of this reply to you I went
back and scanned some of Tim Berners-Lee's musings on this subject:
-> http://www.w3.org/DesignIssues/Identity.html "Identifiers - what
is identified?".  I think that Tim and I may have reached slightly
different conclusions about some of the details.  I might post a
followup to this.

>Q1: For example, is it possible to do that?
>(As far as I know, there is no DTD(or XML Schema?) for RDF.

I am a little concerned about the phrasing of the question as
"resource which is created in a document" and I think that there
could be a sublety here which may affect the interpretation of the
question.  I will come back to this, but first let me share a little
background from the RDF Model and Syntax Working Group discussions.

The question of what, exactly, a URI fragment designates in the
case of an XML document that uses the RDF namespace is indeed an
area that is murky in the spec, I have recently realized.  Part
of your question has, I claim, a single consistent answer and part
has several feasible answers.

Some background:

RDF is not specified with a DTD because by its very nature it wants to
facilitate the sort of modularity that DTD technology makes extremely
difficult.  We wanted metadata communities to be able to freely mix
RDF statements using any RDF property sets they wished to combine.  As
demonstrated by the XHTML modularization work
http://www.w3.org/TR/xhtml-modularization/ the effort to combine this
free combination of property vocabularies with DTD validation takes a
significant effort and requires a certain amount of prior arrangement
and agreement between different communities.  In the RDF/XML syntax
discussions we felt that XML Namespace technology was a much more
practical direction for the future and we placed our faith in the XML
community to eventually deliver technology that would support
validation with the kind of modularity that XML Namespaces promises.
XML Schema might fulfil that promise.  I haven't absorbed enough of
the last call specification yet to be sure.  Questions like yours are
very timely during this last call review of the XML Schema
specification.

In several Working Drafts of RDF Model and Syntax the bagID and ID
attributes were specified to be XML AttType ID.  As late as
http://www.w3.org/TR/1998/WD-rdf-syntax-19980819/#grammar we were
still under the impression that we would be able to specify this
and remain compliant with XML 1.0.  Then Tim Bray pointed out to
the Working Group that XML 1.0 forbids an element from having more
than one attribute of type ID.
http://www.w3.org/TR/REC-xml#sec-attribute-types
Since the bagID and ID attributes name different RDF objects it
was evident from the point of view of the RDF model that they
could appear together.  Rather than contort the syntax more, we
chose to drop the normative reference to XML AttType ID and copy
some words from the XML spec; thus in
http://www.w3.org/1998/10/WD-rdf-syntax-19981008/ and in the
final Recommendation http://www.w3.org/TR/REC-rdf-syntax/#grammar
the language is

  The values for each ID and bagID attribute must not appear in more
  than one such attribute within a document nor may the same value be
  used in an ID and a bagID within a single document.

Note that this all preceeded the XPointer specification which
tells us exactly how to interpret URI fragment syntax in documents
of content type text/xml.  The RDF Model and Syntax Recommendation
is silent on the question of content type.

End of Background.

The RDF Schema Candidate Recommendation clearly thinks that

 <Description ID="label"
   xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  ...

and

 <Description about="http://www.w3.org/2000/01/rdf-schema#label"
   xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  ...

were meant to be two ways of saying exactly the same thing,
provided that the base URI in the first case is
http://www.w3.org/2000/01/rdf-schema#.

That is, the expectation of the Working Group was to say that
the full URI of a resource named in a Description element using
the ID attribute is formed by concatenating the base URI of the
XML document (however that may be determined, including the new
XBase specification http://www.w3.org/TR/xmlbase), a "#" character,
and the ID attribute value.  I now think that this is wrong.

>Therefore it seems to me that we could not resolve a URI
>fragment ID using the knowledge of attribute types in DTD(ID), 
>and need to use RDF specific resolution rules. 
>However I do not know what it is.)

I could argue that RDF does not presume that all URIs will be
resolvable, but that would be avoiding the really interesting
part of your question so I will reserve this observation for
an escape hatch later :-).

Since RDF does not specify a DTD and since it also failed
(forgot?) to specify that ID should be processed for purposes
of fragment resolution as if it were XML AttType ID and since
RDF does not specify a content type you are quite right to
be perplexed.  I confess that I did not fully appreciate all
this as we were drafting the RDF Model and Syntax specification.
I cannot recall that anyone else raised this question at the time,
though we did briefly discuss content type in a different context.

But in retrospect, I conclude that we would likely have gotten
it terribly wrong if we *had* specified fragment resolution before
letting things like XML Schema and XML Pointer mature, so I am
just as happy that we have left the opportunity to discuss this now.

In fact, the RDF Model and Syntax specification does not tell you
how to construct a full URI for the resource named by an ID or bagID.
The resources are addressable at best only locally within the
same RDF/XML expression.

>http://aaa/a.rdf 
>-------------
><rdf:RDF xmlns:rdf="http://http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>  xmlns="http://xxx/xxx">
>  <rdf:Description ID="a">
>    <p1>v1</p1>
>  </rdf:Description>
></rdf:RDF>

This says there is a resource whose name is "a".  The name "a" can
only be resolved within the context of the document http://aaa/a.rdf.

>http://bbb/b.rdf
>-------------
><rdf:RDF xmlns:rdf="http://http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>  xmlns="http://xxx/xxx">
><rdf:Description about="http://aaa/a.rdf#a">
>  <p2>v2</p2>
></rdf:Description>
></rdf:RDF>

This refers to the resource whose URI is http://aaa/a.rdf#a but we
do not have any way of knowing the relationship between this resource
and the one named above.  I admit that this is likely to be a surprising
conclusion to some.

>Q2: Can "bagID" and "ID" within one document have the same value(URI)?
>(As far as I know, there is no restrictions in the RDF M&S spec but I guess
>the answer is No.)

This, at least, does have a clear answer.  The English wording
is unambiguous but it could have been made more accessible to
non-English speakers.  The same value must not be used in both
an ID and a bagID within a single document.

  The values for each ID and bagID attribute must not appear in more
  than one such attribute within a document nor may the same value be
  used in an ID and a bagID within a single document.

    http://www.w3.org/TR/REC-rdf-syntax/#grammar

>For example, 
><rdf:RDF xmlns:rdf="http://http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>  xmlns="http://xxx/xxx">
>  <rdf:Description ID="a">
>    <p1>v1</p1>
>  </rdf:Description>
>  <rdf:Description bagID="a">
>    <p2>v2</p2>
>  </rdf:Description>
></rdf:RDF>

From the RDF model perspective, there is no trouble in stating that
an instance of a Bag named "a" also has a p1 property with the value
"v1".  This is how I would wish to interpret the above if it had been
allowed.  That is, a resource named "a" has rdf:Type rdf:Bag and
has a http://xxx/xxxp1 property "v1".  Allowing the syntax is not
really necessary, then, as my proposed interpretation is the same as
having said <rdf:Description about="#a"><p1>v1</p1></rdf:Description>.

>Q3: When a RDF description is embedded in an XML application document using
>name space, how should the RDF resource described by the RDF description be
>annotated by another RDF description which is in another document?
>
>For example,
>(assuming the type of attribute "ccpp:ID" is ID in DTD.)
>
>http://aaa/a.xml
>---------------
><ccpp:Profile ccpp:ID="a" xmlns:ccpp="http://ccpp/ccpp" >
>  <rdf:RDF xmlns:rdf="http://http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>    xmlns=http://xxx/xxx>
>    <rdf:Description ID="a">
>      <p1>v1</p1>
>    </rdf:Description>
>  </rdf:RDF>
></ccpp:Profile>

I think you can not refer to the RDF resource named "a" outside
of http://aaa/a.xml.  If you wanted to declare that the "a"
resource had an external name you might write something like

http://aaa/a.xml
---------------
<ccpp:Profile ccpp:ID="a" xmlns:ccpp="http://ccpp/ccpp" >
  <rdf:RDF xmlns:rdf="http://http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns=http://xxx/xxx>
    <rdf:Description about="http://aaa/a.xml#b">
      <p1>v1</p1>
    </rdf:Description>
  </rdf:RDF>
</ccpp:Profile>

Now you have to be careful that if http://aaa/a.xml has content type
text/xml then it does not also have a ccpp:ID attribute with the value
"b" unless it really does mean that the RDF Resource and the XML
Fragment are one and the same thing.

When you wrote this question you did not use the phrasing "RDF
resource created by the RDF description".  I said above that I would
come back to this.  The RDF Model and Syntax specification does use
the phrasing "creating ... new resource" when referring to the ID
attribute.  It is a philosophical question whether a resource
exists before you know either its name or any relationships it may
have to other resources in your world.  But even if you decide that
the instant of creation is the time the name is uttered, it is
important to distinguish the RDF resource as a separate entity from
the XML markup in which the name is given.  The XML fragment and
the RDF Resource are in general not the same object.  One could
declare content type that made them the same, I suppose, but I'm
not sure of what advantage that would be.  Tim noted in
http://www.w3.org/DesignIssues/Identity.html:

  "To have a different interpretation of a URI as a function of the
   notional type of the document belies the fact the point of using
   XML syntax for RDF was that RDF documents should be XML documents!
   Of course we embed RDF in regular XML documents."

>http://bbb/b.rdf
>-------------
><rdf:RDF xmlns:rdf="http://http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>  xmlns="http://xxx/xxx">
><rdf:Description about=http://aaa/a.xml#a>  
>      <!-- ? what is it addressing? I guess the answer is
"ccpp:Profile" tag -->

If http://aaa/a.xml has content type text/xml or application/xml then 
by the rules of XPointer http://www.w3.org/TR/1999/WD-xptr-19991206
this must be referring to the XML element ccpp:Profile above.

>      <!-- when I want to address the RDF resource "a" in a.xml, how
to do that? -->

sorry, there appears to be no way to do this at the moment.
Use the rdf:about attribute instead.

>      <!-- I guess the answer is the RDF description in a.xml needs to have ccpp:ID? -->

That could help, if you really mean to say that the resource you are
describing is the specific instance of the XML element.  I doubt that
is what you mean, though.

>  <p2>v2</p2>
></rdf:Description>
></rdf:RDF>
>
>Q4: It seems to me that it would be nice if I had "xml:id".
>I vaguely remember there was a discussion whether we should
>have "xml:id" or not in somewhere...
>Could you let me know what is wrong with "xml:id"?

I agree that many namespaces are likely to create an attribute
of XML AttType ID called "id" or "ID".  It would seem to be
a convenience to have such an attribute in the xml namespace
so it can be easily shared by everyone.  This would allow
those namespace applications to perform bare XPointer processing
without requiring access to the Schema or DTD.  I think this
would be a big win.  But such an attribute has a very different
interpretation than rdf:ID.

The RDF Interest Group has touched on some of these questions; see
http://lists.w3.org/Archives/Public/www-rdf-interest/1999Nov/0101.html
and also browse around the thread via
http://lists.w3.org/Archives/Public/www-rdf-interest/1999Nov/thread.html#73

There was also a thread that is loosely related to this question of
identifying RDF resources, but this specific question was not raised there.
http://lists.w3.org/Archives/Public/www-rdf-interest/1999Dec/0028.html

-Ralph

Received on Wednesday, 19 April 2000 16:19:34 UTC