XML-Data (mapping object-style XML to frames)

Eric Prud'hommeaux and I just spent some time talking through the
issues, and we settled on the following design, for your consideration.
I kept this in the form he and I discussed; I hope the relationship to
rule form is clear enough.   (Eric says Hi.)

The XML document (no default namespace):
        
        <Person tel="x531" 
                x:bday="Tuesday"
                xmlns:x="http://example.org/2">
          <name>Eric</name>
          <x:bday>1966-11-08</x:bday>
        </Person>
        
maps to:
        
           _#<http://www.w3.org/ns/none#Person>[
               <http://www.w3.org/ns/none#tel> -> "x531"
               <http://example.org/2bday> -> "Tuesday"
               <http://www.w3.org/ns/none#name> -> "Eric"
               <http://example.org/2bday> -> "1966-11-08"
           ]
        
and with a default namespace:
        
        <Person tel="x531" 
                x:bday="Tuesday"
         xmlns="http://example.org/1"
                xmlns:x="http://example.org/2">
          <name>Eric</name>
          <x:bday>1966-11-08</x:bday>
        </Person>
        
it maps to:
        
           _#<http://example/1Person>[
               <http://example/1tel> -> "x531"
               <http://example.org/2bday> -> "Tuesday"
               <http://example/1name> -> "Eric"
               <http://example.org/2bday> -> "1966-11-08"
           ]
        
Several notes:

1. Attribute and elements are mapped to IRIs in the same
   way, so you can't distinguish between them.  We suggest
   there are very few practical cases where you need to
   distinguish.  (And things are much nicer this way.)
   (If you need to translate to some construct (eg in jrules) that
   does distinguish, you can turn it into an OR of the two
   forms.)

2. The IRI is constructed by simply concatenating the namespace and
   the local part of the name, so you get the slightly odd looking
   http://example.org/2bday and http://example/1tel.  Since people
   wont usually see these, it should not be a problem.

3. Attributes with no namespace are treated as if they had the
   namespace of their element.  (Again, we lose some ability to
   distinguish between certainl XML documents, but it should be fine.)

4. Elements with no namespace are treated as if they had the namespace
   "http://www.w3.org/ns/none#".

This seems to us to be pretty easy to use, about the same implementation
difficulty, and only excluding a few XML documents that would otherwise
be processable.   (You were already excluding the ones where order
matter, right?  If not, we'd need to bring in lists.)

      -- Sandro

Received on Tuesday, 7 September 2010 20:51:32 UTC