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/11 10:44:27 UTC

[01/14] incubator-taverna-language git commit: Test bag-of-bags-manifest.json

Repository: incubator-taverna-language
Updated Branches:
  refs/heads/master 2658cc479 -> e50826e64


Test bag-of-bags-manifest.json

.. several of these fail for some reason.


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/3c9d0a95
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/3c9d0a95
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/3c9d0a95

Branch: refs/heads/master
Commit: 3c9d0a95bc3c3f29f17d724216f76ba2044c1886
Parents: ad352d1
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Thu May 10 17:38:56 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Thu May 10 17:40:11 2018 +0100

----------------------------------------------------------------------
 .../robundle/manifest/TestRDFToManifest.java    | 72 +++++++++++++++++++-
 1 file changed, 70 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/3c9d0a95/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java b/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
index 4123ce2..13e099e 100644
--- a/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
+++ b/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
@@ -1,5 +1,7 @@
 package org.apache.taverna.robundle.manifest;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,12 +20,17 @@ package org.apache.taverna.robundle.manifest;
  * specific language governing permissions and limitations
  * under the License.
  */
-
-
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
+import java.io.InputStream;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
 
+import org.apache.taverna.robundle.Bundle;
+import org.apache.taverna.robundle.Bundles;
 import org.junit.Test;
 
 import com.github.jsonldjava.core.DocumentLoader;
@@ -48,4 +55,65 @@ public class TestRDFToManifest {
 				retrievedFrom);
 
 	}
+	
+	@Test
+	public void multipleConformsTo() throws Exception {
+		try (Bundle ro = Bundles.createBundle();
+			 InputStream json = getClass().getResourceAsStream("/bag-of-bags-manifest.json")) {
+			// Make a new, empty manifest we can inspect
+			assertNotNull("Can't find bag-of-bags-manifest.json", json);
+			Manifest manifest = new Manifest(ro);
+			
+			// NOTE: Uses RO-BagIt folder metadata/ instead of .ro/
+			URI baseURI = ro.getPath("metadata/manifest.json").toUri();			
+			new RDFToManifest().readTo(json, manifest, baseURI);
+
+			// Check basic metadata
+			assertEquals(URI.create("https://github.com/ini-bdds/bdbag"),
+					manifest.getCreatedBy().getUri());
+			assertEquals(1, manifest.getAuthoredBy().size());
+			Agent author = manifest.getAuthoredBy().get(0);
+			assertEquals("Stian Soiland-Reyes", 
+					author.getName());
+			assertEquals(URI.create("mbox:stain@apache.org"), 
+					author.getUri());
+			// FIXME: Why is ORCID not picked up?
+//			assertEquals(URI.create("https://orcid.org/0000-0001-9842-9718"),
+//					author.getOrcid());
+
+			// FIXME: Why are annotations not picked up?
+//			assertEquals(1, manifest.getAnnotations().size());
+//			PathAnnotation ann = manifest.getAnnotations().get(0);
+//			assertEquals(ro.getRoot().toUri(),
+//					ann.getAbout());
+//			assertEquals(ro.getPath("data/README").toUri(), ann.getContent());
+			
+			// Now let's check aggregations
+			assertEquals(1, manifest.getAggregates().size());
+			// As aggregates order is not preserved, for simplicity this test
+			// has only one aggregation			
+			PathMetadata a1 = manifest.getAggregates().get(0);
+			URI uri = URI.create("http://n2t.net/ark:/57799/b90h3c");
+			assertEquals(uri, a1.getUri());
+			assertEquals(a1, manifest.getAggregation(uri));
+			
+			// FIXME: More than one?
+			assertEquals(URI.create("https://w3id.org/ro/bagit/profile"),
+					a1.getConformsTo());
+//			assertEquals(URI.create("https://tools.ietf.org/html/draft-kunze-bagit-14"),
+//					a1.getConformsTo());
+
+			
+			Proxy bundledAs = a1.getBundledAs();
+			// FIXME: Why is there no bundledAs?
+//			assertNotNull(bundledAs);
+//			assertEquals(ro.getPath("data"), 
+//					bundledAs.getFolder());			
+//			assertEquals("bag1.zip", a1.getBundledAs().getFilename());
+
+			// TODO: Enable fetching based on bundledAs URI?
+			//ro.getRoot().resolve("data/bag1.zip")
+			
+		}				
+	}
 }


[02/14] incubator-taverna-language git commit: Parse back conformsTo

Posted by st...@apache.org.
Parse back conformsTo


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/2ca81c68
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/2ca81c68
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/2ca81c68

Branch: refs/heads/master
Commit: 2ca81c68db5702714f24bdafe0f4444c96410dad
Parents: dec7689
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Thu May 10 13:54:46 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Thu May 10 17:40:11 2018 +0100

