A dataset is a hierarchical collection of name-value pairs, used for a variety of purposes in Fiz. In its simplest form, a dataset consists of any number of name-value pairs where both names and values are strings. For example, a dataset might have the following contents:

name

value

state

California

capital

Sacramento

population

36,756,666

The names for dataset entries can be arbitrary strings, but in practice they usually consist of standard identifier characters. The value of a Dataset entry can one of two forms:

In practice most datasets have only one or two levels, but they can be nested to any depth.

Usage

Here are some examples of the different ways that datasets are used in Fiz:

Classes

Datasets are implemented as a thin layer on top of Java HashMaps. The following classes provide support for datasets:

Dataset: the core class for datasets. Provides the following features:

YamlDataset: a subclass of Dataset that can generate datasets from strings or files formatted using a subset of YAML notation. Also provides facilities for writing Datasets out in YAML notation.

XmlDataset: a subclass of Dataset that can generate datasets from strings or files formatted using a subset of XML notation. Also provides facilities for writing Datasets out in XML notation.

CompoundDataset: a subclass of Dataset that takes a collection of existing datasets and makes them behave as if they were a single dataset. If the same name exists in more than one dataset, then entries in earlier datasets supersede those in later datasets (or, you can request all matching entries).