Schema¶
A JSON file inspired by JSON schema is used to describe the various agents,
entities, and activities in SEIS-PROV
. If a SEIS-PROV
record is
discovered it has to be validated against the scheme for that particular
record. The JSON “schema” furthermore determines which types are valid
SEIS-PROV
types. It is a vital component of any program validating
SEIS-PROV
files.
Structure¶
At the top-level the file has a _metainformation
key that determines the
namespace and version of SEIS-PROV
.
"_metainformation": {
"format": "SEIS-PROV",
"namespace": "http://seisprov.org/seis_prov/0.1/#",
"recommended_namespace_prefix": "seis_prov",
"version": "0.1"
}
Entities, agents, and activities are defined under the entities
,
agents
, and activities
keys. Each record is described by a JSON
object adhering to this schema.
We will illustrate this on the example of the multiplication activity as it is a very basic example. Keep in mind that the documentation is also build from this definition so everything will always be consistent.
{
"package": "seis_prov",
"type": "activity",
"name": "multiply",
"two_letter_code": "mp",
"label": "Multiply",
"description": "Multiply each value of the data with a certain factor. This is implied by many operations but sometimes useful to capture in its own right.",
"other_seis_prov_attributes_allowed": false,
"attributes": [
{
"name": "factor",
"types": ["xsd:double"],
"description": "The factor by which to multiply.",
"required": true,
"example_value": 2.5
}
]
}
Each record definition has the following keys:
package
- Which package this belongs to. Will always be
seis_prov
. type
- The type of record. One of
activity
,entity
,agent
. name
- The name of that particular record.
two_letter_code
- Used in the id of each record.
label
- Pretty version of the name. Will be the prov:label of each record.
description
- An arbitrarily long description of the record which can contain restructured text.
other_seis_prov_attributes_allowed
- Boolean indicating if the record can have attributes under the
SEIS-PROV
record aside from the ones defined for it. attributes
- A list of required and optional attributes for that record.
Attributes¶
Each attribute is again a JSON object, this time with the following keys:
name
- The name of that record.
types
- A list of allowed types as strings. The types are XML Schema types.
description
- A description of that attribute.
required
- A flag denoting if the attribute is required or not.
example_value
- An example value for the attribute. This is only used to generate the documentation.
pattern
- This is optional. If given the value of that attribute must match the given regular expression.