Skip to content
Open
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
7 changes: 3 additions & 4 deletions .github/workflows/manage_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ name: Build, Test, Draft Release

on:
push:
branches:
- develop
- feature/*
branches:
- develop
pull_request:
branches:
branches:
- master

permissions:
Expand Down
86 changes: 85 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ REQUIRED_DIRS = $(config.LIBRARY_DIR) $(config.SOURCE_DIR) $(config.QUERIES_DIR)
# ----------------------------------------
#### Targets / main "goals" of this Makefile
.PHONY: all
all: setup reason-individual test-individual build-combined reason-combined test-combined
all: setup bfo-diff stamp-version reason-individual test-individual build-combined reason-combined test-combined build-ccom

# Setup target for creating necessary directories
.PHONY: setup
Expand Down Expand Up @@ -169,3 +169,87 @@ clean:
@[ "${config.REPORTS_DIR}" ] || ( echo ">> config.REPORTS_DIR is not set"; exit 1 )
rm -rf $(config.REPORTS_DIR)
rm -rf $(combined-file)

BFO_LOCAL := src/cco-imports/bfo-core.ttl
BFO_UPSTREAM_URL := http://purl.obolibrary.org/obo/bfo/2020/bfo-core.ttl
BFO_UPSTREAM_TMP := $(config.TEMP_DIR)/bfo-upstream-latest.ttl
BFO_DIFF_OUT := $(config.TEMP_DIR)/bfo-upstream-diff.txt

.PHONY: bfo-diff
bfo-diff: | $(config.TEMP_DIR)
@echo "Fetching BFO upstream from $(BFO_UPSTREAM_URL)..."
curl -sSL -o $(BFO_UPSTREAM_TMP) $(BFO_UPSTREAM_URL)
@echo "Diffing local $(BFO_LOCAL) against upstream..."
@if diff -u $(BFO_LOCAL) $(BFO_UPSTREAM_TMP) > $(BFO_DIFF_OUT) 2>&1; then \
echo "BFO DIFF: No changes — local copy is in sync with upstream."; \
else \
echo "BFO DIFF: Changes detected! Review $(BFO_DIFF_OUT) before release."; \
echo "--- Summary (added/removed lines) ---"; \
echo " Lines added : $$(grep -c '^+[^+]' $(BFO_DIFF_OUT) || echo 0)"; \
echo " Lines removed: $$(grep -c '^-[^-]' $(BFO_DIFF_OUT) || echo 0)"; \
fi
@echo "Full diff written to $(BFO_DIFF_OUT)"

# ---------------------------------------------------------------------------
# T11 — stamp-version: Update owl:versionIRI and owl:versionInfo on all modules
# ---------------------------------------------------------------------------

VERSION ?=
DATE ?= $(TODAY)

.PHONY: stamp-version
stamp-version:
@if [ -z '$(VERSION)' ]; then \
echo 'ERROR: VERSION is required. Usage: make stamp-version VERSION=2.1 [DATE=YYYY-MM-DD]'; \
exit 1; \
fi
@echo "Stamping v$(VERSION) ($(DATE)) on all module files..."
@for f in $(DEV_FILES); do \
echo " $$f"; \
sed -i '' \
-e 's|<https://www\.commoncoreontologies\.org/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/|<https://www.commoncoreontologies.org/$(DATE)/|g' \
-e 's|"Version [^"]*"@en|"Version $(VERSION)"@en|g' \
"$$f"; \
done
@echo " src/cco-merged/CommonCoreOntologiesMerged.ttl"
@sed -i '' \
-e 's|<https://www\.commoncoreontologies\.org/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/|<https://www.commoncoreontologies.org/$(DATE)/|g' \
-e 's|"Version [^"]*"@en|"Version $(VERSION)"@en|g' \
src/cco-merged/CommonCoreOntologiesMerged.ttl
@echo "stamp-version complete: v$(VERSION) / $(DATE)"

# ---------------------------------------------------------------------------
# T12 — build-ccom: Rebuild CommonCoreOntologiesMerged.ttl via ROBOT merge
# ---------------------------------------------------------------------------
CCOM_MERGED := src/cco-merged/CommonCoreOntologiesMerged.ttl
CCOM_IRI := https://www.commoncoreontologies.org/CommonCoreOntologiesMerged
CCOM_COMMENT := A stand-alone file containing the eleven mid-level Common Core Ontologies plus BFO. Provided for use-cases where one file representing a specific release of CCO and its imports is desirable.
CCOM_LICENSE := BSD 3-Clause: https://github.com/CommonCoreOntology/CommonCoreOntologies/blob/master/LICENSE
CCOM_RIGHTS := CUBRC Inc., see full license.

.PHONY: build-ccom
build-ccom: $(ROBOT_FILE) | $(config.TEMP_DIR)
@if [ -z '$(VERSION)' ]; then \
echo 'ERROR: VERSION is required. Usage: make build-ccom VERSION=2.1 [DATE=YYYY-MM-DD]'; \
exit 1; \
fi
@echo "Merging 11 CCO modules + BFO via ROBOT merge..."
java -jar $(ROBOT_FILE) merge \
$(foreach f,$(DEV_FILES),--input $(f)) \
--input $(BFO_LOCAL) \
--catalog src/cco-merged/catalog-v001.xml \
--output $(config.TEMP_DIR)/ccom-raw.ttl
@echo "Applying CCOM ontology header (IRI, version, metadata)..."
java -jar $(ROBOT_FILE) annotate \
--input $(config.TEMP_DIR)/ccom-raw.ttl \
--remove-annotations \
--ontology-iri $(CCOM_IRI) \
--version-iri https://www.commoncoreontologies.org/$(DATE)/CommonCoreOntologiesMerged \
--language-annotation rdfs:label "Common Core Ontologies Merged" en \
--language-annotation rdfs:comment "$(CCOM_COMMENT)" en \
--language-annotation http://purl.org/dc/terms/license "$(CCOM_LICENSE)" en \
--language-annotation http://purl.org/dc/terms/rights "$(CCOM_RIGHTS)" en \
--language-annotation owl:versionInfo "Version $(VERSION)" en \
--language-annotation owl:versionInfo "Depends on http://purl.obolibrary.org/obo/bfo/2020/bfo-core.ttl, obtained $(DATE)." en \
--output $(CCOM_MERGED)
@echo "build-ccom complete: $(CCOM_MERGED)"