Skip to content

Commit

Permalink
Add schema module that provide fields to describe a single resource (…
Browse files Browse the repository at this point in the history
…file / database table) #143
  • Loading branch information
jh-RLI committed Jun 5, 2024
1 parent ff31c72 commit b361900
Showing 1 changed file with 334 additions and 0 deletions.
334 changes: 334 additions & 0 deletions metadata/v200_draft/build_source/schemas/resource.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,334 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "general.json#metadata/v200_draft/schemas/resource.json",
"type": "object",
"properties": {
"resource": {
"title": "Resource",
"description": "The data resource format describes a data resource as an individual file or table.",
"type": "object",
"properties": {
"profile": {
"description": "A string identifying the profile of this descriptor as per the profiles specification. This information is retained in order to comply with the \"Tabular Data Package\" standard. If at all in doubt the value should read \"tabular-data-resource\".",
"example": "tabular-data-resource",
"type": [
"string",
"null"
],
"badge": "Gold",
"title": "Profile",
"options": {
"hidden": true
}
},
"name": {
"description": "A resource MUST contain a name unique to amongst all resources in this data package. To comply with the data package standard it must consist of only lowercase alphanumeric character plus \".\", \"-\" and \"_\". It may not start with a number. In a database this will be the name of the table within its containing schema. It would be usual for the name to correspond to the file name (minus the file-extension) of the data file the resource describes. Example:",
"example": "sandbox.example_table",
"type": [
"string",
"null"
],
"badge": "Iron",
"title": "Name"
},
"path": {
"description": "A URL that should be a permanent http(s) address or other path directly linking to the resource.",
"example": "https://openenergy-platform.org/dataedit/view/openstreetmap/osm_deu_line",
"type": [
"string",
"null"
],
"badge": "Gold",
"title": "Path",
"options": {
"hidden": true
}
},
"format": {
"description": "The file extension. 'csv', 'xls', 'json' etc. are expected to be the standard file extension for this type of resource. When you upload your data to the OEDB, in the shown metadata string, the format will be changed accordingly to 'PostgreSQL', since the data there are stored in a database.",
"example": "csv",
"type": [
"string",
"null"
],
"badge": "Gold",
"title": "Format",
"options": {
"hidden": true
}
},
"encoding": {
"description": "Specifies the character encoding of the resource's data file. The values should be one of the \"Preferred MIME Names\" for a character encoding registered with IANA. If no value for this key is specified then the default is UTF-8.",
"example": "UTF-8",
"type": [
"string",
"null"
],
"badge": "Gold",
"title": "Encoding",
"options": {
"hidden": true
}
},
"schema": {
"description": "Object containing fields, primary key and for foreign keys. Describes the structure of the present data.",
"type": "object",
"properties": {
"fields": {
"description": "List of field objects.",
"type": "array",
"items": {
"description": "Field object. Every object describes a column and provides name, description, type and unit.",
"type": "object",
"properties": {
"name": {
"description": "The name of the field. The string must be unique within it's scope",
"example": "year",
"type": [
"string",
"null"
],
"badge": "Iron",
"title": "Name",
"readonly": true
},
"description": {
"description": "A text describing the field.",
"example": "Reference year for which the data were collected.",
"type": [
"string",
"null"
],
"badge": "Silver",
"title": "Description"
},
"type": {
"description": "The data type of the field. In case of a geom column in a database, also indicate the shape and CRS.",
"example": "geometry(Point, 4326)",
"type": [
"string",
"null"
],
"badge": "Iron",
"title": "Type",
"readonly": true
},
"isAbout": {
"description": "Ontology URI to describe the column header",
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"description": "A class label of the OEO terms.",
"example": "wind energy converting unit",
"type": [
"string",
"null"
],
"badge": "Platinum",
"title": "Name"
},
"path": {
"description": "Path to the OEO class (URI)",
"example": "https://openenergy-platform.org/ontology/oeo/OEO_00000044",
"type": [
"string",
"null"
],
"badge": "Platinum",
"title": "Path",
"format": "uri"
}
},
"badge": "Platinum",
"title": "isAbout",
"additionalProperties": false
},
"badge": "Platinum",
"title": "isAbout"
},
"valueReference": {
"description": "Ontology URI for an extended description of the values in the column",
"type": "array",
"items": {
"type": "object",
"properties": {
"value": {
"description": "The name of the value in the column.",
"example": "onshore",
"type": [
"string",
"null"
],
"badge": "Platinum",
"title": "Value"
},
"name": {
"description": "The class label of the OEO terms.",
"example": "onshore wind farm",
"type": [
"string",
"null"
],
"badge": "Platinum",
"title": "Name"
},
"path": {
"description": " The URI of the OEO class",
"example": "https://openenergy-platform.org/ontology/oeo/OEO_00000311",
"type": [
"string",
"null"
],
"badge": "Platinum",
"title": "Path",
"format": "uri"
}
},
"badge": "Platinum",
"title": "valueReference",
"additionalProperties": false
},
"badge": "Platinum",
"title": "valueReference"
},
"unit": {
"description": "The unit, preferably SI-unit, that values in this field are mapped to. If 'unit' doesn't apply to a field, use 'null'. If the unit is given in a seperate field, reference this field.",
"example": "MW",
"type": [
"string",
"null"
],
"badge": "Silver",
"title": "Unit"
}
},
"additionalProperties": false,
"title": "Field"
},
"title": "Field"
},
"primaryKey": {
"description": "A primary key is a field or set of fields that uniquely identifies each row in the table. It's recorded as a list of strings, since it is possible to define the primary key as made up of several columns.",
"example": "id",
"type": "array",
"items": {
"description": "A primary key is a field or set of fields that uniquely identifies each row in the table.",
"example": "id",
"type": [
"string",
"null"
],
"badge": "Iron",
"title": "Primary key"
},
"badge": "Iron",
"title": "Primary key"
},
"foreignKeys": {
"description": "List of foreign keys.",
"type": "array",
"items": {
"description": "A foreign key is a field that refers to a column in another table.",
"type": "object",
"properties": {
"fields": {
"description": "The column (as list of items) in the table that is constrainted by the foreign key.",
"example": "version",
"type": "array",
"items": {
"description": "The column in the table that is constrainted by the foreign key.",
"example": "version",
"type": [
"string",
"null"
],
"badge": "Iron",
"title": "Field"
},
"badge": "Iron",
"title": "Fields"
},
"reference": {
"description": "The reference to the foreign table.",
"type": "object",
"properties": {
"resource": {
"description": "The foreign resource (table).",
"example": "schema.table",
"type": [
"string",
"null"
],
"badge": "Iron",
"title": "Resource"
},
"fields": {
"description": "The foreign resource column.",
"example": "version",
"type": "array",
"items": {
"description": "The foreign resource column.",
"example": "version",
"type": [
"string",
"null"
],
"badge": "Iron",
"title": "Field"
},
"badge": "Iron",
"title": "Field"
}
},
"badge": "Iron",
"title": "Reference",
"additionalProperties": false
}
},
"title": "Foreign Key",
"additionalProperties": false
},
"badge": "Iron",
"title": "Foreign Keys"
}
},
"title": "Schema",
"additionalProperties": false
},
"dialect": {
"description": "Object. A CSV Dialect defines a simple format to describe the various dialects of CSV files in a language agnostic manner. In case of a database, the values in the containing fields are \"null\".",
"type": "object",
"properties": {
"delimiter": {
"description": "The delimiter specifies the character sequence which should separate fields (columns). Common characters are \",\" (comma), \".\" (point) and \"\\t\" (tab).",
"example": ",",
"type": [
"string",
"null"
],
"badge": "Silver",
"title": "Delimiter"
},
"decimalSeparator": {
"description": "A symbol used to separate the integer part from the fractional part of a number written in decimal form. Depending on language and region this symbol can be \".\" or \",\".",
"example": ".",
"type": [
"string",
"null"
],
"badge": "Silver",
"title": "Decimal separator"
}
},
"additionalProperties": false,
"title": "Dialect",
"options": {
"hidden": true
}
}
}
}
}
}

0 comments on commit b361900

Please sign in to comment.