----------------------------------------------------------------------
 .../robundle/manifest/RDFToManifest.java        | 32 +++++++++++++++-----
 1 file changed, 25 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/2ca81c68/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/RDFToManifest.java
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/RDFToManifest.java b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/RDFToManifest.java
index f9fea56..c144f19 100644
--- a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/RDFToManifest.java
+++ b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/RDFToManifest.java
@@ -8,9 +8,9 @@ package org.apache.taverna.robundle.manifest;
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -103,16 +103,16 @@ public class RDFToManifest {
 	protected static Model jsonLdAsJenaModel(InputStream jsonIn, URI base)
 			throws IOException, RiotException {
 		Model model = ModelFactory.createDefaultModel();
-		
+
 		ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
-		try { 
+		try {
 			// TAVERNA-971: set context classloader so jarcache.json is consulted
 			// even through OSGi
 			Thread.currentThread().setContextClassLoader(RDFToManifest.class.getClassLoader());
-			
+
 			// Now we can parse the JSON-LD without network access
 			RDFDataMgr.read(model, jsonIn, base.toASCIIString(), Lang.JSONLD);
-		} finally { 
+		} finally {
 			// Restore old context class loader (if any)
 			Thread.currentThread().setContextClassLoader(oldCl);
 		}
@@ -416,7 +416,7 @@ public class RDFToManifest {
 		// createdOn
 		RDFNode created = ro.getPropertyValue(createdOn);
 		manifest.setCreatedOn(literalAsFileTime(created));
-		
+
 		// history
 		List<Path> history = new ArrayList<Path> ();
 		for (Individual histItem : listObjectProperties (ro, hasProvenance)) {
@@ -458,6 +458,24 @@ public class RDFToManifest {
 		RDFNode retrieved = ro.getPropertyValue(retrievedOn);
 		manifest.setRetrievedOn(literalAsFileTime(retrieved));
 
+		// conformsTo
+		for (Individual standard : listObjectProperties(ro,
+				conformsTo)) {
+			if (standard.isURIResource()) {
+				URI uri;
+				try {
+					uri = new URI(standard.getURI());
+				} catch (URISyntaxException ex) {
+					logger.log(Level.WARNING, "Invalid URI for conformsTo: " +
+					           standard, ex);
+					continue;
+				}
+				if (! manifest.getConformsTo().contains(uri)) {
+					manifest.getConformsTo().add(uri);
+				}
+			}
+		}
+
 		// Aggregates
 		for (Individual aggrResource : listObjectProperties(ro, aggregates)) {
 			String uriStr = aggrResource.getURI();


[10/14] incubator-taverna-language git commit: Newer bundle ontology 0.2.0-SNAPSHOT

Posted by st...@apache.org.
Newer bundle ontology 0.2.0-SNAPSHOT

Changes by Stian Soiland-Reyes, University of Manchester
contributed under the terms of the Apache License 2.0


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/b5dd34aa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/b5dd34aa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/b5dd34aa

Branch: refs/heads/master
Commit: b5dd34aa99ec2d1a9f04ce9f85c351ff121c4fc7
Parents: 76fc46f
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Thu May 10 19:15:52 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Thu May 10 19:15:52 2018 +0100

----------------------------------------------------------------------
 .../src/main/resources/ontologies/bundle.owl    | 49 ++++++++++++++++----
 1 file changed, 40 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/b5dd34aa/taverna-robundle/src/main/resources/ontologies/bundle.owl
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/main/resources/ontologies/bundle.owl b/taverna-robundle/src/main/resources/ontologies/bundle.owl
index 2084f5c..dbcaea3 100644
--- a/taverna-robundle/src/main/resources/ontologies/bundle.owl
+++ b/taverna-robundle/src/main/resources/ontologies/bundle.owl
@@ -15,6 +15,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
+
 <!DOCTYPE rdf:RDF [
     <!ENTITY ao "http://purl.org/ao/" >
     <!ENTITY oa "http://www.w3.org/ns/oa#" >
@@ -28,7 +29,7 @@
 ]>
 
 
-<rdf:RDF xmlns="http://purl.org/wf4ever/bundle#"
+<rdf:RDF xmlns="http://purl.org/wf4ever/bundle"
      xml:base="http://purl.org/wf4ever/bundle"
      xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
      xmlns:ro="http://purl.org/wf4ever/ro#"
@@ -41,8 +42,9 @@
      xmlns:ore="http://www.openarchives.org/ore/terms/">
     <owl:Ontology rdf:about="http://purl.org/wf4ever/bundle">
         <owl:imports rdf:resource="http://purl.org/wf4ever/ro"/>
-        <owl:versionIRI rdf:resource="http://purl.org/wf4ever/bundle/0.1.0-SNAPSHOT"/>
+        <owl:versionIRI rdf:resource="http://purl.org/wf4ever/bundle/0.2.0-SNAPSHOT"/>
         <owl:imports rdf:resource="http://www.w3.org/ns/oa#"/>
+        <owl:imports rdf:resource="http://www.w3.org/ns/prov#"/>
     </owl:Ontology>
     
 
@@ -74,6 +76,14 @@
     
 
 
+    <!-- http://purl.org/wf4ever/bundle#bundledAs -->
+
+    <owl:ObjectProperty rdf:about="&bundle;bundledAs">
+        <rdfs:subPropertyOf rdf:resource="http://www.w3.org/ns/prov#generalizationOf"/>
+    </owl:ObjectProperty>
+    
+
+
     <!-- http://purl.org/wf4ever/bundle#hasAnnotation -->
 
     <owl:ObjectProperty rdf:about="&bundle;hasAnnotation">
@@ -87,7 +97,10 @@
 
     <!-- http://purl.org/wf4ever/bundle#hasProxy -->
 
-    <owl:ObjectProperty rdf:about="&bundle;hasProxy"/>
+    <owl:ObjectProperty rdf:about="&bundle;hasProxy">
+        <rdfs:range rdf:resource="&ore;Proxy"/>
+        <rdfs:subPropertyOf rdf:resource="http://www.w3.org/ns/prov#alternateOf"/>
+    </owl:ObjectProperty>
     
 
 
@@ -115,7 +128,30 @@
     <!-- http://www.openarchives.org/ore/terms/proxyFor -->
 
     <rdf:Description rdf:about="&ore;proxyFor">
-        <owl:inverseOf rdf:resource="&bundle;hasProxy"/>
+        <owl:propertyChainAxiom rdf:parseType="Collection">
+            <rdf:Description>
+                <owl:inverseOf rdf:resource="&bundle;hasProxy"/>
+            </rdf:Description>
+            <rdf:Description>
+                <owl:inverseOf rdf:resource="&bundle;bundledAs"/>
+            </rdf:Description>
+        </owl:propertyChainAxiom>
+    </rdf:Description>
+    
+
+
+    <!-- http://www.openarchives.org/ore/terms/proxyIn -->
+
+    <rdf:Description rdf:about="&ore;proxyIn">
+        <owl:propertyChainAxiom rdf:parseType="Collection">
+            <rdf:Description>
+                <owl:inverseOf rdf:resource="&bundle;hasProxy"/>
+            </rdf:Description>
+            <rdf:Description>
+                <owl:inverseOf rdf:resource="&bundle;bundledAs"/>
+            </rdf:Description>
+            <rdf:Description rdf:about="&ore;isAggregatedBy"/>
+        </owl:propertyChainAxiom>
     </rdf:Description>
     
 
@@ -130,8 +166,3 @@
 
     <rdf:Description rdf:about="&oa;hasTarget"/>
 </rdf:RDF>
-
-
-
-<!-- Generated by the OWL API (version 3.4.2) http://owlapi.sourceforge.net -->
-


[03/14] incubator-taverna-language git commit: add conformsTo property to Manifest

Posted by st...@apache.org.
add conformsTo property to Manifest


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/a8c8446e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/a8c8446e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/a8c8446e

Branch: refs/heads/master
Commit: a8c8446e48b8b3becd3a671a6b5d24fd06ac240a
Parents: 2658cc4
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Thu May 10 11:10:58 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Thu May 10 17:40:11 2018 +0100

----------------------------------------------------------------------
 .../org/apache/taverna/robundle/manifest/Manifest.java  | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/a8c8446e/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/Manifest.java
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/Manifest.java b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/Manifest.java
index ad073a9..50979bf 100644
--- a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/Manifest.java
+++ b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/Manifest.java
@@ -67,7 +67,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
 import com.fasterxml.jackson.annotation.JsonValue;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
-@JsonPropertyOrder(value = { "@context", "id", "manifest", "createdOn",
+@JsonPropertyOrder(value = { "@context", "id", "manifest", "conformsTo","createdOn",
 		"createdBy", "createdOn", "authoredOn", "authoredBy",
 		"retrievedFrom", "retrievedOn", "retrievedBy",
 		"history", "aggregates", "annotations", "@graph" })
@@ -114,6 +114,7 @@ public class Manifest {
 	private List<Path> history = new ArrayList<>();
 	private URI id = URI.create("/");
 	private List<Path> manifest = new ArrayList<>();
+	private List<URI> conformsTo = new ArrayList<>();
 
 	public Manifest(Bundle bundle) {
 		this.bundle = bundle;
@@ -167,6 +168,11 @@ public class Manifest {
 		return bundle;
 	}
 
+	public List<URI> getConformsTo() {
+		return conformsTo;
+	}
+
+
 	@JsonProperty(value = "@context")
 	public List<Object> getContext() {
 		ArrayList<Object> context = new ArrayList<>();
@@ -379,6 +385,10 @@ public class Manifest {
 		this.bundle = bundle;
 	}
 
+	public void setConformsTo(List<URI> conformsTo) {
+		this.conformsTo = conformsTo;
+	}
+
 	public void setCreatedBy(Agent createdBy) {
 		this.createdBy = createdBy;
 	}


[07/14] incubator-taverna-language git commit: TAVERNA-1046: Pick up ORCID from manifest

Posted by st...@apache.org.
TAVERNA-1046: Pick up ORCID from manifest

Note that this modifies our "cached" bundle.jsonld context
to map "orcid" alternatively to prov:alternateOf -- this is not
currently reflected upstream in https://w3id.org/bundle/context


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/ea432007
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/ea432007
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/ea432007

Branch: refs/heads/master
Commit: ea4320079c79db73eb9bac3e7b73755bc6b2e57b
Parents: 3c9d0a9
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Thu May 10 18:17:19 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Thu May 10 18:17:19 2018 +0100

----------------------------------------------------------------------
 .../robundle/manifest/RDFToManifest.java        | 32 +++++++++++++++++---
 .../src/main/resources/contexts/bundle.jsonld   |  2 +-
 2 files changed, 28 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/ea432007/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/RDFToManifest.java
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/RDFToManifest.java b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/RDFToManifest.java
index c144f19..2976234 100644
--- a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/RDFToManifest.java
+++ b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/RDFToManifest.java
@@ -163,6 +163,10 @@ public class RDFToManifest {
 
 	private OntClass standard;
 
+	private OntModel roterms;
+
+	private ObjectProperty alternateOf;
+
 	public RDFToManifest() {
 		loadOntologies();
 	}
@@ -193,8 +197,26 @@ public class RDFToManifest {
 		List<Agent> creators = new ArrayList<>();
 		for (Individual agent : listObjectProperties(in, property)) {
 			Agent a = new Agent();
-			if (agent.getURI() != null)
-				a.setUri(relativizeFromBase(agent.getURI(), base));
+
+			// Check for any ORCIDs, note that "orcid" is mapped as
+			// prov:alternateOf in our modified bundle.jsonld
+			for (Individual alternate : listObjectProperties(agent, alternateOf)) {
+				if (alternate.isURIResource() && (
+						alternate.getURI().startsWith("https://orcid.org/") ||
+						alternate.getURI().startsWith("http://orcid.org/"))) {
+					// TODO: Check against https://support.orcid.org/knowledgebase/articles/116780-structure-of-the-orcid-identifier
+					a.setOrcid(URI.create(alternate.getURI()));
+					break;
+				}
+			}
+			if (agent.isURIResource()) {
+				URI agentURI = relativizeFromBase(agent.getURI(), base);
+				if ("orcid.org".equals(agentURI.getHost()) && a.getOrcid() == null) {
+					a.setOrcid(agentURI);
+				} else {
+					a.setUri(agentURI);
+				}
+			}
 
 			RDFNode name = agent.getPropertyValue(foafName);
 			if (name != null && name.isLiteral())
@@ -366,8 +388,8 @@ public class RDFToManifest {
 		if (prov != null)
 			return;
 		OntModel ontModel = loadOntologyFromClasspath(PROV_O_RDF, PROV_O);
-
-		checkNotNull(ontModel);
+		alternateOf = ontModel.getObjectProperty(PROV + "alternateOf");
+		checkNotNull(ontModel, alternateOf);
 
 		prov = ontModel;
 	}
@@ -571,7 +593,7 @@ public class RDFToManifest {
 			 */
 			for (Individual body : listObjectProperties(
 					model.getOntResource(ann), hasBody)) {
-				if (body.getURI() == null) {
+				if (! body.isURIResource()) {
 					logger.warning("Can't find annotation body for anonymous "
 							+ body);
 					continue;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/ea432007/taverna-robundle/src/main/resources/contexts/bundle.jsonld
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/main/resources/contexts/bundle.jsonld b/taverna-robundle/src/main/resources/contexts/bundle.jsonld
index cadb9ff..170777f 100644
--- a/taverna-robundle/src/main/resources/contexts/bundle.jsonld
+++ b/taverna-robundle/src/main/resources/contexts/bundle.jsonld
@@ -88,7 +88,7 @@
         "@id": "foaf:name"
     },
     "orcid": {
-        "@id": "roterms:orcid",
+        "@id": "prov:alternateOf",
         "@type": "@id"
     },
 


[04/14] incubator-taverna-language git commit: add RO conformsTo for COMBINE archives

Posted by st...@apache.org.
add RO conformsTo for COMBINE archives


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/dec76891
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/dec76891
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/dec76891

Branch: refs/heads/master
Commit: dec76891b4bc7613753520adcc931c256563bbe6
Parents: a8c8446
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Thu May 10 11:13:52 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Thu May 10 17:40:11 2018 +0100

----------------------------------------------------------------------
 .../manifest/combine/CombineManifest.java       | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/dec76891/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 0efdd81..898149d 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
@@ -37,6 +37,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.attribute.FileTime;
 import java.util.ArrayList;
@@ -526,6 +527,25 @@ public class CombineManifest {
 				}
 			} else {
 				Path path = bundle.getRoot().resolve(c.getLocation());
+				if (Files.isSameFile(bundle.getRoot(), path)) {
+					// metadata about the archive itself
+					if (c.getFormat() != null && ! c.getFormat().isEmpty()) {
+						URI uri;
+						try {
+							uri = new URI(c.getFormat());
+						} catch (URISyntaxException e) {
+							logger.warning(MANIFEST_XML + " non-URI format for . expected http://identifiers.org/combine.specifications/omex");
+							continue;
+						}
+						if (! manifest.getConformsTo().contains(uri)) {
+							manifest.getConformsTo().add(uri);
+						}
+					}
+					// Don't add / to the list of aggregations in RO,
+					// as / is the RO itself!
+					continue;
+				}
+
 				if (!exists(path)) {
 					logger.warning(MANIFEST_XML + " listed relative path "
 							+ path + ", but it does not exist in bundle");


[05/14] incubator-taverna-language git commit: Rewrote example in my own words

Posted by st...@apache.org.
Rewrote example in my own words

Just one aggregate now, to make test code simpler


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/ad352d14
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/ad352d14
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/ad352d14

Branch: refs/heads/master
Commit: ad352d14066c376192adfa4ca4b3659b7d0b76c5
Parents: eeb6704
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Thu May 10 17:07:51 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Thu May 10 17:40:11 2018 +0100

----------------------------------------------------------------------
 .../test/resources/bag-of-bags-manifest.json    | 598 +------------------
 1 file changed, 8 insertions(+), 590 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/ad352d14/taverna-robundle/src/test/resources/bag-of-bags-manifest.json
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/test/resources/bag-of-bags-manifest.json b/taverna-robundle/src/test/resources/bag-of-bags-manifest.json
index c7d1904..28a94c6 100644
--- a/taverna-robundle/src/test/resources/bag-of-bags-manifest.json
+++ b/taverna-robundle/src/test/resources/bag-of-bags-manifest.json
@@ -6,7 +6,7 @@
     "aggregates": [
         {
             "bundledAs": {
-                "filename": "adrenal_gland.seed16.tissue.bag.zip", 
+                "filename": "bag1.zip", 
                 "folder": "../data/"
             }, 
             "conformsTo": [
@@ -14,590 +14,7 @@
                 "https://w3id.org/ro/bagit/profile"
             ], 
             "uri": "http://n2t.net/ark:/57799/b90h3c"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "blood_vessel.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9km3p"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "bone_element.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9b37v"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "brain.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b92m31"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "bronchus.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9t376"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "esophagus.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9jm3c"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "extraembryonic_structure.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9b387"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "eye.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9mx1b"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "gonad.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9wx0f"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "heart.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9nd6c"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "kidney.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9cw9v"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "large_intestine.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b94d5b"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "liver.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9vw96"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "lung.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9md5p"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "lymphatic_vessel.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9bw9j"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "lymphoblast.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b93d4n"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "mammary_gland.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9tw9w"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "mouth.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9kd5c"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "muscle_organ.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b99x05"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "pancreas.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b92d63"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "prostate_gland.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9t09x"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "skin.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b95d7d"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "spinal_cord.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9h67f"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "stomach.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9566z"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "thyroid_gland.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9wq1r"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "tongue.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9n67p"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "urinary_bladder.seed16.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9cq3v"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "adrenal_gland.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9cd6w"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "blood_vessel.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b97q3m"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "bone_element.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b93x22"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "brain.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9067s"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "bronchus.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9vh5w"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "esophagus.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9qq3z"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "extraembryonic_structure.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9m092"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "eye.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9g674"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "gonad.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9bh57"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "heart.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b96q39"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "kidney.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9310b"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "large_intestine.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9z67g"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "liver.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9th6z"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "lung.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9pq3n"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "lymphatic_vessel.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9k09r"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "lymphoblast.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9f686"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "mammary_gland.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b99h5x"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "mouth.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b95q4c"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "muscle_organ.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b92093"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "pancreas.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9x96t"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "prostate_gland.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9sh58"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "skin.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b91m5g"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "spinal_cord.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9j09f"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "stomach.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9d97j"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "thyroid_gland.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b98h47"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "tongue.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b94t2b"
-        }, 
-        {
-            "bundledAs": {
-                "filename": "urinary_bladder.seed20.tissue.bag.zip", 
-                "folder": "../data/"
-            }, 
-            "conformsTo": [
-                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
-                "https://w3id.org/ro/bagit/profile"
-            ], 
-            "uri": "http://n2t.net/ark:/57799/b9109s"
-        }
+        } 
     ], 
     "annotations": [
         {
@@ -609,13 +26,14 @@
         }
     ], 
     "authoredBy": {
-        "name": "Ravi Madduri", 
-        "orcid": "http://orcid.org/0000-0003-2130-2887"
+        "name": "Stian Soiland-Reyes", 
+	"uri": "mbox:stain@apache.org",
+        "orcid": "https://orcid.org/0000-0001-9842-9718"
     }, 
-    "authoredOn": "2018-02-14T21:25:20+00:00", 
+    "authoredOn": "2018-05-10T16:07:00+00:00", 
     "createdBy": {
         "name": "BDBag version: 1.1.5 (Bagit version: 1.6.3)", 
         "uri": "https://github.com/ini-bdds/bdbag"
     }, 
-    "createdOn": "2018-02-14T21:25:20+00:00"
-}
\ No newline at end of file
+    "createdOn": "2018-05-10T16:07:00+00:00"
+}


[08/14] incubator-taverna-language git commit: Can't expect to parse annotations with no "content"

Posted by st...@apache.org.
Can't expect to parse annotations with no "content"

.. as they were slightly wrong from BDBAg example
using "uri" property instead.


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/2cb004de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/2cb004de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/2cb004de

Branch: refs/heads/master
Commit: 2cb004deb1b7fe5770b9aadc20cf398929d07cf2
Parents: ea43200
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Thu May 10 18:21:46 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Thu May 10 18:22:40 2018 +0100

----------------------------------------------------------------------
 .../taverna/robundle/manifest/TestRDFToManifest.java     | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/2cb004de/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java b/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
index 13e099e..7ebc5ad 100644
--- a/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
+++ b/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
@@ -77,11 +77,14 @@ public class TestRDFToManifest {
 					author.getName());
 			assertEquals(URI.create("mbox:stain@apache.org"), 
 					author.getUri());
-			// FIXME: Why is ORCID not picked up?
-//			assertEquals(URI.create("https://orcid.org/0000-0001-9842-9718"),
-//					author.getOrcid());
+			assertEquals(URI.create("https://orcid.org/0000-0001-9842-9718"),
+					author.getOrcid());
 
-			// FIXME: Why are annotations not picked up?
+			
+			// FIXME: The BDBag got this wrong and used "uri" instead of "content", and so
+			// data/README accidentally became the ID of the annotation.
+			// That means that we can't find any annotations as we only pick up
+			// on those that have a "content"
 //			assertEquals(1, manifest.getAnnotations().size());
 //			PathAnnotation ann = manifest.getAnnotations().get(0);
 //			assertEquals(ro.getRoot().toUri(),


[09/14] incubator-taverna-language git commit: Avoid deprecated setProxy() method

Posted by st...@apache.org.
Avoid deprecated setProxy() method


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/76fc46fc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/76fc46fc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/76fc46fc

Branch: refs/heads/master
Commit: 76fc46fcc679b74643105f73c67516e7271fd5eb
Parents: 2cb004d
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Thu May 10 19:15:08 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Thu May 10 19:15:08 2018 +0100

----------------------------------------------------------------------
 .../org/apache/taverna/robundle/manifest/PathMetadata.java     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/76fc46fc/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/PathMetadata.java
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/PathMetadata.java b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/PathMetadata.java
index d145fdd..fe4ca04 100644
--- a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/PathMetadata.java
+++ b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/PathMetadata.java
@@ -8,9 +8,9 @@ package org.apache.taverna.robundle.manifest;
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -122,7 +122,7 @@ public class PathMetadata {
 	public Proxy getOrCreateBundledAs() {
 		if (bundledAs == null) {
 			bundledAs = new Proxy();
-			setProxy();
+			bundledAs.setURI();
 		}
 		return bundledAs;
 	}


[06/14] incubator-taverna-language git commit: bag-of-bags manifest

Posted by st...@apache.org.
bag-of-bags manifest

contains multiple conformsTo

from http://n2t.net/minid:b9vx04


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/eeb6704d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/eeb6704d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/eeb6704d

Branch: refs/heads/master
Commit: eeb6704ded62f46c11ae1de8c5da0ef81dffb27e
Parents: 2ca81c6
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Thu May 10 16:59:27 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Thu May 10 17:40:11 2018 +0100

----------------------------------------------------------------------
 .../test/resources/bag-of-bags-manifest.json    | 621 +++++++++++++++++++
 1 file changed, 621 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/eeb6704d/taverna-robundle/src/test/resources/bag-of-bags-manifest.json
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/test/resources/bag-of-bags-manifest.json b/taverna-robundle/src/test/resources/bag-of-bags-manifest.json
new file mode 100644
index 0000000..c7d1904
--- /dev/null
+++ b/taverna-robundle/src/test/resources/bag-of-bags-manifest.json
@@ -0,0 +1,621 @@
+{
+    "@context": [
+        "https://w3id.org/bundle/context"
+    ], 
+    "@id": "../", 
+    "aggregates": [
+        {
+            "bundledAs": {
+                "filename": "adrenal_gland.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b90h3c"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "blood_vessel.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9km3p"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "bone_element.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9b37v"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "brain.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b92m31"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "bronchus.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9t376"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "esophagus.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9jm3c"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "extraembryonic_structure.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9b387"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "eye.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9mx1b"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "gonad.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9wx0f"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "heart.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9nd6c"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "kidney.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9cw9v"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "large_intestine.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b94d5b"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "liver.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9vw96"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "lung.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9md5p"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "lymphatic_vessel.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9bw9j"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "lymphoblast.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b93d4n"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "mammary_gland.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9tw9w"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "mouth.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9kd5c"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "muscle_organ.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b99x05"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "pancreas.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b92d63"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "prostate_gland.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9t09x"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "skin.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b95d7d"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "spinal_cord.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9h67f"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "stomach.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9566z"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "thyroid_gland.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9wq1r"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "tongue.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9n67p"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "urinary_bladder.seed16.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9cq3v"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "adrenal_gland.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9cd6w"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "blood_vessel.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b97q3m"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "bone_element.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b93x22"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "brain.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9067s"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "bronchus.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9vh5w"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "esophagus.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9qq3z"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "extraembryonic_structure.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9m092"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "eye.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9g674"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "gonad.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9bh57"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "heart.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b96q39"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "kidney.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9310b"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "large_intestine.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9z67g"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "liver.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9th6z"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "lung.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9pq3n"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "lymphatic_vessel.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9k09r"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "lymphoblast.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9f686"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "mammary_gland.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b99h5x"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "mouth.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b95q4c"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "muscle_organ.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b92093"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "pancreas.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9x96t"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "prostate_gland.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9sh58"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "skin.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b91m5g"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "spinal_cord.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9j09f"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "stomach.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9d97j"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "thyroid_gland.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b98h47"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "tongue.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b94t2b"
+        }, 
+        {
+            "bundledAs": {
+                "filename": "urinary_bladder.seed20.tissue.bag.zip", 
+                "folder": "../data/"
+            }, 
+            "conformsTo": [
+                "https://tools.ietf.org/html/draft-kunze-bagit-14", 
+                "https://w3id.org/ro/bagit/profile"
+            ], 
+            "uri": "http://n2t.net/ark:/57799/b9109s"
+        }
+    ], 
+    "annotations": [
+        {
+            "about": "../", 
+            "oa:motivatedBy": {
+                "@id": "oa:describing"
+            }, 
+            "uri": "../data/README"
+        }
+    ], 
+    "authoredBy": {
+        "name": "Ravi Madduri", 
+        "orcid": "http://orcid.org/0000-0003-2130-2887"
+    }, 
+    "authoredOn": "2018-02-14T21:25:20+00:00", 
+    "createdBy": {
+        "name": "BDBag version: 1.1.5 (Bagit version: 1.6.3)", 
+        "uri": "https://github.com/ini-bdds/bdbag"
+    }, 
+    "createdOn": "2018-02-14T21:25:20+00:00"
+}
\ No newline at end of file


[11/14] incubator-taverna-language git commit: parse bundledAs and folder info

Posted by st...@apache.org.
parse bundledAs and folder info

.. in particular for aggregated URIs as in bag-of-bags-manifest.json


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/aaf3f2bd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/aaf3f2bd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/aaf3f2bd

Branch: refs/heads/master
Commit: aaf3f2bdea6ba9fb315ecde27ea5dc71b24aa559
Parents: b5dd34a
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Thu May 10 19:19:36 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Thu May 10 19:20:21 2018 +0100

----------------------------------------------------------------------
 .../robundle/manifest/RDFToManifest.java        | 53 +++++++++++++++++---
 .../robundle/manifest/TestRDFToManifest.java    | 11 ++--
 2 files changed, 50 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/aaf3f2bd/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/RDFToManifest.java
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/RDFToManifest.java b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/RDFToManifest.java
index 2976234..f0517eb 100644
--- a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/RDFToManifest.java
+++ b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/RDFToManifest.java
@@ -29,7 +29,9 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -93,8 +95,9 @@ public class RDFToManifest {
 	private static final String PROV_AQ_RDF = "/ontologies/prov-aq.rdf";
 	private static final String PROV_O = "http://www.w3.org/ns/prov-o#";
 	private static final String PROV_O_RDF = "/ontologies/prov-o.rdf";
-	@SuppressWarnings("unused")
+
 	private static final String RO = "http://purl.org/wf4ever/ro#";
+	private static final String RO_OWL = "/ontologies/ro.owl";
 
 	private static <T> ClosableIterable<T> iterate(ExtendedIterator<T> iterator) {
 		return new ClosableIterable<T>(iterator);
@@ -167,6 +170,12 @@ public class RDFToManifest {
 
 	private ObjectProperty alternateOf;
 
+	private ObjectProperty bundledAs;
+
+	private DatatypeProperty entryName;
+
+	private OntModel ro;
+
 	public RDFToManifest() {
 		loadOntologies();
 	}
@@ -258,7 +267,8 @@ public class RDFToManifest {
 		hasProxy = ontModel.getObjectProperty(BUNDLE + "hasProxy");
 		hasAnnotation = ontModel.getObjectProperty(BUNDLE + "hasAnnotation");
 		inFolder = ontModel.getObjectProperty(BUNDLE + "inFolder");
-		checkNotNull(hasProxy, hasAnnotation, inFolder);
+		bundledAs = ontModel.getObjectProperty(BUNDLE + "bundledAs");
+		checkNotNull(hasProxy, hasAnnotation, inFolder, bundledAs);
 		bundle = ontModel;
 	}
 
@@ -315,6 +325,7 @@ public class RDFToManifest {
 		loadPAV();
 		loadPROVAQ();
 		loadOA();
+		loadRO();
 		loadBundle();
 	}
 
@@ -394,9 +405,13 @@ public class RDFToManifest {
 		prov = ontModel;
 	}
 
-	@SuppressWarnings("deprecation")
-	private static void setPathProxy(PathMetadata meta, URI proxy) {
-		meta.setProxy(proxy);
+	protected synchronized void loadRO() {
+		if (ro != null)
+			return;
+		OntModel ontModel = loadOntologyFromClasspath(RO_OWL, RO);
+		entryName = ontModel.getDatatypeProperty(RO + "entryName");
+		checkNotNull(ontModel, entryName);
+		ro = ontModel;
 	}
 
 	public void readTo(InputStream manifestResourceAsStream, Manifest manifest,
@@ -511,11 +526,14 @@ public class RDFToManifest {
 			PathMetadata meta = manifest.getAggregation(relativizeFromBase(
 					uriStr, root));
 
-			// hasProxy
 			Set<Individual> proxies = listObjectProperties(aggrResource,
 					hasProxy);
+			if (proxies.isEmpty()) {
+				// FIXME: Jena does not follow OWL properties paths from hasProxy
+				proxies = listObjectProperties(aggrResource, bundledAs);
+			}
 			if (!proxies.isEmpty()) {
-				// We can only deal with the first one
+				// Should really only be one anyway
 				Individual proxy = proxies.iterator().next();
 
 				String proxyUri = null;
@@ -525,9 +543,28 @@ public class RDFToManifest {
 					proxyUri = proxy.getSameAs().getURI();
 				}
 
+				Proxy proxyInManifest = meta.getOrCreateBundledAs();
 				if (proxyUri != null) {
-					setPathProxy(meta, relativizeFromBase(proxyUri, root));
+					proxyInManifest.setURI(relativizeFromBase(proxyUri, root));
+				}
+
+				RDFNode eName = proxy.getPropertyValue(entryName);
+				if (eName != null && eName.isLiteral()) {
+					proxyInManifest.setFilename(eName.asLiteral().getString());;
 				}
+				RDFNode folder = proxy.getPropertyValue(inFolder);
+				if (folder != null && folder.isURIResource()) {
+					URI folderUri = URI.create(folder.asResource().getURI());
+					if (! folderUri.resolve("/").equals(manifest.getBaseURI())) {
+						logger.warning("Invalid bundledAs folder, outside base URI of RO: " + folderUri);
+						continue;
+					}
+					Path folderPath = Paths.get(folderUri);
+					// Note: folder need NOT exist in zip file, so we don't need to do
+					// Files.createDirectories(folderPath);
+					proxyInManifest.setFolder(folderPath);
+				}
+
 			}
 
 			// createdBy

http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/aaf3f2bd/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java b/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
index 7ebc5ad..12fd543 100644
--- a/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
+++ b/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
@@ -79,7 +79,6 @@ public class TestRDFToManifest {
 					author.getUri());
 			assertEquals(URI.create("https://orcid.org/0000-0001-9842-9718"),
 					author.getOrcid());
-
 			
 			// FIXME: The BDBag got this wrong and used "uri" instead of "content", and so
 			// data/README accidentally became the ID of the annotation.
@@ -108,11 +107,11 @@ public class TestRDFToManifest {
 
 			
 			Proxy bundledAs = a1.getBundledAs();
-			// FIXME: Why is there no bundledAs?
-//			assertNotNull(bundledAs);
-//			assertEquals(ro.getPath("data"), 
-//					bundledAs.getFolder());			
-//			assertEquals("bag1.zip", a1.getBundledAs().getFilename());
+			assertNotNull(bundledAs);
+			// FIXME: Why is there no bundledAs data?
+			assertEquals(ro.getPath("data"), 
+					bundledAs.getFolder());			
+			assertEquals("bag1.zip", a1.getBundledAs().getFilename());
 
 			// TODO: Enable fetching based on bundledAs URI?
 			//ro.getRoot().resolve("data/bag1.zip")


[13/14] incubator-taverna-language git commit: TAVERNA-1047: Ensure annotations have /.ro/ relative URIs

Posted by st...@apache.org.
TAVERNA-1047: Ensure annotations have /.ro/ relative URIs


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/3336e75e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/3336e75e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/3336e75e

Branch: refs/heads/master
Commit: 3336e75e396fad0594db3b761aea8d10a95d3a92
Parents: 71708bc
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Fri May 11 09:42:56 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Fri May 11 09:42:56 2018 +0100

----------------------------------------------------------------------
 .../robundle/manifest/PathAnnotation.java       | 29 ++++++++++++++------
 1 file changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/3336e75e/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/PathAnnotation.java
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/PathAnnotation.java b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/PathAnnotation.java
index 17783f7..451be52 100644
--- a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/PathAnnotation.java
+++ b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/PathAnnotation.java
@@ -8,9 +8,9 @@ package org.apache.taverna.robundle.manifest;
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -25,6 +25,7 @@ import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
+import java.util.stream.Collectors;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
@@ -87,15 +88,26 @@ public class PathAnnotation {
 	}
 
 	private URI relativizePath(Path path) {
-		return URI.create("/.ro/").relativize(
+		return relativizeUri(
 				URI.create(path.toUri().getRawPath()));
 	}
 
+	private URI relativizeUri(URI relativeOrAbsolute) {
+		// NOTE: We can't fix absolute URIs within the RO bundle here, as
+		// we don't know the root. We can however get rid of "/.ro/"
+		// if it is present.
+		return URI.create("/.ro/").relativize(relativeOrAbsolute);
+	}
+
 	public void setAbout(List<URI> about) {
 		if (about == null) {
 			throw new NullPointerException("about list can't be null");
 		}
-		this.about = about;
+		// Relativize if needed.
+		// Note: This will also ensure we make a copy of the list.
+		this.about = about.stream()
+				.map(this::relativizeUri)
+				.collect(Collectors.toList());
 	}
 
 	public void setAbout(Path path) {
@@ -105,7 +117,7 @@ public class PathAnnotation {
 	public void setAbout(URI about) {
 		this.about.clear();
 		if (about != null) {
-			this.about.add(about);
+			this.about.add(relativizeUri(about));
 		}
 	}
 
@@ -119,15 +131,16 @@ public class PathAnnotation {
 	}
 
 	public void setContent(URI content) {
-		this.content = content;
+		this.content = relativizeUri(content);
 	}
 
 	public void setUri(URI uri) {
-		this.uri = uri;
+		// Normally absolute urn:uuid: URIs, but just in case..
+		this.uri = relativizeUri(uri);
 	}
 
 	@Override
 	public String toString() {
-		return "Annotation: " + getContent() + " about " + getAbout();
+		return "Annotation: " + getContent() + " about " + getAboutList();
 	}
 }


[14/14] incubator-taverna-language git commit: TAVERNA-1048: Look up annotations by Path/URI

Posted by st...@apache.org.
TAVERNA-1048: Look up annotations by Path/URI


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/e50826e6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/e50826e6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/e50826e6

Branch: refs/heads/master
Commit: e50826e6439c1a3f5c1f01e7b1e437e613d5ee90
Parents: 3336e75
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Fri May 11 09:44:59 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Fri May 11 09:44:59 2018 +0100

----------------------------------------------------------------------
 .../taverna/robundle/manifest/Manifest.java     | 46 +++++++++++++++++---
 1 file changed, 39 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/e50826e6/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/Manifest.java
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/Manifest.java b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/Manifest.java
index 50979bf..437d9f9 100644
--- a/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/Manifest.java
+++ b/taverna-robundle/src/main/java/org/apache/taverna/robundle/manifest/Manifest.java
@@ -8,9 +8,9 @@ package org.apache.taverna.robundle.manifest;
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -27,7 +27,6 @@ import static java.nio.file.FileVisitResult.CONTINUE;
 import static java.nio.file.FileVisitResult.SKIP_SUBTREE;
 import static java.nio.file.Files.createDirectories;
 import static java.nio.file.Files.getLastModifiedTime;
-import static java.nio.file.Files.isDirectory;
 import static java.nio.file.Files.newBufferedWriter;
 import static java.nio.file.Files.walkFileTree;
 import static java.nio.file.StandardOpenOption.CREATE;
@@ -53,8 +52,10 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 import java.util.logging.Logger;
+import java.util.stream.Collectors;
 
 import org.apache.taverna.robundle.Bundle;
 import org.apache.taverna.robundle.manifest.combine.CombineManifest;
@@ -150,6 +151,36 @@ public class Manifest {
 		return annotations;
 	}
 
+	@JsonIgnore
+	public Optional<PathAnnotation> getAnnotation(URI annotation) {
+		return getAnnotations().stream()
+				.filter(a -> annotation.equals(a.getUri()))
+				.findAny();
+	}
+
+	@JsonIgnore
+	public List<PathAnnotation> getAnnotations(final URI about) {
+		final URI aboutAbs;
+		URI manifestBase = getBaseURI().resolve(RO + "/" + MANIFEST_JSON);
+		if (about.isAbsolute()) {
+			aboutAbs = about;
+		} else {
+			aboutAbs = manifestBase.resolve(about);
+		}
+		// Compare absolute URIs against absolute URIs
+		return getAnnotations().stream()
+					.filter(a -> a.getAboutList().stream()
+							.map(manifestBase::resolve)
+							.filter(aboutAbs::equals)
+							.findAny().isPresent())
+					.collect(Collectors.toList());
+	}
+
+	@JsonIgnore
+	public List<PathAnnotation> getAnnotations(Path about) {
+		return getAnnotations(about.toUri());
+	}
+
 	public List<Agent> getAuthoredBy() {
 		return authoredBy;
 	}
@@ -221,9 +252,9 @@ public class Manifest {
 
 	/**
 	 * Guess media type based on extension
-	 * 
+	 *
 	 * @see http://wf4ever.github.io/ro/bundle/#media-types
-	 * 
+	 *
 	 * @param file
 	 *            A Path to a file
 	 * @return media-type, e.g. <code>application/xml</code> or
@@ -433,7 +464,7 @@ public class Manifest {
 
 	/**
 	 * Write as an RO Bundle JSON-LD manifest
-	 * 
+	 *
 	 * @return The path of the written manifest (e.g. ".ro/manifest.json")
 	 * @throws IOException
 	 */
@@ -461,7 +492,7 @@ public class Manifest {
 
 	/**
 	 * Write as a ODF manifest.xml
-	 * 
+	 *
 	 * @see http
 	 *      ://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part3.
 	 *      html#__RefHeading__752807_826425813
@@ -471,4 +502,5 @@ public class Manifest {
 	public Path writeAsODFManifest() throws IOException {
 		return new ODFManifest(this).createManifestXML();
 	}
+
 }


[12/14] incubator-taverna-language git commit: Complete test parsing of example manifest.json

Posted by st...@apache.org.
Complete test parsing of example manifest.json


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/71708bc3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/71708bc3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/71708bc3

Branch: refs/heads/master
Commit: 71708bc35f03f551bbbd70fe7501a03b99f7bda8
Parents: aaf3f2b
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Fri May 11 09:38:40 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Fri May 11 09:38:40 2018 +0100

----------------------------------------------------------------------
 .../robundle/manifest/TestRDFToManifest.java    | 164 +++++++++++++++++--
 1 file changed, 146 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/71708bc3/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
----------------------------------------------------------------------
diff --git a/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java b/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
index 12fd543..a5d6835 100644
--- a/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
+++ b/taverna-robundle/src/test/java/org/apache/taverna/robundle/manifest/TestRDFToManifest.java
@@ -1,7 +1,6 @@
 package org.apache.taverna.robundle.manifest;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -10,9 +9,9 @@ import static org.junit.Assert.assertNotEquals;
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -21,13 +20,16 @@ import static org.junit.Assert.assertNotEquals;
  * under the License.
  */
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.InputStream;
 import java.net.URI;
+import java.time.Instant;
 import java.util.Arrays;
-import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 import org.apache.taverna.robundle.Bundle;
 import org.apache.taverna.robundle.Bundles;
@@ -55,7 +57,133 @@ public class TestRDFToManifest {
 				retrievedFrom);
 
 	}
-	
+
+	@Test
+	public void manifestFromSpec() throws Exception {
+		try (Bundle ro = Bundles.createBundle();
+			 InputStream json = getClass().getResourceAsStream("/manifest.json")) {
+			// Make a new, empty manifest we can inspect
+			assertNotNull("Can't find manifest.json", json);
+			Manifest manifest = new Manifest(ro);
+
+			URI baseURI = ro.getPath(".ro/manifest.json").toUri();
+			new RDFToManifest().readTo(json, manifest, baseURI);
+
+			assertEquals(Arrays.asList(ro.getPath("/.ro/manifest.json")),
+						manifest.getManifest());
+
+			assertEquals(URI.create("http://example.com/retrieved"),
+					manifest.getRetrievedFrom());
+			assertEquals(Instant.parse("2013-03-05T17:29:03Z"),
+					manifest.getRetrievedOn().toInstant());
+
+			Agent retrievedBy = manifest.getRetrievedBy();
+			assertEquals("John P. Smith",
+					retrievedBy.getName());
+			assertEquals(URI.create("http://example.com/foaf#john"),
+					retrievedBy.getUri());
+			assertEquals(URI.create("http://orcid.org/0000-0002-1825-0100"),
+					retrievedBy.getOrcid());
+
+			assertEquals(Instant.parse("2013-03-05T17:29:03Z"),
+					manifest.getCreatedOn().toInstant());
+			Agent createdBy = manifest.getCreatedBy();
+			assertEquals("Alice W. Land",
+					createdBy.getName());
+			assertEquals(URI.create("http://example.com/foaf#alice"),
+					createdBy.getUri());
+			assertEquals(URI.create("http://orcid.org/0000-0002-1825-0097"),
+					createdBy.getOrcid());
+
+			assertEquals(Arrays.asList(ro.getPath(".ro/evolution.ttl")),
+						manifest.getHistory());
+
+			// As manifest.getAggregation() will create non-existing entries
+			// we will check the list of URIs first
+			Set<URI> aggregatedUris = manifest.getAggregates().stream()
+				.map(PathMetadata::getUri)
+				.collect(Collectors.toSet());
+			System.out.println(aggregatedUris);
+			// Compare as Set as order is not necessarily preserved
+			assertTrue(aggregatedUris.contains(URI.create("/folder/soup.jpeg")));
+			assertTrue(aggregatedUris.contains(URI.create("http://example.com/blog/")));
+			assertTrue(aggregatedUris.contains(URI.create("/README.txt")));
+			assertTrue(aggregatedUris.contains(URI.create("http://example.com/comments.txt")));
+			assertEquals(4, manifest.getAggregates().size());
+
+
+			PathMetadata soup = manifest.getAggregation(ro.getPath("folder/soup.jpeg"));
+			assertEquals(URI.create("http://example.com/retrieved/soup.jpeg"),
+					soup.getRetrievedFrom());
+			assertEquals(Instant.parse("2013-03-05T17:29:04Z"),
+					soup.getRetrievedOn().toInstant());
+			Agent peter = soup.getRetrievedBy();
+			assertEquals("Peter L. Jones",
+					peter.getName());
+			assertEquals(URI.create("http://example.com/foaf#peter"),
+					peter.getUri());
+			assertEquals(URI.create("http://orcid.org/0000-0002-1825-0120"),
+					peter.getOrcid());
+
+			PathMetadata blog = manifest.getAggregation(URI.create("http://example.com/blog/"));
+			// No additional metadata
+			assertNull(blog.getRetrievedFrom());
+			assertNull(blog.getRetrievedBy());
+			assertNull(blog.getRetrievedOn());
+			assertNull(blog.getCreatedBy());
+			assertNull(blog.getCreatedOn());
+			// NOTE: bundledAs might be created later when saving the manifest
+			assertNull(blog.getBundledAs());
+
+			PathMetadata readme = manifest.getAggregation(ro.getPath("/README.txt"));
+			assertEquals("text/plain", readme.getMediatype());
+			assertEquals("Bob Builder", readme.getCreatedBy().getName());
+			assertEquals(URI.create("http://example.com/foaf#bob"), readme.getCreatedBy().getUri());
+
+			PathMetadata comments = manifest.getAggregation(URI.create("http://example.com/comments.txt"));
+			Proxy bundledAs = comments.getBundledAs();
+			assertEquals(URI.create("urn:uuid:a0cf8616-bee4-4a71-b21e-c60e6499a644"),
+					bundledAs.getURI());
+			// TAVERNA-1043 - should work looking up "folder" even though JSON says "/folder/"
+			assertEquals(ro.getPath("folder"), bundledAs.getFolder());
+			assertEquals("external.txt", bundledAs.getFilename());
+
+
+			// Again, these could be in any order
+			assertEquals(3, manifest.getAnnotations().size());
+			// annotation 1
+			PathAnnotation ann1 = manifest.getAnnotation(URI.create("urn:uuid:d67466b4-3aeb-4855-8203-90febe71abdf")).get();
+			assertEquals(URI.create("urn:uuid:d67466b4-3aeb-4855-8203-90febe71abdf"), ann1.getUri());
+			assertEquals(URI.create("/folder/soup.jpeg"), ann1.getAbout());
+			assertEquals(URI.create("annotations/soup-properties.ttl"), ann1.getContent());
+
+			// annotation 2
+			PathAnnotation ann2 = manifest.getAnnotations(URI.create("urn:uuid:a0cf8616-bee4-4a71-b21e-c60e6499a644")).get(0);
+			assertEquals(URI.create("urn:uuid:a0cf8616-bee4-4a71-b21e-c60e6499a644"), ann2.getAbout());
+			assertEquals(URI.create("http://example.com/blog/they-aggregated-our-file"),
+					ann2.getContent());
+
+			// annotation 3
+			PathAnnotation ann3 = manifest.getAnnotations(ro.getRoot()).get(0);
+			// Can be retrieved either by Path, relative URI or absolute URI
+			assertEquals(ann3,
+					manifest.getAnnotations(URI.create("/")).get(0));
+			assertEquals(ann3,
+					manifest.getAnnotations(ro.getRoot().toUri()).get(0));
+			// Or by the second 'about' URI
+			assertEquals(ann3,
+					manifest.getAnnotations(URI.create("urn:uuid:d67466b4-3aeb-4855-8203-90febe71abdf")).get(0));
+			// single content
+			assertEquals(URI.create("annotations/a-meta-annotation-in-this-ro.txt"),
+					ann3.getContent());
+			// multiple about
+			assertEquals(2, ann3.getAboutList().size());
+			// ... but order not necessarily preserved
+			assertTrue(ann3.getAboutList().contains(URI.create("urn:uuid:d67466b4-3aeb-4855-8203-90febe71abdf")));
+			assertTrue(ann3.getAboutList().contains(URI.create("/")));
+		}
+	}
+
 	@Test
 	public void multipleConformsTo() throws Exception {
 		try (Bundle ro = Bundles.createBundle();
@@ -63,9 +191,9 @@ public class TestRDFToManifest {
 			// Make a new, empty manifest we can inspect
 			assertNotNull("Can't find bag-of-bags-manifest.json", json);
 			Manifest manifest = new Manifest(ro);
-			
+
 			// NOTE: Uses RO-BagIt folder metadata/ instead of .ro/
-			URI baseURI = ro.getPath("metadata/manifest.json").toUri();			
+			URI baseURI = ro.getPath("metadata/manifest.json").toUri();
 			new RDFToManifest().readTo(json, manifest, baseURI);
 
 			// Check basic metadata
@@ -73,13 +201,13 @@ public class TestRDFToManifest {
 					manifest.getCreatedBy().getUri());
 			assertEquals(1, manifest.getAuthoredBy().size());
 			Agent author = manifest.getAuthoredBy().get(0);
-			assertEquals("Stian Soiland-Reyes", 
+			assertEquals("Stian Soiland-Reyes",
 					author.getName());
-			assertEquals(URI.create("mbox:stain@apache.org"), 
+			assertEquals(URI.create("mbox:stain@apache.org"),
 					author.getUri());
 			assertEquals(URI.create("https://orcid.org/0000-0001-9842-9718"),
 					author.getOrcid());
-			
+
 			// FIXME: The BDBag got this wrong and used "uri" instead of "content", and so
 			// data/README accidentally became the ID of the annotation.
 			// That means that we can't find any annotations as we only pick up
@@ -89,33 +217,33 @@ public class TestRDFToManifest {
 //			assertEquals(ro.getRoot().toUri(),
 //					ann.getAbout());
 //			assertEquals(ro.getPath("data/README").toUri(), ann.getContent());
-			
+
 			// Now let's check aggregations
 			assertEquals(1, manifest.getAggregates().size());
 			// As aggregates order is not preserved, for simplicity this test
-			// has only one aggregation			
+			// has only one aggregation
 			PathMetadata a1 = manifest.getAggregates().get(0);
 			URI uri = URI.create("http://n2t.net/ark:/57799/b90h3c");
 			assertEquals(uri, a1.getUri());
 			assertEquals(a1, manifest.getAggregation(uri));
-			
+
 			// FIXME: More than one?
 			assertEquals(URI.create("https://w3id.org/ro/bagit/profile"),
 					a1.getConformsTo());
 //			assertEquals(URI.create("https://tools.ietf.org/html/draft-kunze-bagit-14"),
 //					a1.getConformsTo());
 
-			
+
 			Proxy bundledAs = a1.getBundledAs();
 			assertNotNull(bundledAs);
 			// FIXME: Why is there no bundledAs data?
-			assertEquals(ro.getPath("data"), 
-					bundledAs.getFolder());			
+			assertEquals(ro.getPath("data"),
+					bundledAs.getFolder());
 			assertEquals("bag1.zip", a1.getBundledAs().getFilename());
 
 			// TODO: Enable fetching based on bundledAs URI?
 			//ro.getRoot().resolve("data/bag1.zip")
-			
-		}				
+
+		}
 	}
 }