Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Prism is a data representation mechanisms that allows to present data in several formats and the same time.

Live Data

Prism objects are more or less ordinary data structures in Java. They can be accessed using a native Prism interface (API), but the same data can also be accessed by variety of other interfaces (JAXB, DOM, ...). The unique feature of prism is that the data are not transformed to these formats but real live data are presented. For example if a bean property is set by invoking JAXB setter the change is immediately reflected to the underlying prism data model. The next call to DOM interface will return the new value of the property.

Prism Native Data Structures

Full article: Prism Data Structures

Each prism data structure is constructed from items. The items can be of three types:

  • Property is an item that contains useful value. It usually contains primitive data types such as string, integer or date. But it may also contain complex data structures. Property is the "atomic" unit of information, it cannot be divided to smaller parts. Property values can be added, deleted or replaced, but only a complete value. Prism does not care for anything smaller than a property.
  • Reference points to a prism object. It is used to represent relationship between prism objects.
  • Container contains other items: properties, references or other containers. Containers build the structure of prism data.

Prism objects are special cases of prism containers. Although prism data can be represented without objects, objects give a kind of order to the data. Objects are supposed to be stand-alone meaningful sets of prism data. Each object has its unique identifier called simple object identifier or OID for short. Prism references are used to point to objects which is a method to create complex data structures.

Any prism item (except object) may have multiple values. Such values are unordered. Limiting the values to unordered makes it much easier to work with relative changes.

Schema

Each prism item has a definition. The definition is defined by the schema or is determined at runtime. The definition tells the type of the item, e.g. whether it is string, integer or a date. This is necessary to present the same data in various formats. E.g. to be able to correctly process write of the data using a DOM interface the prism must know that it is date to correctly parse it from the DOM string representation.

The presence of a schema at runtime has yet another advantage: code can be generated from the schema. This is used by the prism JAXB code generator which generates data representation that provide a simple Java Bean interface. Having a data model generated and compiled is a huge advantage for most systems. E.g. compiler checks are making the development cycle much shorter and it makes refactoring much more reliable.

Currently Prism Schema is defined in XML Schema Defenition (XSD) language with custom annotations (but that may change in the future).

Dynamic Schemas

On of the unique features of prism is support for runtime and dynamic schemas.

Runtime schema is a static schema definition that is not available at compile time. It may be available as assembly time or even at runtime. It usually takes form of XSD files that are loaded at system start. As such schema is not available as compile time it cannot be used to generate compiled code. But except for that the runtime schema behaves almost the same as compile time schema: it is used to parse and validate data when parsing prism items from XML, to serialize data, etc.

Dynamic schema is schema that is not fixed, not even in runtime. E.g. there may be a container that can store items of any type, even each instance of the container may have different items of different types. Prism supports such schema and still correctly maintains definitions for such items end-to-end. E.g. it parses the data from the source format and creates appropriate definition. The definition travels with the item though the system. If the data are serialized, the definition is serialized with the data (if possible), e.g. by using the XML xsi:type runtime type specification.

Prism Interfaces

Native Prism API

JAXB Generated Beans

DOM

Parsing and Serialization

In addition to live data interfaces prism data can be parsed from and serialized to a variety of data formats.

Data Format

Parsing

Serialization

XML

Yes (DOM, StAX planned soon)

Yes (DOM)

JSON

Planned

Planned

TODO

Describe:

  • Items, values, definitions
  • Deltas
  • Dynamic schemas
  • parsing state (rawElements)
  • No labels