- From: Dave Reynolds <der@hplb.hpl.hp.com>
- Date: Tue, 20 Nov 2007 18:54:50 +0000
- To: RIF <public-rif-wg@w3.org>
This note is intended to satisfy ACTION-349. ** Use case At F2F7 we discussed how XML data models might be accessed from RIF, in particular that one could map a class of XML instance data to RIF Frames [1]. In that proposal the xs:complexType corresponding to an element was recorded as part of the frame by use of the rif:instanceOf (#) property. This is needed in cases where the element or element type might be open and a rule needs to match on the actual element type. For example. Consider a purchase order schema in which the item description is open (xs:any) to any of some set of known complex types (restrict the xs:any to a namespace containing the legal element names and associated xs:complexType definitions for known item types). For example we might have two item types eg:SoftwareType and eg:HardwareType with associated elements eg:software and eg:hardware. An example instance document might be: <eg:Order id="#42"> <eg:item> <eg:software> .... </eg:software> </eg:item> ... </eg:Order> <eg:Order id="#43"> <eg:item> <eg:hardware> .... </eg:hardware> </eg:item> ... </eg:Order> Suppose all software is delivered electronically and we want to write a rule to check if an order needs a physical shipment it might be something like: "If the order's item is of type hardware then it is a physical shipment" This would look something like: Forall ?item ?order ( eg:physicalShipment^^rif:iri(?order) :- And ( ?order # eg:OrderType^^rif:iri [ eg:item^^rif:iri -> ?item], ?item # eg:HardwareType^^rif:iri ) ) Note that this is a completely artificial example. ** Discussion 1. This use case simply requires there be some known property which relates an "object" to the corresponding xs:complexType. It doesn't require that that same property be used elsewhere, it could be just part of the XML Schema mapping and need not be #/rif:instanceOf. In particular there's no reason from this use case to use the same property to represent other type relationships such as rdf:type. 2. This use case also depends on how we decide to handle XML mapping. The proposal we discussed at F2F7 was based on treating XML data as a serialization of some underlying object model and so reused XML/data binding approaches. These tend to equate xs:complexTypes with object types. However, we could take a different approach to XML. For example we could map the raw DOM tree to RIF Frames. In that case there wouldn't be any distinguished type relationship at all. On reflection I personally don't regard this as a compelling use case for rif:instanceOf (due to point 1). However, as best as I can recall this is the sort of thing we were discussing at the time I landed the action. Dave P.S. As a side-note, it would be a good idea for someone more familiar with XML Schema data models (and how they are used in commercial rule languages) to take over progressing ISSUE-37, though I see that it is not critical path. [1] http://lists.w3.org/Archives/Public/public-rif-wg/2007Sep/att-0185/dataModels.pdf -- Hewlett-Packard Limited Registered Office: Cain Road, Bracknell, Berks RG12 1HN Registered No: 690597 England
Received on Tuesday, 20 November 2007 18:55:14 UTC