Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-i
automake \
aha \
dos2unix \
sqlite3 \
libjson-perl \
libbusiness-isbn-perl \
pkg-config \
Expand Down Expand Up @@ -102,14 +101,6 @@ RUN chmod +x /tools/obodash && \
echo " echo 'skipped ROBOT jar download.....' && touch \$@" >> Makefile && \
echo "" >> Makefile

# Install relation-graph
ENV RG=2.3.2
ENV PATH="/tools/relation-graph/bin:$PATH"
RUN wget -nv https://github.com/balhoff/relation-graph/releases/download/v$RG/relation-graph-cli-$RG.tgz \
&& tar -zxvf relation-graph-cli-$RG.tgz \
&& mv relation-graph-cli-$RG /tools/relation-graph \
&& chmod +x /tools/relation-graph

# Install ROBOT plugins
RUN wget -nv -O /tools/sssom-cli https://github.com/gouttegd/sssom-java/releases/download/sssom-java-$SSSOM_JAVA_VERSION/sssom-cli && \
chmod +x /tools/sssom-cli && \
Expand Down
2 changes: 1 addition & 1 deletion docker/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@ RUN wget -nv https://github.com/ontodev/rdftab.rs/archive/refs/tags/v$RDFTAB_VER
tar xf rdftab.tar.gz && \
cd rdftab.rs-$RDFTAB_VERSION && \
cargo build --release -Z sparse-registry && \
install -D -m 755 target/release/rdftab /staging/full/usr/bin/rdftab && \
install -D -m 755 target/release/rdftab /staging/lite/usr/bin/rdftab && \
cd /build && \
rm -rf rdftab.rs-$RDFTAB_VERSION rdftab.tar.gz /root/.cargo
15 changes: 13 additions & 2 deletions docker/odklite/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ ENV ROBOT_VERSION=1.9.7
ENV DOSDP_VERSION=0.19.3
ENV OWLTOOLS_VERSION=2020-04-06
ENV AMMONITE_VERSION=2.5.9
ENV RELATION_GRAPH=2.3.2

WORKDIR /tools
ENV JAVA_HOME="/usr"
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV PATH="/tools:/tools/dosdptools/bin:$PATH"
ENV PATH="/tools:/tools/dosdptools/bin:/tools/relation-graph/bin:$PATH"

ARG ODK_VERSION=0.0.0
ENV ODK_VERSION=$ODK_VERSION
Expand All @@ -33,7 +34,8 @@ RUN apt-get update && \
jq \
rsync \
time \
sudo
sudo \
sqlite3

# Install Python environment (copied over from the builder image).
COPY --from=obolibrary/odkbuild:latest /staging/lite /
Expand Down Expand Up @@ -73,9 +75,18 @@ RUN wget -nv https://github.com/lihaoyi/Ammonite/releases/download/$AMMONITE_VER
chmod 755 /tools/amm && \
java -cp /tools/amm ammonite.AmmoniteMain /dev/null

# Install relation-graph
RUN wget -nv https://github.com/balhoff/relation-graph/releases/download/v$RELATION_GRAPH/relation-graph-cli-$RELATION_GRAPH.tgz && \
tar -zxvf relation-graph-cli-$RELATION_GRAPH.tgz && \
mv relation-graph-cli-$RELATION_GRAPH /tools/relation-graph && \
chmod +x /tools/relation-graph

# Install RDF/XML validation script
COPY --chmod=755 scripts/check-rdfxml.sh /tools/check-rdfxml

# Install script to convert JSON context prefix map to CSV prefix map
COPY --chmod=755 scripts/context2csv.py /tools/context2csv

# Make sure we run under an existing user account with UID/GID
# matching the UID/GID of the calling user
COPY --chmod=755 scripts/entrypoint.sh /usr/local/sbin/odkuser-entrypoint.sh
Expand Down
4 changes: 2 additions & 2 deletions odk/odk.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,8 @@ class OntologyProject(JsonSchemaMixin):
release_materialize_object_properties : List[str] = None
"""Define which object properties to materialise at release time."""

export_formats : List[str] = field(default_factory=lambda: ['owl', 'obo'])
"""A list of export formats you wish your release artefacts to be exported to, such as owl, obo, gz, ttl."""
export_formats : List[str] = field(default_factory=lambda: ['owl', 'obo', 'db'])
"""A list of export formats you wish your release artefacts to be exported to, such as owl, obo, gz, ttl, db."""

namespaces : Optional[List[str]] = None
"""A list of namespaces that are considered at home in this ontology. Used for certain filter commands."""
Expand Down
1 change: 1 addition & 0 deletions requirements.txt.lite
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ tsvalid
jinjanator
lightrdf
sssom
semsql
babelon
16 changes: 16 additions & 0 deletions scripts/context2csv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python3

import json
import sys

try:
context = json.load(sys.stdin)
except json.JSONDecodeError:
sys.exit("Cannot read context file")

if not '@context' in context:
sys.exit("No @context in supposed context file")

print("prefix,base")
for prefix_name, url_prefix in context['@context'].items():
print(f"{prefix_name},{url_prefix}")
4 changes: 4 additions & 0 deletions template/.gitignore.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ bin/
*.tmp.obo
*.tmp.owl
*.tmp.json
*-relation-graph.tsv.gz
.template.db

.github/token.txt

Expand All @@ -16,11 +18,13 @@ src/ontology/reports/*
src/ontology/{{ project.id }}.owl
src/ontology/{{ project.id }}.obo
src/ontology/{{ project.id }}.json
src/ontology/{{ project.id }}.db
src/ontology/{{ project.id }}-base.*
src/ontology/{{ project.id }}-basic.*
src/ontology/{{ project.id }}-full.*
src/ontology/{{ project.id }}-simple.*
src/ontology/{{ project.id }}-simple-non-classified.*
src/ontology/config/context.csv

src/ontology/seed.txt
src/ontology/dosdp-tools.log
Expand Down
16 changes: 16 additions & 0 deletions template/src/ontology/Makefile.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ ONTOLOGYTERMS = $(TMPDIR)/ontologyterms.txt
EDIT_PREPROCESSED = $(TMPDIR)/$(ONT)-preprocess.owl
{%- if project.use_context %}
CONTEXT_FILE = config/context.json
{%- if 'db' in project.export_formats %}
CONTEXT_FILE_CSV = config/context.csv
{%- endif %}
{%- endif %}

{%- if project.use_dosdps %}
Expand Down Expand Up @@ -1058,6 +1061,19 @@ $(TRANSLATIONSDIR)/%.babelon.json: $(TRANSLATIONSDIR)/%.babelon.tsv
{% endif -%}
{% endfor -%}

{% if 'db' in project.export_formats -%}
{% if project.use_context -%}
$(CONTEXT_FILE_CSV): $(CONTEXT_FILE)
context2csv < $< > $@
{% endif -%}

%.db: %.owl $(CONTEXT_FILE_CSV)
@rm -f $*.db $*-relation-graph.tsv.gz .template.db .template.db.tmp
semsql make $*.db{% if project.use_context %} -P $(CONTEXT_FILE_CSV){% endif %}
@rm -f $*-relation-graph.tsv.gz .template.db .template.db.tmp
@test -f $*.db || (echo "SQLite/SemSQL generation failed" && exit 1)
{% endif -%}

# ----------------------------------------
# Release artefacts: main release artefacts
# ----------------------------------------
Expand Down
1 change: 1 addition & 0 deletions tests/test-release-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export_formats:
- obo
- json
- ttl
- db
import_group:
products:
- id: ro
Expand Down