diff --git a/Makefile b/Makefile index f1c3349..99c2c07 100644 --- a/Makefile +++ b/Makefile @@ -15,14 +15,14 @@ COMPILED_MODELS := $(patsubst models/%.ttl,models/compiled/%.ttl,$(MODEL_SOURCES # '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 $@ $< + uv run 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) install-kernel: - python -m ipykernel install --user --name=python3 + uv run python -m ipykernel install --user --name=python3 # Rule to clean up the compiled models. clean: diff --git a/build_examples.sh b/build_examples.sh index 4a2b0ce..2c981bc 100644 --- a/build_examples.sh +++ b/build_examples.sh @@ -2,7 +2,7 @@ set -x # run the tools/make_model_formats.py script on the models directory -python tools/make_model_formats.py models +uv run python tools/make_model_formats.py models # for each filename in the examples/ directory, look for a corresponding .ttl file in the # models directory. If it exists, run the tools/make_count_table.py script as @@ -24,14 +24,15 @@ for filename in examples/*.md; do md_filename="examples/$(basename "${filename%.md}.md")" echo " Writing to $md_filename" - python tools/make_count_table.py "$ttl_filename" "$md_filename" - python tools/make-notebook.py "$ttl_filename" "$md_filename" - python tools/mark-out-of-date.py "$ttl_filename" "$md_filename" + uv run python tools/make_count_table.py "$ttl_filename" "$md_filename" + uv run python tools/make-notebook.py "$ttl_filename" "$md_filename" + uv run python tools/mark-out-of-date.py "$ttl_filename" "$md_filename" done # build queries -python tools/generate-queries.py +uv run python tools/generate-queries.py # for each filename in the models/ directory, run tools/compile.py -o models/compiled/.ttl mkdir -p models/compiled -make compile-models +make -j 4 compile-models +jb build . diff --git a/pyproject.toml b/pyproject.toml index 2578c3a..7a32474 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,30 +2,19 @@ name = "models-open223-info" version = "0.1.0" description = "Add your description here" -authors = [ - { name = "Gabe Fierro", email = "gtfierro@mines.edu" } -] +readme = "README.md" +requires-python = ">=3.9" dependencies = [ - "jupyter-book>=0.15.1", - "toml>=0.10.2", - "sphinxcontrib-mermaid>=0.9.2", - "rdflib>=7.0.0", - "pyontoenv==0.1.9a3", - "brickschema==0.7.4a9", + "brick-tq-shacl==0.3.4a1", + "jupyter-book>=1.0.2", + "jupyterlab>=4.2.5", "nbformat>=5.10.4", - "jupyterlab>=4.2.4", - "buildingmotif[topquadrant] @ git+https://github.com/NREL/buildingmotif.git@develop" + "pyontoenv>=0.1.9", + "rdflib>=7.0.0", + "sphinxcontrib-mermaid>=0.9.2", + "toml>=0.10.2", ] -readme = "README.md" -requires-python = ">= 3.11" [build-system] requires = ["hatchling"] build-backend = "hatchling.build" - -[tool.rye] -managed = true -dev-dependencies = [] - -[tool.hatch.metadata] -allow-direct-references = true diff --git a/tools/compile.py b/tools/compile.py index 9b39c2a..5cb1d39 100644 --- a/tools/compile.py +++ b/tools/compile.py @@ -2,11 +2,13 @@ import string import random import argparse -import brickschema -from brickschema import topquadrant_shacl +import rdflib +#import brickschema +#from brickschema import topquadrant_shacl +from brick_tq_shacl.topquadrant_shacl import infer, validate import rdflib -graph = brickschema.Graph() +graph = rdflib.Graph() if __name__ == "__main__": parser = argparse.ArgumentParser( @@ -41,9 +43,9 @@ graph.remove((None, rdflib.OWL.imports, None)) s223.remove((None, rdflib.OWL.imports, None)) #topquadrant_shacl._MAX_EXTERNAL_LOOPS = 2 - graph = topquadrant_shacl.infer(graph, s223) + graph = infer(graph, s223) #graph.expand(profile="shacl", backend="topquadrant") - valid, _, report = topquadrant_shacl.validate(graph, s223) + valid, _, report = validate(graph, s223) if not valid: print(report) raise Exception("Validation failed: {}".format(report))