RIF Serialization Strawman (more on ACTION-309 [1])

Taking into account some of the discussion so far [1], here's the start
of actual text for the Arch document.  I'm converging on calling this
subject (how to turn the asn07 model into an actual XML syntax), "RIF
Serialization", as this text should make clear.

Note that this text does not yet talk about how to work at the schema
level, and how to generate an XML Schema from asn07.   I think it's
probably easier to understand starting at this level.


================================================================

/== RIF Serialization

Each RIF dialect has its own XML syntax, but all the dialects follow
certain syntactic conventions in order to support backward and forward
compatibility and to support code reuse in systems which support many
dialects. 

These RIF XML syntaxes are all based on the idea that a RIF document
is an XML serialization of a set of in-memory data structures.  The
in-memory data structures contain the rules and any associated data
and metadata that need to be transmitted.  

Each data item in the structure is either a primitive data value (eg
int, float, string), a ''frame'', or a list of frames.  A ''frame''
corresponds roughly to an "object" in many system -- it consists of a
class identifier and a set of pairs of a property identifier and a
property value.  The value of a property may be either a primitive data
value or a reference to a frame or list of frames.  (The support for
multiple values per property is a generalization beyond what is found in
some object systems; in those systems it is equivalent to having the
value of a property be a set of values.)

A RIF serializer recursively converts a set of frames to an XML
document.  A RIF de-serializer converts an XML document back into the
same set of frames.  By design, serializers and de-serializers do not
need access to schema information -- the structures and the XML syntax
are sufficiently self-describing to be handled without an external
schema.

In asn07, here is the model of the RIF syntax data structures:

    class Item
    
        subclass Frame
            property class: rdfs:Class
            property pvpair: PVPair*
          
        subclass List         
            property elements: List of Frame
    
        subclass Literal
       
            subclass DataValue:
                property lexicalRepresentation: xs:string
                property datatype: DataType
       
            subclass Text:     
                property content: xs:string
                property languageTag: xs:string?
              
    class PVPair:
        property property: rdf:Property
        property value: Item

The serialization format is defined recursively.  The root element of
the document is an rdf:RDF element.  The child elements of that root
are each a serialization of one of the frames serialized in the
document.

The serialization of a frame is an XML element tree where the element
tag corresponds to the frame's class and each direct child corresponds
to one property-value pair.   
...

================================================================

At this point, I realized that describing the mapping in prose is
horrible.  Maybe some kind of table would show it most clearly?  Or
pseudo code?  Or real code?  Any idea how best to specify this?

      -- Sandro

[1] http://www.w3.org/2005/rules/wg/track/actions/309
[2] http://lists.w3.org/Archives/Public/public-rif-wg/2007Jul/0058.html

Received on Tuesday, 17 July 2007 03:01:51 UTC