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

develop #193

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
17ef7db
[WIP]
ksclarke Apr 14, 2024
a6cfe0a
Update docs, fix parsing bug
ksclarke Apr 18, 2024
cff1f2a
Add more cookbook examples
ksclarke Apr 19, 2024
4b61aee
Update upstream cookbook recipe: 0003
ksclarke Apr 19, 2024
8bb4450
Documentation updates
ksclarke May 26, 2024
585012d
Update PMD rules
ksclarke Jun 1, 2024
1d50e9b
[WIP] Code snapshot
ksclarke Jun 11, 2024
a92f806
Reformat according to new code styles
ksclarke Jun 11, 2024
0621751
[WIP] Update parent project, cookbook tests
ksclarke Jun 16, 2024
44d69d1
Update README.md
ksclarke Jun 16, 2024
d6cf0b2
Add missing cookbook test fixture
ksclarke Jun 16, 2024
390a589
Update repo status badge in README
ksclarke Jun 16, 2024
e433058
Wordsmith README
ksclarke Jun 16, 2024
219bd3d
Fix Sonar CI run
ksclarke Jun 16, 2024
974aa2c
Update auto-approver GA
ksclarke Jun 17, 2024
aa347b9
Fix Sonar CI run
ksclarke Jun 17, 2024
cb7c0b3
Reconfigure Sonar plugin
ksclarke Jun 18, 2024
45e1447
Update with Sonar suggestions
ksclarke Jun 18, 2024
e8331b5
Update with Sonar suggestions
ksclarke Jun 18, 2024
0b64a23
Fix javadoc plugin reference
ksclarke Jun 18, 2024
33d3835
Add missing @param tag
ksclarke Jun 18, 2024
2d9a5e4
Parent project version update + refactoring
ksclarke Jun 22, 2024
9440132
Fix recursive methods
ksclarke Jun 23, 2024
86f726d
Remove generics from ContentResource
ksclarke Jun 23, 2024
1193255
Fix Sonar issues
ksclarke Jun 23, 2024
fddba57
Small Sonar suggested cleanups
ksclarke Jun 23, 2024
56dc0e1
Remove generics from services
ksclarke Jun 23, 2024
549caa0
WIP - Test
ksclarke Jun 24, 2024
097fa74
Update with more Sonar suggestions
ksclarke Jun 27, 2024
eb54511
Sonar suggested cleanup
ksclarke Jun 28, 2024
a769a4f
Move Sonar config to parent project
ksclarke Jun 30, 2024
cd2854b
Update freelib-utils dependency
ksclarke Jul 1, 2024
ee24d43
Update parent project
ksclarke Jul 1, 2024
be2d3dd
Add tests
ksclarke Jul 4, 2024
8ab11bb
[WIP] Add tests
ksclarke Jul 7, 2024
6f44d3f
[WIP] Add tests
ksclarke Jul 7, 2024
d5ebdc4
Support Web Annotations w/o a motivation
ksclarke Jul 10, 2024
64212b4
[WIP] Test updates
ksclarke Jul 18, 2024
a490f2d
[WIP] Add more tests
ksclarke Jul 20, 2024
59483e8
Fix supplementing/paiting tests
ksclarke Jul 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 17 ]
java: [ 17, 21 ]

steps:

- name: Check out code
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
with:
fetch-depth: 0 # Unshallow checkout helps SonarCloud provide more info

- name: Install JDK ${{ matrix.java }}
uses: actions/setup-java@860f60056505705214d223b91ed7a30f173f6142 # v3.3.0
Expand All @@ -28,15 +30,21 @@ jobs:
java-version: ${{ matrix.java }}

# If running locally in act, install Maven
- name: Set up Maven if needed
if: ${{ env.ACT }}
- name: Set up Maven
uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
with:
maven-version: 3.8.2

