Chapter 3. Data Model Interface

Table of Contents

3.1. Compile-Time Model
3.2. Run-Time Model
3.2.1. Current Extent
3.2.2. Current Queue Collection

In constrast to the Java programming language, a programme of the XL programming language depends on a data model both at compile-time and run-time, at least if it makes use of some of the new features. Such a data model parametrizes the XL programming language for the concrete relational data source in use. It is not specified of what nature such a relational data source may be, but it has to fit into the data model interface. For example, the XL programming language could be used for XML documents as relational data source, for relational databases, or for graphs of Java objects. The XL programming language provides common syntax and semantics for these kinds of data sources, however, it is clear that each data source represents its data using a specific model, and that each data source supports a different set of operations.

The interface between the XL programming language and a specific data source is split into two parts: At compile-time, the compile-time model provides static information about the data source to a compiler for the XL programming language. At run-time, a run-time model is associated with the compile-time model and offers a set of requests and operations on the data source. The run-time model is used by the run-time system of the XL programming language in order to implement the semantics of, e.g., queries, rules, and quasi-parallel assignments.

3.1. Compile-Time Model

A compile-time model is used by a compiler for the XL programming language. It describes static properties of the relational data source, among them the base class of node terms, encodings of some standard edge relations, and declarations of properties.

A compile-time model is represented by an instance of the interface de.grogra.xl.compiletime.Model. At every point of a compilation unit of the XL programming language, there has to be exactly one such model which is associated with that point. How this association is done is not defined by this specification; it depends on the compiler.

The interface Model specifies the method getRuntimeName. The returned value is used by a compiler for the XL programming language to tag compiled code with a name which allows for the determination of a corresponding run-time model at run-time.

The method needsWrapperFor determines for a given type whether values of this type can be represented at run-time as nodes of an extent (Section 3.2, “Run-Time Model”) or not: If a wrapper is needed, values of the given type have to be wrapped by wrapper nodes before they can be represented in the extent. The type of the corresponding wrapper node is obtained by the method getWrapperClassFor, it has to be a reference type. The method needsWrapperFor has to return true for primitive types, i.e., only objects are allowed as nodes.

Besides the discussed methods, the interface Model specifies a set of further methods. Their meaning will be described in the sequel in the context of their usage.