1{
2  "$schema": "http://json-schema.org/draft-04/schema#",
3  "title": "Data Resource",
4  "description": "Data Resource.",
5  "type": "object",
6  "oneOf": [
7    {
8      "required": [
9        "name",
10        "data"
11      ]
12    },
13    {
14      "required": [
15        "name",
16        "path"
17      ]
18    }
19  ],
20  "properties": {
21    "profile": {
22      "propertyOrder": 10,
23      "default": "data-resource",
24      "title": "Profile",
25      "description": "The profile of this descriptor.",
26      "context": "Every Package and Resource descriptor has a profile. The default profile, if none is declared, is `data-package` for Package and `data-resource` for Resource.",
27      "type": "string",
28      "examples": [
29        "{\n  \"profile\": \"tabular-data-package\"\n}\n",
30        "{\n  \"profile\": \"http://example.com/my-profiles-json-schema.json\"\n}\n"
31      ]
32    },
33    "name": {
34      "propertyOrder": 20,
35      "title": "Name",
36      "description": "An identifier string. Lower case characters with `.`, `_`, `-` and `/` are allowed.",
37      "type": "string",
38      "pattern": "^([-a-z0-9._/])+$",
39      "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.",
40      "examples": [
41        "{\n  \"name\": \"my-nice-name\"\n}\n"
42      ]
43    },
44    "path": {
45      "propertyOrder": 30,
46      "title": "Path",
47      "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.",
48      "oneOf": [
49        {
50          "title": "Path",
51          "description": "A fully qualified URL, or a POSIX file path..",
52          "type": "string",
53          "pattern": "^(?=^[^./~])(^((?!\\.{2}).)*$).*$",
54          "examples": [
55            "{\n  \"path\": \"file.csv\"\n}\n",
56            "{\n  \"path\": \"http://example.com/file.csv\"\n}\n"
57          ],
58          "context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly."
59        },
60        {
61          "type": "array",
62          "minItems": 1,
63          "items": {
64            "title": "Path",
65            "description": "A fully qualified URL, or a POSIX file path..",
66            "type": "string",
67            "pattern": "^(?=^[^./~])(^((?!\\.{2}).)*$).*$",
68            "examples": [
69              "{\n  \"path\": \"file.csv\"\n}\n",
70              "{\n  \"path\": \"http://example.com/file.csv\"\n}\n"
71            ],
72            "context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly."
73          },
74          "examples": [
75            "[ \"file.csv\" ]\n",
76            "[ \"http://example.com/file.csv\" ]\n"
77          ]
78        }
79      ],
80      "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.",
81      "examples": [
82        "{\n  \"path\": [\n    \"file.csv\",\n    \"file2.csv\"\n  ]\n}\n",
83        "{\n  \"path\": [\n    \"http://example.com/file.csv\",\n    \"http://example.com/file2.csv\"\n  ]\n}\n",
84        "{\n  \"path\": \"http://example.com/file.csv\"\n}\n"
85      ]
86    },
87    "data": {
88      "propertyOrder": 230,
89      "title": "Data",
90      "description": "Inline data for this resource."
91    },
92    "schema": {
93      "propertyOrder": 40,
94      "title": "Schema",
95      "description": "A schema for this resource.",
96      "type": "object"
97    },
98    "title": {
99      "propertyOrder": 50,
100      "title": "Title",
101      "description": "A human-readable title.",
102      "type": "string",
103      "examples": [
104        "{\n  \"title\": \"My Package Title\"\n}\n"
105      ]
106    },
107    "description": {
108      "propertyOrder": 60,
109      "format": "textarea",
110      "title": "Description",
111      "description": "A text description. Markdown is encouraged.",
112      "type": "string",
113      "examples": [
114        "{\n  \"description\": \"# My Package description\\nAll about my package.\"\n}\n"
115      ]
116    },
117    "homepage": {
118      "propertyOrder": 70,
119      "title": "Home Page",
120      "description": "The home on the web that is related to this data package.",
121      "type": "string",
122      "format": "uri",
123      "examples": [
124        "{\n  \"homepage\": \"http://example.com/\"\n}\n"
125      ]
126    },
127    "sources": {
128      "propertyOrder": 140,
129      "options": {
130        "hidden": true
131      },
132      "title": "Sources",
133      "description": "The raw sources for this resource.",
134      "type": "array",
135      "minItems": 0,
136      "items": {
137        "title": "Source",
138        "description": "A source file.",
139        "type": "object",
140        "required": [
141          "title"
142        ],
143        "properties": {
144          "title": {
145            "title": "Title",
146            "description": "A human-readable title.",
147            "type": "string",
148            "examples": [
149              "{\n  \"title\": \"My Package Title\"\n}\n"
150            ]
151          },
152          "path": {
153            "title": "Path",
154            "description": "A fully qualified URL, or a POSIX file path..",
155            "type": "string",
156            "pattern": "^(?=^[^./~])(^((?!\\.{2}).)*$).*$",
157            "examples": [
158              "{\n  \"path\": \"file.csv\"\n}\n",
159              "{\n  \"path\": \"http://example.com/file.csv\"\n}\n"
160            ],
161            "context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly."
162          },
163          "email": {
164            "title": "Email",
165            "description": "An email address.",
166            "type": "string",
167            "format": "email",
168            "examples": [
169              "{\n  \"email\": \"example@example.com\"\n}\n"
170            ]
171          }
172        }
173      },
174      "examples": [
175        "{\n  \"sources\": [\n    {\n      \"title\": \"World Bank and OECD\",\n      \"path\": \"http://data.worldbank.org/indicator/NY.GDP.MKTP.CD\"\n    }\n  ]\n}\n"
176      ]
177    },
178    "licenses": {
179      "description": "The license(s) under which the resource is published.",
180      "propertyOrder": 150,
181      "options": {
182        "hidden": true
183      },
184      "title": "Licenses",
185      "type": "array",
186      "minItems": 1,
187      "items": {
188        "title": "License",
189        "description": "A license for this descriptor.",
190        "type": "object",
191        "properties": {
192          "name": {
193            "title": "Open Definition license identifier",
194            "description": "MUST be an Open Definition license identifier, see http://licenses.opendefinition.org/",
195            "type": "string",
196            "pattern": "^([-a-zA-Z0-9._])+$"
197          },
198          "path": {
199            "title": "Path",
200            "description": "A fully qualified URL, or a POSIX file path..",
201            "type": "string",
202            "pattern": "^(?=^[^./~])(^((?!\\.{2}).)*$).*$",
203            "examples": [
204              "{\n  \"path\": \"file.csv\"\n}\n",
205              "{\n  \"path\": \"http://example.com/file.csv\"\n}\n"
206            ],
207            "context": "Implementations need to negotiate the type of path provided, and dereference the data accordingly."
208          },
209          "title": {
210            "title": "Title",
211            "description": "A human-readable title.",
212            "type": "string",
213            "examples": [
214              "{\n  \"title\": \"My Package Title\"\n}\n"
215            ]
216          }
217        },
218        "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."
219      },
220      "context": "This property is not legally binding and does not guarantee that the package is licensed under the terms defined herein.",
221      "examples": [
222        "{\n  \"licenses\": [\n    {\n      \"name\": \"odc-pddl-1.0\",\n      \"path\": \"http://opendatacommons.org/licenses/pddl/\",\n      \"title\": \"Open Data Commons Public Domain Dedication and License v1.0\"\n    }\n  ]\n}\n"
223      ]
224    },
225    "format": {
226      "propertyOrder": 80,
227      "title": "Format",
228      "description": "The file format of this resource.",
229      "context": "`csv`, `xls`, `json` are examples of common formats.",
230      "type": "string",
231      "examples": [
232        "{\n  \"format\": \"xls\"\n}\n"
233      ]
234    },
235    "mediatype": {
236      "propertyOrder": 90,
237      "title": "Media Type",
238      "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).",
239      "type": "string",
240      "pattern": "^(.+)/(.+)$",
241      "examples": [
242        "{\n  \"mediatype\": \"text/csv\"\n}\n"
243      ]
244    },
245    "encoding": {
246      "propertyOrder": 100,
247      "title": "Encoding",
248      "description": "The file encoding of this resource.",
249      "type": "string",
250      "default": "utf-8",
251      "examples": [
252        "{\n  \"encoding\": \"utf-8\"\n}\n"
253      ]
254    },
255    "bytes": {
256      "propertyOrder": 110,
257      "options": {
258        "hidden": true
259      },
260      "title": "Bytes",
261      "description": "The size of this resource in bytes.",
262      "type": "integer",
263      "examples": [
264        "{\n  \"bytes\": 2082\n}\n"
265      ]
266    },
267    "hash": {
268      "propertyOrder": 120,
269      "options": {
270        "hidden": true
271      },
272      "title": "Hash",
273      "type": "string",
274      "description": "The MD5 hash of this resource. Indicate other hashing algorithms with the {algorithm}:{hash} format.",
275      "pattern": "^([^:]+:[a-fA-F0-9]+|[a-fA-F0-9]{32}|)$",
276      "examples": [
277        "{\n  \"hash\": \"d25c9c77f588f5dc32059d2da1136c02\"\n}\n",
278        "{\n  \"hash\": \"SHA256:5262f12512590031bbcc9a430452bfd75c2791ad6771320bb4b5728bfb78c4d0\"\n}\n"
279      ]
280    }
281  }
282}