This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added `resources` heading * Added $schema * Updated urls * Removed `package.profile` * Updated $schema * Started extensions * Finished extensions * Updated wording * Updated JSONSchema version * Added extensions note * Fixed recursivity * Updated sections * Fixed extension example * Updated JSON Schema version * Updated extensions features list * Fixed unfinished sentence * Replace idempotent -> immutable * Update content/docs/specifications/extensions.md Co-authored-by: Peter Desmet <[email protected]> * Improved grammar --------- Co-authored-by: Peter Desmet <[email protected]>
- Loading branch information
1 parent
52e43a1
commit a731ab4
Showing
12 changed files
with
154 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,115 @@ | ||
--- | ||
title: Extensions | ||
sidebar: | ||
hidden: true | ||
order: 5 | ||
--- | ||
|
||
<table> | ||
<tr> | ||
<th>Authors</th> | ||
<td>Rufus Pollock, Paul Walsh, Evgeny Karev, Peter Desmet</td> | ||
<td>Rufus Pollock, Paul Walsh, Adam Kariv, Evgeny Karev, Peter Desmet</td> | ||
</tr> | ||
</table> | ||
|
||
:::caution | ||
This section is under development | ||
::: | ||
The Data Package Standard extensibility features for domain-specific needs. | ||
|
||
## Language | ||
|
||
The key words `MUST`, `MUST NOT`, `REQUIRED`, `SHALL`, `SHALL NOT`, `SHOULD`, `SHOULD NOT`, `RECOMMENDED`, `MAY`, and `OPTIONAL` in this document are to be interpreted as described in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt) | ||
|
||
## Introduction | ||
|
||
The Data Package Standard provides a rich set of metadata and data features for general applications. At the same time, the Data Package Standard at its core is domain-agnostic and does not provide any builtin means to describe metadata in specific knowledge areas such as biology or medicine. | ||
|
||
A domain-specific extension is the way to enrich Data Package's metadata to meet specific needs of a knowledge domain. For example, there are some prominent Data Package extensions: | ||
|
||
- [Camera Trap Data Package](https://camtrap-dp.tdwg.org/) | ||
- [Fiscal Data Package](https://fiscal.datapackage.org) | ||
|
||
## Extension | ||
|
||
The Data Package Standard has a simple yet powerful extension mechanism based on the [Profile](../glossary/#profile) concept. An extension is, generally speaking, a project that provides one or more domain-specific profiles to the Data Package Standard specifications. | ||
|
||
From user-perspective, a custom profile can be provided as a `$schema` property in a corresponding specification [Descriptor](../glossary/#descriptor). Having a profile instructs implementation to validate a descriptor using JSON Schema rules of the profile. | ||
|
||
Usually, Data Package is the specification that is extended. As a container format, it is the most natural target for metadata enrichment. At the same time, technically any of the core specifications can be extended. For example, if you build a Table Schema catalog, it is possible to extend a Table Schema specification using the same approach as described below. | ||
|
||
Note, that the Data Package Standard's extension system completely relies on the JSON Schema Standard without extending its builtin features in any way. It makes the system robust and provides rich tooling support such as [text editor validation](https://code.visualstudio.com/docs/languages/json#_mapping-in-the-json). | ||
|
||
Combining modern JSON Schema features with an ability to provide profiles to any of the core Data Package Standard specification descriptors, allows to achieve almost any of metadata enrichment goals including but not limited to: | ||
|
||
- Adding new domain-specific properties. | ||
- Requiring existing properties to comply with certain requirements. | ||
- Defining what resources are expected. | ||
- Requiring resources to meet certain dialect or schema requirements. | ||
- Combining existent profiles as a part of a high-level extension. | ||
- Creating domain-specific dialect and schema catalogues. | ||
|
||
## Example | ||
|
||
For example, we will create a Spatial Data Package that requires a `geopoint` marker to be provided for each resource consisting a Data Package. | ||
|
||
### Profile | ||
|
||
First of all, we need to create a Data Package profile. Note that it includes a default data package profile as per the [specification requirement](../data-package/#schema): | ||
|
||
```json | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Spatial Data Package Profile", | ||
"type": "object", | ||
"allOf": [ | ||
{ "$ref": "https://datapackage.org/profiles/2.0/datapackage.json" }, | ||
{ "$ref": "#/definitions/spatialMixin" } | ||
], | ||
"definitions": { | ||
"spatialMixin": { | ||
"type": "object", | ||
"properties": { | ||
"resources": { | ||
"type": "array", | ||
"item": { | ||
"type": "object", | ||
"required": ["geopoint"], | ||
"properties": { | ||
"geopoint": { | ||
"type": "object", | ||
"properties": { | ||
"lon": { "type": "number" }, | ||
"lat": { "type": "number" }, | ||
"additionalProperties": false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Descriptor | ||
|
||
Consider that the profile above is published at `https://spatial.datapackage.org/profiles/1.0/datapackage.json`. In this case, a Data Package descriptor compatible to exemplar Spatial Data Package (v1) will look as below: | ||
|
||
```json | ||
{ | ||
"$schema": "https://spatial.datapackage.org/profiles/1.0/datapackage.json", | ||
"title": "Spatial Data Package Descriptor", | ||
"resources": [ | ||
{ | ||
"name": "expedition-1", | ||
"path": "expedition-1.csv", | ||
"geopoint": { | ||
"lon": 90, | ||
"lat": 90 | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### Software | ||
|
||
Even though they are not aware of the extension, any Data Package software implementation will be validating a Spatial Data Package out of the box: both the domain-specific properties as well as the general Data Package properties. We do encourage extensions authors however to build on top of existing software to support domain-specific properties on the programming models level as well. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$ref": "build/profiles/dictionary.json#/definitions/dataPackage" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$ref": "build/profiles/dictionary.json#/definitions/dataResource" | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$ref": "build/profiles/dictionary.json#/definitions/tableDialect" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$ref": "build/profiles/dictionary.json#/definitions/tableSchema" | ||
} |