Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile models for queries #20

Merged
merged 14 commits into from
Jan 16, 2024
6 changes: 6 additions & 0 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:
run: |
pip install -r requirements.txt

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: build examples
run: |
bash build_examples.sh
Expand Down
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.PHONY: all environment compile-models clean refresh-ontoenv

# Assuming 'all' should build everything. If 'environment' is a task that should be run,
# you need to add a corresponding recipe for it.
all: refresh-ontoenv compile-models

# MODEL_SOURCES will find all .ttl files in the models directory.
MODEL_SOURCES := $(wildcard models/*.ttl)

# COMPILED_MODELS will be the list of files but in the models/compiled folder.
COMPILED_MODELS := $(patsubst models/%.ttl,models/compiled/%.ttl,$(MODEL_SOURCES))

refresh-ontoenv:
ontoenv init -s ontologies/ -v

# Rule to compile each model.
# The prerequisite 'models/%.ttl' means it will match each .ttl file in the models directory.
# 'tools/compile.py' ensures the compile script is present, but should be a prerequisite only if you want to track changes on it.
# 'ontologies/*.ttl' captures changes in any .ttl file in the ontologies directory.
models/compiled/%.ttl: models/%.ttl tools/compile.py
python tools/compile.py -r -i -o $@ $< ontologies/223p.ttl

# The compile-models target will "make" all of the COMPILED_MODELS.
compile-models: $(COMPILED_MODELS)

# Rule to clean up the compiled models.
clean:
rm -f models/compiled/*.ttl
7 changes: 7 additions & 0 deletions build_examples.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash
set -x

# run the tools/make_model_formats.py script on the models directory
python tools/make_model_formats.py models

Expand Down Expand Up @@ -26,3 +29,7 @@ done

# build queries
python tools/generate-queries.py

# for each filename in the models/ directory, run tools/compile.py -o models/compiled/<filename>.ttl
mkdir -p models/compiled
make compile-models
6,475 changes: 6,475 additions & 0 deletions ontologies/223p.ttl

Large diffs are not rendered by default.

Loading