OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

xri message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: XRI as structured URI


Inspired by a recent blog entry by Mark Nottingham ( http://www.mnot.net/blog/archives/000137.html ), and some internal requirements about describing "XRI namespaces", I decided to sit down and think about how one could structure the parsing and (more importantly) construction of XRIs from a template and a set of data fields.
 
For example, lets say I have an XRI template for XRIs identifying houses on a trash collection route
 
xri:@TrashCompany/<city>/<street>/<number>
 
Examples of this XRI would include:
 
xri:@TrashCompany/belmont/ralston/1000
xrI:@TrashCompany/oakland/telegraph/400
 
I want to be able to describe this template more formally, however, and so I set about seeing what I could do leveraging XML tools.
 
The first step was to define a simple XML schema for representing the structure of a XRI. This representation should be fairly rivial to convert to and from the form that we are defining in the XRI spec:
 
<xri>
  <content>
    <segment><pnode>@</pnode><pnode>TrashCompany</pnode></segment>
    <segment><pnode id="city">...</pnode></segment>
    <segment><pnode id="street">...</pnode></segment>
    <segment><pnode id="number">...</pnode></segment>
  </content>
 
The next step was to add some information about what are fields:
 
  <fields>
    <description ref="city">
      <type>http://www.w3.org/2001/XMLSchema#string</type>
      <summary>The city where this location is</summary>
    </description>
    ...
  </fields>
</xri>
 
These above xml document constitutes a "template". To fill in the template (something an application constructing an XRI might do), a simple XML file of the following form is used:
 
<data>
  <variable>
    <name>city</name>
    <value>belmont</name>
  </variable>
</data>
 
Next, I defined an XSL stylesheet that takes the template above and "plugs in" the data fields. The result is an XML file contains the <xri><content>...</content></xri> with all the data fields filled in - in other words a structured XRI with data fields filled in. This can easily be transformed back into the form of the XRI in the specification:
 
<xri>
  <content>
    <segment><pnode>@</pnode><pnode>TrashCompany</pnode></segment>
    <segment><pnode>belmont</pnode></segment>
    <segment><pnode>ralston</pnode></segment>
    <segment><pnode>1000</pnode></segment>
  </content>
</xri>
 
I think the approach of converting the XRI to XML and processing it there with XML tools is interesting. This is just a first stab at this approach.
 
I'm NOT suggesting that this stuff become formalized by the TC, I'm merely suggesting that there are a lot of uses XRIs can be put to, and we can start playing with them NOW.
 
The XSL and sample XML files are attached in a zip file.
 
    -Gabe

xrixml.zip



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]