[GitHub] incubator-taverna-language pull request #39: Support nested workflows by par...
Github user stain commented on a diff in the pull request: https://github.com/apache/incubator-taverna-language/pull/39#discussion_r201983228 --- Diff: taverna-scufl2-cwl/src/main/java/org/apache/taverna/scufl2/cwl/WorkflowParser.java --- @@ -67,6 +68,12 @@ public WorkflowParser() { JsonNode cwlFile = mapper.valueToTree(reader.load(WorkflowParser.class.getResourceAsStream(FILE_NAME))); this.cwlParser = new CWLParser(cwlFile); this.converter = new Converter(); +workflowInputs = new HashMap<>(); --- End diff -- I don't know why these collections have to be created as part of this constructor, rather move that out to each of their field definitions. It makes sense to do it in the constructor instead if you have multiple constructors that do it differently, say by passing in values; or if it's complex objects that are intra-connected, as the order of the field constructors is easy to change by accident. But for simple `HashMap` then they can be created in any order as I don't think anything else in the constructor expects them to pre-exist. ---
[GitHub] incubator-taverna-language pull request #39: Support nested workflows by par...
Github user stain commented on a diff in the pull request: https://github.com/apache/incubator-taverna-language/pull/39#discussion_r201984605 --- Diff: taverna-scufl2-cwl/src/main/java/org/apache/taverna/scufl2/cwl/components/WorkflowProcess.java --- @@ -0,0 +1,232 @@ +/* + * 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. + */ + +package org.apache.taverna.scufl2.cwl; + +import java.io.File; +import java.io.IOException; +import java.util.Set; +import java.util.HashSet; +import java.util.Map; +import java.util.HashMap; + + +import org.apache.taverna.scufl2.api.core.Processor; +import org.apache.taverna.scufl2.api.core.DataLink; +import org.apache.taverna.scufl2.api.core.Workflow; + +import org.apache.taverna.scufl2.api.container.WorkflowBundle; + +import org.apache.taverna.scufl2.api.port.InputWorkflowPort; +import org.apache.taverna.scufl2.api.port.OutputWorkflowPort; +import org.apache.taverna.scufl2.api.port.InputProcessorPort; +import org.apache.taverna.scufl2.api.port.OutputProcessorPort; +import org.apache.taverna.scufl2.api.port.SenderPort; +import org.apache.taverna.scufl2.api.port.ReceiverPort; + +import org.apache.taverna.scufl2.api.io.WorkflowBundleIO; +import org.apache.taverna.scufl2.api.io.WriterException; + +import com.fasterxml.jackson.databind.JsonNode; + +public class WorkflowProcess implements Process { + +private CWLParser cwlParser; + +private Map workflowInputs; +private Map workflowOutputs; +private Map workflowProcessors; +private Map processorInputs; +private Map processorOutputs; +private Set dataLinks; + +private Converter converter; + +public WorkflowProcess(JsonNode node) { +cwlParser = new CWLParser(node); +converter = new Converter(); +workflowInputs = new HashMap<>(); +workflowOutputs = new HashMap<>(); +workflowProcessors = new HashMap<>(); +processorInputs = new HashMap<>(); +processorOutputs = new HashMap<>(); +dataLinks = new HashSet<>(); +this.parse(); +this.receiverPorts = new HashSet(workflowInputs.values()); +this.senderPorts = new HashSet(workflowOutputs.values()); +} + +public void parse() { +parseInputs(); +parseOutputs(); +Set cwlSteps = cwlParser.parseSteps(); +parseProcessors(cwlSteps); +parseDataLinks(cwlSteps); + +Workflow workflow = new Workflow(); +Set inputs = new HashSet<>(workflowInputs.values()); +Set outputs = new HashSet<>(workflowOutputs.values()); +Set processors = new HashSet<>(workflowProcessors.values()); + +workflow.setInputPorts(inputs); +workflow.setOutputPorts(outputs); +workflow.setProcessors(processors); +workflow.setDataLinks(dataLinks); + +//System.out.println(workflow); +//writeWorkflowToFile(workflow); +// +//System.out.println("DEBUG WORKFLOW"); +//System.out.println(workflow.getInputPorts()); +//System.out.println(workflow.getOutputPorts()); +//System.out.println(workflow.getProcessors()); + +} + +public void writeWorkflowToFile(Workflow workflow) { --- End diff -- This function looks like test code, can you move it to something under src/test? ---
[GitHub] incubator-taverna-language pull request #39: Support nested workflows by par...
Github user stain commented on a diff in the pull request: https://github.com/apache/incubator-taverna-language/pull/39#discussion_r201982376 --- Diff: taverna-scufl2-cwl/src/main/java/org/apache/taverna/scufl2/cwl/Main.java --- @@ -0,0 +1,46 @@ +/* + * 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. + */ +package org.apache.taverna.scufl2.cwl; + +import org.yaml.snakeyaml.Yaml; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class Main { + +private static final String HELLO_WORLD_CWL = "/hello_world.cwl"; +private static final String WORKFLOW_WITH_COMMAND = "/workflow_with_command.cwl"; +private static JsonNode cwlFile; + +public static void main(String[] args) { --- End diff -- This sounds like a test class, can we move it to src/test or ideally change it to a junit @Test? ---
[GitHub] incubator-taverna-language pull request #39: Support nested workflows by par...
Github user stain commented on a diff in the pull request: https://github.com/apache/incubator-taverna-language/pull/39#discussion_r201984063 --- Diff: taverna-scufl2-cwl/src/main/java/org/apache/taverna/scufl2/cwl/components/CommandLineTool.java --- @@ -0,0 +1,80 @@ +/* + * 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. + */ + +package org.apache.taverna.scufl2.cwl; + +import java.util.Set; +import java.util.Map; +import java.util.HashMap; + +import com.fasterxml.jackson.databind.JsonNode; + +import org.apache.taverna.scufl2.api.port.InputProcessorPort; +import org.apache.taverna.scufl2.api.port.OutputProcessorPort; + +public class CommandLineTool implements Process { + +private final static String BASE_COMMAND = "baseCommand"; +private final static String ID = "id"; +private final static String INPUT_BINDINDGS = "inputBinding"; + +private CWLParser cwlParser; + +private JsonNode node; + +private String baseCommand = null; +private Map processorInputs; +private Map processorOutputs; + +public CommandLineTool(JsonNode node) { +this.node = node; +this.cwlParser = new CWLParser(node); +this.processorInputs = new HashMap<>(); +this.processorOutputs = new HashMap<>(); +this.parse(); +this.receiverPorts = new HashSet(processorInputs.values()); +this.senderPorts = new HashSet(processorOutputs.values()); +} + +public void parse() { +baseCommand = node.get(BASE_COMMAND).asText(); +parseInputs(); +parseOutputs(); +} + +public void parseInputs() { +Set cwlInputs = cwlParser.parseInputs(); +for(PortDetail detail: cwlInputs) { +String portId = detail.getId(); +InputProcessorPort port = new InputProcessorPort(); --- End diff -- Add a TODO to set the processor port depth from the CWL type (e.g. checking for `[]`) ---
[GitHub] incubator-taverna-language pull request #44: Avoid ontology files, simplify ...
GitHub user stain opened a pull request: https://github.com/apache/incubator-taverna-language/pull/44 Avoid ontology files, simplify licenses This completes #43 to remove all *.owl/*.ttl files of CC-BY-licensed ontologies. Instead they are replaced with Java classes with constants only, as generated by [Jena schemagen maven plugin](https://jena.apache.org/documentation/tools/schemagen-maven.html) and then copied in. Note that javadoc has been stripped from almost all the vocabularies so that they only contain the terms, and thus hopefully should no longer need to be considered "derived work". W3C licenses have been included in text form, as requested in earlier RC vote. You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/incubator-taverna-language no-ontologies Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-taverna-language/pull/44.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #44 commit 68ad29a06d8a8dcd11d8c61003618e13d8c93b25 Author: Stian Soiland-Reyes Date: 2018-11-27T12:24:45Z add taverna-scufl2-ro-vocabs module commit b34dd573598a24bd7243351873fb688ce50caaba Author: Stian Soiland-Reyes Date: 2018-11-27T12:26:44Z Moved vocularies to taverna-ro-vocabs commit 58a7618a07dc3870c20bc5938ba4bd6810128e26 Author: Stian Soiland-Reyes Date: 2018-12-06T23:35:34Z Add PROV-AQ terms commit d510013ec403db4c6f3d78f24365281c3f4164cb Author: Stian Soiland-Reyes Date: 2018-12-07T02:45:19Z Hand-coded vocabularies instead of including ontologies commit 4ebeadca9629bd021b858a244d3ce36dbc4ffc96 Author: Stian Soiland-Reyes Date: 2018-12-07T02:46:08Z Shrink LICENSE as ontologies are no longer included for roevo.xsd, move from LICENSE to CC-BY 3.0 attribution only in NOTICE as it is only a required attribution and the CC-BY 3.0 license does not apply to the derived work. commit 329cef490754d0492b4496721f7040d9d6ebf25d Author: Stian Soiland-Reyes Date: 2018-12-07T02:51:00Z Updated xenc-schema.xsd now Software License header As downloaded from https://www.w3.org/TR/xmlenc-core/xenc-schema.xsd commit 936293fb080aac8a8ecef7c123ddbc330a4e71f5 Author: Stian Soiland-Reyes Date: 2018-12-07T03:09:26Z w3c licenses Converted from html to text commit 0ba3ddfe02dae441029ab1b6b12d998d09ec7002 Author: Stian Soiland-Reyes Date: 2018-12-07T03:23:32Z Avoid roevo CC-BY license by removing documentation it is no longer by "derived from" http://w3id.org/ro/roevo commit 9bd8687b83ccbc5fabfc4ad00b61c711fd3250c0 Author: Stian Soiland-Reyes Date: 2018-12-07T03:25:00Z Updated w3c licenses and reference local copy commit 74718a7ba74ac947a53285712e3fc2f81c17d442 Author: Stian Soiland-Reyes Date: 2018-12-07T03:35:44Z Reference/include w3c licenses commit c6175ca7d93555d2bcc305ab1b1347b2a78df461 Author: Stian Soiland-Reyes Date: 2018-12-07T03:41:23Z Relative path for ./xmldsig-core-schema.xsd commit 1ad20c1ea7c9fff3c013a1c5ebf229ae78cbdacb Author: Stian Soiland-Reyes Date: 2018-12-07T03:58:36Z lowercase vocabulary prefix name commit 97739d674c0edded8fbece5a0015e9a0ca5f3b0d Author: Stian Soiland-Reyes Date: 2018-12-07T04:10:51Z Use new taverna-ro-vocabs constants commit 0d01d92ae2242b32cdb4e8f567a6dbea65f9e138 Author: Stian Soiland-Reyes Date: 2018-12-07T04:13:12Z more Prov -> prov commit 93f45f0bb053ddd6b2e224aa57bcb61aac41947d Author: Stian Soiland-Reyes Date: 2018-12-07T04:15:30Z also avoid XMLSchema.dtd commit cf5413258785e11588f34606d8cd2800a9701bae Author: Stian Soiland-Reyes Date: 2018-12-07T04:16:36Z xml typo ---
[GitHub] incubator-taverna-language pull request #43: WIP: Avoid distributing CC-BY w...
GitHub user stain opened a pull request: https://github.com/apache/incubator-taverna-language/pull/43 WIP: Avoid distributing CC-BY works .. but instead distribute our derived Java classes as produced by the Jena maven plugin schemagen. Unlike CC-BY-SA, [CC-BY](https://creativecommons.org/licenses/by/3.0/legalcode) is not "share-alike", so our derived work (`*.java`) can be distributed as the Apache license as long as we fulfill the CC-BY attribution requirements. [CC-BY 3.0 section 4](https://creativecommons.org/licenses/by/3.0/legalcode) talks about adaptations (my emphases): > If You Distribute, or Publicly Perform the Work or any **Adaptations** or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: > (i) the **name of the Original Author** (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; > (ii) the **title of the Work** if supplied; > (iii) to the extent reasonably practicable, **the URI**, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and > (iv) , consistent with Section 3(b), in the case of an Adaptation, a **credit identifying the use of the Work** in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). > > The credit required by this Section 4 (b) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, **if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits** and in a manner **at least as prominent** as the credits for the other contributing authors. > For the avoidance of doubt, You may only use the credit required by this Section for the **purpose of attribution** in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties. Reading this it seems that the most appropriate attribution is in our NOTICE file, where we thus need to include the name or the original work, author. Note that the attribution does NOT say that we have to attribute the CC-BY license for the Derived Work, therefore we can license it as Apache License. See the suggested [NOTICE](https://github.com/apache/incubator-taverna-language/blob/no-ontologies/NOTICE#L11) addition - it was tricky to word this correct so it does not imply that the generated `*.java` are licensed CC-BY! A downside of hard-coding the generated classes is that they are trickier to update - however these ontologies are by now stable and rarely change. This pull request is Work in Progress as there are other CC-BY files that would need similar 'schemagen' generation. You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/incubator-taverna-language no-ontologies Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-taverna-language/pull/43.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #43 commit f88ea045cf8e8bbec568266af53fe77bd96907a0 Author: Stian Soiland-Reyes Date: 2018-11-21T11:19:18Z Adding generated-code under Apache License commit 98dcf2bb86ed1f813e768b69064a9ecbc704c180 Author: Stian Soiland-Reyes Date: 2018-11-21T11:25:49Z Moved CC-BY to NOTICE as it is just attribution .. not a license on our derivative work! commit 5778e6fb731a6ea87a2556d0c8741c0215ae4fc6 Author: Stian Soiland-Reyes Date: 2018-11-21T11:26:49Z attributions moved to NOTICE commit 110c351bbe573916a6c812b2f2e55922be78ad25 Author: Stian Soiland-Reyes Date: 2018-11-21T11:53:05Z Simplify NOTICE to avoid CC-BY confusion commit f31ee1824206dd7ad28fa4a6d62d22f000a11c00 Author: Stian Soiland-Reyes Date: 2018-11-21T11:56:10Z Apache license ---
[GitHub] incubator-taverna-language issue #43: WIP: Avoid distributing CC-BY works
Github user stain commented on the issue: https://github.com/apache/incubator-taverna-language/pull/43 I am having second thoughts here on this "adaptation" workaround.. While CC-BY 3.0 does not put any particular constraints on adaptations, this was [flagged as a concern in 3.0](https://wiki.creativecommons.org/wiki/4.0/Treatment_of_adaptations#Licensing_adaptations) and CC-BY 4.0 closes this "loop hole" by adding terms like > If You Share the Licensed Material (including in modified form), You must: > retain the following if it is supplied by the Licensor with the Licensed Material: > ... > a notice that refers to this Public License; > If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. However if we shrink the generated code to no longer include the documentation as javadoc, and only contain the vocabulary names from the namespaces, then what little remains from the Original work (just the names) should no longer be copyrightable nor need a CC-BY license. I am making an assumption here that the *collection* of names in a small vocabulary do not constiute [sui generis database rights](https://en.wikipedia.org/wiki/Sui_generis_database_right).. (That would cause problems for anyone referencing larger parts of CC-BY licensed vocabularies, like Jena's [DCTerms](https://github.com/apache/jena/blob/master/jena-core/src/main/java/org/apache/jena/vocabulary/DCTerms.java) class. Perhaps @afs would know - were those generated from https://github.com/apache/jena/tree/master/jena-core/vocabularies ? Seems to [date from 2003](https://svn.apache.org/viewvc?view=revision=1109818)! ) ---
[GitHub] incubator-taverna-language issue #43: WIP: Avoid distributing CC-BY works
Github user stain commented on the issue: https://github.com/apache/incubator-taverna-language/pull/43 .. actually Andy can relax as suis-generis rights stop after 15 years.. :) ---