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 2015/02/23 11:05:07 UTC
[22/79] [partial] incubator-taverna-language git commit: Revert
"temporarily empty repository"
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/main/java/org/apache/taverna/scufl2/rdfxml/impl/NamespacePrefixMapperJAXB_RI.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/main/java/org/apache/taverna/scufl2/rdfxml/impl/NamespacePrefixMapperJAXB_RI.java b/taverna-scufl2-rdfxml/src/main/java/org/apache/taverna/scufl2/rdfxml/impl/NamespacePrefixMapperJAXB_RI.java
new file mode 100644
index 0000000..822419a
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/main/java/org/apache/taverna/scufl2/rdfxml/impl/NamespacePrefixMapperJAXB_RI.java
@@ -0,0 +1,54 @@
+package org.apache.taverna.scufl2.rdfxml.impl;
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+
+import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
+
+public class NamespacePrefixMapperJAXB_RI extends NamespacePrefixMapper {
+ @Override
+ public String getPreferredPrefix(String namespaceUri, String suggestion,
+ boolean requirePrefix) {
+ switch (namespaceUri) {
+ case "http://www.w3.org/2001/XMLSchema-instance":
+ return "xsi";
+ case "http://ns.taverna.org.uk/2010/scufl2#":
+ return ""; // default
+ case "http://www.w3.org/1999/02/22-rdf-syntax-ns#":
+ return "rdf";
+ case "http://www.w3.org/2000/01/rdf-schema#":
+ return "rdfs";
+ case "http://purl.org/dc/elements/1.1/":
+ return "dc";
+ case "http://purl.org/dc/terms/":
+ return "dcterms";
+ case "http://www.w3.org/2002/07/owl#":
+ return "owl";
+ default:
+ return suggestion;
+ }
+ }
+
+ @Override
+ public String[] getPreDeclaredNamespaceUris() {
+ return new String[] {};
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/main/resources/META-INF/services/org.apache.taverna.scufl2.api.io.WorkflowBundleReader
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/main/resources/META-INF/services/org.apache.taverna.scufl2.api.io.WorkflowBundleReader b/taverna-scufl2-rdfxml/src/main/resources/META-INF/services/org.apache.taverna.scufl2.api.io.WorkflowBundleReader
new file mode 100644
index 0000000..42ee9f0
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/main/resources/META-INF/services/org.apache.taverna.scufl2.api.io.WorkflowBundleReader
@@ -0,0 +1 @@
+org.apache.taverna.scufl2.rdfxml.RDFXMLReader
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/main/resources/META-INF/services/org.apache.taverna.scufl2.api.io.WorkflowBundleWriter
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/main/resources/META-INF/services/org.apache.taverna.scufl2.api.io.WorkflowBundleWriter b/taverna-scufl2-rdfxml/src/main/resources/META-INF/services/org.apache.taverna.scufl2.api.io.WorkflowBundleWriter
new file mode 100644
index 0000000..d3370c3
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/main/resources/META-INF/services/org.apache.taverna.scufl2.api.io.WorkflowBundleWriter
@@ -0,0 +1 @@
+org.apache.taverna.scufl2.rdfxml.RDFXMLWriter
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/main/resources/META-INF/spring/scufl2-rdfxml-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/main/resources/META-INF/spring/scufl2-rdfxml-context-osgi.xml b/taverna-scufl2-rdfxml/src/main/resources/META-INF/spring/scufl2-rdfxml-context-osgi.xml
new file mode 100644
index 0000000..e05618f
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/main/resources/META-INF/spring/scufl2-rdfxml-context-osgi.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ 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
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:beans="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <service ref="rdfXMLReader" interface="org.apache.taverna.scufl2.api.io.WorkflowBundleReader" />
+
+ <service ref="rdfXMLWriter" interface="org.apache.taverna.scufl2.api.io.WorkflowBundleWriter" />
+
+</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/main/resources/META-INF/spring/scufl2-rdfxml-context.xml
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/main/resources/META-INF/spring/scufl2-rdfxml-context.xml b/taverna-scufl2-rdfxml/src/main/resources/META-INF/spring/scufl2-rdfxml-context.xml
new file mode 100644
index 0000000..2560aac
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/main/resources/META-INF/spring/scufl2-rdfxml-context.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ 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
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <bean id="rdfXMLReader" class="org.apache.taverna.scufl2.rdfxml.RDFXMLReader" />
+
+ <bean id="rdfXMLWriter" class="org.apache.taverna.scufl2.rdfxml.RDFXMLWriter" />
+
+</beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/DummyParserTest.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/DummyParserTest.java b/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/DummyParserTest.java
new file mode 100644
index 0000000..8f5d548
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/DummyParserTest.java
@@ -0,0 +1,100 @@
+package org.apache.taverna.scufl2.rdfxml;
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.taverna.scufl2.rdfxml.jaxb.ObjectFactory;
+import org.apache.taverna.scufl2.rdfxml.jaxb.Profile;
+import org.apache.taverna.scufl2.rdfxml.jaxb.ProfileDocument;
+import org.apache.taverna.scufl2.rdfxml.jaxb.Workflow;
+import org.apache.taverna.scufl2.rdfxml.jaxb.WorkflowBundle;
+import org.apache.taverna.scufl2.rdfxml.jaxb.WorkflowBundleDocument;
+import org.apache.taverna.scufl2.rdfxml.jaxb.WorkflowDocument;
+
+public class DummyParserTest {
+
+ private JAXBContext jaxbContext;
+ private Unmarshaller unmarshaller;
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void parse() throws Exception {
+ URL resource = getClass().getResource("example/workflowBundle.rdf");
+ URI baseUri = resource.toURI();
+
+ @SuppressWarnings("rawtypes")
+ JAXBElement<WorkflowBundleDocument> workflowBundle = (JAXBElement<WorkflowBundleDocument>) unmarshaller
+ .unmarshal(resource);
+ WorkflowBundleDocument bundleDoc = workflowBundle.getValue();
+ WorkflowBundle wfBundle = (WorkflowBundle) bundleDoc.getAny().get(0);
+
+ //System.out.println(wfBundle.getName());
+ //System.out.println(wfBundle.getMainWorkflow());
+ //System.out.println(wfBundle.getSameBaseAs().getResource());
+ for (WorkflowBundle.Workflow wfLink : wfBundle.getWorkflow()) {
+ String about = wfLink.getWorkflow().getAbout();
+ String seeAlso = wfLink.getWorkflow().getSeeAlso().getResource();
+
+ URI wfResource = baseUri.resolve(seeAlso);
+ JAXBElement<WorkflowDocument> unmarshalled = (JAXBElement<WorkflowDocument>) unmarshaller
+ .unmarshal(wfResource.toURL());
+ WorkflowDocument wfDoc = unmarshalled.getValue();
+ Workflow wf = (Workflow) wfDoc.getAny().get(0);
+ //System.out.println(about + " " + wf.getName());
+ }
+
+ for (WorkflowBundle.Profile profileLink : wfBundle.getProfile()) {
+ String about = profileLink.getProfile().getAbout();
+ String seeAlso = profileLink.getProfile().getSeeAlso()
+ .getResource();
+
+ URI profileResource = baseUri.resolve(seeAlso);
+ JAXBElement unmarshalled = (JAXBElement) unmarshaller
+ .unmarshal(profileResource.toURL());
+ ProfileDocument profileDoc = (ProfileDocument) unmarshalled
+ .getValue();
+ Profile profile = (Profile) profileDoc.getAny().get(0);
+ //System.out.println(about + " " + profile.getName());
+ }
+ }
+
+ @Before
+ public void makeUnmarshaller() throws JAXBException {
+
+ Class<?>[] packages = { ObjectFactory.class,
+ org.w3._1999._02._22_rdf_syntax_ns_.ObjectFactory.class,
+ org.w3._2000._01.rdf_schema_.ObjectFactory.class };
+ jaxbContext = JAXBContext.newInstance(packages);
+ unmarshaller = jaxbContext.createUnmarshaller();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestProfileParser.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestProfileParser.java b/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestProfileParser.java
new file mode 100644
index 0000000..a4cb052
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestProfileParser.java
@@ -0,0 +1,179 @@
+package org.apache.taverna.scufl2.rdfxml;
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Stack;
+
+import org.apache.taverna.scufl2.api.ExampleWorkflow;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.WorkflowBean;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+import org.apache.taverna.scufl2.rdfxml.ProfileParser;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class TestProfileParser {
+ private static final String PROFILE_RDF = "example/profile/tavernaWorkbench.rdf";
+
+ protected ProfileParser profileParser = new ProfileParser();
+
+ private URL profileUrl;
+
+ private WorkflowBundle bundle;
+
+ private Profile profile;
+
+ @Test
+ public void activity() throws Exception {
+ assertEquals(1, profile.getActivities().size());
+ Activity helloScript = profile.getActivities().getByName("HelloScript");
+ assertEquals("HelloScript", helloScript.getName());
+ assertEquals(
+"http://ns.taverna.org.uk/2010/activity/beanshell",
+ helloScript.getType().toASCIIString());
+ assertEquals(1, helloScript.getInputPorts().size());
+ InputActivityPort personName = helloScript.getInputPorts().getByName(
+ "personName");
+ assertEquals("personName", personName.getName());
+ assertEquals(0, personName.getDepth().intValue());
+
+ assertEquals(1, helloScript.getOutputPorts().size());
+ OutputActivityPort hello = helloScript.getOutputPorts().getByName(
+ "hello");
+ assertEquals("hello", hello.getName());
+ assertEquals(0, hello.getDepth().intValue());
+ assertEquals(0, hello.getGranularDepth().intValue());
+
+ }
+
+ @Test
+ public void configuration() throws Exception {
+ assertEquals(1, profile.getConfigurations().size());
+ Configuration hello = profile.getConfigurations().getByName("Hello");
+ assertEquals("Hello", hello.getName());
+ assertEquals(profile.getActivities().getByName("HelloScript"),
+ hello.getConfigures());
+ assertEquals(
+"http://ns.taverna.org.uk/2010/activity/beanshell#Config",
+ hello.getType().toASCIIString());
+ }
+
+ public void loadProfileDocument() {
+ profileUrl = getClass().getResource(PROFILE_RDF);
+ assertNotNull("Could not find profile document " + PROFILE_RDF,
+ profileUrl);
+ }
+
+ @Test
+ public void parserStackEmpty() throws Exception {
+ Stack<WorkflowBean> stack = profileParser.getParserState().getStack();
+ assertEquals(1, stack.size());
+ assertEquals(bundle, stack.peek());
+ }
+
+ @Test
+ public void portBindings() throws Exception {
+ ProcessorBinding hello = profile.getProcessorBindings().getByName(
+ "Hello");
+ assertEquals(1, hello.getInputPortBindings().size());
+ assertEquals(1, hello.getOutputPortBindings().size());
+
+ ProcessorInputPortBinding input = hello.getInputPortBindings()
+ .iterator().next();
+ InputActivityPort inputActivityPort = profile.getActivities()
+ .getByName("HelloScript").getInputPorts()
+ .getByName("personName");
+ assertEquals(inputActivityPort, input.getBoundActivityPort());
+
+ InputProcessorPort inputProcessorPort = bundle.getMainWorkflow()
+ .getProcessors().getByName("Hello").getInputPorts()
+ .getByName("name");
+ assertEquals(inputProcessorPort, input.getBoundProcessorPort());
+
+ ProcessorOutputPortBinding output = hello.getOutputPortBindings()
+ .iterator().next();
+ OutputActivityPort outputActivityPort = profile.getActivities()
+ .getByName("HelloScript").getOutputPorts().getByName("hello");
+ assertEquals(outputActivityPort, output.getBoundActivityPort());
+
+ OutputProcessorPort outputProcessorPort = bundle.getMainWorkflow()
+ .getProcessors().getByName("Hello").getOutputPorts()
+ .getByName("greeting");
+ assertEquals(outputProcessorPort, output.getBoundProcessorPort());
+
+ }
+
+ public void prepareParserState() throws URISyntaxException {
+ bundle = new ExampleWorkflow().makeWorkflowBundle();
+ bundle.getProfiles().clear();
+ bundle.setMainProfile(null);
+
+ profileParser.getParserState().setLocation(URI.create("/"));
+ profileParser.getParserState().push(bundle);
+ }
+
+ @Test
+ public void processorBinding() throws Exception {
+ assertEquals(1, profile.getProcessorBindings().size());
+ ProcessorBinding hello = profile.getProcessorBindings().getByName(
+ "Hello");
+ assertEquals(profile.getActivities().getByName("HelloScript"),
+ hello.getBoundActivity());
+ assertEquals(bundle.getMainWorkflow().getProcessors()
+ .getByName("Hello"), hello.getBoundProcessor());
+ assertEquals("Hello", hello.getName());
+ assertEquals(10, hello.getActivityPosition().intValue());
+ }
+
+ @Test
+ public void profileName() throws Exception {
+ assertEquals("tavernaWorkbench", profile.getName());
+ }
+
+ @Before
+ public void readProfile() throws Exception {
+ loadProfileDocument();
+ prepareParserState();
+ profileParser.readProfile(URI.create("/profile/tavernaWorkbench/"),
+ URI.create("profile/tavernaWorkbench.rdf"),
+ profileUrl.openStream());
+ profile = bundle.getProfiles().getByName("tavernaWorkbench");
+ assertNotNull(profile);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRDFXMLReader.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRDFXMLReader.java b/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRDFXMLReader.java
new file mode 100644
index 0000000..0ffccb1
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRDFXMLReader.java
@@ -0,0 +1,235 @@
+package org.apache.taverna.scufl2.rdfxml;
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+
+import static org.apache.taverna.scufl2.api.io.structure.StructureReader.TEXT_VND_TAVERNA_SCUFL2_STRUCTURE;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.io.output.ByteArrayOutputStream;
+import org.apache.taverna.scufl2.api.common.NamedSet;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.io.ReaderException;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
+import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+import org.apache.taverna.scufl2.rdfxml.RDFXMLSerializer;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+
+public class TestRDFXMLReader {
+
+ private static final String EXAMPLE_SCUFL2 = "example.wfbundle";
+ private URL exampleBundle;
+ public static final String APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE = "application/vnd.taverna.scufl2.workflow-bundle";
+ protected WorkflowBundle workflowBundle;
+ protected WorkflowBundleIO bundleIO = new WorkflowBundleIO();
+ org.apache.taverna.scufl2.api.io.TestWorkflowBundleIO testWorkflowBundleIO = new org.apache.taverna.scufl2.api.io.TestWorkflowBundleIO();
+
+ @Test
+ public void bundleName() throws Exception {
+ assertEquals("HelloWorld", workflowBundle.getName());
+ }
+
+ @Before
+ public void exampleBundle() throws ReaderException, IOException {
+ String name = EXAMPLE_SCUFL2;
+ exampleBundle = getClass().getResource(name);
+ assertNotNull("Can't find example workflow bundle " + name,
+ exampleBundle);
+ workflowBundle = bundleIO.readBundle(exampleBundle,
+ APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
+ }
+
+ @Test
+ public void iterationStrategy() throws Exception {
+ Processor hello = workflowBundle.getMainWorkflow().getProcessors()
+ .getByName("Hello");
+ assertEquals(1, hello.getIterationStrategyStack().size());
+ IterationStrategyTopNode iterationStrategyTopNode = hello
+ .getIterationStrategyStack().get(0);
+ assertTrue(iterationStrategyTopNode instanceof CrossProduct);
+ CrossProduct cross = (CrossProduct) iterationStrategyTopNode;
+ assertEquals(1, cross.size());
+ PortNode portNode = (PortNode) cross.get(0);
+ assertEquals(hello.getInputPorts().getByName("name"),
+ portNode.getInputProcessorPort());
+ assertEquals(0, portNode.getDesiredDepth().intValue());
+ }
+
+ @Test
+ public void iterationStrategyWait4Me() throws Exception {
+ Processor wait4me = workflowBundle.getMainWorkflow().getProcessors()
+ .getByName("wait4me");
+ assertEquals(0, wait4me.getIterationStrategyStack().size());
+ }
+
+ @Test
+ public void processorInputPorts() throws Exception {
+ Processor hello = workflowBundle.getMainWorkflow().getProcessors()
+ .getByName("Hello");
+ assertEquals(1, hello.getInputPorts().size());
+ assertEquals("name", hello.getInputPorts().getByName("name").getName());
+ assertEquals(0, hello.getInputPorts().getByName("name").getDepth()
+ .intValue());
+ }
+
+ @Test
+ public void processorOutputPorts() throws Exception {
+ Processor hello = workflowBundle.getMainWorkflow().getProcessors()
+ .getByName("Hello");
+ assertEquals(1, hello.getOutputPorts().size());
+ assertEquals("greeting", hello.getOutputPorts().getByName("greeting")
+ .getName());
+ assertEquals(0, hello.getOutputPorts().getByName("greeting").getDepth()
+ .intValue());
+ assertEquals(0, hello.getOutputPorts().getByName("greeting")
+ .getGranularDepth().intValue());
+ }
+
+ @Test
+ public void processorPortsWait4Me() throws Exception {
+ Processor wait4me = workflowBundle.getMainWorkflow().getProcessors()
+ .getByName("wait4me");
+ assertEquals(0, wait4me.getInputPorts().size());
+ assertEquals(0, wait4me.getOutputPorts().size());
+ }
+
+ @Test
+ public void processors() throws Exception {
+ Set<String> expected = new HashSet<String>();
+ expected.add("Hello");
+ expected.add("wait4me");
+ assertEquals(expected, workflowBundle.getMainWorkflow().getProcessors()
+ .getNames());
+ }
+
+ @Test
+ public void profiles() throws Exception {
+ assertEquals(2, workflowBundle.getProfiles().size());
+ Profile tavernaWorkbench = workflowBundle.getProfiles().getByName(
+ "tavernaWorkbench");
+ assertEquals("tavernaWorkbench", tavernaWorkbench.getName());
+ assertEquals(workflowBundle.getMainProfile(), tavernaWorkbench);
+ assertEquals("tavernaServer", workflowBundle.getProfiles().getByName("tavernaServer").getName());
+ }
+
+ @Test
+ public void globalBaseURI() throws Exception {
+ assertEquals("http://ns.taverna.org.uk/2010/workflowBundle/28f7c554-4f35-401f-b34b-516e9a0ef731/", workflowBundle.getGlobalBaseURI().toASCIIString());
+ }
+
+ // TODO: Un-ignore and update this test
+ @Ignore
+ @Test
+ public void testParsedWorkflow() throws Exception {
+ assertEquals("HelloWorld", workflowBundle.getName());
+
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ bundleIO.writeBundle(workflowBundle, output,
+ TEXT_VND_TAVERNA_SCUFL2_STRUCTURE);
+ String bundleTxt = new String(output.toByteArray(), "UTF-8");
+
+ assertEquals(testWorkflowBundleIO.getStructureFormatWorkflowBundle(),
+ bundleTxt);
+
+ }
+
+ @Test
+ public void guessMediaType() throws Exception {
+
+ byte[] firstBytes = new byte[1024];
+ getClass().getResourceAsStream(EXAMPLE_SCUFL2).read(firstBytes);
+ assertEquals(APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE, bundleIO.guessMediaTypeForSignature(firstBytes));
+ // Mess up the mime type string
+ firstBytes[45] = 32;
+ assertEquals(null, bundleIO.guessMediaTypeForSignature(firstBytes));
+ }
+
+ @Test
+ public void readStreamNoMediaType() throws ReaderException, IOException {
+ workflowBundle = bundleIO.readBundle(getClass().getResourceAsStream(EXAMPLE_SCUFL2), null);
+ assertNotNull(workflowBundle);
+ }
+
+ @Test
+ public void workflowIdentifier() throws Exception {
+ assertEquals(
+ "http://ns.taverna.org.uk/2010/workflow/00626652-55ae-4a9e-80d4-c8e9ac84e2ca/",
+ workflowBundle.getMainWorkflow().getIdentifier()
+ .toASCIIString());
+ }
+
+ @Test
+ public void workflowInputPorts() throws Exception {
+ NamedSet<InputWorkflowPort> inputPorts = workflowBundle
+ .getMainWorkflow().getInputPorts();
+ assertEquals(1, inputPorts.size());
+ assertEquals("yourName", inputPorts.getByName("yourName").getName());
+ assertEquals(0, inputPorts.getByName("yourName").getDepth().intValue());
+ }
+
+ @Test
+ public void workflowOutputPorts() throws Exception {
+ NamedSet<OutputWorkflowPort> outputPorts = workflowBundle
+ .getMainWorkflow().getOutputPorts();
+ assertEquals(1, outputPorts.size());
+ assertEquals("results", outputPorts.getByName("results").getName());
+ }
+
+ @Test
+ public void workflows() throws Exception {
+ assertEquals(1, workflowBundle.getWorkflows().size());
+ Workflow helloWorld = workflowBundle.getWorkflows().getByName(
+ "HelloWorld");
+ assertEquals("HelloWorld", helloWorld.getName());
+ assertEquals(workflowBundle.getMainWorkflow(), helloWorld);
+ }
+
+ @Test
+ public void xmlOutput() throws Exception {
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ new RDFXMLSerializer(workflowBundle).workflowDoc(output,
+ workflowBundle.getMainWorkflow(),
+ URI.create("workflows/HelloWorld.rdf"));
+ @SuppressWarnings("unused")
+ String bundleTxt = new String(output.toByteArray(), "UTF-8");
+// System.out.println(bundleTxt);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRDFXMLSerializer.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRDFXMLSerializer.java b/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRDFXMLSerializer.java
new file mode 100644
index 0000000..f44aab8
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRDFXMLSerializer.java
@@ -0,0 +1,490 @@
+package org.apache.taverna.scufl2.rdfxml;
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.commons.io.output.ByteArrayOutputStream;
+import org.apache.commons.io.output.NullOutputStream;
+import org.apache.taverna.scufl2.api.ExampleWorkflow;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.rdfxml.RDFXMLSerializer;
+import org.jdom.Attribute;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.Namespace;
+import org.jdom.input.SAXBuilder;
+import org.jdom.xpath.XPath;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+
+public class TestRDFXMLSerializer {
+ protected static final String TAVERNAWORKBENCH_RDF = "profile/tavernaWorkbench.rdf";
+ protected static final String TAVERNASERVER_RDF = "profile/tavernaServer.rdf";
+ protected static final String HELLOWORLD_RDF = "workflow/HelloWorld.rdf";
+ RDFXMLSerializer serializer = new RDFXMLSerializer();
+ ExampleWorkflow exampleWf = new ExampleWorkflow();
+ WorkflowBundle workflowBundle;
+
+ Namespace XSI_NS = Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
+ Namespace RDF_NS = Namespace.getNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
+ Namespace RDSF_NS = Namespace.getNamespace("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
+ Namespace SCUFL2_NS = Namespace.getNamespace("s", "http://ns.taverna.org.uk/2010/scufl2#");
+ Namespace BEANSHELL_NS = Namespace.getNamespace("beanshell",
+ "http://ns.taverna.org.uk/2010/activity/beanshell#");
+
+
+ protected void assertXpathEquals(String expected, Element element,
+ String xpath) throws JDOMException {
+ Object o = xpathSelectElement(element, xpath);
+ if (o == null) {
+ fail("Can't find " + xpath + " in " + element);
+ return;
+ }
+ String text;
+ if (o instanceof Attribute) {
+ text = ((Attribute)o).getValue();
+ } else {
+ text = ((Element)o).getValue();
+ }
+ assertEquals(expected, text);
+ }
+
+
+ protected void checkProfileDocument(Element root, boolean isWorkbench) throws JDOMException {
+
+ assertEquals("ProfileDocument", root.getAttributeValue("type", XSI_NS));
+ assertXpathEquals(isWorkbench ? "tavernaWorkbench/" : "tavernaServer/", root, "./@xml:base");
+
+ Element profile = (Element) root.getChildren().get(0);
+ Element activity = (Element) root.getChildren().get(1);
+ Element binding = (Element) root.getChildren().get(2);
+ Element configuration = (Element) root.getChildren().get(3);
+
+
+ assertSame(xpathSelectElement(root, "./s:Profile"), profile);
+ assertSame(xpathSelectElement(root, "./s:Activity"), activity);
+ assertSame(xpathSelectElement(root, "./s:ProcessorBinding"), binding);
+ assertSame(xpathSelectElement(root, "./s:Configuration"), configuration);
+
+ assertXpathEquals("", profile, "./@rdf:about");
+ assertXpathEquals(isWorkbench ? "tavernaWorkbench" : "tavernaServer", profile, "./s:name");
+ assertXpathEquals("processorbinding/Hello/", profile, "./s:processorBinding/@rdf:resource");
+ assertXpathEquals("configuration/Hello/", profile, "./s:activateConfiguration/@rdf:resource");
+
+ // activity
+ assertXpathEquals("activity/HelloScript/", activity, "./@rdf:about");
+ assertXpathEquals("HelloScript", activity, "./s:name");
+ assertXpathEquals("http://ns.taverna.org.uk/2010/activity/beanshell",
+ activity, "./rdf:type/@rdf:resource");
+ // activity input
+ assertXpathEquals("activity/HelloScript/in/personName", activity, "./s:inputActivityPort/s:InputActivityPort/@rdf:about");
+ assertXpathEquals("personName", activity, "./s:inputActivityPort/s:InputActivityPort/s:name");
+ assertXpathEquals("0", activity, "./s:inputActivityPort/s:InputActivityPort/s:portDepth");
+ assertXpathEquals("http://www.w3.org/2001/XMLSchema#integer", activity, "./s:inputActivityPort/s:InputActivityPort/s:portDepth/@rdf:datatype");
+ // activity output
+ assertXpathEquals("activity/HelloScript/out/hello", activity, "./s:outputActivityPort/s:OutputActivityPort/@rdf:about");
+ assertXpathEquals("hello", activity, "./s:outputActivityPort/s:OutputActivityPort/s:name");
+ assertXpathEquals("0", activity, "./s:outputActivityPort/s:OutputActivityPort/s:portDepth");
+ assertXpathEquals("http://www.w3.org/2001/XMLSchema#integer", activity, "./s:outputActivityPort/s:OutputActivityPort/s:portDepth/@rdf:datatype");
+ assertXpathEquals("0", activity, "./s:outputActivityPort/s:OutputActivityPort/s:granularPortDepth");
+ assertXpathEquals("http://www.w3.org/2001/XMLSchema#integer", activity, "./s:outputActivityPort/s:OutputActivityPort/s:granularPortDepth/@rdf:datatype");
+
+ // processor binding
+ assertXpathEquals("processorbinding/Hello/", binding, "./@rdf:about");
+ assertXpathEquals("Hello", binding, "./s:name");
+ assertXpathEquals("activity/HelloScript/", binding, "./s:bindActivity/@rdf:resource");
+ assertXpathEquals("../../workflow/HelloWorld/processor/Hello/", binding, "./s:bindProcessor/@rdf:resource");
+ // input port binding
+ assertXpathEquals("processorbinding/Hello/in/name", binding, "./s:inputPortBinding/s:InputPortBinding/@rdf:about");
+ assertXpathEquals("activity/HelloScript/in/personName", binding, "./s:inputPortBinding/s:InputPortBinding/s:bindInputActivityPort/@rdf:resource");
+ assertXpathEquals("../../workflow/HelloWorld/processor/Hello/in/name", binding, "./s:inputPortBinding/s:InputPortBinding/s:bindInputProcessorPort/@rdf:resource");
+ // output port binding
+ assertXpathEquals("processorbinding/Hello/out/greeting", binding, "./s:outputPortBinding/s:OutputPortBinding/@rdf:about");
+ assertXpathEquals("activity/HelloScript/out/hello", binding, "./s:outputPortBinding/s:OutputPortBinding/s:bindOutputActivityPort/@rdf:resource");
+ assertXpathEquals("../../workflow/HelloWorld/processor/Hello/out/greeting", binding, "./s:outputPortBinding/s:OutputPortBinding/s:bindOutputProcessorPort/@rdf:resource");
+
+
+ assertXpathEquals("configuration/Hello/", configuration, "./@rdf:about");
+ assertXpathEquals("configuration/Hello.json", configuration, "./rdfs:seeAlso/@rdf:resource");
+
+ assertXpathEquals(
+ "http://ns.taverna.org.uk/2010/activity/beanshell#Config",
+ configuration, "./rdf:type/@rdf:resource");
+ assertXpathEquals("Hello", configuration, "./s:name");
+ assertXpathEquals("activity/HelloScript/", configuration, "./s:configure/@rdf:resource");
+// assertXpathEquals("hello = \"Hello, \" + personName;\n" +
+// (isWorkbench ? "JOptionPane.showMessageDialog(null, hello);" : "System.out.println(\"Server says: \" + hello);"), configuration, "./beanshell:script");
+
+ }
+
+ protected void checkRoot(Element root) {
+ assertEquals(RDF_NS, root.getNamespace());
+ assertEquals("rdf", root.getNamespacePrefix());
+ assertEquals("RDF", root.getName());
+ assertEquals(SCUFL2_NS, root.getNamespace(""));
+ String schemaLocation = root.getAttributeValue("schemaLocation", XSI_NS);
+ schemaLocation = schemaLocation.replaceAll("\\s+", " ");
+ String[] schemaLocations = schemaLocation.split(" ");
+ String[] expectedSchemaLocations = {
+ "http://ns.taverna.org.uk/2010/scufl2#","http://ns.taverna.org.uk/2010/scufl2/scufl2.xsd",
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#","http://ns.taverna.org.uk/2010/scufl2/rdf.xsd"
+ };
+ assertArrayEquals(expectedSchemaLocations, schemaLocations);
+ }
+
+
+ protected void checkWorkflowBundleDocument(Element root) throws JDOMException {
+ assertEquals("WorkflowBundleDocument", root.getAttributeValue("type", XSI_NS));
+
+ assertXpathEquals("./", root, "./@xml:base");
+
+ Element wbundle = root.getChild("WorkflowBundle", SCUFL2_NS);
+ assertSame(wbundle, root.getChildren().get(0));
+
+
+
+ assertXpathEquals("", wbundle, "./@rdf:about");
+
+ assertXpathEquals("HelloWorld", wbundle, "./s:name");
+ assertXpathEquals("http://ns.taverna.org.uk/2010/workflowBundle/28f7c554-4f35-401f-b34b-516e9a0ef731/",
+ wbundle, "./s:globalBaseURI/@rdf:resource");
+
+ assertXpathEquals("workflow/HelloWorld/",
+ wbundle, "./s:mainWorkflow/@rdf:resource");
+ assertXpathEquals("workflow/HelloWorld/",
+ wbundle, "./s:workflow/s:Workflow/@rdf:about");
+ assertXpathEquals(HELLOWORLD_RDF,
+ wbundle, "./s:workflow/s:Workflow/rdfs:seeAlso/@rdf:resource");
+
+ assertXpathEquals("profile/tavernaWorkbench/",
+ wbundle, "./s:mainProfile/@rdf:resource");
+
+
+
+ assertXpathEquals("profile/tavernaServer/",
+ wbundle, "./s:profile[1]/s:Profile/@rdf:about");
+ assertXpathEquals("profile/tavernaServer.rdf", wbundle, "./s:profile[1]/s:Profile/rdfs:seeAlso/@rdf:resource");
+
+ assertXpathEquals("profile/tavernaWorkbench/",
+ wbundle, "./s:profile[2]/s:Profile/@rdf:about");
+ assertXpathEquals(TAVERNAWORKBENCH_RDF,
+ wbundle, "./s:profile[2]/s:Profile/rdfs:seeAlso/@rdf:resource");
+
+
+
+ }
+
+
+ protected void checkWorkflowDocument(Element root) throws JDOMException {
+ assertEquals("WorkflowDocument", root.getAttributeValue("type", XSI_NS));
+
+
+
+ assertXpathEquals("HelloWorld/", root, "./@xml:base");
+
+
+ Element wf = root.getChild("Workflow", SCUFL2_NS);
+ assertSame(wf, root.getChildren().get(0));
+
+ assertXpathEquals("", wf, "./@rdf:about");
+
+
+ assertXpathEquals("HelloWorld", wf, "./s:name");
+ assertXpathEquals("http://ns.taverna.org.uk/2010/workflow/00626652-55ae-4a9e-80d4-c8e9ac84e2ca/",
+ wf, "./s:workflowIdentifier/@rdf:resource");
+
+ assertXpathEquals("in/yourName",
+ wf, "./s:inputWorkflowPort/s:InputWorkflowPort/@rdf:about");
+ assertXpathEquals("yourName",
+ wf, "./s:inputWorkflowPort/s:InputWorkflowPort/s:name");
+ assertXpathEquals("0",
+ wf, "./s:inputWorkflowPort/s:InputWorkflowPort/s:portDepth");
+ assertXpathEquals("http://www.w3.org/2001/XMLSchema#integer",
+ wf, "./s:inputWorkflowPort/s:InputWorkflowPort/s:portDepth/@rdf:datatype");
+
+
+ assertXpathEquals("out/results",
+ wf, "./s:outputWorkflowPort/s:OutputWorkflowPort/@rdf:about");
+ assertXpathEquals("results",
+ wf, "./s:outputWorkflowPort/s:OutputWorkflowPort/s:name");
+
+
+ assertXpathEquals("processor/Hello/",
+ wf, "./s:processor[1]/s:Processor/@rdf:about");
+ assertXpathEquals("Hello",
+ wf, "./s:processor[1]/s:Processor/s:name");
+
+ assertXpathEquals("processor/Hello/in/name",
+ wf, "./s:processor[1]/s:Processor/s:inputProcessorPort/s:InputProcessorPort/@rdf:about");
+ assertXpathEquals("name",
+ wf, "./s:processor[1]/s:Processor/s:inputProcessorPort/s:InputProcessorPort/s:name");
+ assertXpathEquals("0",
+ wf, "./s:processor[1]/s:Processor/s:inputProcessorPort/s:InputProcessorPort/s:portDepth");
+ assertXpathEquals("http://www.w3.org/2001/XMLSchema#integer",
+ wf, "./s:processor[1]/s:Processor/s:inputProcessorPort/s:InputProcessorPort/s:portDepth/@rdf:datatype");
+
+
+
+ assertXpathEquals("processor/Hello/out/greeting",
+ wf, "./s:processor[1]/s:Processor/s:outputProcessorPort/s:OutputProcessorPort/@rdf:about");
+
+ assertXpathEquals("greeting",
+ wf, "./s:processor[1]/s:Processor/s:outputProcessorPort/s:OutputProcessorPort/s:name");
+ assertXpathEquals("0",
+ wf, "./s:processor[1]/s:Processor/s:outputProcessorPort/s:OutputProcessorPort/s:portDepth");
+ assertXpathEquals("http://www.w3.org/2001/XMLSchema#integer",
+ wf, "./s:processor[1]/s:Processor/s:outputProcessorPort/s:OutputProcessorPort/s:portDepth/@rdf:datatype");
+ assertXpathEquals("0",
+ wf, "./s:processor[1]/s:Processor/s:outputProcessorPort/s:OutputProcessorPort/s:granularPortDepth");
+ assertXpathEquals("http://www.w3.org/2001/XMLSchema#integer",
+ wf, "./s:processor[1]/s:Processor/s:outputProcessorPort/s:OutputProcessorPort/s:granularPortDepth/@rdf:datatype");
+
+ assertXpathEquals("processor/Hello/iterationstrategy/", wf, "./s:processor[1]/s:Processor/s:iterationStrategyStack/s:IterationStrategyStack/@rdf:about");
+ assertXpathEquals("Collection", wf, "./s:processor[1]/s:Processor/s:iterationStrategyStack/s:IterationStrategyStack/s:iterationStrategies/@rdf:parseType");
+ assertXpathEquals("processor/Hello/iterationstrategy/0/", wf, "./s:processor[1]/s:Processor/s:iterationStrategyStack/s:IterationStrategyStack/s:iterationStrategies/s:CrossProduct/@rdf:about");
+ assertXpathEquals("Collection", wf, "./s:processor[1]/s:Processor/s:iterationStrategyStack/s:IterationStrategyStack/s:iterationStrategies/s:CrossProduct/s:productOf/@rdf:parseType");
+ assertXpathEquals("processor/Hello/iterationstrategy/0/0/", wf, "./s:processor[1]/s:Processor/s:iterationStrategyStack/s:IterationStrategyStack/s:iterationStrategies/s:CrossProduct/s:productOf/s:PortNode/@rdf:about");
+ assertXpathEquals("processor/Hello/in/name", wf, "./s:processor[1]/s:Processor/s:iterationStrategyStack/s:IterationStrategyStack/s:iterationStrategies/s:CrossProduct/s:productOf/s:PortNode/s:iterateOverInputPort/@rdf:resource");
+ assertXpathEquals("0", wf, "./s:processor[1]/s:Processor/s:iterationStrategyStack/s:IterationStrategyStack/s:iterationStrategies/s:CrossProduct/s:productOf/s:PortNode/s:desiredDepth");
+ assertXpathEquals("http://www.w3.org/2001/XMLSchema#integer", wf, "./s:processor[1]/s:Processor/s:iterationStrategyStack/s:IterationStrategyStack/s:iterationStrategies/s:CrossProduct/s:productOf/s:PortNode/s:desiredDepth/@rdf:datatype");
+
+
+ assertXpathEquals("processor/wait4me/",
+ wf, "./s:processor[2]/s:Processor/@rdf:about");
+ assertXpathEquals("wait4me",
+ wf, "./s:processor[2]/s:Processor/s:name");
+
+
+ assertXpathEquals("datalink?from=processor/Hello/out/greeting&to=out/results&mergePosition=0",
+ wf, "./s:datalink[1]/s:DataLink/@rdf:about");
+
+ assertXpathEquals("datalink?from=in/yourName&to=processor/Hello/in/name",
+ wf, "./s:datalink[2]/s:DataLink/@rdf:about");
+
+ assertXpathEquals("datalink?from=in/yourName&to=out/results&mergePosition=1",
+ wf, "./s:datalink[3]/s:DataLink/@rdf:about");
+ assertXpathEquals("in/yourName",
+ wf, "./s:datalink[3]/s:DataLink/s:receiveFrom/@rdf:resource");
+ assertXpathEquals("out/results",
+ wf, "./s:datalink[3]/s:DataLink/s:sendTo/@rdf:resource");
+ assertXpathEquals("1",
+ wf, "./s:datalink[3]/s:DataLink/s:mergePosition");
+ assertXpathEquals("http://www.w3.org/2001/XMLSchema#integer",
+ wf, "./s:datalink[3]/s:DataLink/s:mergePosition/@rdf:datatype");
+
+ assertXpathEquals("control?block=processor/Hello/&untilFinished=processor/wait4me/",
+ wf, "./s:control/s:Blocking/@rdf:about");
+
+
+ assertXpathEquals("processor/Hello/",
+ wf, "./s:control/s:Blocking/s:block/@rdf:resource");
+ assertXpathEquals("processor/wait4me/",
+ wf, "./s:control/s:Blocking/s:untilFinished/@rdf:resource");
+
+ assertXpathEquals("datalink?from=processor/Hello/out/greeting&to=out/results&mergePosition=0",
+ wf, "./s:datalink[1]/s:DataLink/@rdf:about");
+ assertXpathEquals("processor/Hello/out/greeting",
+ wf, "./s:datalink[1]/s:DataLink/s:receiveFrom/@rdf:resource");
+ assertXpathEquals("out/results",
+ wf, "./s:datalink[1]/s:DataLink/s:sendTo/@rdf:resource");
+ assertXpathEquals("0",
+ wf, "./s:datalink[1]/s:DataLink/s:mergePosition");
+ assertXpathEquals("http://www.w3.org/2001/XMLSchema#integer",
+ wf, "./s:datalink[1]/s:DataLink/s:mergePosition/@rdf:datatype");
+
+
+
+ assertXpathEquals("datalink?from=in/yourName&to=processor/Hello/in/name",
+ wf, "./s:datalink[2]/s:DataLink/@rdf:about");
+ assertXpathEquals("in/yourName",
+ wf, "./s:datalink[2]/s:DataLink/s:receiveFrom/@rdf:resource");
+ assertXpathEquals("processor/Hello/in/name",
+ wf, "./s:datalink[2]/s:DataLink/s:sendTo/@rdf:resource");
+ assertNull(xpathSelectElement(wf, "./s:datalink[2]/s:DataLink/s:mergePosition"));
+
+
+
+ assertXpathEquals("datalink?from=in/yourName&to=out/results&mergePosition=1",
+ wf, "./s:datalink[3]/s:DataLink/@rdf:about");
+ assertXpathEquals("in/yourName",
+ wf, "./s:datalink[3]/s:DataLink/s:receiveFrom/@rdf:resource");
+ assertXpathEquals("out/results",
+ wf, "./s:datalink[3]/s:DataLink/s:sendTo/@rdf:resource");
+ assertXpathEquals("1",
+ wf, "./s:datalink[3]/s:DataLink/s:mergePosition");
+ assertXpathEquals("http://www.w3.org/2001/XMLSchema#integer",
+ wf, "./s:datalink[3]/s:DataLink/s:mergePosition/@rdf:datatype");
+
+ assertXpathEquals("control?block=processor/Hello/&untilFinished=processor/wait4me/",
+ wf, "./s:control/s:Blocking/@rdf:about");
+
+
+ assertXpathEquals("processor/Hello/",
+ wf, "./s:control/s:Blocking/s:block/@rdf:resource");
+ assertXpathEquals("processor/wait4me/",
+ wf, "./s:control/s:Blocking/s:untilFinished/@rdf:resource");
+
+ }
+
+ // TODO: Update tests
+ @Ignore
+ @Test
+ public void exampleProfileTavernaServer() throws Exception {
+ URL tavernaWorkbenc = getClass().getResource("example/profile/tavernaServer.rdf");
+ SAXBuilder saxBuilder = new SAXBuilder();
+ Document doc = saxBuilder.build(tavernaWorkbenc);
+ Element root = doc.getRootElement();
+
+ checkRoot(root);
+ checkProfileDocument(root, false);
+
+ }
+
+
+ // TODO: Update tests
+ @Ignore
+ @Test
+ public void exampleProfileTavernaWorkbench() throws Exception {
+ URL tavernaWorkbenc = getClass().getResource("example/profile/tavernaWorkbench.rdf");
+ SAXBuilder saxBuilder = new SAXBuilder();
+ Document doc = saxBuilder.build(tavernaWorkbenc);
+ Element root = doc.getRootElement();
+
+ checkRoot(root);
+ checkProfileDocument(root, true);
+
+ }
+
+ @Test
+ public void exampleWorkflow() throws Exception {
+ URL workflowURL = getClass().getResource("example/workflow/HelloWorld.rdf");
+ SAXBuilder saxBuilder = new SAXBuilder();
+ Document doc = saxBuilder.build(workflowURL);
+
+ Element root = doc.getRootElement();
+
+ checkRoot(root);
+ checkWorkflowDocument(root);
+
+ }
+
+
+ @Test
+ public void exampleWorkflowBundle() throws Exception {
+ URL workflowBundleURL = getClass().getResource("example/workflowBundle.rdf");
+
+
+ SAXBuilder saxBuilder = new SAXBuilder();
+ Document doc = saxBuilder.build(workflowBundleURL);
+
+ Element root = doc.getRootElement();
+
+ checkRoot(root);
+ checkWorkflowBundleDocument(root);
+
+ }
+
+
+ @Before
+ public void makeExampleWorkflow() {
+ workflowBundle = new ExampleWorkflow().makeWorkflowBundle();
+ serializer.setWfBundle(workflowBundle);
+ }
+
+
+ protected Document parseXml(ByteArrayOutputStream outStream)
+ throws JDOMException, IOException {
+ SAXBuilder saxBuilder = new SAXBuilder();
+ return saxBuilder.build(new ByteArrayInputStream(outStream.toByteArray()));
+ }
+
+
+ @Test
+ public void profile() throws Exception {
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ // To test that seeAlso URIs are stored
+ serializer.profileDoc(outStream, workflowBundle.getMainProfile(), URI.create(TAVERNAWORKBENCH_RDF));
+ //System.out.write(outStream.toByteArray());
+ Document doc = parseXml(outStream);
+ Element root = doc.getRootElement();
+
+ checkRoot(root);
+ checkProfileDocument(root, true);
+ }
+
+
+ @Test
+ public void workflow() throws Exception {
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ // To test that seeAlso URIs are stored
+ serializer.workflowDoc(outStream, workflowBundle.getMainWorkflow(), URI.create(HELLOWORLD_RDF));
+// System.out.write(outStream.toByteArray());
+ Document doc = parseXml(outStream);
+ Element root = doc.getRootElement();
+
+ checkRoot(root);
+ checkWorkflowDocument(root);
+ }
+
+ @Test
+ public void workflowBundle() throws Exception {
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ // To test that seeAlso URIs are stored
+ serializer.workflowDoc(new NullOutputStream(), workflowBundle.getMainWorkflow(), URI.create(HELLOWORLD_RDF));
+ serializer.profileDoc(new NullOutputStream(), workflowBundle.getProfiles().getByName("tavernaWorkbench"), URI.create(TAVERNAWORKBENCH_RDF));
+ serializer.profileDoc(new NullOutputStream(), workflowBundle.getProfiles().getByName("tavernaServer"), URI.create(TAVERNASERVER_RDF));
+
+ serializer.workflowBundleDoc(outStream, URI.create("workflowBundle.rdf"));
+ //System.out.write(outStream.toByteArray());
+ Document doc = parseXml(outStream);
+ Element root = doc.getRootElement();
+
+ checkRoot(root);
+ checkWorkflowBundleDocument(root);
+
+ }
+
+
+ protected Object xpathSelectElement(Element element, String xpath) throws JDOMException {
+ XPath x = XPath.newInstance(xpath);
+ x.addNamespace(SCUFL2_NS);
+ x.addNamespace(RDF_NS);
+ x.addNamespace(RDSF_NS);
+ x.addNamespace(BEANSHELL_NS);
+ //x.addNamespace(XML_NS);
+
+ return x.selectSingleNode(element);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRDFXMLWriter.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRDFXMLWriter.java b/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRDFXMLWriter.java
new file mode 100644
index 0000000..4ecad1b
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRDFXMLWriter.java
@@ -0,0 +1,158 @@
+package org.apache.taverna.scufl2.rdfxml;
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.TestWorkflowBundleIO;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.rdfxml.RDFXMLReader;
+import org.apache.taverna.scufl2.ucfpackage.UCFPackage;
+import org.apache.taverna.scufl2.ucfpackage.UCFPackage.ResourceEntry;
+import org.junit.Before;
+import org.junit.Test;
+
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+public class TestRDFXMLWriter {
+
+ private static final String APPLICATION_RDF_XML = "application/rdf+xml";
+ public static final String APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE = "application/vnd.taverna.scufl2.workflow-bundle";
+ protected WorkflowBundle workflowBundle;
+ protected WorkflowBundleIO bundleIO = new WorkflowBundleIO();
+
+ @Before
+ public void makeExampleWorkflow() {
+ workflowBundle = new TestWorkflowBundleIO().makeWorkflowBundle();
+ }
+
+ @Test
+ public void awkwardFilenames() throws Exception {
+ workflowBundle.getProfiles().removeByName("tavernaServer");
+ String funnyName = "Funny_%2f_characters_50%_of the time";
+ workflowBundle.getMainProfile().setName(funnyName);
+ workflowBundle.getMainWorkflow().setName(funnyName);
+ File bundleFile = tempFile();
+ bundleIO.writeBundle(workflowBundle, bundleFile,
+ APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
+ UCFPackage ucfPackage = new UCFPackage(bundleFile);
+ Map<String, ResourceEntry> profiles = ucfPackage.listResources("profile");
+ assertEquals(2, profiles.size());
+ assertTrue(profiles.keySet().contains("Funny_%252f_characters_50%25_of%20the%20time.rdf"));
+ assertTrue(profiles.keySet().contains("Funny_%252f_characters_50%25_of%20the%20time/"));
+
+ Map<String, ResourceEntry> workflows = ucfPackage.listResources("workflow");
+ assertEquals(1, workflows.size());
+ assertEquals("Funny_%252f_characters_50%25_of%20the%20time.rdf", workflows.keySet().iterator().next());
+
+ // and.. can we read it in again correctly?
+ WorkflowBundle readBundle = bundleIO.readBundle(bundleFile, APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
+ assertEquals(funnyName, readBundle.getMainProfile().getName());
+ assertEquals(funnyName, readBundle.getMainWorkflow().getName());
+ // did the JSON parse back in?
+ JsonNode oldJson = workflowBundle.getMainProfile().getConfigurations().getByName("Hello").getJson();
+ assertTrue(oldJson.get("script").asText().startsWith("hello"));
+ JsonNode newJson = readBundle.getMainProfile().getConfigurations().getByName("Hello").getJson();
+ assertTrue(newJson.get("script").asText().startsWith("hello"));
+ assertEquals(oldJson, newJson);
+ }
+
+ @Test
+ public void writeBundleToFile() throws Exception {
+ File bundleFile = tempFile();
+ bundleIO.writeBundle(workflowBundle, bundleFile,
+ APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
+ UCFPackage ucfPackage = new UCFPackage(bundleFile);
+ verifyRootFile(ucfPackage);
+ verifyPackageStructure(ucfPackage);
+ // TODO: Check RDF/XML using xpath
+ }
+
+ private void verifyRootFile(UCFPackage ucfPackage) {
+ List<ResourceEntry> rootFiles = ucfPackage.getRootFiles();
+ assertEquals(1, rootFiles.size());
+ assertEquals("workflowBundle.rdf", rootFiles.get(0).getPath());
+ assertEquals("application/rdf+xml", rootFiles.get(0).getMediaType());
+ assertEquals("0.4.0", rootFiles.get(0).getVersion());
+ }
+
+
+ @Test
+ public void writeBundleToStream() throws Exception {
+
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ bundleIO.writeBundle(workflowBundle, outStream,
+ APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
+ outStream.close();
+
+ InputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
+ UCFPackage ucfPackage;
+ try {
+ // Avoid UCFPackage from creating a temporary file
+ System.setProperty("org.odftoolkit.odfdom.tmpfile.disable", "true");
+ ucfPackage = new UCFPackage(inStream);
+ } finally {
+ System.clearProperty("org.odftoolkit.odfdom.tmpfile.disable");
+ }
+ verifyPackageStructure(ucfPackage);
+
+ }
+
+ protected void verifyPackageStructure(UCFPackage ucfPackage) {
+ assertEquals(
+ RDFXMLReader.APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE,
+ ucfPackage.getPackageMediaType());
+ assertEquals(APPLICATION_RDF_XML,
+ ucfPackage.getResourceEntry("workflowBundle.rdf")
+ .getMediaType());
+
+ assertEquals(APPLICATION_RDF_XML,
+ ucfPackage.getResourceEntry("workflow/HelloWorld.rdf")
+ .getMediaType());
+
+ assertEquals(APPLICATION_RDF_XML,
+ ucfPackage.getResourceEntry("profile/tavernaServer.rdf")
+ .getMediaType());
+ assertEquals(APPLICATION_RDF_XML,
+ ucfPackage.getResourceEntry("profile/tavernaWorkbench.rdf")
+ .getMediaType());
+ }
+
+ public File tempFile() throws IOException {
+ File bundleFile = File.createTempFile("test", ".scufl2");
+// bundleFile.deleteOnExit();
+ System.out.println(bundleFile);
+ return bundleFile;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestResourcesInZip.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestResourcesInZip.java b/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestResourcesInZip.java
new file mode 100644
index 0000000..2ac4bd2
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestResourcesInZip.java
@@ -0,0 +1,98 @@
+package org.apache.taverna.scufl2.rdfxml;
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+
+import static org.apache.taverna.scufl2.rdfxml.TestRDFXMLWriter.APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE;
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.taverna.scufl2.api.ExampleWorkflow;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.ucfpackage.UCFPackage;
+import org.junit.Before;
+import org.junit.Test;
+
+
+@SuppressWarnings("resource")
+public class TestResourcesInZip {
+
+ protected WorkflowBundleIO bundleIO = new WorkflowBundleIO();
+ protected ExampleWorkflow exampleWorkflow = new ExampleWorkflow();
+ protected WorkflowBundle originalBundle;
+
+
+ @Before
+ public void makeBundle() {
+ originalBundle = exampleWorkflow.makeWorkflowBundle();
+ }
+
+ @Test
+ public void singleFile() throws Exception {
+ UCFPackage resources = originalBundle.getResources();
+ assertEquals(APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE, resources.getPackageMediaType());
+ resources.addResource("Hello there", "hello.txt", "text/plain");
+ File bundleFile = tempFile();
+ bundleIO.writeBundle(originalBundle, bundleFile, APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
+ assertEquals(APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE, resources.getPackageMediaType());
+ assertEquals(1, resources.getRootFiles().size());
+ assertEquals("workflowBundle.rdf", resources.getRootFiles().get(0).getPath());
+
+ ZipFile zipFile = new ZipFile(bundleFile);
+ ZipEntry hello = zipFile.getEntry("hello.txt");
+ assertEquals("hello.txt", hello.getName());
+ assertEquals("Hello there",
+ IOUtils.toString(zipFile.getInputStream(hello), "ASCII"));
+ }
+
+ @Test
+ public void differentMediaType() throws Exception {
+ UCFPackage resources = originalBundle.getResources();
+ resources.setPackageMediaType("application/x-something-else");
+ assertEquals("application/x-something-else", resources.getPackageMediaType());
+
+ resources.addResource("Hello there", "hello.txt", "text/plain");
+ File bundleFile = tempFile();
+ bundleIO.writeBundle(originalBundle, bundleFile, APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
+ assertEquals("application/x-something-else", resources.getPackageMediaType());
+ assertEquals(0, resources.getRootFiles().size());
+ // RDFXMLWriter does not touch the rootFile or media type if it's non-null
+
+ ZipFile zipFile = new ZipFile(bundleFile);
+ ZipEntry hello = zipFile.getEntry("hello.txt");
+ assertEquals("hello.txt", hello.getName());
+ assertEquals("Hello there",
+ IOUtils.toString(zipFile.getInputStream(hello), "ASCII"));
+ }
+
+ public File tempFile() throws IOException {
+ File bundleFile = File.createTempFile("test", ".scufl2");
+ bundleFile.deleteOnExit();
+ //System.out.println(bundleFile);
+ return bundleFile;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRevisionParsing.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRevisionParsing.java b/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRevisionParsing.java
new file mode 100644
index 0000000..79cceb8
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/test/java/org/apache/taverna/scufl2/rdfxml/TestRevisionParsing.java
@@ -0,0 +1,118 @@
+package org.apache.taverna.scufl2.rdfxml;
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
+
+import org.apache.taverna.scufl2.api.annotation.Revision;
+import org.apache.taverna.scufl2.rdfxml.RevisionParser;
+import org.junit.Test;
+
+
+public class TestRevisionParsing {
+
+ private static final String ROEVO_TEST_XML = "roevo-test.xml";
+ RevisionParser parser = new RevisionParser();
+
+ @Test
+ public void parseTestXML() throws Exception {
+ URL base = getClass().getResource(ROEVO_TEST_XML);
+ assertNotNull("Could not find " + ROEVO_TEST_XML, base);
+ InputStream inStream = base.openStream();
+ Map<URI, Revision> revisions = parser.readRevisionChain(inStream, base.toURI());
+ assertTrue(revisions.size() > 3);
+
+ Revision r3 = revisions.get(URI.create("http://example.com/test/v3"));
+ assertNotNull("Did not return a Revision", r3);
+ assertEquals("http://example.com/test/v3", r3.getIdentifier().toASCIIString());
+
+ GregorianCalendar expectedTime = createTime(2012, 12, 24, 18, 0, 0);
+ assertEquals(expectedTime.getTimeInMillis(), r3.getGeneratedAtTime().getTimeInMillis());
+
+
+
+ assertEquals("http://example.com/InsertNestedWorkflow",
+ r3.getChangeSpecificationType().toASCIIString());
+
+
+ assertEquals(2, r3.getWasAttributedTo().size());
+ assertTrue(r3.getWasAttributedTo().contains(URI.create("http://example.com/Fred")));
+ assertTrue(r3.getWasAttributedTo().contains(URI.create("http://example.net/SomeoneElse#me")));
+
+ assertEquals(2, r3.getHadOriginalSources().size());
+ List<Revision> originals = new ArrayList<Revision>(r3.getHadOriginalSources());
+ assertEquals("http://example.org/originalSource1", originals.get(0).getIdentifier().toASCIIString());
+ assertEquals("http://example.com/test/originalSource2", originals.get(1).getIdentifier().toASCIIString());
+
+
+ assertEquals(2, r3.getAdditionOf().size());
+ assertTrue(r3.getAdditionOf().contains(URI.create("http://example.com/test/nested-workflow1")));
+ assertTrue(r3.getAdditionOf().contains(URI.create("http://example.net/nested-workflow2")));
+
+ assertEquals(2, r3.getRemovalOf().size());
+ assertTrue(r3.getRemovalOf().contains(URI.create("http://example.net/removed-item")));
+ assertTrue(r3.getRemovalOf().contains(URI.create("http://example.com/test/removed-item2")));
+
+ assertEquals(2, r3.getModificationsOf().size());
+ assertTrue(r3.getModificationsOf().contains(URI.create("http://example.com/test/modified")));
+ assertTrue(r3.getModificationsOf().contains(URI.create("http://example.net/modified2")));
+
+ Revision r2 = r3.getPreviousRevision();
+ assertEquals("http://example.com/test/v2", r2.getIdentifier().toASCIIString());
+
+ GregorianCalendar r2Time = createTime(2010, 1, 15, 11, 0, 0);
+ assertEquals(r2Time.getTimeInMillis(), r2.getGeneratedAtTime().getTimeInMillis());
+
+ Revision r1 = r2.getPreviousRevision();
+ assertEquals("http://example.net/v1", r1.getIdentifier().toASCIIString());
+ Revision r0 = r1.getPreviousRevision();
+ assertEquals("http://example.net/v0", r0.getIdentifier().toASCIIString());
+ assertEquals(null, r0.getPreviousRevision());
+
+ }
+
+ private GregorianCalendar createTime(int year, int month, int date, int hourOfDay, int minute,
+ int second) {
+ // WARNING: java.util.GregorianCalendar is the most broken Calendar API I've ever come across.
+ GregorianCalendar expectedTime = new GregorianCalendar(TimeZone.getTimeZone("GMT+01:00"));
+ // 1) Months (but only months) start at 0, not 1!
+ expectedTime.set(year, month-1, date, hourOfDay, minute, second);
+ // 2) Even if you set the time explicitly, we have to set the millis as well
+ // otherwise it would use the millisecond value at the point of construction (!!)
+ expectedTime.set(Calendar.MILLISECOND, 0);
+ // 3) Still they don't actually compare equal, even if they are at the point in time in
+ // milliseconds since epochs
+ return expectedTime;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example.wfbundle
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example.wfbundle b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example.wfbundle
new file mode 100644
index 0000000..5e01a49
Binary files /dev/null and b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example.wfbundle differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/META-INF/container.xml
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/META-INF/container.xml b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/META-INF/container.xml
new file mode 100644
index 0000000..8d064af
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/META-INF/container.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ 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
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<container version="1.0"
+ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
+ <rootfiles>
+ <rootfile full-path="workflowBundle.ttl"
+ media-type="text/turtle" />
+ <rootfile full-path="workflowBundle.rdf"
+ media-type="application/rdf+xml" />
+ </rootfiles>
+ <relationships>
+ <relationship type="metadata" target="/annotation/$dir/$filename.$ext" />
+ </relationships>
+</container>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/META-INF/manifest.xml
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/META-INF/manifest.xml b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/META-INF/manifest.xml
new file mode 100644
index 0000000..f30dd2b
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/META-INF/manifest.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ 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
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
+ <manifest:file-entry manifest:media-type="application/vnd.taverna.scufl2.workflowBundle" manifest:full-path="/"/>
+
+ <manifest:file-entry manifest:media-type="text/turtle" manifest:full-path="workflowBundle.ttl"/>
+ <manifest:file-entry manifest:media-type="text/turtle" manifest:full-path="workflow/HelloWorld.ttl"/>
+ <manifest:file-entry manifest:media-type="text/turtle" manifest:full-path="annotation/workflow/HelloWorld.ttl"/>
+ <manifest:file-entry manifest:media-type="text/turtle" manifest:full-path="annotation/workflowBundle.ttl"/>
+ <manifest:file-entry manifest:media-type="text/turtle" manifest:full-path="profile/tavernaWorkbench.ttl"/>
+ <manifest:file-entry manifest:media-type="text/turtle" manifest:full-path="profile/tavernaServer.ttl"/>
+
+ <manifest:file-entry manifest:media-type="application/rdf+xml" manifest:full-path="workflowBundle.rdf"/>
+ <manifest:file-entry manifest:media-type="application/rdf+xml" manifest:full-path="workflow/HelloWorld.rdf"/>
+ <manifest:file-entry manifest:media-type="application/rdf+xml" manifest:full-path="annotation/workflow/HelloWorld.rdf"/>
+ <manifest:file-entry manifest:media-type="application/rdf+xml" manifest:full-path="annotation/workflowBundle.rdf"/>
+ <manifest:file-entry manifest:media-type="application/rdf+xml" manifest:full-path="profile/tavernaWorkbench.rdf"/>
+ <manifest:file-entry manifest:media-type="application/rdf+xml" manifest:full-path="profile/tavernaServer.rdf"/>
+
+ <manifest:file-entry manifest:media-type="image/svg+xml" manifest:full-path="Thumbnails/thumbnail.svg"/>
+ <manifest:file-entry manifest:media-type="image/png" manifest:full-path="Thumbnails/thumbnail.png"/>
+
+ <manifest:file-entry manifest:media-type="image/svg+xml" manifest:full-path="diagram/workflow/HelloWorld.svg"/>
+ <manifest:file-entry manifest:media-type="image/png" manifest:full-path="diagram/workflow/HelloWorld.png"/>
+</manifest:manifest>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/Thumbnails/thumbnail.png
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/Thumbnails/thumbnail.png b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/Thumbnails/thumbnail.png
new file mode 100644
index 0000000..8b69f43
Binary files /dev/null and b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/Thumbnails/thumbnail.png differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/Thumbnails/thumbnail.svg
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/Thumbnails/thumbnail.svg b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/Thumbnails/thumbnail.svg
new file mode 100644
index 0000000..0c14a45
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/Thumbnails/thumbnail.svg
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ 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
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+ <!ATTLIST svg xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink">
+]>
+<!-- Generated by Graphviz version 2.20.2 (Tue Mar  2 19:03:41 UTC 2010)
+ For user: (stain) Stian Soiland-Reyes,,,, -->
+<!-- Title: A_simple_hello_world_workflow Pages: 1 -->
+<svg width="146pt" height="210pt"
+ viewBox="0.00 0.00 146.00 210.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 206)">
+<title>A_simple_hello_world_workflow</title>
+<polygon style="fill:#ffffff;stroke:#ffffff;" points="-4,4 -4,-206 142,-206 142,4 -4,4"/>
+<g id="cluster2" class="cluster"><title>cluster_A_simple_hello_world_workflowsinks</title>
+<polygon style="fill:none;stroke:black;stroke-dasharray:1,5;" points="11,-16 11,-73 130,-73 130,-16 11,-16"/>
+<text text-anchor="middle" x="70" y="-60.5" style="font-family:Times New Roman;font-size:10.00;">Workflow output ports</text>
+</g>
+<g id="cluster3" class="cluster"><title>cluster_A_simple_hello_world_workflowsources</title>
+<polygon style="fill:none;stroke:black;stroke-dasharray:1,5;" points="10,-137 10,-194 121,-194 121,-137 10,-137"/>
+<text text-anchor="middle" x="65" y="-181.5" style="font-family:Times New Roman;font-size:10.00;">Workflow input ports</text>
+</g>
+<!-- A_simple_hello_world_workflowWORKFLOWINTERNALSINKCONTROL -->
+<g id="node2" class="node"><title>A_simple_hello_world_workflowWORKFLOWINTERNALSINKCONTROL</title>
+<polygon style="fill:#66cd00;stroke:black;" points="96,-28 102,-37 90,-37 96,-28"/>
+</g>
+<!-- A_simple_hello_world_workflowWORKFLOWINTERNALSINK_results -->
+<g id="node3" class="node"><title>A_simple_hello_world_workflowWORKFLOWINTERNALSINK_results</title>
+<polygon style="fill:#8ed6f0;stroke:black;" points="67,-44 23,-44 23,-24 67,-24 67,-44"/>
+<text text-anchor="middle" x="45" y="-31" style="font-family:Arial;font-size:10.00;">results</text>
+</g>
+<!-- A_simple_hello_world_workflowWORKFLOWINTERNALSOURCECONTROL -->
+<g id="node5" class="node"><title>A_simple_hello_world_workflowWORKFLOWINTERNALSOURCECONTROL</title>
+<polygon style="fill:#ff4040;stroke:black;" points="101,-161 95,-152 107,-152 101,-161"/>
+</g>
+<!-- A_simple_hello_world_workflowWORKFLOWINTERNALSOURCE_yourName -->
+<g id="node6" class="node"><title>A_simple_hello_world_workflowWORKFLOWINTERNALSOURCE_yourName</title>
+<polygon style="fill:#8ed6f0;stroke:black;" points="86,-165 26,-165 26,-145 86,-145 86,-165"/>
+<text text-anchor="middle" x="56" y="-152" style="font-family:Arial;font-size:10.00;">yourName</text>
+</g>
+<!-- A_simple_hello_world_workflowBeanshell -->
+<g id="node7" class="node"><title>A_simple_hello_world_workflowBeanshell</title>
+<polygon style="fill:#deb887;stroke:black;" points="58,-129 2.13163e-14,-129 0,-109 58,-109 58,-129"/>
+<text text-anchor="middle" x="29" y="-116" style="font-family:Arial;font-size:10.00;">Beanshell</text>
+</g>
+<!-- A_simple_hello_world_workflowWORKFLOWINTERNALSOURCE_yourName->A_simple_hello_world_workflowBeanshell -->
+<g id="edge4" class="edge"><title>A_simple_hello_world_workflowWORKFLOWINTERNALSOURCE_yourName->A_simple_hello_world_workflowBeanshell</title>
+<path style="fill:none;stroke:#000000;" d="M48,-145C46,-143 44,-140 42,-138"/>
+<polygon style="fill:#000000;stroke:#000000;" points="44.916,-136.042 37,-129 38.7969,-139.441 44.916,-136.042"/>
+</g>
+<!-- A_simple_hello_world_workflowMerge0 -->
+<g id="node8" class="node"><title>A_simple_hello_world_workflowMerge0</title>
+<ellipse style="fill:#4f94cd;stroke:black;" cx="45" cy="-87" rx="6" ry="6"/>
+</g>
+<!-- A_simple_hello_world_workflowWORKFLOWINTERNALSOURCE_yourName->A_simple_hello_world_workflowMerge0 -->
+<g id="edge6" class="edge"><title>A_simple_hello_world_workflowWORKFLOWINTERNALSOURCE_yourName->A_simple_hello_world_workflowMerge0</title>
+<path style="fill:none;stroke:#000000;" d="M58,-145C60,-135 61,-121 58,-109 57,-106 56,-103 54,-100"/>
+<polygon style="fill:#000000;stroke:#000000;" points="57.268,-98.625 49,-92 51.332,-102.335 57.268,-98.625"/>
+</g>
+<!-- A_simple_hello_world_workflowBeanshell->A_simple_hello_world_workflowMerge0 -->
+<g id="edge8" class="edge"><title>A_simple_hello_world_workflowBeanshell->A_simple_hello_world_workflowMerge0</title>
+<path style="fill:none;stroke:#000000;" d="M34,-109C35,-107 36,-105 38,-102"/>
+<polygon style="fill:#000000;stroke:#000000;" points="41.1369,-103.56 42,-93 34.7402,-100.717 41.1369,-103.56"/>
+</g>
+<!-- A_simple_hello_world_workflowMerge0->A_simple_hello_world_workflowWORKFLOWINTERNALSINK_results -->
+<g id="edge10" class="edge"><title>A_simple_hello_world_workflowMerge0->A_simple_hello_world_workflowWORKFLOWINTERNALSINK_results</title>
+<path style="fill:none;stroke:#000000;" d="M45,-81C45,-74 45,-64 45,-54"/>
+<polygon style="fill:#000000;stroke:#000000;" points="48.5001,-54 45,-44 41.5001,-54 48.5001,-54"/>
+</g>
+</g>
+</svg>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/annotation/workflow/HelloWorld.rdf
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/annotation/workflow/HelloWorld.rdf b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/annotation/workflow/HelloWorld.rdf
new file mode 100644
index 0000000..46152dc
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/annotation/workflow/HelloWorld.rdf
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ 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
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<rdf:RDF xmlns="http://purl.org/dc/elements/1.1/"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:scufl2="http://ns.taverna.org.uk/2010/scufl2#"
+ xml:base="../../workflow/HelloWorld/">
+
+ <rdf:Description rdf:about="">
+ <date>2010-07-28</date>
+ <description>A simple hello world workflow</description>
+ </rdf:Description>
+
+ <rdf:Description rdf:about="datalink/5">
+ <description>Connects workflow input port "yourName"
+ directly to be merged on workflow output port "result". Merged in
+ position 1, meaning that the data from "Hello" will come first. </description>
+ </rdf:Description>
+
+ <rdf:Description rdf:about="in/yourName">
+ <scufl2:exampleValue>John Doe</scufl2:exampleValue>
+ <description>Your name</description>
+ </rdf:Description>
+
+ <rdf:Description rdf:about="out/results">
+ <scufl2:exampleList rdf:parseType="Resource">
+ <rdf:first>Hello, John Doe!</rdf:first>
+ <rdf:rest rdf:parseType="Resource">
+ <rdf:first>John Doe</rdf:first>
+ <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
+ </rdf:rest>
+ </scufl2:exampleList>
+ <description>Personalised greeting, followed by name</description>
+ </rdf:Description>
+
+ <rdf:Description rdf:about="processor/Hello">
+ <description>A service that says greets the given name</description>
+ <title>Hello world</title>
+ </rdf:Description>
+
+ <rdf:Description rdf:about="processor/Hello/in/name">
+ <scufl2:exampleValue>Stian</scufl2:exampleValue>
+ <description>Name of person to greet</description>
+ </rdf:Description>
+
+ <rdf:Description rdf:about="processor/Hello/out/greeting">
+ <scufl2:exampleValue>Hello, Stian!</scufl2:exampleValue>
+ <description>Personalised greeting</description>
+ </rdf:Description>
+</rdf:RDF>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/annotation/workflowBundle.rdf
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/annotation/workflowBundle.rdf b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/annotation/workflowBundle.rdf
new file mode 100644
index 0000000..e4317f1
--- /dev/null
+++ b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/annotation/workflowBundle.rdf
@@ -0,0 +1,39 @@
+<?xml version='1.0'?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ 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
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+
+<!-- Processed by Id: cwm.py,v 1.197 2007/12/13 15:38:39 syosi Exp -->
+<!-- using base file:///home/stain/stuff/src/workspace/scufl2/scufl2-rdf/src/main/resources/example/annotation/workflowBundle.ttl-->
+
+
+<rdf:RDF xmlns="http://purl.org/dc/elements/1.1/"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dcterms="http://purl.org/dc/terms/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+
+ <rdf:Description rdf:about="../">
+ <dcterms:created>2010-07-29T14:12:14+01:00</dcterms:created>
+ <dcterms:modified>2010-07-29T14:12:14+01:00</dcterms:modified>
+ <dc:creator>Stian Soiland-Reyes</dc:creator>
+ <dc:description>An example workflow to illustrate SCUFL2</dc:description>
+ </rdf:Description>
+</rdf:RDF>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/c08405cb/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/diagram/workflow/HelloWorld.png
----------------------------------------------------------------------
diff --git a/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/diagram/workflow/HelloWorld.png b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/diagram/workflow/HelloWorld.png
new file mode 100644
index 0000000..74bc4e1
Binary files /dev/null and b/taverna-scufl2-rdfxml/src/test/resources/org/apache/taverna/scufl2/rdfxml/example/diagram/workflow/HelloWorld.png differ