Generate RDF from Excel spreadsheets.
pip3 install excel2rdf
$ excel2rdf --help
Usage: excel2rdf [OPTIONS] INPUT_FILENAME OUTPUT_FILENAME
Options:
-f TEXT RDF format
--help Show this message and exit.
excel2rdf input.xlsx output.ttl
The first sheet in the Excel document (Sheet1) can be named anything. It is used as the data table.
The first column of the header must be named uri
. The value of the cells in the column uri
will be the fully qualified URI of a resource for the given row. If left blank, excel2rdf will generate a random URI.
The other columns of the header denote the predicate of the triple statement in curie format. The cell values can be either a curie or any literal value.
The following table demonstrates the usage of the same property skos:prefLabel
across many columns with values in different language tags.
uri | rdf:type | skos:prefLabel | skos:prefLabel | skos:prefLabel | skos:prefLabel |
---|---|---|---|---|---|
https://example.com/concept/m | skos:Concept | metre | meter@en-us | metre@en-gb | metre@en-au |
Output:
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
<https://example.com/concept/m> a skos:Concept ;
skos:prefLabel "metre",
"metre"@en-au,
"metre"@en-gb,
"meter"@en-us .
A sheet named prefixes
must exist. This sheet contains the prefix declarations. The first cell in the row must begin with a #
. The second cell must be the prefix value and the third cell must be the fully qualified base URI of the prefix.
A single base URI is declared with the first cell containing ##
and the second cell containing the base URI.
## | https://example.com/concept/ | |
---|---|---|
# | skos | http://www.w3.org/2004/02/skos/core# |
# | rdf | http://www.w3.org/1999/02/22-rdf-syntax-ns# |
See examples/manufacturers.xlsx for a full example.
- The
.
character cannot be used in the headings of each column.