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

Feature 1419 competency question coverage report #1420

Merged
merged 45 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
341af86
Added draft of competency question coverage check
areleu Nov 24, 2022
a20dd8c
Added some flexibility to etd
areleu Nov 25, 2022
0ae1d00
Removed competency question coverage
areleu Nov 25, 2022
6ad2675
Added pytest infrastructure
areleu Nov 25, 2022
0deaf93
Added extra pytest dependencies
areleu Nov 25, 2022
707ffa8
Added pytest to CI
areleu Nov 25, 2022
9137ead
Try latest robot version
areleu Nov 25, 2022
f7744cd
Refer to source for ETD
areleu Nov 25, 2022
af34b07
Refer to version in CI
areleu Nov 25, 2022
05cb1eb
Another try with robot and etd
areleu Nov 25, 2022
0557e97
Fixed etd path
areleu Nov 25, 2022
08c051c
Problems with robot versions?
areleu Nov 25, 2022
4d51b06
Probably an issue when converting from omn to owl
areleu Nov 25, 2022
58cb9ce
Renamed CQs and reorganized their folder structure
areleu Nov 28, 2022
724429b
Updated CQ discovery glob
areleu Nov 28, 2022
96e2f64
Restructured levels
areleu Nov 28, 2022
2919672
Renamed rest of CQs
areleu Nov 28, 2022
157a9bd
First attempt to makea badge
areleu Nov 28, 2022
f0bd83b
Added correct path to report
areleu Nov 28, 2022
ee86e57
Added coverage badge to readme as example
areleu Nov 28, 2022
447d1d4
Report always uploads
areleu Nov 28, 2022
81a49a0
Wrong competency questions make the test fail
areleu Nov 28, 2022
ef4048d
Added missing terms to the report
areleu Nov 29, 2022
12cf373
Created job dependency tree
areleu Nov 29, 2022
1215f39
Added checkout to test pipeline
areleu Nov 29, 2022
32b75b3
Dont upload jar files
areleu Nov 29, 2022
04af58c
Merge branch 'feature-1020-export-of-existing-terms-and-definitions' …
areleu Dec 16, 2022
ca9b29c
Updated glossary directory
areleu Dec 16, 2022
d8fdf16
Fixed glossary path not being written
areleu Dec 16, 2022
9d29f9e
Merge branch 'dev' into feature-1419-competency-question-coverage-report
areleu May 22, 2023
296f5b2
Updated competency test
areleu May 22, 2023
9bc2f2c
Revert omn change
areleu May 22, 2023
904629c
Merge branch 'dev' into feature-1419-competency-question-coverage-report
areleu Jun 15, 2023
398edc5
Unified biofuel is renewable query and deleted duplicate
areleu Jun 15, 2023
5a1542b
Fixed name of question 041
areleu Jun 15, 2023
370adf6
Renamed questions to be consistent with old names, restored deleted d…
areleu Jun 15, 2023
1e0faf4
Fix test 047 implementation
areleu Jun 15, 2023
fb15b9c
Reworked deprecated runs
areleu Jun 19, 2023
fe05602
Updated gitignore
areleu Jun 19, 2023
ff58eed
Removed run questions script
areleu Jun 19, 2023
db69fd4
Created implementing folder
areleu Jun 19, 2023
2fe3043
Added option to fail on tets in implementation
areleu Jun 19, 2023
72f153f
Updated changelog
areleu Jun 19, 2023
7da2c11
Merge branch 'dev' into feature-1419-competency-question-coverage-report
areleu Jul 31, 2023
4138490
Merge branch 'dev' into feature-1419-competency-question-coverage-report
areleu Aug 1, 2023
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
88 changes: 75 additions & 13 deletions .github/workflows/automated-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,50 @@ jobs:
- name: make
run: |
make
- name: validate-profile
run: |
echo "java -jar build/robot.jar validate-profile --input build/oeo/$(cat VERSION)/oeo-full.owl --profile Full -vvv --output merged-validation.txt"
java -jar build/robot.jar validate-profile --input build/oeo/$(cat VERSION)/oeo-full.owl --profile Full -vvv --output merged-validation.txt
- name: verify
run: |
java -jar build/robot.jar verify --input build/oeo/$(cat VERSION)/oeo-full.owl --queries tests/verify/*
- uses: actions/upload-artifact@master
with:
name: build-artifacts
path: build/oeo
test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '3.7'
architecture: x64
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- uses: actions/download-artifact@master
with:
name: build-artifacts
path: build/oeo
- name: install python dependencies
run: pip install -r src/scripts/requirements.txt
- name: setup robot 1.9.0
run: |
wget https://github.com/ontodev/robot/releases/download/v1.9.0/robot.jar -O build/robot19.jar
- name: Build ETD xlsx
run: |
java -jar build/robot19.jar merge --input build/oeo/$(cat VERSION)/oeo-full.omn \
--include-annotations true \
export --header "ID|LABEL|definition" \
--prefix "OEO: http://openenergy-platform.org/ontology/oeo/OEO_" \
--sort "LABEL" \
--export $(pwd)/build/oeo/$(cat VERSION)/etd.xlsx
- name: Build ETD csv
run: |
python $(pwd)/src/scripts/etd/etd.py $(pwd)/build/oeo/$(cat VERSION)
- name: consistency
run: |
wget https://github.com/owlcs/releases/raw/master/HermiT/org.semanticweb.hermit-packaged-1.4.6.519-SNAPSHOT.jar -O build/hermit.jar
Expand All @@ -22,21 +66,39 @@ jobs:
fi
echo "Ontology is inconsistent: $OUT"
exit 1
- name: validate-profile
run: |
echo "java -jar build/robot.jar validate-profile --input build/oeo/$(cat VERSION)/oeo-full.owl --profile Full -vvv --output merged-validation.txt"
java -jar build/robot.jar validate-profile --input build/oeo/$(cat VERSION)/oeo-full.owl --profile Full -vvv --output merged-validation.txt
- name: verify
run: |
java -jar build/robot.jar verify --input build/oeo/$(cat VERSION)/oeo-full.owl --queries tests/verify/*
- name: competency
run: |
bash tests/competency_questions/run_questions.sh "java -jar build/hermit.jar" $(pwd)/build/oeo/$(cat VERSION)/oeo-full.owl true
bash tests/competency_questions/run_questions.sh "java -jar build/hermit.jar" $(pwd)/build/oeo/$(cat VERSION)/oeo-full.owl false
- name: Upload Artifacts
- name: Upload Ontology
if: always()
uses: actions/upload-artifact@v3
with:
name: build-files
path: |
build/**/*
!build/**/*.jar
!build/**/*.jar
- name: competency
continue-on-error: true
run: |
pytest -s -v
# bash tests/competency_questions/run_questions.sh "java -jar build/hermit.jar" $(pwd)/build/oeo/$(cat VERSION)/oeo-full.owl true
# bash tests/competency_questions/run_questions.sh "java -jar build/hermit.jar" $(pwd)/build/oeo/$(cat VERSION)/oeo-full.owl false
- name: Upload Artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: test-report
path: build/report.json
- name: Get Coverage for badge
run : |
echo "COVERAGE=$(head build/report.json | grep -o '"coverage": "[^"]*"' | grep -o '[^"]*\%')" >> $GITHUB_ENV
REF=${{ github.ref }}
IFS='/' read -ra PATHS <<< "$REF"
BRANCH_NAME="${PATHS[1]}_${PATHS[2]}"
echo "BRANCH=$(echo ${BRANCH_NAME})" >> $GITHUB_ENV
- name: Coverage Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 6d00affa9fbc89c79684d62091d96551
filename: open_energy_ontology__${{ env.BRANCH }}.json
label: CQ Coverage
message: ${{ env.COVERAGE }}
color: green
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
build/
*/__pycache__/*
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ and the versioning aims to respect [Semantic Versioning](http://semver.org/spec/
- secondary energy production (#1619)
- hydro energy, solar energy, wind energy (#1620)
- gross domestic product (#1623)

- reimplemented competency question tests in pytest (#1420)
- added commands to filter competency questions from the command line (#1420)
- added descriptive names to competency questions. and organized them in directories (#1420)

### Removed
- old compteency question bash script (#1420)

## [1.15.0] - 2023-05-31

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![License: CC0-1.0](https://img.shields.io/badge/License-CC0%201.0-lightgrey.svg)](http://creativecommons.org/publicdomain/zero/1.0/)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/OpenEnergyPlatform/ontology)
![Coverage Badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/areleu/6d00affa9fbc89c79684d62091d96551/raw/open_energy_ontology__heads_feature-1419-competency-question-coverage-report.json)

# Open Energy Family - Open Energy Ontology (OEO)

Expand Down
6 changes: 2 additions & 4 deletions src/scripts/etd/etd.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
df = df.replace('\n', '<br>', regex=True)
df = df.sort_values("LABEL", key=lambda col: col.str.strip().str.lower())
# Create one table per letter:

pathlib.Path(cwd + "/src/scripts/etd/glossary/").mkdir(parents=True, exist_ok=True)

pathlib.Path(target_path).joinpath("glossary").mkdir(parents=True, exist_ok=True)
# header = GLOSSARY_HEADER + " ".join([f"[{letter}]({BASE_LINK_WIKI}{letter})" for letter in string.ascii_uppercase]) + "\n"

# with open(cwd + "/src/scripts/etd/glossary/glossary.md", "w") as fil:
Expand Down Expand Up @@ -55,4 +53,4 @@
df_csv["ID"] = df_csv["ID"].str.replace("http://openenergy-platform.org/ontology/oeo/oeo-physical/", "")
df_csv["ID"] = df_csv["ID"].str.replace("http://openenergy-platform.org/ontology/oeo/oeo-model/", "")
df_csv["ID"] = df_csv["ID"].str.replace(":", "_")
df_csv.to_csv(pathlib.Path(target_path).joinpath("glossary/glossary.csv").as_posix(), index=False)
df_csv.to_csv(pathlib.Path(target_path).joinpath("glossary/glossary.csv").as_posix(), index=False)
4 changes: 3 additions & 1 deletion src/scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pandas
tabulate
openpyxl
openpyxl
pytest
pytest_harvest
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Prefix: : <http://openenergy-platform.org/ontology/oeo/>
Ontology: <http://openenergy-platform.org/ontology/cc/> <http://openenergy-platform.org/ontology/cc/>

# Competency Question: Is biofuel renewable fuel?

Class: OEO_00000033
Class: OEO_00000072

Class: OEO_00000072
SubClassOf: OEO_00000033

# This competency question gets deprecated with this pull request: https://github.com/OpenEnergyPlatform/ontology/pull/1409
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Class: OEO_00000033
Class: OEO_00000072
SubClassOf: OEO_00000033

# This competency question gets deprecated with this pull request: https://github.com/OpenEnergyPlatform/ontology/pull/1409
# This competency question gets deprecated with this pull request: https://github.com/OpenEnergyPlatform/ontology/pull/1409
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ Prefix: obo: <http://purl.obolibrary.org/obo/>
Ontology: <http://openenergy-platform.org/ontology/cc/> <http://openenergy-platform.org/ontology/cc/>


# Do all hot things carry energy?
# Do all hot things carry energy?

Class: owl:Nothing

ObjectProperty: obo:RO_0000053 #bearer_of
ObjectProperty: obo:RO_0000053 #bearer_of
Class: OEO_00000207 #Thermal energy
ObjectProperty: obo:RO_0000091 #has_disposition
Class: OEO_00000151 #energy carrier disposition

EquivalentClasses: ((obo:RO_0000053 some OEO_00000207) and not (obo:RO_0000091 some OEO_00000151)), owl:Nothing
# All bearers of thermal energy have the disposition of being energy carriers

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Ontology: <http://openenergy-platform.org/ontology/cc/> <http://openenergy-platf
Class: OEO_00000026
Class: OEO_00000038
Class: OEO_00000219
Class: OEO_00000321
Class: OEO_00000322

Class: OEO_00000013
EquivalentTo: OEO_00000026 or OEO_00000038 or OEO_00000219 or OEO_00000322
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Ontology: <http://openenergy-platform.org/ontology/cc/> <http://openenergy-platf

Class: OEO_00000025
ObjectProperty: OEO_00000529
Class: OEO_00000182
Individual: OEO_00000182

Class: OEO_00000025
SubClassOf: OEO_00000529 value OEO_00000182
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Prefix: : <http://openenergy-platform.org/ontology/oeo/>
Ontology: <http://openenergy-platform.org/ontology/cc/> <http://openenergy-platform.org/ontology/cc/>


#Is a gas fired power unit a fuelled power unit?
#Is a gas fired power unit a fueled power unit?

Class: OEO_00000017
Class: OEO_00000175
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Ontology: <http://openenergy-platform.org/ontology/cc/> <http://openenergy-platf
# Every portion of hydrogen is an energy carrier

ObjectProperty: obo:RO_0000091 # has disposion
Class: OEO_00000028 # energy carrier disposition
Class: OEO_00000151 # energy carrier disposition

Class: OEO_00000220 # hydrogen
SubClassOf: obo:RO_0000091 some OEO_00000028
SubClassOf: obo:RO_0000091 some OEO_00000151
32 changes: 0 additions & 32 deletions tests/competency_questions/run_questions.sh

This file was deleted.

8 changes: 8 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@


def pytest_addoption(parser):
parser.addoption("--selected", action="store", default="")
parser.addoption("--report", action="store", default="report.json")
parser.addoption("--implementation", action="store_true", default=False, help="Run in development tests")
parser.addoption("--deprecated", action="store_true", default=False, help="Run deprecated tests")

Loading