What is XERE?

Conceptual models, like the Entity-Relationship (ER) model, provide a high-level abstraction for information on a given application domain and are useful for database design, reverse engineering and semantics integration.

XML Schemas (XSD) are an XML language developed by the W3C as a substitution for Document Type Definitions (DTD). Initially designed only to better define the structure of XML document classes, Schemas are gradually becoming another powerful model to describe the fragments of reality of our universe of discourse.

Therefore, having a standard presentation of the conceptual model induced by XML Schemas is helpful in designing better applications. Xere is a mapping algorithm which allows the translation of XML Schemas into Entity-Relationship diagrams.

XERE Development

The Xere algorithm is being developed and it currently handles:

  • Global and local element definitions
  • Global (references) and local (nested) types
  • Complex types, with extensions and restrictions
  • All the content models (all, choice, sequence)
  • Occurrence constraints (minOccurs and maxOccurs) both on elements and content models
  • Simple types, basic and extended to complex types
  • Mixed content
  • Global and local attribute definitions

We are working to add support for:

  • Simple types with facets
  • Namespaces
  • Key and Keyref
  • Type substitution

Since XSD are written in XML, the prototype implementation of the Xere algorithm is coded in XSLT language. The Xere stylesheet takes a Schema definition and outputs a XML document describing the corresponding ER diagram.

Try XERE

To test the Xere algorithm, you can download the Xere stylesheet and apply it to your schemas, or try the online transformation tool.

The Xere stylesheet can be downloaded here. It has to be considered as alpha software, so it is not guaranteed to be bug-free.
To use the stylesheet you need:

  • A fully-conformant XSLT processor like Xalan
  • An XSD definition. The definition must be valid and well-formed and follow these rules:
    • The stylesheet does not currently handle namespace prefixes, so you must remove them from the source. XSD elements prefixed with their namespace (usually "xs:" or "xsd:") will not be correctly processed.
    • Features not supported by the stylesheet (see list below) will be usually skipped by the stylesheet, but can occasionally produce strange results.

The output XML document of the Xere stylesheet is written with a very simple XML language. The following table describes the elements used. You can also download the schema definition for this language.

Element name Attributes Children Description
entity name - the entity name. zero or more attribute elements, defining the entity attributes. Defines an entity in the ER diagram.
attribute name - the attribute name.
type - the attribute type.
None. Defines an attribute for an ER entity. The special names value and text are used for attributes holding the element simple value and the mixed element text, respectively.
relation from - name of the first entity in the relation.
to - name of the second entity in the relation.
card - cardinality of the relation in the form "a,b-c,d", where (a,b) is the cardinality on the "from" table side.
None. Defines a binary ER relation.
specialization base - the specialized entity. one or more entity elements, defining the possible specializations. Defines an ER total specialization construct.
er None None. The document root.