Martin Fowler wrote a ancient book “Analysis Patterns: Reusable Object Models” and now some of them are available on his website. The problem of temporal data is covered in the chapter on “Temporal Patterns” http://martinfowler.com/eaaDev/timeNarrative.html Maybe you can get some ideas there, William David Velásquez Creativo de Software Creativos Digitales S.A.S. Calle 30 # 83 - 50 Local 1033 Tel: 322 1730 - 311 709 8421 Medellín, Colombia De: Costello, Roger L. [mailto:costello@mitre.org] Hi Folks, Do you have data that changes over time? Below is one way of dealing with time-varying data. Example: A Book has a Title, Author, Binding (hardcover or softcover), and Cost. The latter two properties vary over time. In 1970 the book had these values: <Book> An event is a change of one or more of Book’s time-varying properties. A state is the property set valid over a time period. An event occurs at the transition between states. [1] In 1974 the cost of the book rose, from $14.95 to $16.95. That change in cost is an event. In 1980 the binding was changed to softcover and the cost dropped to $8.95. That’s a second event. This graphic depicts the events (and states): The time varying properties of Book are encapsulated in a container called Time Slice. The following graphic shows the Book’s two time-varying properties (Binding and Cost) embedded inside a Time Slice container: ValidTime = the time period for which the Time Slice is valid. Here is an XML document; the time slices show the history of changes: Now let’s see how to implement this using XML Schema. Create a schema file for TimeSlice. Declare a TimeSlice element. Inside TimeSlice declare ValidTime, which is to contain the Start and End elements. After ValidTime is where the time-varying properties are to be placed, so that is an extension point: In a separate schema file, declare the Book element. The Book element contains Title and Author (non-time-varying properties). After that comes the time-varying properties, so reference the TimeSlice element in the other schema file. Lastly, separate from the Book element declaration, declare the time-varying properties: Binding and Cost. Here’s the arrangement of files: Now let’s see the actual schema files. Here is the temporal schema file: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> Here is the Book schema file: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> Here is a sample XML instance document: <Book id="RB"> Acknowledgement: the above is a synopsis and simplification of the AIXM (Aeronautical Information Exchange Model) Temporality Model (http://aixm.aero/sites/aixm.aero/files/imce/AIXM51/aixm_temporality_1.0.pdf). The example shown is my own. /Roger [1] Quote from the AIXM Temporality Model paper. |