Skip to content

Commit

Permalink
Compile models for queries (#20)
Browse files Browse the repository at this point in the history
* build compiled models

* add ontologies

* queries refer to compiled models. add link to cmpiled model too

* add deps

* include java for topquadrant shacl

* remove unneeded files

* more visibility

* find onntology

* get curdir

* use correct 223p file

* update 223p.ttl

* shorter compile times, fix query formatting?

* prioritize compiled model

* fixing links
  • Loading branch information
gtfierro authored Jan 16, 2024
1 parent c2f42d1 commit c26cdfc
Show file tree
Hide file tree
Showing 21 changed files with 121,954 additions and 4 deletions.
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

0 comments on commit c26cdfc

Please sign in to comment.