You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2018/05/10 10:32:50 UTC
incubator-taverna-language git commit: TAVERNA-1045: Avoid duplicate
about/content annotations
Repository: incubator-taverna-language
Updated Branches:
refs/heads/master b85ec8ba2 -> 99516e11d
TAVERNA-1045: Avoid duplicate about/content annotations
.. by maintaining a set of known pairings.
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/commit/99516e11
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/99516e11
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/99516e11
Branch: refs/heads/master
Commit: 99516e11de452bb4a51a1898858d7ede9b6ef9e1
Parents: b85ec8b
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Thu May 10 11:28:15 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Thu May 10 11:28:15 2018 +0100
----------------------------------------------------------------------
.../manifest/combine/CombineManifest.java | 24 +++++++++++++-------
1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/99516e11/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/combine/CombineManifest.java
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/combine/CombineManifest.java b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/combine/CombineManifest.java
index 2057253..854667a 100644
--- a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/combine/CombineManifest.java
+++ b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/combine/CombineManifest.java
@@ -65,6 +65,7 @@ import org.apache.taverna.robundle.xml.combine.ObjectFactory;
import org.apache.taverna.robundle.xml.combine.OmexManifest;
import org.xml.sax.InputSource;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.jena.query.QueryExecution;
import org.apache.jena.query.QueryExecutionFactory;
import org.apache.jena.query.QueryFactory;
@@ -352,20 +353,26 @@ public class CombineManifest {
return;
}
- for (URI about : bundleSubjects()) {
- Resource resource = metadata.getResource(fakeFileURI(about));
+ Set<Pair<URI,URI>> foundAnnotations = new HashSet<>();
+ for (URI subject : bundleSubjects()) {
+ Resource resource = metadata.getResource(fakeFileURI(subject));
if (!metadata.containsResource(resource)) {
System.out.println("Nothing known about " + resource);
continue;
}
- PathAnnotation ann = new PathAnnotation();
- ann.setAbout(manifest.relativeToBundleRoot(about));
- ann.setContent(manifest.relativeToBundleRoot(metadataRdf.toUri()));
- manifest.getAnnotations().add(ann);
+ URI about = manifest.relativeToBundleRoot(subject);
+ URI content = manifest.relativeToBundleRoot(metadataRdf.toUri());
+ if (! foundAnnotations.add(Pair.of(about, content))) {
+ // Avoid duplication
+ PathAnnotation ann = new PathAnnotation();
+ ann.setAbout(subject);
+ ann.setContent(content);
+ manifest.getAnnotations().add(ann);
+ }
// Extract information that could be in our manifest
- PathMetadata pathMetadata = manifest.getAggregation(about);
+ PathMetadata pathMetadata = manifest.getAggregation(subject);
// Created date. We'll prefer dcModified.
Property dcCreated = metadata
@@ -383,8 +390,9 @@ public class CombineManifest {
.getProperty("http://purl.org/dc/terms/W3CDTF");
Statement w3cSt = createdSt.getResource().getProperty(
dcW3CDTF);
- if (w3cSt != null)
+ if (w3cSt != null) {
fileTime = literalAsFileTime(w3cSt.getObject());
+ }
}
if (fileTime != null) {
pathMetadata.setCreatedOn(fileTime);