Giter VIP home page Giter VIP logo

iiif-manifest-generator's People

Contributors

hshyk avatar kloor avatar leighbicknell avatar mkancija avatar sylry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iiif-manifest-generator's Issues

BUG: A manifest with multiple sequences can never validate.

At present validation requires that all sequences contain a canvas. It also specifies that in a manifest a sequence after the first one may only contain 'id', 'type' and 'label'.

Unless i'm doing something wrong, the 'isTopLevel' property appears to have no effect on either of these requirements, making the circular logic impossible to follow.

I believe that for this to work in Resources/Sequence.php the 'Canvases must be present in a sequence' requirement needs moving into the 'isTopLevel' clause?


I think the fix for this is to add a memberDataOnly clause to the top of the sequence::toArray method:

         if ($this->getOnlyMemberData()) {
            ArrayCreator::addRequired($item, Identifier::ID, $this->getID(), "The id must be present in a Manifest");
            ArrayCreator::addRequired($item, Identifier::TYPE, $this->getType(), "The type must be present in a Manifest");
            ArrayCreator::addRequired($item, Identifier::LABEL, $this->getLabels(), "The label must be present in a Manifest");

            return $item;
        }

Then add getOnlyMemberData to the manifest::validateSequence exclusions:

    public function validateSequence(Sequence $sequence)
    {
        $classname = '\IIIF\PresentationAPI\Resources\Sequence';
        $exclusions = array(
            'getID',
            'getType',
            'getLabels',
            'getDefaultContext',
            **'getOnlyMemberData'**
        );
        $message = "A Sequence after the first one embedded within a Manifest should only contain an id, type and label";
        Validator::shouldNotContainItems($sequence, $classname, $exclusions, $message);
        Validator::shouldContainItems($sequence, array('getLabels'), 'Multiple Sequences within a Manifest must contain a label');
    }

And then for ease of use we can automate setting onlyMemberData on every sequence after the first in manifest.php:

    /**
     * Add a sequence to the manifest.
     *
     * @param \IIIF\PresentationAPI\Resources\Sequence $sequence
     */
    public function addSequence(Sequence $sequence)
    {
        if (count($this->sequences)) {
            $sequence->returnOnlyMemberData();
        }
        array_push($this->sequences, $sequence);
    }

If i'm misunderstanding something please let me know.

Error in README.md Example?

In the 10th line of the example, should

$thumbnail->setService($service_thumbnail);

actually be

$manifest->setService($service_thumbnail);

This is a really cool library -- hoping to use it for our organization's IIIF implementation.

The ManifestTest is failing

The testCreateManifest1

--- Expected
+++ Actual
@@ @@
 {
     "@context": "http:\/\/iiif.io\/api\/presentation\/2\/context.json",
     "@id": "http:\/\/example.org\/iiif\/book1\/manifest",
     "@type": "sc:Manifest",
+    "viewingHint": "paged",
+    "viewingDirection": "right-to-left",
+    "navDate": "1856-01-01T00:00:00Z",
@@ @@
-        }
+        },
+        "@type": "dctypes:Image"
     },
-    "viewingDirection": "right-to-left",
-    "viewingHint": "paged",
-    "navDate": "1856-01-01T00:00:00Z",
@@ @@
+    "rendering": {
+        "@id": "http:\/\/example.org\/iiif\/book1.pdf",
+        "label": "Download as PDF",
+        "format": "application\/pdf"
+    },
@@ @@
-    "rendering": {
-        "@id": "http:\/\/example.org\/iiif\/book1.pdf",
-        "label": "Download as PDF",
-        "format": "application\/pdf"
-    },
@@ @@
-                    "label": "p. 1",
+                    "height": 500,
                     "width": 500,
-                    "height": 500
+                    "label": "p. 1"

/app/tests/IIIF/Test/Integration/ManifestTest.php:148

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.