CSV to VOTable importer
Created: 2013-07-29 17:33:49
Last updated: 2013-07-29 17:37:10
This module provides a VOTable representation of the CSV file being pointed by the csv_file_path, either as a POSIX local file path, or a URL.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (1)
Juan de Dios Santander-Vela |
Titles (1)
Descriptions (1)
This module provides a VOTable representation of the CSV file being pointed by the csv_file_path, either as a POSIX local file path, or a URL. |
Dependencies (0)
Inputs (1)
Name |
Description |
csv_file_path |
File path, or URL, containing csv data
|
Processors (5)
Name |
Type |
Description |
Format_conversion |
tpipe |
This AstroTaverna module uses the STIL library to change between the formats set by formatTableIn and formatTableOut (for instance, csv, fits, votable, tsv, and many others). In string mode, it changes the table _content_ passed by voTable, and generates content in the output format in outputTable. In file or URL mode, the path or URL is read, and a new file is generated, and its path is delivered in the output. |
formatTableIn_value_csv |
stringconstant |
Set to csv, so that CSV files can be read. Valuecsv |
formatTableOut_value_votable |
stringconstant |
Set to votable, so that the result is a VOtable. Valuevotable |
Read_Text_File |
localworker |
Beanshell generic module that produces a Taverna string from the path of the given file. Used here to retrieve the contents of the CSV file path or URL. ScriptBufferedReader getReader (String fileUrl, String encoding) throws IOException {
InputStreamReader reader;
try {
if (encoding == null) {
reader = new FileReader(fileUrl);
} else {
reader = new InputStreamReader(new FileInputStream(fileUrl),encoding);
}
}
catch (FileNotFoundException e) {
// try a real URL instead
URL url = new URL(fileUrl);
if (encoding == null) {
reader = new InputStreamReader (url.openStream());
} else {
reader = new InputStreamReader (url.openStream(), encoding);
}
}
return new BufferedReader(reader);
}
StringBuffer sb = new StringBuffer(4000);
if (encoding == void) {
encoding = null;
}
BufferedReader in = getReader(fileurl, encoding);
String str;
String lineEnding = System.getProperty("line.separator");
while ((str = in.readLine()) != null) {
sb.append(str);
sb.append(lineEnding);
}
in.close();
filecontents = sb.toString();
|
encoding_value |
stringconstant |
Constant value to set the input encoding for the CSV file. Set to UTF-8. Valueutf-8 |
Outputs (1)
Name |
Description |
votable |
Final string with the VOTable content representation of the input CSV file.
|
Datalinks (6)
Source |
Sink |
formatTableIn_value_csv:value |
Format_conversion:formatTableIn |
formatTableOut_value_votable:value |
Format_conversion:formatTableOut |
Read_Text_File:filecontents |
Format_conversion:voTable |
csv_file_path |
Read_Text_File:fileurl |
encoding_value:value |
Read_Text_File:encoding |
Format_conversion:outputTable |
votable |
Uploader
License
All versions of this Workflow are
licensed under:
Version 2 (latest)
(of 2)
Credits (3)
(People/Groups)
Attributions (0)
(Workflows/Files)
None
Shared with Groups (3)
Featured In Packs (2)
Log in to add to one of your Packs
Attributed By (0)
(Workflows/Files)
None
Favourited By (1)
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
Comments (1)
Log in to make a comment
the read_file box is not needed. Instead of providing a path in the input port, you can choose the file when you run the workflow and Taverna open it and extract its content.