-
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.
Refactor Resource class according to v1 specs (#44)
- Loading branch information
1 parent
1bef8dc
commit 3daa3a2
Showing
10 changed files
with
2,467 additions
and
144 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 |
---|---|---|
@@ -0,0 +1,278 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"title": "Data Resource", | ||
"description": "Data Resource.", | ||
"type": "object", | ||
"oneOf": [ | ||
{ | ||
"required": [ | ||
"name", | ||
"data" | ||
] | ||
}, | ||
{ | ||
"required": [ | ||
"name", | ||
"path" | ||
] | ||
} | ||
], | ||
"properties": { | ||
"profile": { | ||
"propertyOrder": 10, | ||
"title": "Profile", | ||
"description": "The profile of this descriptor.", | ||
"context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `default`. The namespace for the profile is the type of descriptor, so, `default` for a Package descriptor is not the same as `default` for a Resource descriptor.", | ||
"type": "string", | ||
"default": "default", | ||
"examples": [ | ||
"{\n \"profile\": \"tabular-data-package\"\n}\n", | ||
"{\n \"profile\": \"http://example.com/my-profiles-json-schema.json\"\n}\n" | ||
] | ||
}, | ||
"name": { | ||
"propertyOrder": 20, | ||
"title": "Name", | ||
"description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.", | ||
"type": "string", | ||
"pattern": "^([-a-z0-9._/])+$", | ||
"context": "This is ideally a url-usable and human-readable name. Name `SHOULD` be invariant, meaning it `SHOULD NOT` change when its parent descriptor is updated.", | ||
"examples": [ | ||
"{\n \"name\": \"my-nice-name\"\n}\n" | ||
] | ||
}, | ||
"path": { | ||
"propertyOrder": 30, | ||
"title": "Path", | ||
"description": "A reference to the data for this resource, as either a path as a string, or an array of paths as strings. of valid URIs.", | ||
"oneOf": [ | ||
{ | ||
"title": "Path", | ||
"description": "A fully qualified URL, or a POSIX file path..", | ||
"type": "string", | ||
"examples": [ | ||
"{\n \"path\": \"file.csv\"\n}\n", | ||
"{\n \"path\": \"http://example.com/file.csv\"\n}\n" | ||
], | ||
"context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly." | ||
}, | ||
{ | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { | ||
"title": "Path", | ||
"description": "A fully qualified URL, or a POSIX file path..", | ||
"type": "string", | ||
"examples": [ | ||
"{\n \"path\": \"file.csv\"\n}\n", | ||
"{\n \"path\": \"http://example.com/file.csv\"\n}\n" | ||
], | ||
"context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly." | ||
}, | ||
"examples": [ | ||
"[ \"file.csv\" ]\n", | ||
"[ \"http://example.com/file.csv\" ]\n" | ||
] | ||
} | ||
], | ||
"context": "The dereferenced value of each referenced data source in `path` `MUST` be commensurate with a native, dereferenced representation of the data the resource describes. For example, in a *Tabular* Data Resource, this means that the dereferenced value of `path` `MUST` be an array.", | ||
"examples": [ | ||
"{\n \"path\": [\n \"file.csv\",\n \"file2.csv\"\n ]\n}\n", | ||
"{\n \"path\": [\n \"http://example.com/file.csv\",\n \"http://example.com/file2.csv\"\n ]\n}\n", | ||
"{\n \"path\": \"http://example.com/file.csv\"\n}\n" | ||
] | ||
}, | ||
"data": { | ||
"propertyOrder": 230, | ||
"title": "Data", | ||
"description": "Inline data for this resource." | ||
}, | ||
"schema": { | ||
"propertyOrder": 40, | ||
"title": "Schema", | ||
"description": "A schema for this resource.", | ||
"type": "object" | ||
}, | ||
"title": { | ||
"propertyOrder": 50, | ||
"title": "Title", | ||
"description": "A human-readable title.", | ||
"type": "string", | ||
"examples": [ | ||
"{\n \"title\": \"My Package Title\"\n}\n" | ||
] | ||
}, | ||
"description": { | ||
"propertyOrder": 60, | ||
"format": "textarea", | ||
"title": "Description", | ||
"description": "A text description. Markdown is encouraged.", | ||
"type": "string", | ||
"examples": [ | ||
"{\n \"description\": \"# My Package description\\nAll about my package.\"\n}\n" | ||
] | ||
}, | ||
"homepage": { | ||
"propertyOrder": 70, | ||
"title": "Home Page", | ||
"description": "The home on the web that is related to this data package.", | ||
"type": "string", | ||
"format": "uri", | ||
"examples": [ | ||
"{\n \"homepage\": \"http://example.com/\"\n}\n" | ||
] | ||
}, | ||
"sources": { | ||
"propertyOrder": 140, | ||
"options": { | ||
"hidden": true | ||
}, | ||
"title": "Sources", | ||
"description": "The raw sources for this resource.", | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { | ||
"title": "Source", | ||
"description": "A source file.", | ||
"type": "object", | ||
"required": [ | ||
"title" | ||
], | ||
"properties": { | ||
"title": { | ||
"title": "Title", | ||
"description": "A human-readable title.", | ||
"type": "string", | ||
"examples": [ | ||
"{\n \"title\": \"My Package Title\"\n}\n" | ||
] | ||
}, | ||
"path": { | ||
"title": "Path", | ||
"description": "A fully qualified URL, or a POSIX file path..", | ||
"type": "string", | ||
"examples": [ | ||
"{\n \"path\": \"file.csv\"\n}\n", | ||
"{\n \"path\": \"http://example.com/file.csv\"\n}\n" | ||
], | ||
"context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly." | ||
}, | ||
"email": { | ||
"title": "Email", | ||
"description": "An email address.", | ||
"type": "string", | ||
"format": "email", | ||
"examples": [ | ||
"{\n \"email\": \"example@example.com\"\n}\n" | ||
] | ||
} | ||
} | ||
}, | ||
"examples": [ | ||
"{\n \"sources\": [\n {\n \"name\": \"World Bank and OECD\",\n \"uri\": \"http://data.worldbank.org/indicator/NY.GDP.MKTP.CD\"\n }\n ]\n}\n" | ||
] | ||
}, | ||
"licenses": { | ||
"description": "The license(s) under which the resource is published.", | ||
"propertyOrder": 150, | ||
"options": { | ||
"hidden": true | ||
}, | ||
"title": "Licenses", | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { | ||
"title": "License", | ||
"description": "A license for this descriptor.", | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"title": "Open Definition license identifier", | ||
"description": "MUST be an Open Definition license identifier, see http://licenses.opendefinition.org/", | ||
"type": "string", | ||
"pattern": "^([-a-zA-Z0-9._])+$" | ||
}, | ||
"path": { | ||
"title": "Path", | ||
"description": "A fully qualified URL, or a POSIX file path..", | ||
"type": "string", | ||
"examples": [ | ||
"{\n \"path\": \"file.csv\"\n}\n", | ||
"{\n \"path\": \"http://example.com/file.csv\"\n}\n" | ||
], | ||
"context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly." | ||
}, | ||
"title": { | ||
"title": "Title", | ||
"description": "A human-readable title.", | ||
"type": "string", | ||
"examples": [ | ||
"{\n \"title\": \"My Package Title\"\n}\n" | ||
] | ||
} | ||
}, | ||
"context": "Use of this property does not imply that the person was the original creator of, or a contributor to, the data in the descriptor, but refers to the composition of the descriptor itself." | ||
}, | ||
"context": "This property is not legally binding and does not guarantee that the package is licensed under the terms defined herein.", | ||
"examples": [ | ||
"{\n \"licenses\": [\n {\n \"name\": \"odc-pddl-1.0\",\n \"uri\": \"http://opendatacommons.org/licenses/pddl/\"\n }\n ]\n}\n" | ||
] | ||
}, | ||
"format": { | ||
"propertyOrder": 80, | ||
"title": "Format", | ||
"description": "The file format of this resource.", | ||
"context": "`csv`, `xls`, `json` are examples of common formats.", | ||
"type": "string", | ||
"examples": [ | ||
"{\n \"format\": \"xls\"\n}\n" | ||
] | ||
}, | ||
"mediatype": { | ||
"propertyOrder": 90, | ||
"title": "Media Type", | ||
"description": "The media type of this resource. Can be any valid media type listed with [IANA](https://www.iana.org/assignments/media-types/media-types.xhtml).", | ||
"type": "string", | ||
"pattern": "^(.+)/(.+)$", | ||
"examples": [ | ||
"{\n \"mediatype\": \"text/csv\"\n}\n" | ||
] | ||
}, | ||
"encoding": { | ||
"propertyOrder": 100, | ||
"title": "Encoding", | ||
"description": "The file encoding of this resource.", | ||
"type": "string", | ||
"default": "utf-8", | ||
"examples": [ | ||
"{\n \"encoding\": \"utf-8\"\n}\n" | ||
] | ||
}, | ||
"bytes": { | ||
"propertyOrder": 110, | ||
"options": { | ||
"hidden": true | ||
}, | ||
"title": "Bytes", | ||
"description": "The size of this resource in bytes.", | ||
"type": "integer", | ||
"examples": [ | ||
"{\n \"bytes\": 2082\n}\n" | ||
] | ||
}, | ||
"hash": { | ||
"propertyOrder": 120, | ||
"options": { | ||
"hidden": true | ||
}, | ||
"title": "Hash", | ||
"type": "string", | ||
"description": "The MD5 hash of this resource. Indicate other hashing algorithms with the {algorithm}:{hash} format.", | ||
"pattern": "^([^:]+:[a-fA-F0-9]+|[a-fA-F0-9]{32}|)$", | ||
"examples": [ | ||
"{\n \"hash\": \"d25c9c77f588f5dc32059d2da1136c02\"\n}\n", | ||
"{\n \"hash\": \"SHA256:5262f12512590031bbcc9a430452bfd75c2791ad6771320bb4b5728bfb78c4d0\"\n}\n" | ||
] | ||
} | ||
} | ||
} |
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
Oops, something went wrong.