Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove datapackage reference from jsontableschema foreign keys for v1? #314

Closed
roll opened this issue Oct 19, 2016 · 9 comments
Closed

Remove datapackage reference from jsontableschema foreign keys for v1? #314

roll opened this issue Oct 19, 2016 · 9 comments
Assignees
Milestone

Comments

@roll
Copy link
Member

roll commented Oct 19, 2016

Overview

For now jsontableschema contains cyclic-link with datapackage specification - http://specs.frictionlessdata.io/json-table-schema/#foreign-keys - to allow cross datapackage linking.

Pros

  • allow general referencing mechanism (somewhere in the internet)

Cons

  • allow general referencing mechanism instead of focusing on data integrity inside the data package
  • no implementations for now and hard to say when it could be done and on which level (jts-dp)
  • low-level knows about a top-level (abstraction break) reducing light-weighting of jsontableschema spec

Proposed

Wording of changes is bad but I suppose enough to show the idea:

A foreign key is a reference where entries in a given field (or fields) on this table is a reference to an entry in a field (or fields) on a separate resource. This specification delegates the definition of a separate resource to implementations and high-level specifications. E.g. the datapackage specification use it for a datapackage resource referencing.

The foreignKeys property, if present, MUST be an Array. Each entry in the array must be a foreignKey. A foreignKey MUST be a Hash and:

  • MUST have a property fields. fields is a string or array specifying the field or fields on this resource that form the source part of the foreign key. The structure of the string or array is as per primaryKey above.
  • MUST have a property reference which MUST be a Hash. The Hash
    • MUST have a property resource which is the name of the destination resource. For self-referencing foreign keys, the value of resource MUST be "self".
    • MUST have a property fields which is a string if the outer fields is a string, else an array of the same length as the outer fields, describing the field (or fields) references on the destination resource. The structure of the string or array is as per primaryKey above.

Links

Here is a full discussion - #297

@roll
Copy link
Member Author

roll commented Dec 1, 2016

@pwalsh
Version-1 candidate in implementation mind.

@pwalsh pwalsh self-assigned this Dec 1, 2016
@rufuspollock
Copy link
Contributor

@roll can you highlight the diff here vs current spec.

I agree the cyclic reference is not great. The general wording of this section as it currently stands is not as clear as i would like.

Re datapackage in FKs: I have seen zero examples of cross data package references in the wild. (And if they did happen they might be better stored outside of the data package in a separate file). As such we could drop the datapackage option on FKs without any issues for now.

@roll
Copy link
Member Author

roll commented Dec 5, 2016

Green note should be rewritten.

...

MUST have a property reference which MUST be a Hash. The Hash:

  • MAY have a property datapackage. This property is a string being a url pointing to a Data Package or is the name of a datapackage. If absent the implication is that this is a reference to a resource within the current data package or this is self-referencing foreign key.
  • MUST have a property resource which is the name of the tartget resource within the referenced data package (e.g. resoure inside datapackage). For self-referencing foreign keys, the value of resource MUST be self.

I have some troubles with wording here but the main idea I suppose should be - allow jts to use self referencing and allow jts to use abstract resource referencing. Wich will be described on datapackage level or in other top-level specifications. So it will decouple this too specs.

@pwalsh
Copy link
Member

pwalsh commented Dec 11, 2016

Depends on #327 for proper reframing of this.

@pwalsh pwalsh added this to the Version-1 milestone Dec 11, 2016
@pwalsh
Copy link
Member

pwalsh commented Dec 18, 2016

Implementing JSON References will solve this issue completely. #325 (comment)

@rufuspollock
Copy link
Contributor

I actually suggest we remove foreign key references across Data Packages.

@pwalsh
Copy link
Member

pwalsh commented Jan 30, 2017

will close with #337

@pwalsh
Copy link
Member

pwalsh commented Feb 5, 2017

We won't merge #337 until we can support all the changes in the core implementations we maintain. So closing this as it is implemented in #337 , as leaving it open creates confusion.

@pwalsh pwalsh closed this as completed Feb 5, 2017
@rufuspollock
Copy link
Contributor

FIXED. We removed foreign key references across data packages.

rufuspollock added a commit that referenced this issue May 22, 2017
…s - fixes #314 (again).

* Moved data package references for foreign keys to patterns (still think this is useful).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants