You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@taverna.apache.org by "Enrico Daga (enridaga)" <en...@gmail.com> on 2016/04/28 17:25:22 UTC

Access/modify annotations in a WorkflowBundle

Hi,

I am using the taverna API to explore workflows downloaded from MyExperiment.
At the moment, I converted the files to the .wfbundle format using the taverna command line tools. Everything looks fine.
Unzipping a wfbundle I can read a set of .ttl files in the annotations/ folder, but I am not able to do that through the Java API.
In the simplest form, my code is as follows:

		WorkflowBundleIO io = new WorkflowBundleIO();
		final WorkflowBundle wb = io.readBundle(__f(“file.wfbundle"), null);
		System.out.println("Annotations: " + wb.getAnnotations().size());

What is the recommended way to get:
- The description of a workflow (as I can see it on the myexperiment portal)
- All the annotations in a bundle
- The annotations of a given WorkflowBean element
- To access/modify/extend the annotations

I am using release 0.15.0-incubating.

Thank you in advance for your help,

Enrico





—
Enrico Daga (enridaga)
http://www.enridaga.net <http://www.enridaga.net/>
Il budda e’ nel parco.






Re: Access/modify annotations in a WorkflowBundle

Posted by Stian Soiland-Reyes <st...@apache.org>.
Great! If you find the SNAPSHOT fixes things for you, we can look at
bringing out a patch release soonish.

(We want to get the Command line out first but we are waiting for
legal clearance)

On 10 May 2016 at 10:16, Enrico Daga (enridaga) <en...@gmail.com> wrote:
> Dear Stian,
>
> (sorry for this late reply, I’ve been away for few days)
>
> I understand the problem from your explanation. I really appreciate you integrated the workaround in the current master.
> I am OK on using the SNAPSHOT release for the time being, and happy to report any issues I might find.
>
> Again, thank you for the help.
>
> Best
>
> Enrico
>
>
> —
> Enrico Daga (enridaga)
> http://www.enridaga.net <http://www.enridaga.net/>
> Il budda e’ nel parco.
>
>
>
>
>
>> On 4 May 2016, at 12:04, Stian Soiland-Reyes <st...@apache.org> wrote:
>>
>> I've added the wfbundle parser TAVERNA-71 workaround in master - see
>>
>> https://github.com/apache/incubator-taverna-language/blob/master/taverna-scufl2-wfbundle/src/main/java/org/apache/taverna/scufl2/rdfxml/WorkflowBundleParser.java#L136
>>
>> Do you think you could try out the latest SNAPSHOT?
>>
>> <dependency>
>>  <groupId>org.apache.taverna.language</groupId>
>>  <artifactId>taverna-scufl2-wfbundle</artifactId>
>>  <version>0.15.2-incubating-SNAPSHOT</version>
>> </dependency>
>>
>> <repositories>
>>  <repositories>
>>    <repository>
>>      <id>apache.snapshots</id>
>>      <name>Apache Snapshot Repository</name>
>>      <url>http://repository.apache.org/snapshots</url>
>>      <releases>
>>        <enabled>false</enabled>
>>      </releases>
>>    </repository>
>> </repositories>
>>
>>
>>
>> (If this works, then you don't need your own version of parseAnnotations() )
>>
>> On 4 May 2016 at 11:21, Stian Soiland-Reyes <st...@apache.org> wrote:
>>> My apologies - you are right - I realize now that if you open a
>>> wfbundle (as opposed to a .t2flow) - then getAnnotations() is always
>>> empty.
>>>
>>> It should work if you open a .t2flow as the T2flow parser populates
>>> wfbundle.getAnnotations().
>>>
>>>
>>> The reason is that the annotation links in wfbundle.getAnnotations()
>>> are not stored in the wfbundle manifest (and not parsed).
>>>
>>> some preliminary code for this was at:
>>>
>>> https://github.com/apache/incubator-taverna-language/blob/0.15.1-incubating/taverna-scufl2-wfbundle/src/main/java/org/apache/taverna/scufl2/rdfxml/RDFXMLSerializer.java#L549
>>>
>>> To put it blunt - the t2flow parsed adds
>>> <annotation/02a6e877-a4f0-44f9-9730-6b60a55092a6.ttl> that describes
>>> <workflow/Workflow1/in/DataSetPath> - however the link between
>>> <workflow/Workflow1/in/DataSetPath> and
>>> <annotation/02a6e877-a4f0-44f9-9730-6b60a55092a6.ttl> is not
>>> serialized - and so the only way to find annotation/ now is to go
>>> through the annotation/ folder.
>>>
>>>
>>> I think this relates to
>>> https://issues.apache.org/jira/browse/TAVERNA-965 as the UCFPackage or
>>> WorkflowBundle didn't have a mechanism to serialize which annotations
>>> exist (it would basically need to replicate
>>> https://w3id.org/bundle/#manifest-annotations ) - and so there would
>>> not be any point in not moving to taverna-robundle for managing the
>>> bundle and the annotations.
>>>
>>> This bug was already tracked at
>>> https://issues.apache.org/jira/browse/TAVERNA-71 - I've promoted this
>>> to be Fix For Language 0.16.0.
>>>
>>> I've shown you a workaround in
>>> https://github.com/enridaga/taverna-sandbox/pull/1
>>> to parse the wfbundle annotations
>>> and I'm testing to add this to taverna-scufl2-wfbundle as a workaround.
>>>
>>>
>>>
>>>
>>> On 3 May 2016 at 11:19, Enrico Daga (enridaga) <en...@gmail.com> wrote:
>>>> Hi Stian,
>>>>
>>>> I tried with the latest release but I am still struggling on getting this work.
>>>>
>>>> I prepared a minimal project to test the issue [1], which contains a single test using a workflow downloaded from my experiment (and converted to wfbundle) [2].
>>>>
>>>> This wf contains a set of annotations, particularly from input ports. I can see them unpacking the bundle [3].
>>>>
>>>> However, I cannot access them in the way you suggested (replicated here [4]).
>>>>
>>>> Best,
>>>>
>>>> Enrico
>>>>
>>>>
>>>>
>>>> [1] https://github.com/enridaga/taverna-sandbox <https://github.com/enridaga/taverna-sandbox>
>>>> [2] http://www.myexperiment.org/workflows/4303.html <http://www.myexperiment.org/workflows/4303.html>
>>>> [3] https://github.com/enridaga/taverna-sandbox/tree/master/src/test/resources/bundles/3Drec-v1/annotation <https://github.com/enridaga/taverna-sandbox/tree/master/src/test/resources/bundles/3Drec-v1/annotation>
>>>> [4] https://github.com/enridaga/taverna-sandbox/blob/master/src/test/java/enridaga/AppTest.java <https://github.com/enridaga/taverna-sandbox/blob/master/src/test/java/enridaga/AppTest.java>
>>>>
>>>> —
>>>> Enrico Daga (enridaga)
>>>> http://www.enridaga.net <http://www.enridaga.net/>
>>>> Il budda e’ nel parco.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> On 3 May 2016, at 09:01, Enrico Daga (enridaga) <en...@gmail.com> wrote:
>>>>>
>>>>> Thank you Stian, this is gold.
>>>>>
>>>>> Will try the new release as well.
>>>>>
>>>>> It's good to have Taverna at Apache!
>>>>>
>>>>> Best,
>>>>> Enrico
>>>>>
>>>>>
>>>>> —
>>>>> Enrico Daga (enridaga)
>>>>> http://www.enridaga.net <http://www.enridaga.net/>
>>>>> Il budda e’ nel parco.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> On 2 May 2016, at 17:19, Stian Soiland-Reyes <stain@apache.org <ma...@apache.org>> wrote:
>>>>>>
>>>>>> BTW - another alternative - if you convert to wfdesc with tavlang convert - see
>>>>>> https://github.com/apache/incubator-taverna-language/tree/master/taverna-tavlang-tool <https://github.com/apache/incubator-taverna-language/tree/master/taverna-tavlang-tool>
>>>>>>
>>>>>> then you should also get all the annotations across the workflow - but
>>>>>> you will loose the information about when it was made as it comes back
>>>>>> as a single Triple file.
>>>>>>
>>>>>> On 28 April 2016 at 16:25, Enrico Daga (enridaga) <enricodaga@gmail.com <ma...@gmail.com>> wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I am using the taverna API to explore workflows downloaded from MyExperiment.
>>>>>>> At the moment, I converted the files to the .wfbundle format using the taverna command line tools. Everything looks fine.
>>>>>>> Unzipping a wfbundle I can read a set of .ttl files in the annotations/ folder, but I am not able to do that through the Java API.
>>>>>>> In the simplest form, my code is as follows:
>>>>>>>
>>>>>>>               WorkflowBundleIO io = new WorkflowBundleIO();
>>>>>>>               final WorkflowBundle wb = io.readBundle(__f(“file.wfbundle"), null);
>>>>>>>               System.out.println("Annotations: " + wb.getAnnotations().size());
>>>>>>>
>>>>>>> What is the recommended way to get:
>>>>>>> - The description of a workflow (as I can see it on the myexperiment portal)
>>>>>>> - All the annotations in a bundle
>>>>>>> - The annotations of a given WorkflowBean element
>>>>>>> - To access/modify/extend the annotations
>>>>>>>
>>>>>>> I am using release 0.15.0-incubating.
>>>>>>>
>>>>>>> Thank you in advance for your help,
>>>>>>>
>>>>>>> Enrico
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> —
>>>>>>> Enrico Daga (enridaga)
>>>>>>> http://www.enridaga.net <http://www.enridaga.net/> <http://www.enridaga.net/ <http://www.enridaga.net/>>
>>>>>>> Il budda e’ nel parco.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Stian Soiland-Reyes
>>>>>> Apache Taverna (incubating), Apache Commons RDF (incubating)
>>>>>> http://orcid.org/0000-0001-9842-9718 <http://orcid.org/0000-0001-9842-9718>
>>>>
>>>
>>>
>>>
>>> --
>>> Stian Soiland-Reyes
>>> Apache Taverna (incubating), Apache Commons RDF (incubating)
>>> http://orcid.org/0000-0001-9842-9718
>>
>>
>>
>> --
>> Stian Soiland-Reyes
>> Apache Taverna (incubating), Apache Commons RDF (incubating)
>> http://orcid.org/0000-0001-9842-9718
>



-- 
Stian Soiland-Reyes
Apache Taverna (incubating), Apache Commons RDF (incubating)
http://orcid.org/0000-0001-9842-9718

Re: Access/modify annotations in a WorkflowBundle

Posted by "Enrico Daga (enridaga)" <en...@gmail.com>.
Dear Stian,

(sorry for this late reply, I’ve been away for few days)

I understand the problem from your explanation. I really appreciate you integrated the workaround in the current master.
I am OK on using the SNAPSHOT release for the time being, and happy to report any issues I might find.

Again, thank you for the help.

Best

Enrico


—
Enrico Daga (enridaga)
http://www.enridaga.net <http://www.enridaga.net/>
Il budda e’ nel parco.





> On 4 May 2016, at 12:04, Stian Soiland-Reyes <st...@apache.org> wrote:
> 
> I've added the wfbundle parser TAVERNA-71 workaround in master - see
> 
> https://github.com/apache/incubator-taverna-language/blob/master/taverna-scufl2-wfbundle/src/main/java/org/apache/taverna/scufl2/rdfxml/WorkflowBundleParser.java#L136
> 
> Do you think you could try out the latest SNAPSHOT?
> 
> <dependency>
>  <groupId>org.apache.taverna.language</groupId>
>  <artifactId>taverna-scufl2-wfbundle</artifactId>
>  <version>0.15.2-incubating-SNAPSHOT</version>
> </dependency>
> 
> <repositories>
>  <repositories>
>    <repository>
>      <id>apache.snapshots</id>
>      <name>Apache Snapshot Repository</name>
>      <url>http://repository.apache.org/snapshots</url>
>      <releases>
>        <enabled>false</enabled>
>      </releases>
>    </repository>
> </repositories>
> 
> 
> 
> (If this works, then you don't need your own version of parseAnnotations() )
> 
> On 4 May 2016 at 11:21, Stian Soiland-Reyes <st...@apache.org> wrote:
>> My apologies - you are right - I realize now that if you open a
>> wfbundle (as opposed to a .t2flow) - then getAnnotations() is always
>> empty.
>> 
>> It should work if you open a .t2flow as the T2flow parser populates
>> wfbundle.getAnnotations().
>> 
>> 
>> The reason is that the annotation links in wfbundle.getAnnotations()
>> are not stored in the wfbundle manifest (and not parsed).
>> 
>> some preliminary code for this was at:
>> 
>> https://github.com/apache/incubator-taverna-language/blob/0.15.1-incubating/taverna-scufl2-wfbundle/src/main/java/org/apache/taverna/scufl2/rdfxml/RDFXMLSerializer.java#L549
>> 
>> To put it blunt - the t2flow parsed adds
>> <annotation/02a6e877-a4f0-44f9-9730-6b60a55092a6.ttl> that describes
>> <workflow/Workflow1/in/DataSetPath> - however the link between
>> <workflow/Workflow1/in/DataSetPath> and
>> <annotation/02a6e877-a4f0-44f9-9730-6b60a55092a6.ttl> is not
>> serialized - and so the only way to find annotation/ now is to go
>> through the annotation/ folder.
>> 
>> 
>> I think this relates to
>> https://issues.apache.org/jira/browse/TAVERNA-965 as the UCFPackage or
>> WorkflowBundle didn't have a mechanism to serialize which annotations
>> exist (it would basically need to replicate
>> https://w3id.org/bundle/#manifest-annotations ) - and so there would
>> not be any point in not moving to taverna-robundle for managing the
>> bundle and the annotations.
>> 
>> This bug was already tracked at
>> https://issues.apache.org/jira/browse/TAVERNA-71 - I've promoted this
>> to be Fix For Language 0.16.0.
>> 
>> I've shown you a workaround in
>> https://github.com/enridaga/taverna-sandbox/pull/1
>> to parse the wfbundle annotations
>> and I'm testing to add this to taverna-scufl2-wfbundle as a workaround.
>> 
>> 
>> 
>> 
>> On 3 May 2016 at 11:19, Enrico Daga (enridaga) <en...@gmail.com> wrote:
>>> Hi Stian,
>>> 
>>> I tried with the latest release but I am still struggling on getting this work.
>>> 
>>> I prepared a minimal project to test the issue [1], which contains a single test using a workflow downloaded from my experiment (and converted to wfbundle) [2].
>>> 
>>> This wf contains a set of annotations, particularly from input ports. I can see them unpacking the bundle [3].
>>> 
>>> However, I cannot access them in the way you suggested (replicated here [4]).
>>> 
>>> Best,
>>> 
>>> Enrico
>>> 
>>> 
>>> 
>>> [1] https://github.com/enridaga/taverna-sandbox <https://github.com/enridaga/taverna-sandbox>
>>> [2] http://www.myexperiment.org/workflows/4303.html <http://www.myexperiment.org/workflows/4303.html>
>>> [3] https://github.com/enridaga/taverna-sandbox/tree/master/src/test/resources/bundles/3Drec-v1/annotation <https://github.com/enridaga/taverna-sandbox/tree/master/src/test/resources/bundles/3Drec-v1/annotation>
>>> [4] https://github.com/enridaga/taverna-sandbox/blob/master/src/test/java/enridaga/AppTest.java <https://github.com/enridaga/taverna-sandbox/blob/master/src/test/java/enridaga/AppTest.java>
>>> 
>>> —
>>> Enrico Daga (enridaga)
>>> http://www.enridaga.net <http://www.enridaga.net/>
>>> Il budda e’ nel parco.
>>> 
>>> 
>>> 
>>> 
>>> 
>>>> On 3 May 2016, at 09:01, Enrico Daga (enridaga) <en...@gmail.com> wrote:
>>>> 
>>>> Thank you Stian, this is gold.
>>>> 
>>>> Will try the new release as well.
>>>> 
>>>> It's good to have Taverna at Apache!
>>>> 
>>>> Best,
>>>> Enrico
>>>> 
>>>> 
>>>> —
>>>> Enrico Daga (enridaga)
>>>> http://www.enridaga.net <http://www.enridaga.net/>
>>>> Il budda e’ nel parco.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> On 2 May 2016, at 17:19, Stian Soiland-Reyes <stain@apache.org <ma...@apache.org>> wrote:
>>>>> 
>>>>> BTW - another alternative - if you convert to wfdesc with tavlang convert - see
>>>>> https://github.com/apache/incubator-taverna-language/tree/master/taverna-tavlang-tool <https://github.com/apache/incubator-taverna-language/tree/master/taverna-tavlang-tool>
>>>>> 
>>>>> then you should also get all the annotations across the workflow - but
>>>>> you will loose the information about when it was made as it comes back
>>>>> as a single Triple file.
>>>>> 
>>>>> On 28 April 2016 at 16:25, Enrico Daga (enridaga) <enricodaga@gmail.com <ma...@gmail.com>> wrote:
>>>>>> Hi,
>>>>>> 
>>>>>> I am using the taverna API to explore workflows downloaded from MyExperiment.
>>>>>> At the moment, I converted the files to the .wfbundle format using the taverna command line tools. Everything looks fine.
>>>>>> Unzipping a wfbundle I can read a set of .ttl files in the annotations/ folder, but I am not able to do that through the Java API.
>>>>>> In the simplest form, my code is as follows:
>>>>>> 
>>>>>>               WorkflowBundleIO io = new WorkflowBundleIO();
>>>>>>               final WorkflowBundle wb = io.readBundle(__f(“file.wfbundle"), null);
>>>>>>               System.out.println("Annotations: " + wb.getAnnotations().size());
>>>>>> 
>>>>>> What is the recommended way to get:
>>>>>> - The description of a workflow (as I can see it on the myexperiment portal)
>>>>>> - All the annotations in a bundle
>>>>>> - The annotations of a given WorkflowBean element
>>>>>> - To access/modify/extend the annotations
>>>>>> 
>>>>>> I am using release 0.15.0-incubating.
>>>>>> 
>>>>>> Thank you in advance for your help,
>>>>>> 
>>>>>> Enrico
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> —
>>>>>> Enrico Daga (enridaga)
>>>>>> http://www.enridaga.net <http://www.enridaga.net/> <http://www.enridaga.net/ <http://www.enridaga.net/>>
>>>>>> Il budda e’ nel parco.
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Stian Soiland-Reyes
>>>>> Apache Taverna (incubating), Apache Commons RDF (incubating)
>>>>> http://orcid.org/0000-0001-9842-9718 <http://orcid.org/0000-0001-9842-9718>
>>> 
>> 
>> 
>> 
>> --
>> Stian Soiland-Reyes
>> Apache Taverna (incubating), Apache Commons RDF (incubating)
>> http://orcid.org/0000-0001-9842-9718
> 
> 
> 
> -- 
> Stian Soiland-Reyes
> Apache Taverna (incubating), Apache Commons RDF (incubating)
> http://orcid.org/0000-0001-9842-9718


Re: Access/modify annotations in a WorkflowBundle

Posted by Stian Soiland-Reyes <st...@apache.org>.
I've added the wfbundle parser TAVERNA-71 workaround in master - see

https://github.com/apache/incubator-taverna-language/blob/master/taverna-scufl2-wfbundle/src/main/java/org/apache/taverna/scufl2/rdfxml/WorkflowBundleParser.java#L136

Do you think you could try out the latest SNAPSHOT?

<dependency>
  <groupId>org.apache.taverna.language</groupId>
  <artifactId>taverna-scufl2-wfbundle</artifactId>
  <version>0.15.2-incubating-SNAPSHOT</version>
</dependency>

<repositories>
  <repositories>
    <repository>
      <id>apache.snapshots</id>
      <name>Apache Snapshot Repository</name>
      <url>http://repository.apache.org/snapshots</url>
      <releases>
        <enabled>false</enabled>
      </releases>
    </repository>
</repositories>



(If this works, then you don't need your own version of parseAnnotations() )

On 4 May 2016 at 11:21, Stian Soiland-Reyes <st...@apache.org> wrote:
> My apologies - you are right - I realize now that if you open a
> wfbundle (as opposed to a .t2flow) - then getAnnotations() is always
> empty.
>
> It should work if you open a .t2flow as the T2flow parser populates
> wfbundle.getAnnotations().
>
>
> The reason is that the annotation links in wfbundle.getAnnotations()
> are not stored in the wfbundle manifest (and not parsed).
>
> some preliminary code for this was at:
>
> https://github.com/apache/incubator-taverna-language/blob/0.15.1-incubating/taverna-scufl2-wfbundle/src/main/java/org/apache/taverna/scufl2/rdfxml/RDFXMLSerializer.java#L549
>
> To put it blunt - the t2flow parsed adds
> <annotation/02a6e877-a4f0-44f9-9730-6b60a55092a6.ttl> that describes
> <workflow/Workflow1/in/DataSetPath> - however the link between
> <workflow/Workflow1/in/DataSetPath> and
> <annotation/02a6e877-a4f0-44f9-9730-6b60a55092a6.ttl> is not
> serialized - and so the only way to find annotation/ now is to go
> through the annotation/ folder.
>
>
> I think this relates to
> https://issues.apache.org/jira/browse/TAVERNA-965 as the UCFPackage or
> WorkflowBundle didn't have a mechanism to serialize which annotations
> exist (it would basically need to replicate
> https://w3id.org/bundle/#manifest-annotations ) - and so there would
> not be any point in not moving to taverna-robundle for managing the
> bundle and the annotations.
>
> This bug was already tracked at
> https://issues.apache.org/jira/browse/TAVERNA-71 - I've promoted this
> to be Fix For Language 0.16.0.
>
> I've shown you a workaround in
> https://github.com/enridaga/taverna-sandbox/pull/1
> to parse the wfbundle annotations
> and I'm testing to add this to taverna-scufl2-wfbundle as a workaround.
>
>
>
>
> On 3 May 2016 at 11:19, Enrico Daga (enridaga) <en...@gmail.com> wrote:
>> Hi Stian,
>>
>> I tried with the latest release but I am still struggling on getting this work.
>>
>> I prepared a minimal project to test the issue [1], which contains a single test using a workflow downloaded from my experiment (and converted to wfbundle) [2].
>>
>> This wf contains a set of annotations, particularly from input ports. I can see them unpacking the bundle [3].
>>
>> However, I cannot access them in the way you suggested (replicated here [4]).
>>
>> Best,
>>
>> Enrico
>>
>>
>>
>> [1] https://github.com/enridaga/taverna-sandbox <https://github.com/enridaga/taverna-sandbox>
>> [2] http://www.myexperiment.org/workflows/4303.html <http://www.myexperiment.org/workflows/4303.html>
>> [3] https://github.com/enridaga/taverna-sandbox/tree/master/src/test/resources/bundles/3Drec-v1/annotation <https://github.com/enridaga/taverna-sandbox/tree/master/src/test/resources/bundles/3Drec-v1/annotation>
>> [4] https://github.com/enridaga/taverna-sandbox/blob/master/src/test/java/enridaga/AppTest.java <https://github.com/enridaga/taverna-sandbox/blob/master/src/test/java/enridaga/AppTest.java>
>>
>> —
>> Enrico Daga (enridaga)
>> http://www.enridaga.net <http://www.enridaga.net/>
>> Il budda e’ nel parco.
>>
>>
>>
>>
>>
>>> On 3 May 2016, at 09:01, Enrico Daga (enridaga) <en...@gmail.com> wrote:
>>>
>>> Thank you Stian, this is gold.
>>>
>>> Will try the new release as well.
>>>
>>> It's good to have Taverna at Apache!
>>>
>>> Best,
>>> Enrico
>>>
>>>
>>> —
>>> Enrico Daga (enridaga)
>>> http://www.enridaga.net <http://www.enridaga.net/>
>>> Il budda e’ nel parco.
>>>
>>>
>>>
>>>
>>>
>>>> On 2 May 2016, at 17:19, Stian Soiland-Reyes <stain@apache.org <ma...@apache.org>> wrote:
>>>>
>>>> BTW - another alternative - if you convert to wfdesc with tavlang convert - see
>>>> https://github.com/apache/incubator-taverna-language/tree/master/taverna-tavlang-tool <https://github.com/apache/incubator-taverna-language/tree/master/taverna-tavlang-tool>
>>>>
>>>> then you should also get all the annotations across the workflow - but
>>>> you will loose the information about when it was made as it comes back
>>>> as a single Triple file.
>>>>
>>>> On 28 April 2016 at 16:25, Enrico Daga (enridaga) <enricodaga@gmail.com <ma...@gmail.com>> wrote:
>>>>> Hi,
>>>>>
>>>>> I am using the taverna API to explore workflows downloaded from MyExperiment.
>>>>> At the moment, I converted the files to the .wfbundle format using the taverna command line tools. Everything looks fine.
>>>>> Unzipping a wfbundle I can read a set of .ttl files in the annotations/ folder, but I am not able to do that through the Java API.
>>>>> In the simplest form, my code is as follows:
>>>>>
>>>>>                WorkflowBundleIO io = new WorkflowBundleIO();
>>>>>                final WorkflowBundle wb = io.readBundle(__f(“file.wfbundle"), null);
>>>>>                System.out.println("Annotations: " + wb.getAnnotations().size());
>>>>>
>>>>> What is the recommended way to get:
>>>>> - The description of a workflow (as I can see it on the myexperiment portal)
>>>>> - All the annotations in a bundle
>>>>> - The annotations of a given WorkflowBean element
>>>>> - To access/modify/extend the annotations
>>>>>
>>>>> I am using release 0.15.0-incubating.
>>>>>
>>>>> Thank you in advance for your help,
>>>>>
>>>>> Enrico
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> —
>>>>> Enrico Daga (enridaga)
>>>>> http://www.enridaga.net <http://www.enridaga.net/> <http://www.enridaga.net/ <http://www.enridaga.net/>>
>>>>> Il budda e’ nel parco.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Stian Soiland-Reyes
>>>> Apache Taverna (incubating), Apache Commons RDF (incubating)
>>>> http://orcid.org/0000-0001-9842-9718 <http://orcid.org/0000-0001-9842-9718>
>>
>
>
>
> --
> Stian Soiland-Reyes
> Apache Taverna (incubating), Apache Commons RDF (incubating)
> http://orcid.org/0000-0001-9842-9718



-- 
Stian Soiland-Reyes
Apache Taverna (incubating), Apache Commons RDF (incubating)
http://orcid.org/0000-0001-9842-9718

Re: Access/modify annotations in a WorkflowBundle

Posted by Stian Soiland-Reyes <st...@apache.org>.
My apologies - you are right - I realize now that if you open a
wfbundle (as opposed to a .t2flow) - then getAnnotations() is always
empty.

It should work if you open a .t2flow as the T2flow parser populates
wfbundle.getAnnotations().


The reason is that the annotation links in wfbundle.getAnnotations()
are not stored in the wfbundle manifest (and not parsed).

some preliminary code for this was at:

https://github.com/apache/incubator-taverna-language/blob/0.15.1-incubating/taverna-scufl2-wfbundle/src/main/java/org/apache/taverna/scufl2/rdfxml/RDFXMLSerializer.java#L549

To put it blunt - the t2flow parsed adds
<annotation/02a6e877-a4f0-44f9-9730-6b60a55092a6.ttl> that describes
<workflow/Workflow1/in/DataSetPath> - however the link between
<workflow/Workflow1/in/DataSetPath> and
<annotation/02a6e877-a4f0-44f9-9730-6b60a55092a6.ttl> is not
serialized - and so the only way to find annotation/ now is to go
through the annotation/ folder.


I think this relates to
https://issues.apache.org/jira/browse/TAVERNA-965 as the UCFPackage or
WorkflowBundle didn't have a mechanism to serialize which annotations
exist (it would basically need to replicate
https://w3id.org/bundle/#manifest-annotations ) - and so there would
not be any point in not moving to taverna-robundle for managing the
bundle and the annotations.

This bug was already tracked at
https://issues.apache.org/jira/browse/TAVERNA-71 - I've promoted this
to be Fix For Language 0.16.0.

I've shown you a workaround in
https://github.com/enridaga/taverna-sandbox/pull/1
to parse the wfbundle annotations
and I'm testing to add this to taverna-scufl2-wfbundle as a workaround.




On 3 May 2016 at 11:19, Enrico Daga (enridaga) <en...@gmail.com> wrote:
> Hi Stian,
>
> I tried with the latest release but I am still struggling on getting this work.
>
> I prepared a minimal project to test the issue [1], which contains a single test using a workflow downloaded from my experiment (and converted to wfbundle) [2].
>
> This wf contains a set of annotations, particularly from input ports. I can see them unpacking the bundle [3].
>
> However, I cannot access them in the way you suggested (replicated here [4]).
>
> Best,
>
> Enrico
>
>
>
> [1] https://github.com/enridaga/taverna-sandbox <https://github.com/enridaga/taverna-sandbox>
> [2] http://www.myexperiment.org/workflows/4303.html <http://www.myexperiment.org/workflows/4303.html>
> [3] https://github.com/enridaga/taverna-sandbox/tree/master/src/test/resources/bundles/3Drec-v1/annotation <https://github.com/enridaga/taverna-sandbox/tree/master/src/test/resources/bundles/3Drec-v1/annotation>
> [4] https://github.com/enridaga/taverna-sandbox/blob/master/src/test/java/enridaga/AppTest.java <https://github.com/enridaga/taverna-sandbox/blob/master/src/test/java/enridaga/AppTest.java>
>
> —
> Enrico Daga (enridaga)
> http://www.enridaga.net <http://www.enridaga.net/>
> Il budda e’ nel parco.
>
>
>
>
>
>> On 3 May 2016, at 09:01, Enrico Daga (enridaga) <en...@gmail.com> wrote:
>>
>> Thank you Stian, this is gold.
>>
>> Will try the new release as well.
>>
>> It's good to have Taverna at Apache!
>>
>> Best,
>> Enrico
>>
>>
>> —
>> Enrico Daga (enridaga)
>> http://www.enridaga.net <http://www.enridaga.net/>
>> Il budda e’ nel parco.
>>
>>
>>
>>
>>
>>> On 2 May 2016, at 17:19, Stian Soiland-Reyes <stain@apache.org <ma...@apache.org>> wrote:
>>>
>>> BTW - another alternative - if you convert to wfdesc with tavlang convert - see
>>> https://github.com/apache/incubator-taverna-language/tree/master/taverna-tavlang-tool <https://github.com/apache/incubator-taverna-language/tree/master/taverna-tavlang-tool>
>>>
>>> then you should also get all the annotations across the workflow - but
>>> you will loose the information about when it was made as it comes back
>>> as a single Triple file.
>>>
>>> On 28 April 2016 at 16:25, Enrico Daga (enridaga) <enricodaga@gmail.com <ma...@gmail.com>> wrote:
>>>> Hi,
>>>>
>>>> I am using the taverna API to explore workflows downloaded from MyExperiment.
>>>> At the moment, I converted the files to the .wfbundle format using the taverna command line tools. Everything looks fine.
>>>> Unzipping a wfbundle I can read a set of .ttl files in the annotations/ folder, but I am not able to do that through the Java API.
>>>> In the simplest form, my code is as follows:
>>>>
>>>>                WorkflowBundleIO io = new WorkflowBundleIO();
>>>>                final WorkflowBundle wb = io.readBundle(__f(“file.wfbundle"), null);
>>>>                System.out.println("Annotations: " + wb.getAnnotations().size());
>>>>
>>>> What is the recommended way to get:
>>>> - The description of a workflow (as I can see it on the myexperiment portal)
>>>> - All the annotations in a bundle
>>>> - The annotations of a given WorkflowBean element
>>>> - To access/modify/extend the annotations
>>>>
>>>> I am using release 0.15.0-incubating.
>>>>
>>>> Thank you in advance for your help,
>>>>
>>>> Enrico
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> —
>>>> Enrico Daga (enridaga)
>>>> http://www.enridaga.net <http://www.enridaga.net/> <http://www.enridaga.net/ <http://www.enridaga.net/>>
>>>> Il budda e’ nel parco.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Stian Soiland-Reyes
>>> Apache Taverna (incubating), Apache Commons RDF (incubating)
>>> http://orcid.org/0000-0001-9842-9718 <http://orcid.org/0000-0001-9842-9718>
>



-- 
Stian Soiland-Reyes
Apache Taverna (incubating), Apache Commons RDF (incubating)
http://orcid.org/0000-0001-9842-9718

Re: Access/modify annotations in a WorkflowBundle

Posted by "Enrico Daga (enridaga)" <en...@gmail.com>.
Hi Stian,

I tried with the latest release but I am still struggling on getting this work.

I prepared a minimal project to test the issue [1], which contains a single test using a workflow downloaded from my experiment (and converted to wfbundle) [2].

This wf contains a set of annotations, particularly from input ports. I can see them unpacking the bundle [3].

However, I cannot access them in the way you suggested (replicated here [4]).

Best,

Enrico



[1] https://github.com/enridaga/taverna-sandbox <https://github.com/enridaga/taverna-sandbox>
[2] http://www.myexperiment.org/workflows/4303.html <http://www.myexperiment.org/workflows/4303.html>
[3] https://github.com/enridaga/taverna-sandbox/tree/master/src/test/resources/bundles/3Drec-v1/annotation <https://github.com/enridaga/taverna-sandbox/tree/master/src/test/resources/bundles/3Drec-v1/annotation>
[4] https://github.com/enridaga/taverna-sandbox/blob/master/src/test/java/enridaga/AppTest.java <https://github.com/enridaga/taverna-sandbox/blob/master/src/test/java/enridaga/AppTest.java> 

—
Enrico Daga (enridaga)
http://www.enridaga.net <http://www.enridaga.net/>
Il budda e’ nel parco.





> On 3 May 2016, at 09:01, Enrico Daga (enridaga) <en...@gmail.com> wrote:
> 
> Thank you Stian, this is gold.
> 
> Will try the new release as well.
> 
> It's good to have Taverna at Apache!
> 
> Best,
> Enrico
> 
> 
> —
> Enrico Daga (enridaga)
> http://www.enridaga.net <http://www.enridaga.net/>
> Il budda e’ nel parco.
> 
> 
> 
> 
> 
>> On 2 May 2016, at 17:19, Stian Soiland-Reyes <stain@apache.org <ma...@apache.org>> wrote:
>> 
>> BTW - another alternative - if you convert to wfdesc with tavlang convert - see
>> https://github.com/apache/incubator-taverna-language/tree/master/taverna-tavlang-tool <https://github.com/apache/incubator-taverna-language/tree/master/taverna-tavlang-tool>
>> 
>> then you should also get all the annotations across the workflow - but
>> you will loose the information about when it was made as it comes back
>> as a single Triple file.
>> 
>> On 28 April 2016 at 16:25, Enrico Daga (enridaga) <enricodaga@gmail.com <ma...@gmail.com>> wrote:
>>> Hi,
>>> 
>>> I am using the taverna API to explore workflows downloaded from MyExperiment.
>>> At the moment, I converted the files to the .wfbundle format using the taverna command line tools. Everything looks fine.
>>> Unzipping a wfbundle I can read a set of .ttl files in the annotations/ folder, but I am not able to do that through the Java API.
>>> In the simplest form, my code is as follows:
>>> 
>>>                WorkflowBundleIO io = new WorkflowBundleIO();
>>>                final WorkflowBundle wb = io.readBundle(__f(“file.wfbundle"), null);
>>>                System.out.println("Annotations: " + wb.getAnnotations().size());
>>> 
>>> What is the recommended way to get:
>>> - The description of a workflow (as I can see it on the myexperiment portal)
>>> - All the annotations in a bundle
>>> - The annotations of a given WorkflowBean element
>>> - To access/modify/extend the annotations
>>> 
>>> I am using release 0.15.0-incubating.
>>> 
>>> Thank you in advance for your help,
>>> 
>>> Enrico
>>> 
>>> 
>>> 
>>> 
>>> 
>>> —
>>> Enrico Daga (enridaga)
>>> http://www.enridaga.net <http://www.enridaga.net/> <http://www.enridaga.net/ <http://www.enridaga.net/>>
>>> Il budda e’ nel parco.
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
>> 
>> 
>> -- 
>> Stian Soiland-Reyes
>> Apache Taverna (incubating), Apache Commons RDF (incubating)
>> http://orcid.org/0000-0001-9842-9718 <http://orcid.org/0000-0001-9842-9718>


Re: Access/modify annotations in a WorkflowBundle

Posted by "Enrico Daga (enridaga)" <en...@gmail.com>.
Thank you Stian, this is gold.

Will try the new release as well.

It's good to have Taverna at Apache!

Best,
Enrico


—
Enrico Daga (enridaga)
http://www.enridaga.net <http://www.enridaga.net/>
Il budda e’ nel parco.





> On 2 May 2016, at 17:19, Stian Soiland-Reyes <st...@apache.org> wrote:
> 
> BTW - another alternative - if you convert to wfdesc with tavlang convert - see
> https://github.com/apache/incubator-taverna-language/tree/master/taverna-tavlang-tool <https://github.com/apache/incubator-taverna-language/tree/master/taverna-tavlang-tool>
> 
> then you should also get all the annotations across the workflow - but
> you will loose the information about when it was made as it comes back
> as a single Triple file.
> 
> On 28 April 2016 at 16:25, Enrico Daga (enridaga) <enricodaga@gmail.com <ma...@gmail.com>> wrote:
>> Hi,
>> 
>> I am using the taverna API to explore workflows downloaded from MyExperiment.
>> At the moment, I converted the files to the .wfbundle format using the taverna command line tools. Everything looks fine.
>> Unzipping a wfbundle I can read a set of .ttl files in the annotations/ folder, but I am not able to do that through the Java API.
>> In the simplest form, my code is as follows:
>> 
>>                WorkflowBundleIO io = new WorkflowBundleIO();
>>                final WorkflowBundle wb = io.readBundle(__f(“file.wfbundle"), null);
>>                System.out.println("Annotations: " + wb.getAnnotations().size());
>> 
>> What is the recommended way to get:
>> - The description of a workflow (as I can see it on the myexperiment portal)
>> - All the annotations in a bundle
>> - The annotations of a given WorkflowBean element
>> - To access/modify/extend the annotations
>> 
>> I am using release 0.15.0-incubating.
>> 
>> Thank you in advance for your help,
>> 
>> Enrico
>> 
>> 
>> 
>> 
>> 
>> —
>> Enrico Daga (enridaga)
>> http://www.enridaga.net <http://www.enridaga.net/> <http://www.enridaga.net/ <http://www.enridaga.net/>>
>> Il budda e’ nel parco.
>> 
>> 
>> 
>> 
>> 
> 
> 
> 
> -- 
> Stian Soiland-Reyes
> Apache Taverna (incubating), Apache Commons RDF (incubating)
> http://orcid.org/0000-0001-9842-9718 <http://orcid.org/0000-0001-9842-9718>

Re: Access/modify annotations in a WorkflowBundle

Posted by Stian Soiland-Reyes <st...@apache.org>.
BTW - another alternative - if you convert to wfdesc with tavlang convert - see
https://github.com/apache/incubator-taverna-language/tree/master/taverna-tavlang-tool

then you should also get all the annotations across the workflow - but
you will loose the information about when it was made as it comes back
as a single Triple file.

On 28 April 2016 at 16:25, Enrico Daga (enridaga) <en...@gmail.com> wrote:
> Hi,
>
> I am using the taverna API to explore workflows downloaded from MyExperiment.
> At the moment, I converted the files to the .wfbundle format using the taverna command line tools. Everything looks fine.
> Unzipping a wfbundle I can read a set of .ttl files in the annotations/ folder, but I am not able to do that through the Java API.
> In the simplest form, my code is as follows:
>
>                 WorkflowBundleIO io = new WorkflowBundleIO();
>                 final WorkflowBundle wb = io.readBundle(__f(“file.wfbundle"), null);
>                 System.out.println("Annotations: " + wb.getAnnotations().size());
>
> What is the recommended way to get:
> - The description of a workflow (as I can see it on the myexperiment portal)
> - All the annotations in a bundle
> - The annotations of a given WorkflowBean element
> - To access/modify/extend the annotations
>
> I am using release 0.15.0-incubating.
>
> Thank you in advance for your help,
>
> Enrico
>
>
>
>
>
> —
> Enrico Daga (enridaga)
> http://www.enridaga.net <http://www.enridaga.net/>
> Il budda e’ nel parco.
>
>
>
>
>



-- 
Stian Soiland-Reyes
Apache Taverna (incubating), Apache Commons RDF (incubating)
http://orcid.org/0000-0001-9842-9718

Re: Access/modify annotations in a WorkflowBundle

Posted by Stian Soiland-Reyes <st...@apache.org>.
On 28 April 2016 at 16:25, Enrico Daga (enridaga) <en...@gmail.com> wrote:
> Hi,
>
> I am using the taverna API to explore workflows downloaded from MyExperiment.
> At the moment, I converted the files to the .wfbundle format using the taverna command line tools. Everything looks fine.
> Unzipping a wfbundle I can read a set of .ttl files in the annotations/ folder, but I am not able to do that through the Java API.
> In the simplest form, my code is as follows:
>
>                 WorkflowBundleIO io = new WorkflowBundleIO();
>                 final WorkflowBundle wb = io.readBundle(__f(“file.wfbundle"), null);
>                 System.out.println("Annotations: " + wb.getAnnotations().size());
>

Hi!

I think the API docs need improvements on this (suggestions welcome!)
- but it should give you a good start for the basics.

Add a dependency for the module taverna-scufl2-annotation.

Then you can instantiate AnnotationTools:

http://taverna.staging.apache.org/javadoc/taverna-language/org/apache/taverna/scufl2/annotation/AnnotationTools.html






> What is the recommended way to get:
> - The description of a workflow (as I can see it on the myexperiment portal)

AnnotationTools ann = new AnnotationTools();
Scufl2Tools scufl2Tools = new Scufl2Tools();

Workflow wf = wb.getMainWorkflow();
System.out.println(ann.getDescription(wf);


> - All the annotations in a bundle

for (Annotation ann: wb.getAnnotations()) {
   System.out.println(ann.getRDFContent())
   // Or more elaborate:
   // (in case you want to replace the content you will need the path)
   //String path = getResourcePath();
   //System.out.println(wb.getResources().getResourceAsString(path));
}

> - The annotations of a given WorkflowBean element

InputPort inp = wf.getInputPorts().first();
Dataset ds = ann.annotationDatasetFor(inp);
// Print as NQuads
// https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/RDFDataMgr.html
RDFDataMgr.write(System.out, ds, Lang.NQUADS);



> - To access/modify/extend the annotations

To add a new annotation with a single statement:

Annotation a = ann.createNewAnnotation(wb, inp, AnnotationTools.
EXAMPLE_DATA , "GATTACCAEXAMPLE");
a.setAnnotatedBy(URI.create("http://orcid.org/0000-0001-9842-9718"));

Anything more complex you will have to manually edit with Jena APIs
and then save back
with workflowBundle.getResources().addResourceUsingOutputStream(path)
or similar.



> I am using release 0.15.0-incubating.

You should be able to use version 0.15.1-incubating which fixes some
smaller bugs in the taverna-scufl2-api.

Let us know if something doesn't work in upgrading! :)



I think AnnotationTools could be improved to use Commons RDF rather
than exposing Jena's Dataset - and add setters as well as the getters.
(The setters are slightly more complicated because you would need to
remove/edit the existing annotation - so more helper methods could be
useful here as well).

Also you might see that there's a big (but incompatible) overlap
between WorkflowBundle annotations and the taverna-robundle Manifest
API
http://taverna.staging.apache.org/javadoc/taverna-language/org/apache/taverna/robundle/manifest/Manifest.html


This is because taverna-ucfpackage predates taverna-robundle and
didn't have access to the nice java.nio.Path API - which complicates
things like reading the annotation file. The branch
https://github.com/apache/incubator-taverna-language/tree/ucfpackage-robundle
tries to align these.

(However the robundle lacks such convenience methods of
AnnotationTools - so another task would be to add something like that)


-- 
Stian Soiland-Reyes
Apache Taverna (incubating), Apache Commons RDF (incubating)
http://orcid.org/0000-0001-9842-9718