- name: Build with Maven
uses: samuelmeuli/action-maven-publish@201a45a3f311b2ee888f252ba9f4194257545709 # v1.4.0
- name: Cache SonarCloud packages
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
maven_goals_phases: "clean verify"
maven_profiles: default
maven_args: "-V -ntp -Dorg.slf4j.simpleLogger.log.net.sourceforge.pmd=error"
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Build with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
mvn -B -ntp -Dorg.slf4j.simpleLogger.log.net.sourceforge.pmd=error -Psonar verify javadoc:javadoc
2 changes: 1 addition & 1 deletion .github/workflows/pr-auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
env:
AUTO_PR_APPROVAL: ${{ secrets.AUTO_PR_APPROVAL }}
steps:
- uses: hmarr/auto-approve-action@7782c7e2bdf62b4d79bdcded8332808fd2f179cd # v2.0.0
- uses: hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363 # v4.0.0
if: env.AUTO_PR_APPROVAL != null
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors:
- family-names: "Matney"
given-names: "Mark A."
name-suffix: "Jr."
title: "Jiiify Presentation"
version: 0.10.0
date-released: 2021-09-17
title: "Jiiify Presentation (v3)"
version: 0.12.4
date-released: 2023-07-28
url: "https://github.com/ksclarke/jiiify-presentation"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# jiiify-presentation <br/>[![IIIF Presentation 3.0](https://img.shields.io/badge/IIIF%20Presentation-3.0-brightgreen)](https://iiif.io/api/presentation/3.0/) [![Maven PR Build](https://github.com/ksclarke/jiiify-presentation/actions/workflows/build.yml/badge.svg)](https://github.com/ksclarke/jiiify-presentation/actions/workflows/build.yml) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/a1fb61b809944441bf65e02132383b6d?branch=v3)](https://www.codacy.com/app/ksclarke/jiiify-presentation?utm_source=github.com&utm_medium=referral&utm_content=ksclarke/jiiify-presentation&utm_campaign=Badge_Coverage) [![Known Vulnerabilities](https://snyk.io/test/github/ksclarke/jiiify-presentation/v3/badge.svg)](https://snyk.io/test/github/ksclarke/jiiify-presentation/v3) [![Maven](https://img.shields.io/maven-central/v/info.freelibrary/jiiify-presentation-v3?colorB=brightgreen)](https://search.maven.org/artifact/info.freelibrary/jiiify-presentation-v3) [![Javadocs](http://javadoc.io/badge2/info.freelibrary/jiiify-presentation-v3/latest/javadoc.svg)](https://javadoc.io/doc/info.freelibrary/jiiify-presentation-v3/latest/index.html)
# jiiify-presentation (JPv3) <br>[![IIIF Presentation 3.0](https://img.shields.io/badge/IIIF%20Presentation-3.0-brightgreen)](https://iiif.io/api/presentation/3.0/) [![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip) [![Maven PR Build](https://github.com/ksclarke/jiiify-presentation/actions/workflows/build.yml/badge.svg)](https://github.com/ksclarke/jiiify-presentation/actions/workflows/build.yml) [![Maven](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/info/freelibrary/jiiify-presentation-v3/maven-metadata.xml.svg?colorB=brightgreen)](https://search.maven.org/artifact/info.freelibrary/jiiify-presentation-v3) [![Javadocs](http://javadoc.io/badge2/info.freelibrary/jiiify-presentation-v3/latest/javadoc.svg)](https://javadoc.io/doc/info.freelibrary/jiiify-presentation-v3/latest/index.html)

