Skip to content

Convert Excel files to JSON, RDF or ISA‐JSONv1

GerganaTancheva123 edited this page Feb 26, 2024 · 2 revisions

Command-line tool

enmconvertor is a command line application for converting between supported data formats with nanomaterial safety data.

Converting MSExcel spreadsheets requires a separate JSON configuration file. The configuration syntax is described in this wiki. Predefined JSON configuration files are available via the Template Wizard

  • Kochev, Nikolay, Nina Jeliazkova, Vesselina Paskaleva, Gergana Tancheva, Luchesar Iliev, Peter Ritchie, and Vedrin Jeliazkov. 2020. “Your Spreadsheets Can Be FAIR: A Tool and FAIRification Workflow for the ENanoMapper Database.” Nanomaterials 10 (10): 1908. https://doi.org/10.3390/nano10101908.

Download

Usage

java -jar enmconvertor-1.4.0.jar
INFO   enmparser 1.4.0 build:b5aa94d89107d6673222e381df00b48100700ed7 1603375933831

usage: enmconvertor-{version}
 -a,--annotation <annotation>  Path to annotation folder 
 -c,--command
 <data|extracttemplatefields|generatejsonconfig|generatetemplate|>   The  type of converted content
 -h,--help  This help
 -i,--input <file>
 [data]: Input file or folder
 [extracttemplatefields]: Root spreadsheet folder as used in .properties
 [generatejsonconfig]: Input spreadsheet
 -I,--inputformat <format>
 xls|xlsx|json|NWrdf|rdf
 If not specified, recognised from input file extension
 -L,--listformats
 List supported formats
 -o,--output <file>
 Output file or folder
 -O,--outputformat <format>
 |json|rdf|isa|report|xlsx_jrc|xlsx_multisheet
 If not specified, recognised from output file extension
 -s,--sheet <sheet>
 Sheet number to be processed. All sheets if missing
 -t,--templateid <templateid>
 Template identifier
 -x,--xconfig <file>
 [data]: JSON config file for input formats xls,xlsx
 [extracttemplatefields]: .properties file assigning JSON to worksheets
 [generatetemplate]: JSON file with template definitions

Note: -a option is not yet functional in the command line application (it is in the web application). The folder layout should be the same as here

Supported formats

java -jar enmconvertor.jar -L

INFO   enmparser 1.4.0 build:b5aa94d89107d6673222e381df00b48100700ed7 1603375933831

(R)     xls     Excel (.xls) spreadsheet, requires JSON configuration file (option -x) on input
(R)     xlsx    Excel (.xlsx) spreadsheet, requires JSON configuration file (option -x) on input
(RW)    json    AMBIT JSON
(R)     NWrdf   NanoWiki RDF (Semantic Media Wiki RDF export)
(RW)    rdf     eNanoMapper RDF (based on BioAssayOntology RDF) , extensions .n3 , .rdf (RDF/XML) , .ttl, .json (for JSON-LD)
(W)     isa     ISA-JSON v1 (see https://github.com/ISA-tools/isa-api)
(W)     report  Human readable Excel export
(W)     xlsx_jrc        Excel (.xlsx) spreadsheet template, JRC/NANOREG format
(W)     xlsx_multisheet Excel (.xlsx) spreadsheet template, multisheet format

Examples NanoSafety Cluster Excel spreadsheets

NANoREG/JRC style template

IOM–Nano–EHS data templates

Converting NanoSafety Cluster Excel spreadsheets

to ISA-JSONv1

java -jar enmconvertor.jar -i "GRACIOUS_Template_ZetaPotential_ElectrophorLightScatt.xlsx" -j "GRACIOUS_Template_ZetaPotential_ElectrophorLightScatt.json" -I xlsx -O isa -o "output.isa.json"

to AMBIT/eNanoMapper JSON

java -jar enmconvertor.jar -i "GRACIOUS_Template_ZetaPotential_ElectrophorLightScatt.xlsx" -j "GRACIOUS_Template_ZetaPotential_ElectrophorLightScatt.json" -I xlsx -O json -o "output.json"

to eNanoMapper RDF

N3 syntax

java -jar enmconvertor.jar -i GRACIOUS_Template_ZetaPotential_ElectrophorLightScatt_modified.xlsx  -x GRACIOUS_Template_ZetaPotential_ElectrophorLightScatt_sheet1_modified.json -O rdf -o output.n3

JSON-LD syntax

java -jar enmconvertor.jar -i GRACIOUS_Template_ZetaPotential_ElectrophorLightScatt_modified.xlsx  -x GRACIOUS_Template_ZetaPotential_ElectrophorLightScatt_sheet1_modified.json -O rdf -o output.json

RDF/XML syntax

java -jar enmconvertor.jar -i GRACIOUS_Template_ZetaPotential_ElectrophorLightScatt_modified.xlsx  -x GRACIOUS_Template_ZetaPotential_ElectrophorLightScatt_sheet1_modified.json -O rdf -o output.rdf

Converting NanoWiki release4

to ISA-JSONv1

java -jar enmconvertor.jar -i nanowiki.cczero.4.rdf.gz -I NWrdf -O isa -o nanowiki.cczero.4.isa.json

to enanomapper RDF (N3 syntax)

java -jar enmconvertor.jar -i nanowiki.cczero.4.rdf.gz -I NWrdf -O rdf -o nanowiki.cczero.4.enm.n3

For developers

ISA-JSON export software tools

Available from the ambit2-export package.

<dependency>
  <groupId>ambit</groupId>
  <artifactId>ambit2-export</artifactId>
  <version>4.0.1-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>net.enanomapper</groupId>
  <artifactId>enmexcelparser</artifactId>
  <version>1.4.0</version>
</dependency>
<dependency>
  <groupId>net.enanomapper</groupId>
  <artifactId>enmnanowiki</artifactId>
  <version>1.4.0</version>
</dependency>
<repository>
	<snapshots>
		<enabled>false</enabled>
	</snapshots>
		<id>nexus-idea-releases</id>
		<name>nexus-idea-releases</name>
		<url>https://nexus.ideaconsult.net/content/repositories/releases</url>
</repository>
<repository>
	<releases>
		<enabled>false</enabled>
	</releases>
	<id>nexus-idea-snapshots</id>
	<name>nexus-idea-snapshots</name>
	<url>https://nexus.ideaconsult.net/content/repositories/snapshots</url>
</repository>
Clone this wiki locally