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

If property can ever have multiple values, require a JSON array #1131

Closed
azaroth42 opened this issue Apr 10, 2017 · 12 comments
Closed

If property can ever have multiple values, require a JSON array #1131

azaroth42 opened this issue Apr 10, 2017 · 12 comments

Comments

@azaroth42
Copy link
Member

azaroth42 commented Apr 10, 2017

From this thread:

https://groups.google.com/forum/?hl=en#!topic/iiif-discuss/ihQ3nHanh8Y

The proposal is to force all properties that can have multiple values to always be an array, in all APIs.
In the Presentation API, this would be: label, metadata, description, thumbnail, attribution, rights, logo, type, viewingHint, related, rendering, service, seeAlso, within

This is done in JSON-LD by adding @container: @set into the context document for those properties.

Note however that JSON-LD 1.0 currently prevents us from doing it for the values of LanguageMaps:

json-ld/json-ld.org#407
#755

But this is fixed in 1.1 (c.f. #1192)

An example from @workergnome:

http://evil-manifests.davidnewbury.com/iiif/garden/everything_a_list.json

@azaroth42 azaroth42 added this to the Presentation 3.0 milestone Apr 10, 2017
@azaroth42
Copy link
Member Author

I am 👍 on the proposal, other than for type which I think we should require be 1:1. Constantly type checking values to see if they're a list or a value is painful and results in hard to find bugs. Note that the current validator even incorrectly errors on the everything_a_list manifest.

@tomcrane
Copy link
Contributor

👍 too. Currently @list property names are plural (e.g., canvases) or mass nouns (e.g., otherContent), but I think the @set property names should remain singular:

"label": [ "one label", "another label"] 

not

"labels": [ "one label", "another label"] 

@workergnome
Copy link

workergnome commented Apr 10, 2017

Agree with @tomcrane on nouns remaining as they are, if only for backwards compatibility.

RE: type: I think about CRM integration, for instance, and, say: http://linked.art/model/object/digital/#iiif-manifests

{
    "id": "http://iiif.example.org/presentation/1/manifest.json", 
    "type": "InformationObject", 
    "conforms_to": "http://iiif.io/api/presentation", 
    "format": "application/ld+json;profile=\"http://iiif.io/api/presentation/2/context.json\""
  }

Here, we're stating that the manifest is a CRM InformationObject, but it's also a sc:Manifest. In a world where it's trying to be both, keeping the same URI, but two different types in two different contexts seems like it would be a problem.

(Or are we distinguishing between the manifest JSON file, and the manifest itself?)

@azaroth42
Copy link
Member Author

Following this pattern, and #1147 / #1176, we should also define an absolute format for first/last/next/prev references. If we ever allow more than just the URI, then they should always be a JSON object, requiring at least two properties (id and something else).

(Reason for 2 properties being that JSON-LD will compact {"id": "foo"} to just "foo")

@workergnome
Copy link

My preference would be to explicitly limit them to 1:1 URIs.

@azaroth42
Copy link
Member Author

azaroth42 commented Jul 5, 2017

General agreement on the 7/5 technical call, and noted that type/@type and @context are special cases.

@christopher-johnson
Copy link

Good proposal. #994.

@azaroth42 azaroth42 changed the title Consider @container:@set for all 1:* properties Constrain the JSON-LD structure as much as possible Sep 28, 2017
@azaroth42 azaroth42 added ratify and removed discuss labels Sep 28, 2017
@azaroth42 azaroth42 changed the title Constrain the JSON-LD structure as much as possible If property can ever have multiple values, require a JSON array Sep 28, 2017
@zimeon
Copy link
Member

zimeon commented Sep 28, 2017

I note that the addition of @container: @set in the context to define this behavior means that the change won't introduce any problems serializing from RDF.

@zimeon
Copy link
Member

zimeon commented Oct 12, 2017

👍 agreed at Toronto WG meeting

@azaroth42
Copy link
Member Author

azaroth42 commented Nov 3, 2017

Done throughout. Leaving open for the other specs, removing presentation tag.

@azaroth42
Copy link
Member Author

Tagging principles so we can document it as a design pattern.

@azaroth42
Copy link
Member Author

Removing image, via #1433

@azaroth42 azaroth42 removed this from the Presentation 3.0 milestone Feb 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants