Replies: 2 comments
-
Hi, why not use option 1, but as a regular tabular data resource? resources:
- name: people
- name: traits
- name: files
type: table # Regular tabular resource
schema:
fields:
- name: person_id
type: string
- name: file_path # Does not need to the first field
type: string
format: default # We could benefit here from an additional format "path", cf. "uri" for URLs
- name: mediatype
type: string
foreignKeys:
- fields: ["person_id"]
reference:
resource: people
fields: ["id"]
data:
- person_id: person1
file_path: ./people_files/person1/profile.jpg
mediatype: image/jpeg
- person_id: person1
file_path: ./people_files/person1/randomName.png
mediatype: image/png
# etc ... We use this approach to describe media files in a camera trap study (including foreign keys):
|
Beta Was this translation helpful? Give feedback.
-
Hi @peterdesmet 👋 Thank you very much for reviewing this 🙏
Ive described the limitation of this approach in the description
in more practical terms: would a system be able to auto-discover the data is also contained in files just thanks to the datapackage specs?
basically data in files is not first class citizen the same way table resources are and it limits automatic discoverability |
Beta Was this translation helpful? Give feedback.
-
Schematize relationships of files
Summary of the issue
More and more data is not tabular: images, videos, html, etc… But it does have relationships.
The current datapackage.org spec allows to define relationships between table fields, but it does not allow it on pure file resources.
A workaround is to have a special table resource that lists the files and leverages the
foreignKeys
spec, but it mixes data and schema concepts. Indeed, one column of the table resource is a path to another resource.Why is this a problem?
Well, the great benefit of using datapackage.org is to enable discoverability of data and a programmatic one even. So that schemas are defined and a whole database schema can be generated without reading the content of each resource. If the relationship is defined inside the data (resource content), then discoverability cannot happen because a script cannot discover these relationships by purely following the datapackage.org standard.
What could be done?
We will use the following use case
Option 1: Special
fileTable
table resource that describes data located in files and its references to other resources via foreign keysWe extend the
table
type for afileTable
type which enforces the first field to befile_path
file_path
must be a a valid path to a file in the datapackageQ: Do we need to declare each file resource when they are described in a
fileTable
?Option 2: File resources can reference a
virtualTable
parentThe idea here is that the schema can still be defined in a table like resource but the data is in files that have to reference it AND have the same fields as properties
This allows for data frames to be in separate JSON files for examples and leverages the existing metadata definition for files like format, mediatype etc…
Beta Was this translation helpful? Give feedback.
All reactions