W3C home > Mailing lists > Public > www-rdf-interest@w3.org > February 2001

Another RDF Syntax Idea

From: Aaron Swartz <aswartz@upclink.com>
Date: Mon, 12 Feb 2001 19:44:04 -0600
To: RDF Interest <www-rdf-interest@w3.org>
Message-ID: <B6ADED84.22726%aswartz@upclink.com>
Yeah, I'm sure others have probably suggested something like this already,
but I figure that now there's a WG to deal with things, we might as well
start discussing stuff with the knowledge that things could happen. If
someone has pointers to similar work, please feel free to send them to me or
post them here. 

Here are my thoughts on improvements to the XML syntax. These are written
with the intention to make it easier to migrate XML-based formats to RDF as
well as making RDF easier to understand. They come from my experience in
writing RDF modules for RSS and the confusions that people have when
developing them. Web version at (updated as needed):

http://logicerror.com/rdf-syntax-idea

1) Allow attributes. RDF allows the use of either attributes or element
content, but it shouldn't be an either/or choice. Often time it makes sense
to use both:

<price format="dollar">100</price>
    becomes
<#URIBeingDescribed> :price [format "dollar"; rdf:value 100 ] .

(the [] is an N3 convention for specifying an anonymous node)

2) Allow element content to be used as an RDF resource. I'm sure others can
think of a better attribute for this, but it's useful for formats (like RSS)
that want to remain backwards compatible.

<format rdf:content="uri">http://example.org/format</format>
    becomes
<#URIBeingDescribed> :format <http://example.org/format> .

(that is, it's interpreted as a URI, not a literal)

3) The LI controversy. I'm sure this has been covered plenty, but here's my
suggestion:

<items rdf:content="list">
  <rdf:li rdf:resource="#uri1" />
  <rdf:li rdf:resource="#uri2" />
</items>
    becomes
<#URIBeingDescribed> :items [
  rdf:_1 <#uri1> ; 
  rdf:_2 <#uri2> ;
] .

(the idea is that it points to an anonymous node that's a list)

If another term is used instead of rdf:li then an rdf:type will be set for
the resource.

4) An arbitrary document header. Often times, you'll want to RDF-ize a
format, but can't because of the requirement that rdf:RDF is the root. If
you add in this element, the format will be incompatible with older tools.
If you don't add it, no RDF parser will understand it. Solution: the
rdf:content element, of course. ;-)

<rss rdf:content="rdf">
    <!-- everything here is interpreted as being inside an rdf:RDF tag -->
</rss>

5) Automatic parenting. Often XML depends a lot on it's tree structure,
which RDF imposes certain restrictions on. It'd be nice to have things that
behave like a list, act like it too:

<rdf:RDF>
  <rdf:Description rdf:about="#q">
     <item rdf:about="#q1">
        <!-- ... -->
     </item>
  </rdf:Description>
</rdf:RDF>
    becomes
<#q> rdf:_1 <#q1> .

(See, it's a list -- get it?)

For those of you who are clever, you'll have noticed that if all these
changes are implemented, you'll be able to convert most XML data formats to
RSS by the addition of just a few attributes. Specifically, you'll be able
to convert RSS 0.91. (You knew I was going somewhere with this.) Here's an
example:

<rss version="0.92+rdf" rdf:content="rdf">
  <channel rdf:about="#channelURI">
    <title>Title goes here...</tite>
    <link rdf:content="uri">http://example.org/</link>
    <!--...-->
    
    <item rdf:about="#itemID">
      <title>item name</title>
      <link rdf:content="uri">http://example.org/a</link>
      <newElement rdf:content="uri" name="value">http://a.com</newElement>
      <!--...-->
    </item>
  </channel>
</rss>

Of course, to make things even easier (and remove redundant elements) a DTD
or some other external file could define the rdf:content attributes.
Thoughts and comments appreciated.
-- 
Aaron Swartz <me@aaronsw.com>|               RSS Info
  <http://www.aaronsw.com>   |   <http://www.blogspace.com/rss/>
AIM: JediOfPi | ICQ: 33158237| news and information on the RSS format
Received on Monday, 12 February 2001 20:44:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:51:48 GMT