Developer:Components

From myExperiment
Revision as of 10:40, 19 March 2014 by FinnBacall (talk | contribs) (Components)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Structure

Components are organised into component families.

Component families are groups of components that comply with a single component profile.

  • Components must be associated with a component family.
  • Component families must be associated with a component profile.

API

An XML-based API for finding and managing Taverna components is described here.

Components

Find/list components

URL: GET http://www.myexperiment.org/components.xml

Returns a list of all visible components. Can be filtered using SPARQL syntax or by providing a component-family URI (or both).

Parameters:

  • query (optional) - Filter the set of components using the given SPARQL query fragment. Will be inserted into a SPARQL template (shown below).
  • prefixes (optional) - A list of prefixes for the above query.
  • component-family (optional) - A URI to a component family (e.g. http://www.myexperiment.org/packs/123). Will only return components from this family.

SPARQL Template

If given, the SPARQL "query" and "prefixes" parameters are inserted into the following template, and a SPARQL query is performed. A template is used to restrict the SPARQL query to only return myExperiment workflow URIs. These URIs are then resolved by myExperiment to workflow objects, over which authorization is performed. This allows components with access restrictions to be discovered by users with sufficient privileges, the alternative being to only allow public components to be listed.

PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX wfdesc:<http://purl.org/wf4ever/wfdesc#>
[SPARQL prefixes parameter here]

SELECT DISTINCT ?workflow_uri WHERE {
  GRAPH ?workflow_uri {
    ?w a wfdesc:Workflow .
    [SPARQL query parameter here]
  }
} 

Get component

URL: GET http://www.myexperiment.org/component.xml?id=123

Return myExperiment's metadata for the given component ID. Contains a URI to download the component.

Parameters:

  • id (required) - The ID of the component.

Create new component

URL: POST http://www.myexperiment.org/component.xml

Upload a new component into a component family.

The body of the request is nearly identical to that of a workflow POST, described here, with an additional field: "component-family".

The "component-family" field should contain the URI to a valid myExperiment component family.

Example

<workflow>
  <title>A Component</title>
  <description>It's a component</description>
  <component-family>http://www.myexperiment.org/packs/1234</component-family>
  <license-type>by-sa</license-type>
  <content-type>application/vnd.taverna.t2flow+xml</content-type>
  <content> ... Base64 encoded workflow body goes here ... </content>
</workflow>

Create new component version

Creates a new version of an existing component.

Identical to the endpoint described above, except an 'id' parameter is required, and an optional 'revision-comment' field can be passed to describe the change between versions.

URL: POST http://www.myexperiment.org/component.xml?id=123

Parameters:

  • id (required) - The ID of the component.

Example

<workflow>
  <content-type>application/vnd.taverna.t2flow+xml</content-type>
  <content> ... Base64 encoded workflow body goes here ... </content>
  <revision-comment>Fixed issue with previous version</revision-comment>
</workflow>

Delete component

Deletes the component with the given ID.

This uses the workflow API.

URL: DELETE http://www.myexperiment.org/workflow.xml?id=123

Component Families

List component families

Returns a list of available component families.

Takes an optional component profile URI to return only component families which use that profile.

URL: GET http://www.myexperiment.org/component-families.xml

Parameters:

  • component-profile (optional) - The URI of a valid myExperiment component profile.

Create component family

Creates a new component family.

The body of the request is nearly identical to that of a pack POST, described here, with an additional field: "component-profile", which should contain a URI of a valid myExperiment component profile.

URL: POST http://www.myexperiment.org/component-family.xml

Example

<pack>
  <title>A Component Family</title>
  <description>It's for components</description>
  <component-profile>http://www.myexperiment.org/files/12345</component-profile>
  <license-type>by-sa</license-type>
</pack>

Delete component family

Deletes the component family with the given ID, and all components within it.

If all components are not able to be deleted due to lack of privileges, the operation will fail and nothing will be deleted.

URL: DELETE http://www.myexperiment.org/component-family.xml?id=123

Parameters:

  • id (required) - The ID of the component family to delete.

Response codes:

  • 200 - Success
  • 401 - Not authorized to delete the family, or one or more components within it

Component Profiles

List component profiles

Lists all available component profiles.

URL: GET http://www.myexperiment.org/component-profiles.xml

Create component profile

Creates a new component profile.

The body of the request is identical to that of a file POST, described here, but the content-type must be application/vnd.taverna.component-profile+xml.

URL: POST http://www.myexperiment.org/component-profile.xml

Example

<file>
  <title>Component Profile</title>
  <filename>profile.xml</filename>
  <description>It's for components</description>
  <content-type>application/vnd.taverna.component-profile+xml</content-type>
  <content> ... Base64 encoded file contents goes here ...</content>
  <license-type>by-sa</license-type>
</file>

Delete component profile

Deletes the component profile with the given ID.

If the component profile is used by one or more families, the operation will fail.

URL: DELETE http://www.myexperiment.org/component-profile.xml?id=123

Parameters:

  • id (required) - The ID of the component profile to delete.

Response codes:

  • 200 - Success
  • 400 - Failure, the component profile is in use and may not be deleted