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

A Wishlist of QName::URI Mapping Examples

From: <Patrick.Stickler@nokia.com>
Date: Fri, 17 Aug 2001 21:25:07 +0300
Message-ID: <2BF0AD29BC31FE46B788773211440431245BF9@trebe003.NOE.Nokia.com>
To: www-rdf-interest@w3.org

In the interest of not merely complaining about problems but not suggesting
solutions, and also in response to Aaron Swartz's valid criticisms of the
particular mechanisms used in my earlier proposal, I wanted to provide a
brief list of examples/cases which hopefully will illustrate the kind of
solution and functionality I am hoping for in future incarnations of RDF
and RDF compliant systems.

I use the namespace prefix 'rdfm:' to correspond to a namespace defining
an ontology for RDF serialization mapping constructs, but don't yet bother
to specify any actual namespace URI (since it is fictional). I also don't
vouch for the correctness or existence of any of the URIs in any of the 
examples (they're just examples)...

Each example provides one or more mapping declarations, a sample XML RDF 
fragment, and the equivalent triple(s).

Note that all mappings are fully bi-directional, and thus can be used
for parsing serialized XML data into triples and serializing triples back
to XML.

The following is a brief summary of the ontology:

    rdfm:Map              a mapping declaration
    rdfm:resource         the URI of an RDF resource
    rdfm:namespace        the URI of a namespace
    rdfm:name             a namespace qualified name
    rdfm:value            a literal CDATA value in the XML instance
    rdfm:property         the URI of an RDF property serving as context for
                             literal CDATA values in the XML instance
    rdfm:pattern          a regular expression pattern matching CDATA
                             in the XML instance

1. QName <-> URI

   <rdfm:Map
    rdfm:resource  ="urn:partax:(foo(bar))"
    rdfm:namespace ="urn:partax:(foo)"
    rdfm:name      ="bar"
   />

   <rdf:RDF ... xmlns:foo="urn:partax:(foo)">
      <rdf:Description ID="X">
         <foo:bar>bas</foo:bar>
      </rdf:Description>
   </rdf:RDF>

   [X, urn:partax:(foo(bar)), "bas"]

This basic example addresses the most essential need of a mapping
solution that (a) does not create unintentional collisions, and (b)
works with any arbitrary URI scheme. The remaining examples are not
manditory but highly desirable (at least to me ;-)

2. CDATA Literal <-> URI

   <rdfm:Map
    rdfm:resource  ="name:metia.nokia.com/MARS/2.1/language"
    rdfm:namespace ="name:metia.nokia.com/MARS/2.1"
    rdfm:name      ="language"
   />
   <rdfm:Map
    rdfm:resource ="http://www.iso.ch/3166-1/en"
    rdfm:property ="http://metia.nokia.com/MARS/2.1/language"
    rdfm:value    ="en"
   />

  <rdf:RDF ... xmlns:mars="http://metia.nokia.com/MARS/2.1">
      <rdf:Description ID="X">
         <mars:language>en</mars:language>
      </rdf:Description>
   </rdf:RDF>

   [X, http://metia.nokia.com/MARS/2.1/language,
http://www.iso.ch/3166-1/en]

IMO, it's better to have an actual resource http://www.iso.ch/3166-1/en 
identified in our knowledge base than a literal such as 'en'. 

3. CDATA Literal <-> RDF Literal with Validation

   <rdfm:Map
    rdfm:resource  ="name:metia.nokia.com/MARS/2.1/date"
    rdfm:namespace ="name:metia.nokia.com/MARS/2.1"
    rdfm:name      ="date"
   />   
   <rdfm:Map
    rdfm:property ="http://metia.nokia.com/MARS/2.1/date"
    rdfm:pattern  ="[0-9]{4}-[0-9]{2}-[0-9]{2}"
   />

  <rdf:RDF ... xmlns:mars="http://metia.nokia.com/MARS/2.1">
      <rdf:Description ID="X">
         <mars:date>2001-08-15</mars:date>
      </rdf:Description>
      <rdf:Description ID="Y">
         <mars:date>01-8-15</mars:date>
      </rdf:Description>
   </rdf:RDF>

   [X, http://metia.nokia.com/MARS/2.1/language, '2001-08-15']
   [Y, http://metia.nokia.com/MARS/2.1/language, ???  ERROR! Not a valid
date!


4. CDATA Literal <-> URI by Pattern

   <rdfm:Map
    rdfm:resource  ="name:metia.nokia.com/MARS/2.1/language"
    rdfm:namespace ="name:metia.nokia.com/MARS/2.1"
    rdfm:name      ="language"
   />
   <rdfm:Map
    rdfm:resource ="http://www.iso.ch/3166-1/en"
    rdfm:property ="http://metia.nokia.com/MARS/2.1/language"
    rdfm:pattern  ="en(-[a-z][a-z])?"
   />

  <rdf:RDF ... xmlns:mars="http://metia.nokia.com/MARS/2.1">
      <rdf:Description ID="X">
         <mars:language>en-us</mars:language>
      </rdf:Description>
     <rdf:Description ID="Y">
         <mars:language>en</mars:language>
      </rdf:Description>
   </rdf:RDF>

   [X, http://metia.nokia.com/MARS/2.1/language,
http://www.iso.ch/3166-1/en]
   [Y, http://metia.nokia.com/MARS/2.1/language,
http://www.iso.ch/3166-1/en] 

Note that regardless of the optional dialect code, they are mapped to
the same language resource.

5. QName synonyms -> common URI

   <rdfm:Map
    rdfm:resource  ="name:metia.nokia.com/MARS/2.1/language"
    rdfm:namespace ="name:metia.nokia.com/MARS/2.1"
    rdfm:name      ="language"
   />
   <rdfm:Map
    rdfm:resource  ="name:metia.nokia.com/MARS/2.1/language"
    rdfm:namespace ="name:metia.nokia.com/MARS/2.1/sf"
    rdfm:name      ="kieli"
   />
   <rdfm:Map
    rdfm:resource ="http://www.iso.ch/3166-1/en"
    rdfm:property ="http://metia.nokia.com/MARS/2.1/language"
    rdfm:value    ="en"
   />

  <rdf:RDF ... xmlns:mars="http://metia.nokia.com/MARS/2.1"
               xmlns:mars-sf="http://metia.nokia.com/MARS/2.1/sf">
      <rdf:Description ID="X">
         <mars:language>en</mars:language>
      </rdf:Description>
      <rdf:Description ID="Y">
         <mars-sf:kieli>en</mars:kieli>
      </rdf:Description>
   </rdf:RDF>

   [X, http://metia.nokia.com/MARS/2.1/language,
http://www.iso.ch/3166-1/en]
   [Y, http://metia.nokia.com/MARS/2.1/language,
http://www.iso.ch/3166-1/en]

And why not just deal with cases like 4 and 5 using e.g. daml:equivalentTo?
In
order to reduce what is already a highly complex inference space by
eliminating 
what are (to the perspective of a given application using such mappings)
irrelevant
syntactical variants or localized vocabularies of equivalent semantic
identities.

--

Have a great weekend, folks!

Cheers,

Patrick

--
Patrick Stickler                      Phone:  +358 3 356 0209
Senior Research Scientist             Mobile: +358 50 483 9453
Software Technology Laboratory        Fax:    +358 7180 35409
Nokia Research Center                 Video:  +358 3 356 0209 / 4227
Visiokatu 1, 33720 Tampere, Finland   Email:  patrick.stickler@nokia.com
 
Received on Friday, 17 August 2001 14:25:12 GMT

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