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

Added support for Presentation 3 services property #89

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

stephenwf
Copy link
Member

  1. Adds check for resources with id in addition to @id to find services from parent resources
  2. Adds services to pool of services to check when listing all services.
  3. Always looks for references to services in parent resources - this might be problematic
  4. Fixes previously passing test where a level1 image service was requested but only level0 was available. Test reflects ground truth but unsure if functionality relied on this bug.

For 3. an alternative to always checking would be to determine that the service doesn't have enough data:

{
  "id": "https://api.bl.uk/auth/iiif/login",
  "type": "AuthCookieService1"
}

Which references this in the manifest.services block:

{
  "id": "https://api.bl.uk/auth/iiif/login",
  "type": "AuthCookieService1",
  "profile": "http://iiif.io/api/auth/1/login",
  "description": {
    "en": [
      "Some portions of this recording may be unavailable due to rights restrictions."
    ]
  },
  "header": {
    "en": [
      "Please Log-In"
    ]
  },
  "label": {
    "en": [
      "Login to The British Library"
    ]
  },
  "service": [
    {
      "id": "https://api.bl.uk/auth/iiif/token",
      "type": "AuthTokenService1",
      "profile": "http://iiif.io/api/auth/1/token"
    }
  ]
}

The lack of profile might be enough? It's possible that in misconfigured manifests this would cause issues, if you had 2 services with the same identifier when you looked for the service recursively in the JSON-LD it would always resolve the first. Even if that service had a different structure.

I believe this is correct behaviour though, short of merging all services we find. cc @tomcrane

@stephenwf stephenwf force-pushed the feature/services-property-p3 branch from 6b335ae to 137edae Compare March 11, 2021 14:14
@tomcrane
Copy link
Contributor

Always looks for references to services in parent resources - this might be problematic

Only allowed on top level - manifest and collection - does that make it simpler?

Here's a useful example: https://iiif.wellcomecollection.org/presentation/b18323017

(WIP, might not be stable there)

@stephenwf
Copy link
Member Author

Hmm, I wonder why the Utils.traverseAndFind was used before? Are there cases where a canvas needs to find a service that's not only inside the manifest?

cc @edsilv

@tomcrane
Copy link
Contributor

The services formalises something the UV was doing anyway - mainly to avoid JSON bloat by repeating the same auth block 500 times on a 500-page manifest. It allowed the service to be declared once anywhere (typically on first occurrence) but then not repeat the full service. This is valid JSON-LD but an optimisation that only the UV might have seen. the services block gives you a peg to hang that sort of service on, so it's more conventional.

So the UV should probably keep the traverse, but people should use this special known location in P3 manifests to do this.

@tomcrane
Copy link
Contributor

Another test fixture:
https://iiif.wellcomecollection.org/presentation/b19192162
(clickthrough, declared once in full in services, thereafter as

"service": {
   "@id": "https://iiif.wellcomecollection.org/auth/clickthrough",
   "@type": "AuthCookieService1"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants