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:28 UTC

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

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();