From 5e08eb6d371cf96683c4d33b71c44aa8983a9af3 Mon Sep 17 00:00:00 2001 From: William Welling Date: Thu, 21 May 2020 13:34:50 -0500 Subject: [PATCH 1/2] afford metadata exclusion, multiple values for dedicated properties --- pom.xml | 2 +- .../iiif/config/model/AbstractIiifConfig.java | 40 +++-- .../iiif/service/AbstractManifestService.java | 46 ++--- .../rdf/AbstractDSpaceRdfManifestService.java | 10 +- .../AbstractFedoraPcdmManifestService.java | 12 +- .../FedoraPcdmCollectionManifestService.java | 12 +- .../tamu/iiif/utility/RdfModelUtility.java | 43 ++++- src/main/resources/application.yml | 18 +- .../model/DSpaceRdfIiiifConfigTest.java | 91 +++++++--- .../model/FedoraPcdmIiiifConfigTest.java | 81 ++++++--- .../model/rdf/RdfOrderedSequenceTest.java | 4 +- .../AbstractDSpaceRdfManifestServiceTest.java | 47 +++-- ...AbstractFedoraPcdmManifestServiceTest.java | 47 +++-- .../iiif/utility/RdfModelUtilityTest.java | 39 ++++- src/test/resources/application.yml | 18 +- .../dspace/json/collection-presentation.json | 20 ++- .../mock/dspace/json/collection.json | 5 + .../mock/dspace/json/collections.json | 4 + .../mock/dspace/json/presentation-allow.json | 21 ++- .../dspace/json/presentation-disallow.json | 21 ++- .../mock/dspace/json/presentation.json | 21 ++- src/test/resources/mock/dspace/rdf/item.rdf | 1 + .../resources/mock/fedora/json/canvas.json | 13 +- .../mock/fedora/json/collection.json | 22 ++- .../mock/fedora/json/presentation-allow.json | 160 ++---------------- .../fedora/json/presentation-disallow.json | 45 +++-- .../mock/fedora/json/presentation.json | 43 +++-- .../resources/mock/fedora/json/sequence.json | 35 ++-- 28 files changed, 510 insertions(+), 411 deletions(-) diff --git a/pom.xml b/pom.xml index 23c63b1..65bee03 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ UTF-8 1.8 3.2.0 - 3.2.5 + 3.2.6 classpath:/config/ diff --git a/src/main/java/edu/tamu/iiif/config/model/AbstractIiifConfig.java b/src/main/java/edu/tamu/iiif/config/model/AbstractIiifConfig.java index e8e91aa..b0a6261 100644 --- a/src/main/java/edu/tamu/iiif/config/model/AbstractIiifConfig.java +++ b/src/main/java/edu/tamu/iiif/config/model/AbstractIiifConfig.java @@ -5,16 +5,18 @@ public abstract class AbstractIiifConfig { - private List labelPrecedence = new ArrayList(); + private List labelPredicates = new ArrayList(); - private List descriptionPrecedence = new ArrayList(); + private List descriptionPredicates = new ArrayList(); - private List attributionPrecedence = new ArrayList(); + private List attributionPredicates = new ArrayList(); private List licensePrecedence = new ArrayList(); private List metadataPrefixes = new ArrayList(); + private List metadataExclusion = new ArrayList(); + private String url; private String identifier; @@ -25,28 +27,28 @@ public AbstractIiifConfig() { contextAsMetadata = true; } - public List getLabelPrecedence() { - return labelPrecedence; + public List getLabelPredicates() { + return labelPredicates; } - public void setLabelPrecedence(List labelPrecedence) { - this.labelPrecedence = labelPrecedence; + public void setLabelPredicates(List labelPredicates) { + this.labelPredicates = labelPredicates; } - public List getDescriptionPrecedence() { - return descriptionPrecedence; + public List getDescriptionPredicates() { + return descriptionPredicates; } - public void setDescriptionPrecedence(List descriptionPrecedence) { - this.descriptionPrecedence = descriptionPrecedence; + public void setDescriptionPredicates(List descriptionPredicates) { + this.descriptionPredicates = descriptionPredicates; } - public List getAttributionPrecedence() { - return attributionPrecedence; + public List getAttributionPredicates() { + return attributionPredicates; } - public void setAttributionPrecedence(List attributionPrecedence) { - this.attributionPrecedence = attributionPrecedence; + public void setAttributionPredicates(List attributionPredicates) { + this.attributionPredicates = attributionPredicates; } public List getLicensePrecedence() { @@ -65,6 +67,14 @@ public void setMetadataPrefixes(List metadataPrefixes) { this.metadataPrefixes = metadataPrefixes; } + public List getMetadataExclusion() { + return metadataExclusion; + } + + public void setMetadataExclusion(List metadataExclusion) { + this.metadataExclusion = metadataExclusion; + } + public String getUrl() { return url; } diff --git a/src/main/java/edu/tamu/iiif/service/AbstractManifestService.java b/src/main/java/edu/tamu/iiif/service/AbstractManifestService.java index 32e5143..9dd9716 100644 --- a/src/main/java/edu/tamu/iiif/service/AbstractManifestService.java +++ b/src/main/java/edu/tamu/iiif/service/AbstractManifestService.java @@ -3,7 +3,7 @@ import static edu.tamu.iiif.constants.Constants.IIIF_IMAGE_API_CONTEXT; import static edu.tamu.iiif.constants.Constants.IIIF_IMAGE_API_LEVEL_ZERO_PROFILE; import static edu.tamu.iiif.utility.RdfModelUtility.createRdfModel; -import static edu.tamu.iiif.utility.RdfModelUtility.getObject; +import static edu.tamu.iiif.utility.RdfModelUtility.getObjects; import static edu.tamu.iiif.utility.StringUtility.encode; import static edu.tamu.iiif.utility.StringUtility.encodeSpaces; import static edu.tamu.iiif.utility.StringUtility.joinPath; @@ -317,46 +317,31 @@ private String getResourceId(String url) throws URISyntaxException { } protected PropertyValueSimpleImpl getLabel(RdfResource rdfResource) { - Optional title = Optional.empty(); - for (String labelPredicate : getConfig().getLabelPrecedence()) { - title = getObject(rdfResource, labelPredicate); - if (title.isPresent()) { - return new PropertyValueSimpleImpl(title.get()); - } + List labels = getObjects(rdfResource, getConfig().getLabelPredicates()); + if (labels.isEmpty()) { + String id = rdfResource.getResource().getURI(); + return new PropertyValueSimpleImpl(getRepositoryContextIdentifier(id)); } - String id = rdfResource.getResource().getURI(); - return new PropertyValueSimpleImpl(getRepositoryContextIdentifier(id)); + return new PropertyValueSimpleImpl(labels); } protected Optional getDescription(RdfResource rdfResource) { - Optional description = Optional.empty(); - for (String descriptionPredicate : getConfig().getDescriptionPrecedence()) { - description = getObject(rdfResource, descriptionPredicate); - if (description.isPresent()) { - return Optional.of(new PropertyValueSimpleImpl(description.get())); - } - } - return Optional.empty(); + List descriptions = getObjects(rdfResource, getConfig().getDescriptionPredicates()); + return descriptions.isEmpty() ? Optional.empty() : Optional.of(new PropertyValueSimpleImpl(descriptions)); } protected Optional getAttribution(RdfResource rdfResource) { - Optional attribution = Optional.empty(); - for (String attributionPredicate : getConfig().getAttributionPrecedence()) { - attribution = getObject(rdfResource, attributionPredicate); - if (attribution.isPresent()) { - return Optional.of(new PropertyValueSimpleImpl(attribution.get())); - } - } - return Optional.empty(); + List attributions = getObjects(rdfResource, getConfig().getAttributionPredicates()); + return attributions.isEmpty() ? Optional.empty() : Optional.of(new PropertyValueSimpleImpl(attributions)); } protected Optional getLicense(RdfResource rdfResource) { - Optional license = Optional.empty(); for (String licensePredicate : getConfig().getLicensePrecedence()) { - license = getObject(rdfResource, licensePredicate); - if (license.isPresent()) { - return Optional.of(license.get()); + List licenses = getObjects(rdfResource, licensePredicate); + if (licenses.isEmpty()) { + continue; } + return Optional.of(licenses.get(0)); } return Optional.empty(); } @@ -408,6 +393,9 @@ private Collection getMetadata(RdfResource rdfResource, String prefix) while (statements.hasNext()) { Statement statement = statements.nextStatement(); Property predicate = statement.getPredicate(); + if (getConfig().getMetadataExclusion().contains(predicate.toString())) { + continue; + } String resourceUrl = rdfResource.getResource().getURI(); String statementUrl = statement.getSubject().getURI(); boolean match = getMatcherHandle(resourceUrl).equals(getMatcherHandle(statementUrl)); diff --git a/src/main/java/edu/tamu/iiif/service/dspace/rdf/AbstractDSpaceRdfManifestService.java b/src/main/java/edu/tamu/iiif/service/dspace/rdf/AbstractDSpaceRdfManifestService.java index edfcc13..3425f7e 100644 --- a/src/main/java/edu/tamu/iiif/service/dspace/rdf/AbstractDSpaceRdfManifestService.java +++ b/src/main/java/edu/tamu/iiif/service/dspace/rdf/AbstractDSpaceRdfManifestService.java @@ -10,7 +10,7 @@ import static edu.tamu.iiif.constants.Constants.DSPACE_RDF_CONDITION; import static edu.tamu.iiif.constants.Constants.PRESENTATION_IDENTIFIER; import static edu.tamu.iiif.constants.Constants.SEQUENCE_IDENTIFIER; -import static edu.tamu.iiif.utility.RdfModelUtility.getObject; +import static edu.tamu.iiif.utility.RdfModelUtility.hasObject; import static edu.tamu.iiif.utility.StringUtility.encodeSpaces; import static edu.tamu.iiif.utility.StringUtility.joinPath; @@ -70,19 +70,19 @@ protected Canvas generateCanvas(ManifestRequest request, RdfResource rdfResource } protected boolean isTopLevelCommunity(Model model) { - return getObject(model, DSPACE_IS_PART_OF_REPOSITORY_PREDICATE).isPresent(); + return hasObject(model, DSPACE_IS_PART_OF_REPOSITORY_PREDICATE); } protected boolean isSubcommunity(Model model) { - return getObject(model, DSPACE_IS_SUB_COMMUNITY_OF_PREDICATE).isPresent(); + return hasObject(model, DSPACE_IS_SUB_COMMUNITY_OF_PREDICATE); } protected boolean isCollection(Model model) { - return getObject(model, DSPACE_IS_PART_OF_COMMUNITY_PREDICATE).isPresent(); + return hasObject(model, DSPACE_IS_PART_OF_COMMUNITY_PREDICATE); } protected boolean isItem(Model model) { - return getObject(model, DSPACE_IS_PART_OF_COLLECTION_PREDICATE).isPresent(); + return hasObject(model, DSPACE_IS_PART_OF_COLLECTION_PREDICATE); } protected URI getDSpaceIiifCollectionUri(String handle) throws URISyntaxException { diff --git a/src/main/java/edu/tamu/iiif/service/fedora/pcdm/AbstractFedoraPcdmManifestService.java b/src/main/java/edu/tamu/iiif/service/fedora/pcdm/AbstractFedoraPcdmManifestService.java index 5410106..1c43405 100644 --- a/src/main/java/edu/tamu/iiif/service/fedora/pcdm/AbstractFedoraPcdmManifestService.java +++ b/src/main/java/edu/tamu/iiif/service/fedora/pcdm/AbstractFedoraPcdmManifestService.java @@ -17,7 +17,7 @@ import static edu.tamu.iiif.constants.Constants.PRESENTATION_IDENTIFIER; import static edu.tamu.iiif.constants.Constants.RDF_TYPE_PREDICATE; import static edu.tamu.iiif.constants.Constants.SEQUENCE_IDENTIFIER; -import static edu.tamu.iiif.utility.RdfModelUtility.getObject; +import static edu.tamu.iiif.utility.RdfModelUtility.findObject; import static edu.tamu.iiif.utility.StringUtility.joinPath; import java.io.IOException; @@ -191,10 +191,10 @@ private URI getFedoraIiifUri(String url, String type) throws URISyntaxException private List getCanvases(ManifestRequest request, RdfResource rdfResource) throws IOException, URISyntaxException { List canvases = new ArrayList(); - Optional firstId = getObject(rdfResource.getModel(), IANA_FIRST_PREDICATE); + Optional firstId = findObject(rdfResource.getModel(), IANA_FIRST_PREDICATE); if (firstId.isPresent()) { - Optional lastId = getObject(rdfResource.getModel(), IANA_LAST_PREDICATE); + Optional lastId = findObject(rdfResource.getModel(), IANA_LAST_PREDICATE); if (lastId.isPresent()) { Resource firstResource = rdfResource.getModel().getResource(firstId.get()); @@ -234,10 +234,10 @@ private void generateOrderedCanvases(ManifestRequest request, RdfOrderedResource Model model = getFedoraRdfModel(rdfOrderedSequence.getResource().getURI()); - Optional id = getObject(model, ORE_PROXY_FOR_PREDICATE); + Optional id = findObject(model, ORE_PROXY_FOR_PREDICATE); if (!id.isPresent()) { - id = getObject(model, ORE_PROXY_FOR_PREDICATE.replace("#", "/")); + id = findObject(model, ORE_PROXY_FOR_PREDICATE.replace("#", "/")); } if (id.isPresent()) { @@ -249,7 +249,7 @@ private void generateOrderedCanvases(ManifestRequest request, RdfOrderedResource canvases.add(canvas); } - Optional nextId = getObject(model, IANA_NEXT_PREDICATE); + Optional nextId = findObject(model, IANA_NEXT_PREDICATE); if (nextId.isPresent()) { Resource resource = rdfOrderedSequence.getModel().getResource(nextId.get()); diff --git a/src/main/java/edu/tamu/iiif/service/fedora/pcdm/FedoraPcdmCollectionManifestService.java b/src/main/java/edu/tamu/iiif/service/fedora/pcdm/FedoraPcdmCollectionManifestService.java index 1959465..c96d3ca 100644 --- a/src/main/java/edu/tamu/iiif/service/fedora/pcdm/FedoraPcdmCollectionManifestService.java +++ b/src/main/java/edu/tamu/iiif/service/fedora/pcdm/FedoraPcdmCollectionManifestService.java @@ -7,7 +7,7 @@ import static edu.tamu.iiif.constants.Constants.PCDM_HAS_FILE_PREDICATE; import static edu.tamu.iiif.constants.Constants.PCDM_HAS_MEMBER_PREDICATE; import static edu.tamu.iiif.model.ManifestType.COLLECTION; -import static edu.tamu.iiif.utility.RdfModelUtility.getObject; +import static edu.tamu.iiif.utility.RdfModelUtility.findObject; import java.io.IOException; import java.net.URI; @@ -123,10 +123,10 @@ private List getResourceManifests(ManifestRequest request, Rd private List gatherResourceManifests(ManifestRequest request, RdfResource rdfResource) throws URISyntaxException, IOException { List manifests = new ArrayList(); - Optional firstId = getObject(rdfResource.getModel(), IANA_FIRST_PREDICATE); + Optional firstId = findObject(rdfResource.getModel(), IANA_FIRST_PREDICATE); if (firstId.isPresent()) { - Optional lastId = getObject(rdfResource.getModel(), IANA_LAST_PREDICATE); + Optional lastId = findObject(rdfResource.getModel(), IANA_LAST_PREDICATE); if (lastId.isPresent()) { Resource firstResource = rdfResource.getModel().getResource(firstId.get()); @@ -141,10 +141,10 @@ private void gatherResourceManifests(ManifestRequest request, RdfOrderedResource Model model = getFedoraRdfModel(rdfOrderedResource.getResource().getURI()); - Optional id = getObject(model, ORE_PROXY_FOR_PREDICATE); + Optional id = findObject(model, ORE_PROXY_FOR_PREDICATE); if (!id.isPresent()) { - id = getObject(model, ORE_PROXY_FOR_PREDICATE.replace("#", "/")); + id = findObject(model, ORE_PROXY_FOR_PREDICATE.replace("#", "/")); } if (id.isPresent()) { @@ -153,7 +153,7 @@ private void gatherResourceManifests(ManifestRequest request, RdfOrderedResource manifests.add(new ManifestReferenceImpl(getFedoraIiifPresentationUri(parameterizedActualId), getLabel(getRdfResourceByUrl(id.get())))); - Optional nextId = getObject(model, IANA_NEXT_PREDICATE); + Optional nextId = findObject(model, IANA_NEXT_PREDICATE); if (nextId.isPresent()) { Resource resource = rdfOrderedResource.getModel().getResource(nextId.get()); diff --git a/src/main/java/edu/tamu/iiif/utility/RdfModelUtility.java b/src/main/java/edu/tamu/iiif/utility/RdfModelUtility.java index 029fb12..862ff35 100644 --- a/src/main/java/edu/tamu/iiif/utility/RdfModelUtility.java +++ b/src/main/java/edu/tamu/iiif/utility/RdfModelUtility.java @@ -3,7 +3,11 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import java.util.Optional; +import java.util.stream.Collectors; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; @@ -21,17 +25,44 @@ public static Model createRdfModel(String rdf) { return model; } - public static Optional getObject(Model model, String uri) { - Optional id = Optional.empty(); + public static boolean hasObject(Model model, String uri) { NodeIterator firstNodeItr = model.listObjectsOfProperty(model.getProperty(uri)); if (firstNodeItr.hasNext()) { - id = Optional.of(firstNodeItr.next().toString()); + return true; } - return id; + return false; } - public static Optional getObject(RdfResource rdfResource, String uri) { - return getObject(rdfResource.getModel(), uri); + public static Optional findObject(Model model, String uri) { + NodeIterator firstNodeItr = model.listObjectsOfProperty(model.getProperty(uri)); + if (firstNodeItr.hasNext()) { + return Optional.of(firstNodeItr.next().toString()); + } + return Optional.empty(); + } + + public static Optional findObject(RdfResource rdfResource, String uri) { + return findObject(rdfResource.getModel(), uri); + } + + public static List getObjects(Model model, String uri) { + List values = new ArrayList(); + NodeIterator firstNodeItr = model.listObjectsOfProperty(model.getProperty(uri)); + while (firstNodeItr.hasNext()) { + values.add(firstNodeItr.next().toString()); + } + return values; + } + + public static List getObjects(RdfResource rdfResource, String uri) { + return getObjects(rdfResource.getModel(), uri); + } + + public static List getObjects(RdfResource rdfResource, List uris) { + return uris.stream() + .map(uri -> getObjects(rdfResource, uri)) + .flatMap(Collection::stream) + .collect(Collectors.toList()); } public static String getParameterizedId(final String id, ManifestRequest request) { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 8e1ed02..8812646 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -49,16 +49,16 @@ iiif: image.server.url: http://localhost:8182/iiif/2 logo.url: https://brandguide.tamu.edu/assets/downloads/logos/TAM-Logo.png dspace: - label-precedence: + label-predicates: - "http://purl.org/dc/elements/1.1/title" - "http://purl.org/dc/terms/title" - "http://www.w3.org/2000/01/rdf-schema#label" - "http://purl.org/dc/elements/1.1/identifier" - description-precedence: + description-predicates: - "http://purl.org/dc/terms/abstract" - "http://purl.org/dc/terms/description" - "http://purl.org/dc/elements/1.1/description" - attribution-precedence: + attribution-predicates: - "http://purl.org/dc/elements/1.1/creator" - "http://purl.org/dc/terms/creator" - "http://purl.org/dc/elements/1.1/contributor" @@ -72,21 +72,24 @@ iiif: metadata-prefixes: - "http://purl.org/dc/elements/1.1/" - "http://purl.org/dc/terms/" + metadata-exclusion: + - "http://purl.org/dc/terms/description" + - "http://purl.org/dc/elements/1.1/description" url: http://localhost:8080 identifier: dspace webapp: xmlui context-as-metadata: true fedora: - label-precedence: + label-predicates: - "http://purl.org/dc/elements/1.1/title" - "http://purl.org/dc/terms/title" - "http://www.w3.org/2000/01/rdf-schema#label" - "http://purl.org/dc/elements/1.1/identifier" - description-precedence: + description-predicates: - "http://purl.org/dc/terms/abstract" - "http://purl.org/dc/terms/description" - "http://purl.org/dc/elements/1.1/description" - attribution-precedence: + attribution-predicates: - "http://purl.org/dc/elements/1.1/creator" - "http://purl.org/dc/terms/creator" - "http://purl.org/dc/elements/1.1/contributor" @@ -100,6 +103,9 @@ iiif: metadata-prefixes: - "http://purl.org/dc/elements/1.1/" - "http://purl.org/dc/terms/" + metadata-exclusion: + - "http://purl.org/dc/terms/description" + - "http://purl.org/dc/elements/1.1/description" url: http://localhost:9000/fcrepo/rest identifier: fedora context-as-metadata: true diff --git a/src/test/java/edu/tamu/iiif/config/model/DSpaceRdfIiiifConfigTest.java b/src/test/java/edu/tamu/iiif/config/model/DSpaceRdfIiiifConfigTest.java index ed085a6..b31505f 100644 --- a/src/test/java/edu/tamu/iiif/config/model/DSpaceRdfIiiifConfigTest.java +++ b/src/test/java/edu/tamu/iiif/config/model/DSpaceRdfIiiifConfigTest.java @@ -16,43 +16,82 @@ public class DSpaceRdfIiiifConfigTest { public void testDSpaceRdfIiifConfig() { DSpaceRdfIiifConfig config = new DSpaceRdfIiifConfig(); - List labelPrecedence = new ArrayList(); - labelPrecedence.add("http://purl.org/dc/elements/1.1/title"); - labelPrecedence.add("http://purl.org/dc/terms/title"); - labelPrecedence.add("http://www.w3.org/2000/01/rdf-schema#label"); - labelPrecedence.add("http://purl.org/dc/elements/1.1/identifier"); - List descriptionPrecedence = new ArrayList(); - descriptionPrecedence.add("http://purl.org/dc/terms/abstract"); - descriptionPrecedence.add("http://purl.org/dc/terms/description"); - descriptionPrecedence.add("http://purl.org/dc/elements/1.1/description"); + List labelPredicates = new ArrayList(); + labelPredicates.add("http://purl.org/dc/elements/1.1/title"); + labelPredicates.add("http://purl.org/dc/terms/title"); + labelPredicates.add("http://www.w3.org/2000/01/rdf-schema#label"); + labelPredicates.add("http://purl.org/dc/elements/1.1/identifier"); + + List descriptionPredicates = new ArrayList(); + descriptionPredicates.add("http://purl.org/dc/terms/abstract"); + descriptionPredicates.add("http://purl.org/dc/terms/description"); + descriptionPredicates.add("http://purl.org/dc/elements/1.1/description"); + + List attributionPredicates = new ArrayList(); + attributionPredicates.add("http://purl.org/dc/elements/1.1/creator"); + attributionPredicates.add("http://purl.org/dc/terms/creator"); + attributionPredicates.add("http://purl.org/dc/elements/1.1/contributor"); + attributionPredicates.add("http://purl.org/dc/terms/contributor"); + attributionPredicates.add("http://purl.org/dc/elements/1.1/publisher"); + attributionPredicates.add("http://purl.org/dc/terms/publisher"); + attributionPredicates.add("http://purl.org/dc/elements/1.1/rights"); + attributionPredicates.add("http://purl.org/dc/terms/rightsHolder"); + + List licensePrecedence = new ArrayList(); + licensePrecedence.add("http://purl.org/dc/terms/license"); + List metadataPrefixes = new ArrayList(); metadataPrefixes.add("http://purl.org/dc/elements/1.1/"); metadataPrefixes.add("http://purl.org/dc/terms/"); - config.setLabelPrecedence(labelPrecedence); - config.setDescriptionPrecedence(descriptionPrecedence); + List metadataExclusion = new ArrayList(); + metadataExclusion.add("http://purl.org/dc/terms/description"); + metadataExclusion.add("http://purl.org/dc/elements/1.1/description"); + + config.setLabelPredicates(labelPredicates); + config.setDescriptionPredicates(descriptionPredicates); + config.setAttributionPredicates(attributionPredicates); + config.setLicensePrecedence(licensePrecedence); config.setMetadataPrefixes(metadataPrefixes); - config.setUrl("http://localhost:8080"); - config.setIdentifier("dspace-rdf"); - config.setWebapp("xmlui"); + config.setMetadataExclusion(metadataExclusion); + config.setUrl("http://localhost:9000/fcrepo/rest"); + config.setIdentifier("fedora-pcdm"); config.setContextAsMetadata(true); - assertEquals(4, config.getLabelPrecedence().size()); - assertEquals("http://purl.org/dc/elements/1.1/title", config.getLabelPrecedence().get(0)); - assertEquals("http://purl.org/dc/terms/title", config.getLabelPrecedence().get(1)); - assertEquals("http://www.w3.org/2000/01/rdf-schema#label", config.getLabelPrecedence().get(2)); - assertEquals("http://purl.org/dc/elements/1.1/identifier", config.getLabelPrecedence().get(3)); - assertEquals(3, config.getDescriptionPrecedence().size()); - assertEquals("http://purl.org/dc/terms/abstract", config.getDescriptionPrecedence().get(0)); - assertEquals("http://purl.org/dc/terms/description", config.getDescriptionPrecedence().get(1)); - assertEquals("http://purl.org/dc/elements/1.1/description", config.getDescriptionPrecedence().get(2)); + assertEquals(4, config.getLabelPredicates().size()); + assertEquals("http://purl.org/dc/elements/1.1/title", config.getLabelPredicates().get(0)); + assertEquals("http://purl.org/dc/terms/title", config.getLabelPredicates().get(1)); + assertEquals("http://www.w3.org/2000/01/rdf-schema#label", config.getLabelPredicates().get(2)); + assertEquals("http://purl.org/dc/elements/1.1/identifier", config.getLabelPredicates().get(3)); + + assertEquals(3, config.getDescriptionPredicates().size()); + assertEquals("http://purl.org/dc/terms/abstract", config.getDescriptionPredicates().get(0)); + assertEquals("http://purl.org/dc/terms/description", config.getDescriptionPredicates().get(1)); + assertEquals("http://purl.org/dc/elements/1.1/description", config.getDescriptionPredicates().get(2)); + + assertEquals(8, config.getAttributionPredicates().size()); + assertEquals("http://purl.org/dc/elements/1.1/creator", config.getAttributionPredicates().get(0)); + assertEquals("http://purl.org/dc/terms/creator", config.getAttributionPredicates().get(1)); + assertEquals("http://purl.org/dc/elements/1.1/contributor", config.getAttributionPredicates().get(2)); + assertEquals("http://purl.org/dc/terms/contributor", config.getAttributionPredicates().get(3)); + assertEquals("http://purl.org/dc/elements/1.1/publisher", config.getAttributionPredicates().get(4)); + assertEquals("http://purl.org/dc/terms/publisher", config.getAttributionPredicates().get(5)); + assertEquals("http://purl.org/dc/elements/1.1/rights", config.getAttributionPredicates().get(6)); + assertEquals("http://purl.org/dc/terms/rightsHolder", config.getAttributionPredicates().get(7)); + + assertEquals(1, config.getLicensePrecedence().size()); + assertEquals("http://purl.org/dc/terms/license", config.getLicensePrecedence().get(0)); + assertEquals(2, config.getMetadataPrefixes().size()); assertEquals("http://purl.org/dc/elements/1.1/", config.getMetadataPrefixes().get(0)); assertEquals("http://purl.org/dc/terms/", config.getMetadataPrefixes().get(1)); - assertEquals("http://localhost:8080", config.getUrl()); - assertEquals("dspace-rdf", config.getIdentifier()); - assertEquals("xmlui", config.getWebapp()); + assertEquals(2, config.getMetadataExclusion().size()); + assertEquals("http://purl.org/dc/terms/description", config.getMetadataExclusion().get(0)); + assertEquals("http://purl.org/dc/elements/1.1/description", config.getMetadataExclusion().get(1)); + + assertEquals("http://localhost:9000/fcrepo/rest", config.getUrl()); + assertEquals("fedora-pcdm", config.getIdentifier()); assertEquals(true, config.getContextAsMetadata()); } diff --git a/src/test/java/edu/tamu/iiif/config/model/FedoraPcdmIiiifConfigTest.java b/src/test/java/edu/tamu/iiif/config/model/FedoraPcdmIiiifConfigTest.java index 2523423..7e850bf 100644 --- a/src/test/java/edu/tamu/iiif/config/model/FedoraPcdmIiiifConfigTest.java +++ b/src/test/java/edu/tamu/iiif/config/model/FedoraPcdmIiiifConfigTest.java @@ -16,39 +16,80 @@ public class FedoraPcdmIiiifConfigTest { public void testFedoraPcdmIiifConfig() { FedoraPcdmIiifConfig config = new FedoraPcdmIiifConfig(); - List labelPrecedence = new ArrayList(); - labelPrecedence.add("http://purl.org/dc/elements/1.1/title"); - labelPrecedence.add("http://purl.org/dc/terms/title"); - labelPrecedence.add("http://www.w3.org/2000/01/rdf-schema#label"); - labelPrecedence.add("http://purl.org/dc/elements/1.1/identifier"); - List descriptionPrecedence = new ArrayList(); - descriptionPrecedence.add("http://purl.org/dc/terms/abstract"); - descriptionPrecedence.add("http://purl.org/dc/terms/description"); - descriptionPrecedence.add("http://purl.org/dc/elements/1.1/description"); + List labelPredicates = new ArrayList(); + labelPredicates.add("http://purl.org/dc/elements/1.1/title"); + labelPredicates.add("http://purl.org/dc/terms/title"); + labelPredicates.add("http://www.w3.org/2000/01/rdf-schema#label"); + labelPredicates.add("http://purl.org/dc/elements/1.1/identifier"); + + List descriptionPredicates = new ArrayList(); + descriptionPredicates.add("http://purl.org/dc/terms/abstract"); + descriptionPredicates.add("http://purl.org/dc/terms/description"); + descriptionPredicates.add("http://purl.org/dc/elements/1.1/description"); + + List attributionPredicates = new ArrayList(); + attributionPredicates.add("http://purl.org/dc/elements/1.1/creator"); + attributionPredicates.add("http://purl.org/dc/terms/creator"); + attributionPredicates.add("http://purl.org/dc/elements/1.1/contributor"); + attributionPredicates.add("http://purl.org/dc/terms/contributor"); + attributionPredicates.add("http://purl.org/dc/elements/1.1/publisher"); + attributionPredicates.add("http://purl.org/dc/terms/publisher"); + attributionPredicates.add("http://purl.org/dc/elements/1.1/rights"); + attributionPredicates.add("http://purl.org/dc/terms/rightsHolder"); + + List licensePrecedence = new ArrayList(); + licensePrecedence.add("http://purl.org/dc/terms/license"); + List metadataPrefixes = new ArrayList(); metadataPrefixes.add("http://purl.org/dc/elements/1.1/"); metadataPrefixes.add("http://purl.org/dc/terms/"); - config.setLabelPrecedence(labelPrecedence); - config.setDescriptionPrecedence(descriptionPrecedence); + List metadataExclusion = new ArrayList(); + metadataExclusion.add("http://purl.org/dc/terms/description"); + metadataExclusion.add("http://purl.org/dc/elements/1.1/description"); + + config.setLabelPredicates(labelPredicates); + config.setDescriptionPredicates(descriptionPredicates); + config.setAttributionPredicates(attributionPredicates); + config.setLicensePrecedence(licensePrecedence); config.setMetadataPrefixes(metadataPrefixes); + config.setMetadataExclusion(metadataExclusion); config.setUrl("http://localhost:9000/fcrepo/rest"); config.setIdentifier("fedora-pcdm"); config.setContextAsMetadata(true); - assertEquals(4, config.getLabelPrecedence().size()); - assertEquals("http://purl.org/dc/elements/1.1/title", config.getLabelPrecedence().get(0)); - assertEquals("http://purl.org/dc/terms/title", config.getLabelPrecedence().get(1)); - assertEquals("http://www.w3.org/2000/01/rdf-schema#label", config.getLabelPrecedence().get(2)); - assertEquals("http://purl.org/dc/elements/1.1/identifier", config.getLabelPrecedence().get(3)); - assertEquals(3, config.getDescriptionPrecedence().size()); - assertEquals("http://purl.org/dc/terms/abstract", config.getDescriptionPrecedence().get(0)); - assertEquals("http://purl.org/dc/terms/description", config.getDescriptionPrecedence().get(1)); - assertEquals("http://purl.org/dc/elements/1.1/description", config.getDescriptionPrecedence().get(2)); + assertEquals(4, config.getLabelPredicates().size()); + assertEquals("http://purl.org/dc/elements/1.1/title", config.getLabelPredicates().get(0)); + assertEquals("http://purl.org/dc/terms/title", config.getLabelPredicates().get(1)); + assertEquals("http://www.w3.org/2000/01/rdf-schema#label", config.getLabelPredicates().get(2)); + assertEquals("http://purl.org/dc/elements/1.1/identifier", config.getLabelPredicates().get(3)); + + assertEquals(3, config.getDescriptionPredicates().size()); + assertEquals("http://purl.org/dc/terms/abstract", config.getDescriptionPredicates().get(0)); + assertEquals("http://purl.org/dc/terms/description", config.getDescriptionPredicates().get(1)); + assertEquals("http://purl.org/dc/elements/1.1/description", config.getDescriptionPredicates().get(2)); + + assertEquals(8, config.getAttributionPredicates().size()); + assertEquals("http://purl.org/dc/elements/1.1/creator", config.getAttributionPredicates().get(0)); + assertEquals("http://purl.org/dc/terms/creator", config.getAttributionPredicates().get(1)); + assertEquals("http://purl.org/dc/elements/1.1/contributor", config.getAttributionPredicates().get(2)); + assertEquals("http://purl.org/dc/terms/contributor", config.getAttributionPredicates().get(3)); + assertEquals("http://purl.org/dc/elements/1.1/publisher", config.getAttributionPredicates().get(4)); + assertEquals("http://purl.org/dc/terms/publisher", config.getAttributionPredicates().get(5)); + assertEquals("http://purl.org/dc/elements/1.1/rights", config.getAttributionPredicates().get(6)); + assertEquals("http://purl.org/dc/terms/rightsHolder", config.getAttributionPredicates().get(7)); + + assertEquals(1, config.getLicensePrecedence().size()); + assertEquals("http://purl.org/dc/terms/license", config.getLicensePrecedence().get(0)); + assertEquals(2, config.getMetadataPrefixes().size()); assertEquals("http://purl.org/dc/elements/1.1/", config.getMetadataPrefixes().get(0)); assertEquals("http://purl.org/dc/terms/", config.getMetadataPrefixes().get(1)); + assertEquals(2, config.getMetadataExclusion().size()); + assertEquals("http://purl.org/dc/terms/description", config.getMetadataExclusion().get(0)); + assertEquals("http://purl.org/dc/elements/1.1/description", config.getMetadataExclusion().get(1)); + assertEquals("http://localhost:9000/fcrepo/rest", config.getUrl()); assertEquals("fedora-pcdm", config.getIdentifier()); assertEquals(true, config.getContextAsMetadata()); diff --git a/src/test/java/edu/tamu/iiif/model/rdf/RdfOrderedSequenceTest.java b/src/test/java/edu/tamu/iiif/model/rdf/RdfOrderedSequenceTest.java index aa15961..e0b3d31 100644 --- a/src/test/java/edu/tamu/iiif/model/rdf/RdfOrderedSequenceTest.java +++ b/src/test/java/edu/tamu/iiif/model/rdf/RdfOrderedSequenceTest.java @@ -26,8 +26,8 @@ public void testRdfOrderedSequence() { System.out.println(model); Resource resource = model.getResource("http://localhost:9000/fcrepo/rest/mwbObjects/TGWCatalog"); RdfResource rdfResource = new RdfResource(model, resource); - Optional firstId = RdfModelUtility.getObject(rdfResource.getModel(), IANA_FIRST_PREDICATE); - Optional lastId = RdfModelUtility.getObject(rdfResource.getModel(), IANA_LAST_PREDICATE); + Optional firstId = RdfModelUtility.findObject(rdfResource.getModel(), IANA_FIRST_PREDICATE); + Optional lastId = RdfModelUtility.findObject(rdfResource.getModel(), IANA_LAST_PREDICATE); System.out.println(firstId.get()); System.out.println(lastId.get()); diff --git a/src/test/java/edu/tamu/iiif/service/dspace/rdf/AbstractDSpaceRdfManifestServiceTest.java b/src/test/java/edu/tamu/iiif/service/dspace/rdf/AbstractDSpaceRdfManifestServiceTest.java index b52975b..0277fa8 100644 --- a/src/test/java/edu/tamu/iiif/service/dspace/rdf/AbstractDSpaceRdfManifestServiceTest.java +++ b/src/test/java/edu/tamu/iiif/service/dspace/rdf/AbstractDSpaceRdfManifestServiceTest.java @@ -23,24 +23,49 @@ public abstract class AbstractDSpaceRdfManifestServiceTest extends AbstractManif protected void setup(AbstractDSpaceRdfManifestService dspaceRdfManifestService) { super.setup(dspaceRdfManifestService); - List labelPrecedence = new ArrayList(); - labelPrecedence.add("http://purl.org/dc/elements/1.1/title"); - labelPrecedence.add("http://purl.org/dc/terms/title"); - labelPrecedence.add("http://www.w3.org/2000/01/rdf-schema#label"); - labelPrecedence.add("http://purl.org/dc/elements/1.1/identifier"); - List descriptionPrecedence = new ArrayList(); - descriptionPrecedence.add("http://purl.org/dc/terms/abstract"); - descriptionPrecedence.add("http://purl.org/dc/terms/description"); - descriptionPrecedence.add("http://purl.org/dc/elements/1.1/description"); + List labelPredicates = new ArrayList(); + labelPredicates.add("http://purl.org/dc/elements/1.1/title"); + labelPredicates.add("http://purl.org/dc/terms/title"); + labelPredicates.add("http://www.w3.org/2000/01/rdf-schema#label"); + labelPredicates.add("http://purl.org/dc/elements/1.1/identifier"); + + List descriptionPredicates = new ArrayList(); + descriptionPredicates.add("http://purl.org/dc/terms/abstract"); + descriptionPredicates.add("http://purl.org/dc/terms/description"); + descriptionPredicates.add("http://purl.org/dc/elements/1.1/description"); + + List attributionPredicates = new ArrayList(); + attributionPredicates.add("http://purl.org/dc/elements/1.1/creator"); + attributionPredicates.add("http://purl.org/dc/terms/creator"); + attributionPredicates.add("http://purl.org/dc/elements/1.1/contributor"); + attributionPredicates.add("http://purl.org/dc/terms/contributor"); + attributionPredicates.add("http://purl.org/dc/elements/1.1/publisher"); + attributionPredicates.add("http://purl.org/dc/terms/publisher"); + attributionPredicates.add("http://purl.org/dc/elements/1.1/rights"); + attributionPredicates.add("http://purl.org/dc/terms/rightsHolder"); + + List licensePrecedence = new ArrayList(); + licensePrecedence.add("http://purl.org/dc/terms/license"); + List metadataPrefixes = new ArrayList(); metadataPrefixes.add("http://purl.org/dc/elements/1.1/"); metadataPrefixes.add("http://purl.org/dc/terms/"); - when(config.getLabelPrecedence()).thenReturn(labelPrecedence); - when(config.getDescriptionPrecedence()).thenReturn(descriptionPrecedence); + + List metadataExclusion = new ArrayList(); + metadataExclusion.add("http://purl.org/dc/terms/description"); + metadataExclusion.add("http://purl.org/dc/elements/1.1/description"); + + when(config.getLabelPredicates()).thenReturn(labelPredicates); + when(config.getDescriptionPredicates()).thenReturn(descriptionPredicates); + when(config.getAttributionPredicates()).thenReturn(attributionPredicates); + when(config.getLicensePrecedence()).thenReturn(licensePrecedence); when(config.getMetadataPrefixes()).thenReturn(metadataPrefixes); + when(config.getMetadataExclusion()).thenReturn(metadataExclusion); + when(config.getUrl()).thenReturn(DSPACE_URL); when(config.getIdentifier()).thenReturn(DSPACE_RDF_IDENTIFIER); when(config.getWebapp()).thenReturn(DSPACE_WEBAPP); + when(config.getContextAsMetadata()).thenReturn(true); } @Override diff --git a/src/test/java/edu/tamu/iiif/service/fedora/pcdm/AbstractFedoraPcdmManifestServiceTest.java b/src/test/java/edu/tamu/iiif/service/fedora/pcdm/AbstractFedoraPcdmManifestServiceTest.java index be39eba..c28c924 100644 --- a/src/test/java/edu/tamu/iiif/service/fedora/pcdm/AbstractFedoraPcdmManifestServiceTest.java +++ b/src/test/java/edu/tamu/iiif/service/fedora/pcdm/AbstractFedoraPcdmManifestServiceTest.java @@ -21,23 +21,48 @@ public abstract class AbstractFedoraPcdmManifestServiceTest extends AbstractMani protected void setup(AbstractFedoraPcdmManifestService fedoraPcdmManifestService) { super.setup(fedoraPcdmManifestService); - List labelPrecedence = new ArrayList(); - labelPrecedence.add("http://purl.org/dc/elements/1.1/title"); - labelPrecedence.add("http://purl.org/dc/terms/title"); - labelPrecedence.add("http://www.w3.org/2000/01/rdf-schema#label"); - labelPrecedence.add("http://purl.org/dc/elements/1.1/identifier"); - List descriptionPrecedence = new ArrayList(); - descriptionPrecedence.add("http://purl.org/dc/terms/abstract"); - descriptionPrecedence.add("http://purl.org/dc/terms/description"); - descriptionPrecedence.add("http://purl.org/dc/elements/1.1/description"); + List labelPredicates = new ArrayList(); + labelPredicates.add("http://purl.org/dc/elements/1.1/title"); + labelPredicates.add("http://purl.org/dc/terms/title"); + labelPredicates.add("http://www.w3.org/2000/01/rdf-schema#label"); + labelPredicates.add("http://purl.org/dc/elements/1.1/identifier"); + + List descriptionPredicates = new ArrayList(); + descriptionPredicates.add("http://purl.org/dc/terms/abstract"); + descriptionPredicates.add("http://purl.org/dc/terms/description"); + descriptionPredicates.add("http://purl.org/dc/elements/1.1/description"); + + List attributionPredicates = new ArrayList(); + attributionPredicates.add("http://purl.org/dc/elements/1.1/creator"); + attributionPredicates.add("http://purl.org/dc/terms/creator"); + attributionPredicates.add("http://purl.org/dc/elements/1.1/contributor"); + attributionPredicates.add("http://purl.org/dc/terms/contributor"); + attributionPredicates.add("http://purl.org/dc/elements/1.1/publisher"); + attributionPredicates.add("http://purl.org/dc/terms/publisher"); + attributionPredicates.add("http://purl.org/dc/elements/1.1/rights"); + attributionPredicates.add("http://purl.org/dc/terms/rightsHolder"); + + List licensePrecedence = new ArrayList(); + licensePrecedence.add("http://purl.org/dc/terms/license"); + List metadataPrefixes = new ArrayList(); metadataPrefixes.add("http://purl.org/dc/elements/1.1/"); metadataPrefixes.add("http://purl.org/dc/terms/"); - when(config.getLabelPrecedence()).thenReturn(labelPrecedence); - when(config.getDescriptionPrecedence()).thenReturn(descriptionPrecedence); + + List metadataExclusion = new ArrayList(); + metadataExclusion.add("http://purl.org/dc/terms/description"); + metadataExclusion.add("http://purl.org/dc/elements/1.1/description"); + + when(config.getLabelPredicates()).thenReturn(labelPredicates); + when(config.getDescriptionPredicates()).thenReturn(descriptionPredicates); + when(config.getAttributionPredicates()).thenReturn(attributionPredicates); + when(config.getLicensePrecedence()).thenReturn(licensePrecedence); when(config.getMetadataPrefixes()).thenReturn(metadataPrefixes); + when(config.getMetadataExclusion()).thenReturn(metadataExclusion); + when(config.getUrl()).thenReturn(FEDORA_URL); when(config.getIdentifier()).thenReturn(FEDORA_PCDM_IDENTIFIER); + when(config.getContextAsMetadata()).thenReturn(true); } @Override diff --git a/src/test/java/edu/tamu/iiif/utility/RdfModelUtilityTest.java b/src/test/java/edu/tamu/iiif/utility/RdfModelUtilityTest.java index d9f6aa0..23bc69c 100644 --- a/src/test/java/edu/tamu/iiif/utility/RdfModelUtilityTest.java +++ b/src/test/java/edu/tamu/iiif/utility/RdfModelUtilityTest.java @@ -1,9 +1,12 @@ package edu.tamu.iiif.utility; +import static edu.tamu.iiif.constants.Constants.DUBLIN_CORE_TERMS_DESCRIPTION; import static edu.tamu.iiif.constants.Constants.DUBLIN_CORE_TERMS_TITLE; import static edu.tamu.iiif.constants.Constants.IANA_FIRST_PREDICATE; import java.io.File; +import java.util.ArrayList; +import java.util.List; import java.util.Optional; import org.apache.jena.rdf.model.Model; @@ -32,25 +35,53 @@ public void testCreateRdfModel() { } @Test - public void testGetIdByPredicate() { + public void testFindIdByPredicate() { String rdf = Files.contentOf(new File("src/test/resources/mock/fedora/rdf/collection_container.rdf"), "UTF-8"); Model model = RdfModelUtility.createRdfModel(rdf); Assert.assertNotNull(model); - Optional firstId = RdfModelUtility.getObject(model, IANA_FIRST_PREDICATE); + Optional firstId = RdfModelUtility.findObject(model, IANA_FIRST_PREDICATE); Assert.assertTrue(firstId.isPresent()); Assert.assertEquals("http://localhost:9000/fcrepo/rest/mwbObjects/TGWCatalog/orderProxies/ExCat0001Proxy", firstId.get()); } @Test - public void testGetObject() { + public void testFindObject() { String rdf = Files.contentOf(new File("src/test/resources/mock/dspace/rdf/item.rdf"), "UTF-8"); Model model = RdfModelUtility.createRdfModel(rdf); Resource resource = model.getResource("http://localhost:8080/rdf/resource/123456789/158308"); RdfResource rdfResource = new RdfResource(model, resource); Assert.assertNotNull(model); - Optional title = RdfModelUtility.getObject(rdfResource, DUBLIN_CORE_TERMS_TITLE); + Optional title = RdfModelUtility.findObject(rdfResource, DUBLIN_CORE_TERMS_TITLE); Assert.assertTrue(title.isPresent()); Assert.assertEquals("Corvette", title.get()); } + @Test + public void getObjects() { + String rdf = Files.contentOf(new File("src/test/resources/mock/dspace/rdf/item.rdf"), "UTF-8"); + Model model = RdfModelUtility.createRdfModel(rdf); + Resource resource = model.getResource("http://localhost:8080/rdf/resource/123456789/158308"); + RdfResource rdfResource = new RdfResource(model, resource); + Assert.assertNotNull(model); + List values = RdfModelUtility.getObjects(rdfResource, DUBLIN_CORE_TERMS_TITLE); + Assert.assertEquals(1, values.size()); + Assert.assertEquals("Corvette", values.get(0)); + } + + @Test + public void getObjectsFromListOfProperties() { + String rdf = Files.contentOf(new File("src/test/resources/mock/dspace/rdf/item.rdf"), "UTF-8"); + Model model = RdfModelUtility.createRdfModel(rdf); + Resource resource = model.getResource("http://localhost:8080/rdf/resource/123456789/158308"); + RdfResource rdfResource = new RdfResource(model, resource); + Assert.assertNotNull(model); + List predicates = new ArrayList<>(); + predicates.add(DUBLIN_CORE_TERMS_TITLE); + predicates.add(DUBLIN_CORE_TERMS_DESCRIPTION); + List values = RdfModelUtility.getObjects(rdfResource, predicates); + Assert.assertEquals(2, values.size()); + Assert.assertEquals("Corvette", values.get(0)); + Assert.assertEquals("A fast car", values.get(1)); + } + } diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 3d3e7f5..3be168a 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -39,16 +39,16 @@ iiif: image.server.url: http://localhost:8182/iiif/2 logo.url: https://brandguide.tamu.edu/assets/downloads/logos/TAM-Logo.png dspace: - label-precedence: + label-predicates: - "http://purl.org/dc/elements/1.1/title" - "http://purl.org/dc/terms/title" - "http://www.w3.org/2000/01/rdf-schema#label" - "http://purl.org/dc/elements/1.1/identifier" - description-precedence: + description-predicates: - "http://purl.org/dc/terms/abstract" - "http://purl.org/dc/terms/description" - "http://purl.org/dc/elements/1.1/description" - attribution-precedence: + attribution-predicates: - "http://purl.org/dc/elements/1.1/creator" - "http://purl.org/dc/terms/creator" - "http://purl.org/dc/elements/1.1/contributor" @@ -62,21 +62,24 @@ iiif: metadata-prefixes: - "http://purl.org/dc/elements/1.1/" - "http://purl.org/dc/terms/" + metadata-exclusion: + - "http://purl.org/dc/terms/description" + - "http://purl.org/dc/elements/1.1/description" url: http://localhost:8080 identifier: dspace webapp: xmlui context-as-metadata: true fedora: - label-precedence: + label-predicates: - "http://purl.org/dc/elements/1.1/title" - "http://purl.org/dc/terms/title" - "http://www.w3.org/2000/01/rdf-schema#label" - "http://purl.org/dc/elements/1.1/identifier" - description-precedence: + description-predicates: - "http://purl.org/dc/terms/abstract" - "http://purl.org/dc/terms/description" - "http://purl.org/dc/elements/1.1/description" - attribution-precedence: + attribution-predicates: - "http://purl.org/dc/elements/1.1/creator" - "http://purl.org/dc/terms/creator" - "http://purl.org/dc/elements/1.1/contributor" @@ -90,6 +93,9 @@ iiif: metadata-prefixes: - "http://purl.org/dc/elements/1.1/" - "http://purl.org/dc/terms/" + metadata-exclusion: + - "http://purl.org/dc/terms/description" + - "http://purl.org/dc/elements/1.1/description" url: http://localhost:9000/fcrepo/rest identifier: fedora context-as-metadata: true \ No newline at end of file diff --git a/src/test/resources/mock/dspace/json/collection-presentation.json b/src/test/resources/mock/dspace/json/collection-presentation.json index 1fc4f9c..7b16e7e 100644 --- a/src/test/resources/mock/dspace/json/collection-presentation.json +++ b/src/test/resources/mock/dspace/json/collection-presentation.json @@ -2,7 +2,9 @@ "@context": "http://iiif.io/api/presentation/2/context.json", "@id": "http://localhost:9000/dspace-rdf/presentation/123456789/158299", "@type": "sc:Manifest", + "attribution": "Chevy", "label": "Cool Cars", + "license": "Test license", "logo": "https://brandguide.tamu.edu/assets/downloads/logos/TAM-Logo.png", "metadata": [ { @@ -16,6 +18,10 @@ { "label": "title", "value": "Cool Cars" + }, + { + "label": "context", + "value": "rdf/handle/123456789/158299" } ], "sequences": [ @@ -57,13 +63,11 @@ ], "thumbnail": { "@id": "http://localhost:8182/iiif/2/ZHNwYWNlLXJkZjp4bWx1aS9iaXRzdHJlYW0vMTIzNDU2Nzg5LzE1ODMwOC8xL3Nwb3J0cy1jYXItMTQ2ODczXzk2MF83MjAucG5n/full/!100,100/0/default.jpg", - "services": [ - { - "@context": "http://iiif.io/api/image/2/context.json", - "@id": "http://localhost:8182/iiif/2/ZHNwYWNlLXJkZjp4bWx1aS9iaXRzdHJlYW0vMTIzNDU2Nzg5LzE1ODMwOC8xL3Nwb3J0cy1jYXItMTQ2ODczXzk2MF83MjAucG5n", - "label": "DSpace IIIF Image Resource Service", - "profile": "http://iiif.io/api/image/2/level0.json" - } - ] + "service": { + "label": "DSpace IIIF Image Resource Service", + "profile": "http://iiif.io/api/image/2/level0.json", + "@context": "http://iiif.io/api/image/2/context.json", + "@id": "http://localhost:8182/iiif/2/ZHNwYWNlLXJkZjp4bWx1aS9iaXRzdHJlYW0vMTIzNDU2Nzg5LzE1ODMwOC8xL3Nwb3J0cy1jYXItMTQ2ODczXzk2MF83MjAucG5n" + } } } \ No newline at end of file diff --git a/src/test/resources/mock/dspace/json/collection.json b/src/test/resources/mock/dspace/json/collection.json index 112b152..accfb8c 100644 --- a/src/test/resources/mock/dspace/json/collection.json +++ b/src/test/resources/mock/dspace/json/collection.json @@ -2,6 +2,7 @@ "@context": "http://iiif.io/api/presentation/2/context.json", "@id": "http://localhost:9000/dspace-rdf/collection/123456789/158299", "@type": "sc:Collection", + "attribution": "Chevy", "label": "Cool Cars", "logo": "https://brandguide.tamu.edu/assets/downloads/logos/TAM-Logo.png", "manifests": [ @@ -23,6 +24,10 @@ { "label": "title", "value": "Cool Cars" + }, + { + "label": "context", + "value": "rdf/handle/123456789/158299" } ], "viewingHint": "multi-part" diff --git a/src/test/resources/mock/dspace/json/collections.json b/src/test/resources/mock/dspace/json/collections.json index a2655e0..0526999 100644 --- a/src/test/resources/mock/dspace/json/collections.json +++ b/src/test/resources/mock/dspace/json/collections.json @@ -21,6 +21,10 @@ { "label": "title", "value": "Cars" + }, + { + "label": "context", + "value": "rdf/handle/123456789/158298" } ], "viewingHint": "multi-part" diff --git a/src/test/resources/mock/dspace/json/presentation-allow.json b/src/test/resources/mock/dspace/json/presentation-allow.json index 085726d..3ef9c42 100644 --- a/src/test/resources/mock/dspace/json/presentation-allow.json +++ b/src/test/resources/mock/dspace/json/presentation-allow.json @@ -2,7 +2,10 @@ "@context": "http://iiif.io/api/presentation/2/context.json", "@id": "http://localhost:9000/dspace-rdf/presentation/123456789/158308?allow=image/png;image/jpeg", "@type": "sc:Manifest", + "attribution": "Chevy", + "description": "A fast car", "label": "Corvette", + "license": "Test license", "logo": "https://brandguide.tamu.edu/assets/downloads/logos/TAM-Logo.png", "metadata": [ { @@ -24,6 +27,10 @@ { "label": "title", "value": "Corvette" + }, + { + "label": "context", + "value": "rdf/handle/123456789/158308" } ], "sequences": [ @@ -65,13 +72,11 @@ ], "thumbnail": { "@id": "http://localhost:8182/iiif/2/ZHNwYWNlLXJkZjp4bWx1aS9iaXRzdHJlYW0vMTIzNDU2Nzg5LzE1ODMwOC8xL3Nwb3J0cy1jYXItMTQ2ODczXzk2MF83MjAucG5n/full/!100,100/0/default.jpg", - "services": [ - { - "@context": "http://iiif.io/api/image/2/context.json", - "@id": "http://localhost:8182/iiif/2/ZHNwYWNlLXJkZjp4bWx1aS9iaXRzdHJlYW0vMTIzNDU2Nzg5LzE1ODMwOC8xL3Nwb3J0cy1jYXItMTQ2ODczXzk2MF83MjAucG5n", - "label": "DSpace IIIF Image Resource Service", - "profile": "http://iiif.io/api/image/2/level0.json" - } - ] + "service": { + "label": "DSpace IIIF Image Resource Service", + "profile": "http://iiif.io/api/image/2/level0.json", + "@context": "http://iiif.io/api/image/2/context.json", + "@id": "http://localhost:8182/iiif/2/ZHNwYWNlLXJkZjp4bWx1aS9iaXRzdHJlYW0vMTIzNDU2Nzg5LzE1ODMwOC8xL3Nwb3J0cy1jYXItMTQ2ODczXzk2MF83MjAucG5n" + } } } \ No newline at end of file diff --git a/src/test/resources/mock/dspace/json/presentation-disallow.json b/src/test/resources/mock/dspace/json/presentation-disallow.json index 022b687..5373ca0 100644 --- a/src/test/resources/mock/dspace/json/presentation-disallow.json +++ b/src/test/resources/mock/dspace/json/presentation-disallow.json @@ -2,7 +2,10 @@ "@context": "http://iiif.io/api/presentation/2/context.json", "@id": "http://localhost:9000/dspace-rdf/presentation/123456789/158308?disallow=image/bmp;image/jpeg", "@type": "sc:Manifest", + "attribution": "Chevy", + "description": "A fast car", "label": "Corvette", + "license": "Test license", "logo": "https://brandguide.tamu.edu/assets/downloads/logos/TAM-Logo.png", "metadata": [ { @@ -24,6 +27,10 @@ { "label": "title", "value": "Corvette" + }, + { + "label": "context", + "value": "rdf/handle/123456789/158308" } ], "sequences": [ @@ -65,13 +72,11 @@ ], "thumbnail": { "@id": "http://localhost:8182/iiif/2/ZHNwYWNlLXJkZjp4bWx1aS9iaXRzdHJlYW0vMTIzNDU2Nzg5LzE1ODMwOC8xL3Nwb3J0cy1jYXItMTQ2ODczXzk2MF83MjAucG5n/full/!100,100/0/default.jpg", - "services": [ - { - "@context": "http://iiif.io/api/image/2/context.json", - "@id": "http://localhost:8182/iiif/2/ZHNwYWNlLXJkZjp4bWx1aS9iaXRzdHJlYW0vMTIzNDU2Nzg5LzE1ODMwOC8xL3Nwb3J0cy1jYXItMTQ2ODczXzk2MF83MjAucG5n", - "label": "DSpace IIIF Image Resource Service", - "profile": "http://iiif.io/api/image/2/level0.json" - } - ] + "service": { + "label": "DSpace IIIF Image Resource Service", + "profile": "http://iiif.io/api/image/2/level0.json", + "@context": "http://iiif.io/api/image/2/context.json", + "@id": "http://localhost:8182/iiif/2/ZHNwYWNlLXJkZjp4bWx1aS9iaXRzdHJlYW0vMTIzNDU2Nzg5LzE1ODMwOC8xL3Nwb3J0cy1jYXItMTQ2ODczXzk2MF83MjAucG5n" + } } } \ No newline at end of file diff --git a/src/test/resources/mock/dspace/json/presentation.json b/src/test/resources/mock/dspace/json/presentation.json index 31a8dfc..b372fcd 100644 --- a/src/test/resources/mock/dspace/json/presentation.json +++ b/src/test/resources/mock/dspace/json/presentation.json @@ -2,7 +2,10 @@ "@context": "http://iiif.io/api/presentation/2/context.json", "@id": "http://localhost:9000/dspace-rdf/presentation/123456789/158308", "@type": "sc:Manifest", + "attribution": "Chevy", + "description": "A fast car", "label": "Corvette", + "license": "Test license", "logo": "https://brandguide.tamu.edu/assets/downloads/logos/TAM-Logo.png", "metadata": [ { @@ -24,6 +27,10 @@ { "label": "title", "value": "Corvette" + }, + { + "label": "context", + "value": "rdf/handle/123456789/158308" } ], "sequences": [ @@ -65,13 +72,11 @@ ], "thumbnail": { "@id": "http://localhost:8182/iiif/2/ZHNwYWNlLXJkZjp4bWx1aS9iaXRzdHJlYW0vMTIzNDU2Nzg5LzE1ODMwOC8xL3Nwb3J0cy1jYXItMTQ2ODczXzk2MF83MjAucG5n/full/!100,100/0/default.jpg", - "services": [ - { - "@context": "http://iiif.io/api/image/2/context.json", - "@id": "http://localhost:8182/iiif/2/ZHNwYWNlLXJkZjp4bWx1aS9iaXRzdHJlYW0vMTIzNDU2Nzg5LzE1ODMwOC8xL3Nwb3J0cy1jYXItMTQ2ODczXzk2MF83MjAucG5n", - "label": "DSpace IIIF Image Resource Service", - "profile": "http://iiif.io/api/image/2/level0.json" - } - ] + "service": { + "label": "DSpace IIIF Image Resource Service", + "profile": "http://iiif.io/api/image/2/level0.json", + "@context": "http://iiif.io/api/image/2/context.json", + "@id": "http://localhost:8182/iiif/2/ZHNwYWNlLXJkZjp4bWx1aS9iaXRzdHJlYW0vMTIzNDU2Nzg5LzE1ODMwOC8xL3Nwb3J0cy1jYXItMTQ2ODczXzk2MF83MjAucG5n" + } } } \ No newline at end of file diff --git a/src/test/resources/mock/dspace/rdf/item.rdf b/src/test/resources/mock/dspace/rdf/item.rdf index 3709a7a..2bc102e 100644 --- a/src/test/resources/mock/dspace/rdf/item.rdf +++ b/src/test/resources/mock/dspace/rdf/item.rdf @@ -16,6 +16,7 @@ dcterms:hasPart ; dcterms:isPartOf ; dcterms:title "Corvette" ; + dcterms:description "A fast car" ; dcterms:license "Test license"; dc:creator "Chevy"; bibo:uri ; diff --git a/src/test/resources/mock/fedora/json/canvas.json b/src/test/resources/mock/fedora/json/canvas.json index fe369f2..6118032 100644 --- a/src/test/resources/mock/fedora/json/canvas.json +++ b/src/test/resources/mock/fedora/json/canvas.json @@ -37,13 +37,6 @@ "label": "format", "value": "jpeg" }, - { - "label": "description", - "value": [ - "Back Cover", - "There is a smudge" - ] - }, { "label": "isPartOf", "value": " The Great War Catalog, page Back Cover" @@ -55,7 +48,11 @@ { "label": "contributor", "value": "Bob Boring" + }, + { + "label": "context", + "value": "mwbObjects/TGWCatalog/Pages/ExCat0084" } ], "width": 2400 -}> \ No newline at end of file +} \ No newline at end of file diff --git a/src/test/resources/mock/fedora/json/collection.json b/src/test/resources/mock/fedora/json/collection.json index fb0b02c..5ee286a 100644 --- a/src/test/resources/mock/fedora/json/collection.json +++ b/src/test/resources/mock/fedora/json/collection.json @@ -2,8 +2,15 @@ "@context": "http://iiif.io/api/presentation/2/context.json", "@id": "http://localhost:9000/fedora-pcdm/collection/mwbObjects/TGWCatalog", "@type": "sc:Collection", - "description": "A page level collection of The Great War exhibit catalog.", - "label": "The Great War Exhibit Catalog", + "attribution": "Bob Boring", + "description": [ + "A page level collection of The Great War exhibit catalog.", + "The assets are JPEGs created from TIFFs created when the catalog was digitized." + ], + "label": [ + "The Great War Exhibit Catalog", + "TGW_Catalog" + ], "logo": "https://brandguide.tamu.edu/assets/downloads/logos/TAM-Logo.png", "manifests": [ { @@ -21,13 +28,6 @@ "label": "references", "value": "The Great War Exhibit Catalog" }, - { - "label": "description", - "value": [ - "A page level collection of The Great War exhibit catalog.", - "The assets are JPEGs created from TIFFs created when the catalog was digitized." - ] - }, { "label": "abstract", "value": "Web presentation images for The Great War catalog. These images will be part of a IIIF Manifest version of the document." @@ -47,6 +47,10 @@ { "label": "contributor", "value": "Bob Boring" + }, + { + "label": "context", + "value": "mwbObjects/TGWCatalog" } ], "viewingHint": "multi-part" diff --git a/src/test/resources/mock/fedora/json/presentation-allow.json b/src/test/resources/mock/fedora/json/presentation-allow.json index f58b21f..b7d23a2 100644 --- a/src/test/resources/mock/fedora/json/presentation-allow.json +++ b/src/test/resources/mock/fedora/json/presentation-allow.json @@ -2,8 +2,13 @@ "@context": "http://iiif.io/api/presentation/2/context.json", "@id": "http://localhost:9000/fedora-pcdm/presentation/mwbObjects/TGWCatalog/Pages/ExCat0084?allow=image/png;image/jpeg", "@type": "sc:Manifest", - "description": "There is a smudge", + "attribution": "Bob Boring", + "description": [ + "There is a smudge", + "Back Cover" + ], "label": "ExCat0084", + "license": "Test license", "logo": "https://brandguide.tamu.edu/assets/downloads/logos/TAM-Logo.png", "metadata": [ { @@ -18,13 +23,6 @@ "label": "format", "value": "jpeg" }, - { - "label": "description", - "value": [ - "Back Cover", - "There is a smudge" - ] - }, { "label": "isPartOf", "value": " The Great War Catalog, page Back Cover" @@ -36,127 +34,10 @@ { "label": "contributor", "value": "Bob Boring" - } - ], - "sequences": [ - { - "@id": "http://localhost:9000/fedora-pcdm/sequence/mwbObjects/TGWCatalog/Pages/ExCat0084?allow=image/png;image/jpeg", - "@type": "sc:Sequence", - "canvases": [ - { - "@id": "http://localhost:9000/fedora-pcdm/canvas/mwbObjects/TGWCatalog/Pages/ExCat0084?allow=image/png;image/jpeg", - "@type": "sc:Canvas", - "height": 3000, - "images": [ - { - "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn/info.json", - "@type": "oa:Annotation", - "motivation": "sc:painting", - "on": "http://localhost:9000/fedora-pcdm/canvas/mwbObjects/TGWCatalog/Pages/ExCat0084?allow=image/png;image/jpeg", - "resource": { - "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn/full/full/0/default.jpg", - "@type": "dctypes:Image", - "format": "image/png; charset=utf-8", - "height": 3000, - "service": { - "label": "Fedora IIIF Image Resource Service", - "profile": "http://iiif.io/api/image/2/level0.json", - "@context": "http://iiif.io/api/image/2/context.json", - "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn" - }, - "width": 2400 - } - } - ], - "label": "ExCat0084", - "metadata": [ - { - "label": "date", - "value": "1/5/2018" - }, - { - "label": "identifier", - "value": "ExCat0084" - }, - { - "label": "format", - "value": "jpeg" - }, - { - "label": "description", - "value": [ - "Back Cover", - "There is a smudge" - ] - }, - { - "label": "isPartOf", - "value": " The Great War Catalog, page Back Cover" - }, - { - "label": "license", - "value": "Test license" - }, - { - "label": "contributor", - "value": "Bob Boring" - } - ], - "width": 2400 - } - ], - "label": "ExCat0084" - } - ], - "thumbnail": { - "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn/full/!100,100/0/default.jpg", - "services": [ - { - "@context": "http://iiif.io/api/image/2/context.json", - "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn", - "label": "Fedora IIIF Image Resource Service", - "profile": "http://iiif.io/api/image/2/level0.json" - } - ] - } -}{ - "@context": "http://iiif.io/api/presentation/2/context.json", - "@id": "http://localhost:9000/fedora-pcdm/presentation/mwbObjects/TGWCatalog/Pages/ExCat0084?allow=image/png;image/jpeg", - "@type": "sc:Manifest", - "description": "There is a smudge", - "label": "ExCat0084", - "logo": "https://brandguide.tamu.edu/assets/downloads/logos/TAM-Logo.png", - "metadata": [ - { - "label": "date", - "value": "1/5/2018" - }, - { - "label": "identifier", - "value": "ExCat0084" - }, - { - "label": "format", - "value": "jpeg" - }, - { - "label": "description", - "value": [ - "Back Cover", - "There is a smudge" - ] - }, - { - "label": "isPartOf", - "value": " The Great War Catalog, page Back Cover" }, { - "label": "license", - "value": "Test license" - }, - { - "label": "contributor", - "value": "Bob Boring" + "label": "context", + "value": "mwbObjects/TGWCatalog/Pages/ExCat0084" } ], "sequences": [ @@ -203,13 +84,6 @@ "label": "format", "value": "jpeg" }, - { - "label": "description", - "value": [ - "Back Cover", - "There is a smudge" - ] - }, { "label": "isPartOf", "value": " The Great War Catalog, page Back Cover" @@ -221,6 +95,10 @@ { "label": "contributor", "value": "Bob Boring" + }, + { + "label": "context", + "value": "mwbObjects/TGWCatalog/Pages/ExCat0084" } ], "width": 2400 @@ -231,13 +109,11 @@ ], "thumbnail": { "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn/full/!100,100/0/default.jpg", - "services": [ - { - "@context": "http://iiif.io/api/image/2/context.json", - "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn", - "label": "Fedora IIIF Image Resource Service", - "profile": "http://iiif.io/api/image/2/level0.json" - } - ] + "service": { + "label": "Fedora IIIF Image Resource Service", + "profile": "http://iiif.io/api/image/2/level0.json", + "@context": "http://iiif.io/api/image/2/context.json", + "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn" + } } } \ No newline at end of file diff --git a/src/test/resources/mock/fedora/json/presentation-disallow.json b/src/test/resources/mock/fedora/json/presentation-disallow.json index 7e2f61c..c8ba51d 100644 --- a/src/test/resources/mock/fedora/json/presentation-disallow.json +++ b/src/test/resources/mock/fedora/json/presentation-disallow.json @@ -2,8 +2,13 @@ "@context": "http://iiif.io/api/presentation/2/context.json", "@id": "http://localhost:9000/fedora-pcdm/presentation/mwbObjects/TGWCatalog/Pages/ExCat0084?disallow=image/bmp;image/jpeg", "@type": "sc:Manifest", - "description": "There is a smudge", + "attribution": "Bob Boring", + "description": [ + "There is a smudge", + "Back Cover" + ], "label": "ExCat0084", + "license": "Test license", "logo": "https://brandguide.tamu.edu/assets/downloads/logos/TAM-Logo.png", "metadata": [ { @@ -18,13 +23,6 @@ "label": "format", "value": "jpeg" }, - { - "label": "description", - "value": [ - "Back Cover", - "There is a smudge" - ] - }, { "label": "isPartOf", "value": " The Great War Catalog, page Back Cover" @@ -36,6 +34,10 @@ { "label": "contributor", "value": "Bob Boring" + }, + { + "label": "context", + "value": "mwbObjects/TGWCatalog/Pages/ExCat0084" } ], "sequences": [ @@ -82,13 +84,6 @@ "label": "format", "value": "jpeg" }, - { - "label": "description", - "value": [ - "Back Cover", - "There is a smudge" - ] - }, { "label": "isPartOf", "value": " The Great War Catalog, page Back Cover" @@ -100,6 +95,10 @@ { "label": "contributor", "value": "Bob Boring" + }, + { + "label": "context", + "value": "mwbObjects/TGWCatalog/Pages/ExCat0084" } ], "width": 2400 @@ -110,13 +109,11 @@ ], "thumbnail": { "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn/full/!100,100/0/default.jpg", - "services": [ - { - "@context": "http://iiif.io/api/image/2/context.json", - "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn", - "label": "Fedora IIIF Image Resource Service", - "profile": "http://iiif.io/api/image/2/level0.json" - } - ] + "service": { + "label": "Fedora IIIF Image Resource Service", + "profile": "http://iiif.io/api/image/2/level0.json", + "@context": "http://iiif.io/api/image/2/context.json", + "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn" + } } -} \ No newline at end of file +}> \ No newline at end of file diff --git a/src/test/resources/mock/fedora/json/presentation.json b/src/test/resources/mock/fedora/json/presentation.json index 5508e89..140921c 100644 --- a/src/test/resources/mock/fedora/json/presentation.json +++ b/src/test/resources/mock/fedora/json/presentation.json @@ -2,8 +2,13 @@ "@context": "http://iiif.io/api/presentation/2/context.json", "@id": "http://localhost:9000/fedora-pcdm/presentation/mwbObjects/TGWCatalog/Pages/ExCat0084", "@type": "sc:Manifest", - "description": "There is a smudge", + "attribution": "Bob Boring", + "description": [ + "There is a smudge", + "Back Cover" + ], "label": "ExCat0084", + "license": "Test license", "logo": "https://brandguide.tamu.edu/assets/downloads/logos/TAM-Logo.png", "metadata": [ { @@ -18,13 +23,6 @@ "label": "format", "value": "jpeg" }, - { - "label": "description", - "value": [ - "Back Cover", - "There is a smudge" - ] - }, { "label": "isPartOf", "value": " The Great War Catalog, page Back Cover" @@ -36,6 +34,10 @@ { "label": "contributor", "value": "Bob Boring" + }, + { + "label": "context", + "value": "mwbObjects/TGWCatalog/Pages/ExCat0084" } ], "sequences": [ @@ -82,13 +84,6 @@ "label": "format", "value": "jpeg" }, - { - "label": "description", - "value": [ - "Back Cover", - "There is a smudge" - ] - }, { "label": "isPartOf", "value": " The Great War Catalog, page Back Cover" @@ -100,6 +95,10 @@ { "label": "contributor", "value": "Bob Boring" + }, + { + "label": "context", + "value": "mwbObjects/TGWCatalog/Pages/ExCat0084" } ], "width": 2400 @@ -110,13 +109,11 @@ ], "thumbnail": { "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn/full/!100,100/0/default.jpg", - "services": [ - { - "@context": "http://iiif.io/api/image/2/context.json", - "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn", - "label": "Fedora IIIF Image Resource Service", - "profile": "http://iiif.io/api/image/2/level0.json" - } - ] + "service": { + "label": "Fedora IIIF Image Resource Service", + "profile": "http://iiif.io/api/image/2/level0.json", + "@context": "http://iiif.io/api/image/2/context.json", + "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn" + } } } \ No newline at end of file diff --git a/src/test/resources/mock/fedora/json/sequence.json b/src/test/resources/mock/fedora/json/sequence.json index 9fbfac2..e49efe5 100644 --- a/src/test/resources/mock/fedora/json/sequence.json +++ b/src/test/resources/mock/fedora/json/sequence.json @@ -1,26 +1,30 @@ { + "@id": "http://localhost:9000/fedora-pcdm/sequence/mwbObjects/TGWCatalog/Pages/ExCat0084", + "@type": "sc:Sequence", "canvases": [ { + "@id": "http://localhost:9000/fedora-pcdm/canvas/mwbObjects/TGWCatalog/Pages/ExCat0084", + "@type": "sc:Canvas", "height": 3000, "images": [ { + "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn/info.json", + "@type": "oa:Annotation", "motivation": "sc:painting", "on": "http://localhost:9000/fedora-pcdm/canvas/mwbObjects/TGWCatalog/Pages/ExCat0084", "resource": { + "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn/full/full/0/default.jpg", + "@type": "dctypes:Image", "format": "image/png; charset=utf-8", "height": 3000, - "width": 2400, "service": { "label": "Fedora IIIF Image Resource Service", "profile": "http://iiif.io/api/image/2/level0.json", "@context": "http://iiif.io/api/image/2/context.json", "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn" }, - "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn/full/full/0/default.jpg", - "@type": "dctypes:Image" - }, - "@id": "http://localhost:8182/iiif/2/ZmVkb3JhLXBjZG06bXdiT2JqZWN0cy9UR1dDYXRhbG9nL1BhZ2VzL0V4Q2F0MDA4NC9maWxlcy9FeENhdDAwODQuanBn/info.json", - "@type": "oa:Annotation" + "width": 2400 + } } ], "label": "ExCat0084", @@ -37,13 +41,6 @@ "label": "format", "value": "jpeg" }, - { - "label": "description", - "value": [ - "Back Cover", - "There is a smudge" - ] - }, { "label": "isPartOf", "value": " The Great War Catalog, page Back Cover" @@ -55,14 +52,14 @@ { "label": "contributor", "value": "Bob Boring" + }, + { + "label": "context", + "value": "mwbObjects/TGWCatalog/Pages/ExCat0084" } ], - "width": 2400, - "@type": "sc:Canvas", - "@id": "http://localhost:9000/fedora-pcdm/canvas/mwbObjects/TGWCatalog/Pages/ExCat0084" + "width": 2400 } ], - "label": "ExCat0084", - "@type": "sc:Sequence", - "@id": "http://localhost:9000/fedora-pcdm/sequence/mwbObjects/TGWCatalog/Pages/ExCat0084" + "label": "ExCat0084" } \ No newline at end of file From 57fb0c44b1b421b415a836b017424392c93003ee Mon Sep 17 00:00:00 2001 From: William Welling Date: Thu, 21 May 2020 13:48:28 -0500 Subject: [PATCH 2/2] return distinct values when looking up multiple predicates --- src/main/java/edu/tamu/iiif/utility/RdfModelUtility.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/edu/tamu/iiif/utility/RdfModelUtility.java b/src/main/java/edu/tamu/iiif/utility/RdfModelUtility.java index 862ff35..88eb5d4 100644 --- a/src/main/java/edu/tamu/iiif/utility/RdfModelUtility.java +++ b/src/main/java/edu/tamu/iiif/utility/RdfModelUtility.java @@ -62,6 +62,7 @@ public static List getObjects(RdfResource rdfResource, List uris return uris.stream() .map(uri -> getObjects(rdfResource, uri)) .flatMap(Collection::stream) + .distinct() .collect(Collectors.toList()); }