Dataset metadata, schemas and queries
A core functionality within QDL is the ability to add metadata to datasets. When storing files in a file system or network drive, adding metadata is limited to encoding it in either the file name, folder structure or in a separate file stored within a so-called 'dataset folder'. In contrast, in QDL it is possible to add metadata in several ways:
- dataset fields
- attributes
- collections
- sequences
- file fields
Dataset fields
A dataset has required and optional fields. The required fields are:
scope, the namespace of the datasetname, e.g. name of a dataset folderUID, typically derived from the name and is always unique within the scopecollected, the datetime when the dataset was collected or generated and defaults to 'now'.
This is the minimal set of fields for QDL to organize datasets internally. Note that all datasets are also given a
universally unique identifier, a UUID of type 4.
The optional fields, rank, description and tags, can be used to provide additional descriptive context to the
dataset. The rank of a dataset represents the importance of a dataset. For instance, measurements that 'fail' can be
given a low rank, whereas measurements that 'succeed' can be given a high rank. The text fields description and
tags describe the context of the dataset further. The description is a long text field (i.e. longer than the name),
and the tags field is a (e.g. comma-separated) list of tags or keywords, useful to add a flurry of associations to a
dataset.
Dataset filtering
Datasets can be filtered based on the required and optional dataset fields.
Additionally, datasets can be queried and filtered by a textual query string; when a query string is provided in
querying the datasets, all datasets will be returned where the query string matches to any of the text fields
(name, description, OID, tags, attributes.value, files.name). Only string value attributes are queried
for the text search.
Datasets can also be filtered by querying specific attribute values. A dataset can have string value
attributes and numeric value attributes. For string value attributes the same syntax is used as the filters for other
fields: <name>=<value>. For example sample=m4.
For numeric value attributes, operators are introduced to search for specific values or ranges of values for that
attribute. The syntax is <name>__<operator>=<value>. For example, distance__eq=1.4 to search for datasets with
numeric attribute distance equal to 1.4. The following operators are supported:
- eq (equal)
- lt (less than)
- le (less than or equal to)
- gt (greater than)
- ge (greater than or equal to).
This makes it possible to find datasets with a value in range [4..8] for attribute distance by adding distance__ge=4
and distance__le=8 to the filter. Using operators gt and lt would have excluded the boundary values 4 and 8 from
the result set.
When multiple filters are given for the same numeric value attribute, all these filters must match for the
datasets that are returned (and). This may lead to unexpected results when used wrongly. For example:
distance__eq=4 and distance__lt=4 will not return any dataset because it is impossible to match the filter.
When multiple filters are given for the same string value attribute, only one of these filters must match for
the datasets that are returned (or). For example: sample=m4 and sample=m5 will return datasets which have
attribute sample with value m4 or m5.
Attributes
Attributes are structured metadata, in the form of key/value pairs. Dataset attributes can be used to annotate datasets with additional properties, that are not present in the standard set of dataset fields. For instance which sample is used for a measurement, within what setup the measurement is executed, which variables are measured or which parameters are swept. They can be used to describe the inner properties of a dataset. Moreover, attributes can be dictated by the schema of a scope (see below), to ensure consistency of datasets within a scope. Dataset queries can be filtered by the attributes used for annotation.
Collections
Collections are similar to folders. They are identified by a UID and a name. The name (and an immutable UID)
of a collection needs to be unique within a scope. Datasets can be part of zero or multiple collections. Collections
can be used to annotate the dataset with external features. For example, a scope is seen as a long-running research
initiative, but typically shorter (master or bachelor student) projects are also spun off of the same scope.
Collections are suited to organize datasets within these shorter projects. Furthermore, collections can be used to
organize datasets together that form a publication, suited to share with an external collaboration or are part of a
conference submission.
Sequences
Acquisition software such as core_tools, QMI or QCodes are used to generate datasets. Typically, an experiment
can sweep a certain parameter and will consist of multiple individual measurements performed in one sequence. When
storing such datasets locally, it is sometimes difficult (at least to an outsider) to discern which datasets are linked
together through the same experiment based on for instance the name of a dataset. Within QDL, it is possible to link
these datasets intrinsically together via sequences. Each sequence has a name and UID. In contrast to a
collection, the actual value of the name or UID is of less importance, other than the linked datasets share the same
value of a sequence. A dataset can only be part of one sequence. A dataset can be filtered based on the UID of a
sequence.
File fields
A file always belongs to one dataset and in QDL also has required and optional fields. The file also has a scope,
name and UID. The name of a file needs to be unique within a dataset and the scope of course matches with the
dataset it belongs to. A file has additional metadata, tags and rank. However, this is used for additional
context. The rank of a file can be used to provide context which file is the most important to view to understand the
dataset. For example, multiple figures can be added to a dataset as a file, but typically the plot which combines
several views together, is seen as the most informative one. The generated_by field can specify which software
generated the file. File tags can provide additional information, similar to dataset tags.
Note that queries are designed around datasets, and not individual files.
Schemas
With a multitude of metadata possibilities, it is important to manage the consistency of datasets within a scope. To this end, a schema can be added to a scope by the scope owner. A schema is a JSON Schema object, which can dictate or limit (depending on the validation level) certain values of dataset metadata. For example, the schema can put limits on the possible names or tags of a dataset, or which dataset attributes are allowed for a dataset. Adding metadata in a consistent way, results in better findability of datasets on the long term.