Datamodel Strawman (ACTION-298)

The statement for this action reads "Show how to use XML Schema for App 
Data Model".
This begs the question: what is an "App Data Model"?  I believe that we 
must define such a thing in RIF, and only then can we define a mapping 
between XML Schema (or relational databases, or OWL, or RDFS, etc.) and 
this RIF Data Model (RDM).

*RIF Data Model

*Informally, a RDM is a set of "frame types".  A frame type specifies 
the type (URI) of the frame and the names and types of the slots. A slot 
type is one of the RIF-supported XML Schema datatypes, the name of a 
frame, or is unspecified (meaning "any type").

*Abstract Syntax
*
class FrameType
    property type : Const
    property slots : List of SlotType

class SlotType
    property name : Const
    subclass SingletonSlotType
        property type : Const?
    subclass ListSlotType
        property elementType : Const?

At this point, I'm not exactly sure what we decided on in Innsbruck for 
the ASN for frames, so I'll make assumptions here:

class Frame
    property oid: TERM
    property type: Const
    property slots: list of Slot

class Slot
    property name: TERM
    property value: TERM

*Semantics
*
A Frame's type may be the same as a FrameType's type.  If so, then the 
Frame's slots must agree in number, name, and type with the FrameType's 
slots.

*Lists

*XML Schemas define lots of 1-to-many relationships using the 
"maxOccurs" attribute.  This is modeled in RDM using generic lists. A 
generic list has an optional type parameter to constrain the type of the 
list elements.

*Friendly Syntax
*
FrameType ::= 'type' CONSTNAME '[' (CONSTNAME '->' SlotTypeName)* ']'
SlotTypeName ::= SORTNAME | 'list' ['<' SORTNAME '>']

*Examples

*type book [ author->string title->string ]

wd1#book [ author->?X title->LeRif ]        // ?X must unify with a string

type bookshelf [ contents->list<book> ]

mybooks#bookshelf [ contents->list( wd1#book [author->Christian 
title->LeRif] wd2#book [author->ChrisW title->"The RIF Book"]) ]

*XML Schema

*I believe that frame types as described above with the addition of a 
generic list type are sufficient to model most complexTypes of XML 
Schema.  Additional mechanism is needed to model the "facets" of simple 
types such as value space restriction using enumeration, regex, and 
numeric range restriction.

Note the XML Schema specification is complex and "real world" mapping 
technologies such as JAXB 2.0 [1] have specifications that are well over 
300 pages long.  It is unlikely RIF can handle all the "corner cases".

[1] http://jcp.org/aboutJava/communityprocess/pfd/jsr222/index.html

Received on Sunday, 15 July 2007 23:16:17 UTC