Skip to content

Commit 66acf7c

Browse files
feat: add bfo-diff, stamp-version, build-ccom targets (#790)
bfo-diff: fetches upstream BFO, diffs vs local, reports line counts stamp-version: updates owl:versionIRI and owl:versionInfo across all 12 ttl files build-ccom: ROBOT merge of 11 modules + BFO, then annotate with correct CCOM header All three targets require VERSION= and exit with a clear error if omitted. Full release pipeline: make all VERSION=2.1 DATE=YYYY-MM-DD Also: trim trailing whitespace in manage_release.yml (no logic changes)
1 parent a360c76 commit 66acf7c

2 files changed

Lines changed: 87 additions & 4 deletions

File tree

.github/workflows/manage_release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ name: Build, Test, Draft Release
22

33
on:
44
push:
5-
branches:
6-
- develop
7-
- feature/*
5+
branches:
6+
- develop
87
pull_request:
9-
branches:
8+
branches:
109
- master
1110

1211
permissions:

Makefile

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,87 @@ clean:
182182
@[ "${config.REPORTS_DIR}" ] || ( echo ">> config.REPORTS_DIR is not set"; exit 1 )
183183
rm -rf $(config.REPORTS_DIR)
184184
rm -rf $(combined-file)
185+
186+
BFO_LOCAL := src/cco-imports/bfo-core.ttl
187+
BFO_UPSTREAM_URL := http://purl.obolibrary.org/obo/bfo/2020/bfo-core.ttl
188+
BFO_UPSTREAM_TMP := $(config.TEMP_DIR)/bfo-upstream-latest.ttl
189+
BFO_DIFF_OUT := $(config.TEMP_DIR)/bfo-upstream-diff.txt
190+
191+
.PHONY: bfo-diff
192+
bfo-diff: | $(config.TEMP_DIR)
193+
@echo "Fetching BFO upstream from $(BFO_UPSTREAM_URL)..."
194+
curl -sSL -o $(BFO_UPSTREAM_TMP) $(BFO_UPSTREAM_URL)
195+
@echo "Diffing local $(BFO_LOCAL) against upstream..."
196+
@if diff -u $(BFO_LOCAL) $(BFO_UPSTREAM_TMP) > $(BFO_DIFF_OUT) 2>&1; then \
197+
echo "BFO DIFF: No changes — local copy is in sync with upstream."; \
198+
else \
199+
echo "BFO DIFF: Changes detected! Review $(BFO_DIFF_OUT) before release."; \
200+
echo "--- Summary (added/removed lines) ---"; \
201+
echo " Lines added : $$(grep -c '^+[^+]' $(BFO_DIFF_OUT) || echo 0)"; \
202+
echo " Lines removed: $$(grep -c '^-[^-]' $(BFO_DIFF_OUT) || echo 0)"; \
203+
fi
204+
@echo "Full diff written to $(BFO_DIFF_OUT)"
205+
206+
# ---------------------------------------------------------------------------
207+
# T11 — stamp-version: Update owl:versionIRI and owl:versionInfo on all modules
208+
# ---------------------------------------------------------------------------
209+
210+
VERSION ?=
211+
DATE ?= $(TODAY)
212+
213+
.PHONY: stamp-version
214+
stamp-version:
215+
@if [ -z '$(VERSION)' ]; then \
216+
echo 'ERROR: VERSION is required. Usage: make stamp-version VERSION=2.1 [DATE=YYYY-MM-DD]'; \
217+
exit 1; \
218+
fi
219+
@echo "Stamping v$(VERSION) ($(DATE)) on all module files..."
220+
@for f in $(DEV_FILES); do \
221+
echo " $$f"; \
222+
sed -i '' \
223+
-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' \
224+
-e 's|"Version [^"]*"@en|"Version $(VERSION)"@en|g' \
225+
"$$f"; \
226+
done
227+
@echo " src/cco-merged/CommonCoreOntologiesMerged.ttl"
228+
@sed -i '' \
229+
-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' \
230+
-e 's|"Version [^"]*"@en|"Version $(VERSION)"@en|g' \
231+
src/cco-merged/CommonCoreOntologiesMerged.ttl
232+
@echo "stamp-version complete: v$(VERSION) / $(DATE)"
233+
234+
# ---------------------------------------------------------------------------
235+
# T12 — build-ccom: Rebuild CommonCoreOntologiesMerged.ttl via ROBOT merge
236+
# ---------------------------------------------------------------------------
237+
CCOM_MERGED := src/cco-merged/CommonCoreOntologiesMerged.ttl
238+
CCOM_IRI := https://www.commoncoreontologies.org/CommonCoreOntologiesMerged
239+
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.
240+
CCOM_LICENSE := BSD 3-Clause: https://github.com/CommonCoreOntology/CommonCoreOntologies/blob/master/LICENSE
241+
CCOM_RIGHTS := CUBRC Inc., see full license.
242+
243+
.PHONY: build-ccom
244+
build-ccom: $(ROBOT_FILE) | $(config.TEMP_DIR)
245+
@if [ -z '$(VERSION)' ]; then \
246+
echo 'ERROR: VERSION is required. Usage: make build-ccom VERSION=2.1 [DATE=YYYY-MM-DD]'; \
247+
exit 1; \
248+
fi
249+
@echo "Merging 11 CCO modules + BFO via ROBOT merge..."
250+
java -jar $(ROBOT_FILE) merge \
251+
$(foreach f,$(DEV_FILES),--input $(f)) \
252+
--input $(BFO_LOCAL) \
253+
--catalog src/cco-merged/catalog-v001.xml \
254+
--output $(config.TEMP_DIR)/ccom-raw.ttl
255+
@echo "Applying CCOM ontology header (IRI, version, metadata)..."
256+
java -jar $(ROBOT_FILE) annotate \
257+
--input $(config.TEMP_DIR)/ccom-raw.ttl \
258+
--remove-annotations \
259+
--ontology-iri $(CCOM_IRI) \
260+
--version-iri https://www.commoncoreontologies.org/$(DATE)/CommonCoreOntologiesMerged \
261+
--language-annotation rdfs:label "Common Core Ontologies Merged" en \
262+
--language-annotation rdfs:comment "$(CCOM_COMMENT)" en \
263+
--language-annotation http://purl.org/dc/terms/license "$(CCOM_LICENSE)" en \
264+
--language-annotation http://purl.org/dc/terms/rights "$(CCOM_RIGHTS)" en \
265+
--language-annotation owl:versionInfo "Version $(VERSION)" en \
266+
--language-annotation owl:versionInfo "Depends on http://purl.obolibrary.org/obo/bfo/2020/bfo-core.ttl, obtained $(DATE)." en \
267+
--output $(CCOM_MERGED)
268+
@echo "build-ccom complete: $(CCOM_MERGED)"

0 commit comments

Comments
 (0)