Jiiify Presentation is a [IIIF Presentation](http://iiif.io/api/presentation) library for Java. It does not contain a server. It's just for working with IIIF presentation manifests.
Jiiify Presentation is a [IIIF Presentation](http://iiif.io/api/presentation) library for Java. It does not contain a manifest server. While it could be used to write such a server, it's purpose is just to provide a way to work with IIIF manifests.

*Warning:* The API for v3 is still in active development. There will definitely be breaking changes before the library reaches version 1.0.0. After it reaches 1.0.0 and becomes stable, the project will use semantic versioning to indicate the types of changes associated with new releases.
*Warning:* The API for v3 is still being actively developed. There will be breaking changes in the `main` branch before the library reaches version 1.0.0. After the stable release, the project will use [semantic versioning](https://semver.org/) to represent the types of ongoing changes being made.

### Prerequisites

* JDK >= 17 (this is the JDK that the released version uses)
* Maven >= 3.8.7 (this is what's used for building the project)
* Maven >= 3.6.3 (this is what's used for building the project)

### Getting Started

Expand Down
4 changes: 3 additions & 1 deletion docs/content/en/docs/recipes/code/0001-mvm-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ linkTitle: "0001-mvm-image"
weight: 0
---

### Use Case

The simplest viable manifest for image content. If all you have for an object is one image on the web and a label to go along with it, this pattern turns it into a IIIF
Presentation resource.

| | |
| :--- | :---: |
| Recipe: | https://iiif.io/api/cookbook/recipe/0001-mvm-image/ |
| Manifest: | https://iiif.io/api/cookbook/recipe/0001-mvm-image/manifest.json |
| JSON: | https://iiif.io/api/cookbook/recipe/0001-mvm-image/manifest.json |

### Method One

Expand Down
4 changes: 3 additions & 1 deletion docs/content/en/docs/recipes/code/0002-mvm-audio.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ linkTitle: "0002-mvn-audio"
weight: 0
---

### Use Case

The simplest viable manifest for audio content. This pattern presents a single audio file in a IIIF Presentation resource.

| | |
| :--- | :---: |
| Recipe: | https://iiif.io/api/cookbook/recipe/0002-mvm-audio/ |
| Manifest: | https://iiif.io/api/cookbook/recipe/0002-mvm-audio/manifest.json |
| JSON: | https://iiif.io/api/cookbook/recipe/0002-mvm-audio/manifest.json |

### Method One

Expand Down
8 changes: 5 additions & 3 deletions docs/content/en/docs/recipes/code/0003-mvm-video.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ linkTitle: "0003-mvn-video"
weight: 0
---

### Use Case

The simplest viable manifest for video content. This pattern presents a single video file in a IIIF Presentation resource.

| | |
| :--- | :---: |
| Recipe: | https://iiif.io/api/cookbook/recipe/0003-mvm-video/ |
| Manifest: | https://iiif.io/api/cookbook/recipe/0003-mvm-video/manifest.json |
| JSON: | https://iiif.io/api/cookbook/recipe/0003-mvm-video/manifest.json |

### Method One

Expand All @@ -20,7 +22,7 @@ create different IDs than are used in the cookbook recipe.
var manifest = new Manifest("https://iiif.io/api/cookbook/recipe/0003-mvm-video/manifest",
new Label("en", "Video Example 3"));
var minter = MinterFactory.getMinter(manifest);
var canvas = new Canvas(minter).setWidthHeight(640, 360).setDuration(572.034);
var canvas = new Canvas(minter).setWidthHeight(480, 360).setDuration(572.034);
var videoContent = new VideoContent("https://fixtures.iiif.io/video/indiana/lunchroom_manners/high/lunchroom_manners_1024kb.mp4");

canvas.paintWith(videoContent.setWidthHeight(480, 360).setDuration(572.034));
Expand All @@ -41,7 +43,7 @@ var videoContent = new VideoContent("https://fixtures.iiif.io/video/indiana/lunc
var page = new AnnotationPage<PaintingAnnotation>("https://iiif.io/api/cookbook/recipe/0003-mvm-video/canvas/page");
var annotation = new PaintingAnnotation("https://iiif.io/api/cookbook/recipe/0003-mvm-video/canvas/page/annotation", canvas);

canvas.setDuration(572.034).setWidthHeight(640, 360);
canvas.setDuration(572.034).setWidthHeight(480, 360);
videoContent.setDuration(572.034).setWidthHeight(480, 360);
page.addAnnotations(annotation.setBody(videoContent).setTarget(new Target(canvas)));
manifest.setCanvases(canvas.setPaintingPages(page));
Expand Down
4 changes: 3 additions & 1 deletion docs/content/en/docs/recipes/code/0004-canvas-size.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ linkTitle: "0004-canvas-size"
weight: 0
---

### Use Case

You have an image ready for annotating that is expected to be replaced later by a higher resolution image. You would like to provide a sufficiently high-resolution
coordinate space to position the annotations precisely. IIIF Presentation v3.0 allows you to describe a Canvas with the dimensions of the larger image to come, fill it
with the smaller image you have ready now, and capture annotations on the smaller image in confidence that they will be positioned appropriately on the larger image when
Expand All @@ -12,7 +14,7 @@ it is swapped in.
| | |
| :--- | :---: |
| Recipe: | https://iiif.io/api/cookbook/recipe/0004-canvas-size/ |
| Manifest: | https://iiif.io/api/cookbook/recipe/0004-canvas-size/manifest.json |
| JSON: | https://iiif.io/api/cookbook/recipe/0004-canvas-size/manifest.json |

### Method One

Expand Down
4 changes: 3 additions & 1 deletion docs/content/en/docs/recipes/code/0005-image-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ linkTitle: "0005-image-service"
weight: 0
---

### Use Case

You have a rare or special object in your collection that you’d like to make available for research to a large audience, including those without the ability to be
present at your institution to examine the object in person. Presenting a medium-resolution flat digital image of the object using IIIF is possible, but if you have
implemented a IIIF Image API service, you have significantly enhanced interaction possibilities for research and engagement. Specifying a IIIF Image API service in your
Expand All @@ -14,7 +16,7 @@ sophisticated inspection of the object and more possibilities for stable, durabl
| | |
| :--- | :---: |
| Recipe: | https://iiif.io/api/cookbook/recipe/0005-image-service/ |
| Manifest: | https://iiif.io/api/cookbook/recipe/0005-image-service/manifest.json |
| JSON: | https://iiif.io/api/cookbook/recipe/0005-image-service/manifest.json |

### Method One

Expand Down
64 changes: 54 additions & 10 deletions docs/content/en/docs/recipes/code/0006-text-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,39 @@ linkTitle: "0006-text-language"
weight: 0
---

### Use Case

In some cases, a IIIF resource may have a title or description (label or summary) in more than one language; or, the publisher of the content may want to provide
descriptive metadata field labels in multiple languages for different language audiences, for example supplying a label for a creator field in both English and French
(“Creator”, “Auteur”).

| | |
| :--- | :---: |
| Recipe: | https://iiif.io/api/cookbook/recipe/0006-text-language/ |
| Manifest: | https://iiif.io/api/cookbook/recipe/0006-text-language/manifest.json |
| JSON: | https://iiif.io/api/cookbook/recipe/0006-text-language/manifest.json |

### Method One

For the first method, we use a Minter to create IDs for the components of the manifest. This allows us to use less code to create the same structures. It will, however,
create different IDs than are used in the cookbook recipe.
For the first method, we use a `Minter` to create IDs for the components of the manifest. This allows us to use less code to create the same structures. It will,
however, create different IDs than are used in the cookbook recipe. It also uses `I18n` objects to create the internationalizations.

_Note that `LEVEL_ONE` and `IMAGE_JPEG` are static imports whose classes (`ImageService3.Profile` and `MediaType`) are predefined in this site's code sandbox._

```java
var manifest = new Manifest("https://iiif.io/api/cookbook/recipe/0006-text-language/manifest.json",
new Label(new I18n("en", "Whistler's Mother"), new I18n("fr", "La Mère de Whistler")));

var canvas = new Canvas(MinterFactory.getMinter(manifest));
var imageContent = new ImageContent("https://iiif.io/api/image/3.0/example/reference/329817fc8a251a01c393f517d8a17d87-Whistlers_Mother/full/max/0/default.jpg");
var service = new ImageService3(LEVEL_ONE, "https://iiif.io/api/image/3.0/example/reference/329817fc8a251a01c393f517d8a17d87-Whistlers_Mother");

var creatorLabel = new Label(new I18n("en", "Creator"), new I18n("fr", "Auteur"));
var creator = new Metadata(creatorLabel, new Value("Whistler, James Abbott McNeill"));
var creator = new Metadata(new Label(new I18n("en", "Creator"), new I18n("fr", "Auteur")),
new Value("Whistler, James Abbott McNeill"));

var subjectLabel = new Label(new I18n("en", "Subject"), new I18n("fr", "Sujet"));
var subjectEN = new I18n("en", "McNeill Anna Matilda, mother of Whistler (1804-1881)");
var subjectFR = new I18n("fr", "McNeill Anna Matilda, mère de Whistler (1804-1881)");
var subject = new Metadata(subjectLabel, new Value(subjectEN, subjectFR));
var subject = new Metadata(new Label(new I18n("en", "Subject"), new I18n("fr", "Sujet")),
new Value(subjectEN, subjectFR));

var summaryEN = new I18n("en", "Arrangement in Grey and Black No. 1, also called Portrait of the Artist's Mother.");
var summaryFR = new I18n("fr", "Arrangement en gris et noir n°1, also called Portrait de la mère de l'artiste.");
Expand All @@ -53,13 +56,15 @@ System.out.println(manifest);

### Method Two

The second method will create a manifest with the same IDs that the cookbook recipe uses. It involves setting all the IDs manually, which involves a little more code.
The second method doesn't use a `Minter` and will create a manifest with the same IDs that the cookbook recipe uses. It sets all the IDs manually, which involves a
little more code. Like the above, it still uses `I18n`(s) for the internationalizations.

_The same note above about `LEVEL_ONE` and `IMAGE_JPEG` also applies to this example._

```java
var manifest = new Manifest("https://iiif.io/api/cookbook/recipe/0006-text-language/manifest.json",
new Label(new I18n("en", "Whistler's Mother"), new I18n("fr", "La Mère de Whistler")));

var canvas = new Canvas("https://iiif.io/api/cookbook/recipe/0006-text-language/canvas/p1");
var page = new AnnotationPage<PaintingAnnotation>("https://iiif.io/api/cookbook/recipe/0006-text-language/page/p1/1");
var annotation = new PaintingAnnotation("https://iiif.io/api/cookbook/recipe/0006-text-language/annotation/p0001-image", canvas);
Expand All @@ -69,10 +74,10 @@ var service = new ImageService3(LEVEL_ONE, "https://iiif.io/api/image/3.0/exampl
var creatorLabel = new Label(new I18n("en", "Creator"), new I18n("fr", "Auteur"));
var creator = new Metadata(creatorLabel, new Value("Whistler, James Abbott McNeill"));

var subjectLabel = new Label(new I18n("en", "Subject"), new I18n("fr", "Sujet"));
var subjectEN = new I18n("en", "McNeill Anna Matilda, mother of Whistler (1804-1881)");
var subjectFR = new I18n("fr", "McNeill Anna Matilda, mère de Whistler (1804-1881)");
var subject = new Metadata(subjectLabel, new Value(subjectEN, subjectFR));
var subject = new Metadata(new Label(new I18n("en", "Subject"), new I18n("fr", "Sujet")),
new Value(subjectEN, subjectFR));

var summaryEN = new I18n("en", "Arrangement in Grey and Black No. 1, also called Portrait of the Artist's Mother.");
var summaryFR = new I18n("fr", "Arrangement en gris et noir n°1, also called Portrait de la mère de l'artiste.");
Expand All @@ -91,4 +96,43 @@ manifest.addCanvases(canvas.setWidthHeight(1114, 991).setPaintingPages(page));
System.out.println(manifest);
```

### Method Three

The third, and last, example uses a `Minter` and creates internationalizations without using `I18n`(s). Instead, internationalizations are passed to their manifest
properties as arrays. This approach is the most concise method of the three.

_The same note above about `LEVEL_ONE` and `IMAGE_JPEG` also applies to this example._

```java
var manifest = new Manifest("https://iiif.io/api/cookbook/recipe/0006-text-language/manifest.json",
new Label("en", "Whistler's Mother", "fr", "La Mère de Whistler"));

var canvas = new Canvas(MinterFactory.getMinter(manifest));
var imageContent = new ImageContent("https://iiif.io/api/image/3.0/example/reference/329817fc8a251a01c393f517d8a17d87-Whistlers_Mother/full/max/0/default.jpg");
var service = new ImageService3(LEVEL_ONE, "https://iiif.io/api/image/3.0/example/reference/329817fc8a251a01c393f517d8a17d87-Whistlers_Mother");

var creator = new Metadata(new Label("en", "Creator", "fr", "Auteur"),
new Value("Whistler, James Abbott McNeill"));

var subject = new Metadata(new Label("en", "Subject", "fr", "Sujet"),
new Value("en", "McNeill Anna Matilda, mother of Whistler (1804-1881)", "fr", "McNeill Anna Matilda, mère de Whistler (1804-1881)"));

var summary = new Summary("en", "Arrangement in Grey and Black No. 1, also called Portrait of the Artist's Mother.",
"fr", "Arrangement en gris et noir n°1, also called Portrait de la mère de l'artiste.");

var reqStatement = new RequiredStatement(new Label("en", "Held By", "fr", "Détenu par"),
new Value("Musée d'Orsay, Paris, France"));

manifest.setMetadata(creator, subject);
manifest.setSummary(summary);
manifest.setRequiredStatement(reqStatement);

imageContent.setWidthHeight(1114, 991).setFormat(IMAGE_JPEG).setServices(service);
manifest.addCanvases(canvas.setWidthHeight(1114, 991).paintWith(imageContent));

System.out.println(manifest);
```

All three of the above methods work, and any of them is a valid way to create the cookbook recipe's manifests.

{{% sandbox %}}
Loading
Loading