-
Notifications
You must be signed in to change notification settings - Fork 6
Description
As part of KBase's work with ontologies in semsql, it would be very handy to be able to export as DSV directly, rather than going via the sqlite database.
We could put together a file similar to build.Makefile to perform the conversions, but I am wary of changes being made in the semsql sqlite build process that we'd have to ensure that we kept up with. I was therefore wondering about adapting the current build command to export either DSV or sqlite, depending on what args it is given.
build.Makefile line 51 onwards:
# -- MAIN TARGET --
# A db is constructed from
# (1) triples loaded using rdftab
# (2) A relation-graph TSV
%.db: %.owl %-$(RGSUFFIX).tsv $(PREFIX_CSV_PATH)
rm -f [email protected] && \
cat $(THIS_DIR)/sql_schema/semsql.sql | sqlite3 [email protected] && \
echo .exit | sqlite3 -echo [email protected] -cmd ".mode csv" -cmd ".import $(PREFIX_CSV_PATH) prefix" && \
rdftab [email protected] < $< && \
sqlite3 [email protected] -cmd '.separator "\t"' ".import $*-$(RGSUFFIX).tsv entailed_edge" && \
gzip -f $*-$(RGSUFFIX).tsv && \
cat $(THIS_DIR)/indexes/*.sql | sqlite3 [email protected] && \
echo "ALTER TABLE statements ADD COLUMN graph TEXT;" | sqlite3 [email protected] && \
(test -d views && find views -maxdepth 1 -name '$(notdir $*)*.sql' -type f -print0 | xargs -0 -I{} sh -c 'sqlite3 [email protected]< "$$1"' sh {} || echo no views ) && \
mv [email protected] $@
.PRECIOUS: %.db
Alter this so that if the desired output is DSV, the rdftab command is run but the sqlite db loading is omitted. Relevant files, including prefixes, relation graph, and schema SQL could be moved to a directory together or something like that.