diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..f90fc14 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,77 @@ +# Built from: +# https://docs.github.com/en/actions/guides/building-and-testing-python +# https://github.com/snok/install-poetry#workflows-and-tips + +name: Build and test linkml-datalog + +on: [pull_request] + +jobs: + test: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8, 3.9] + + steps: + + #---------------------------------------------- + # check-out repo and set-up python + #---------------------------------------------- + - name: Check out repository + uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + #---------------------------------------------- + # install & configure poetry + #---------------------------------------------- + - name: Install Poetry + uses: snok/install-poetry@v1.1.1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + + #---------------------------------------------- + # load cached venv if cache exists + #---------------------------------------------- + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v2 + with: + path: .venv + key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} + + #---------------------------------------------- + # install dependencies if cache does not exist + #---------------------------------------------- + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root + + #---------------------------------------------- + # install your root project, if required + #---------------------------------------------- + - name: Install library + run: poetry install --no-interaction + + #---------------------------------------------- + # run test suite + #---------------------------------------------- + - name: Run tests + run: poetry run python -m unittest discover -p 'test_*.py' + + #---------------------------------------------- + # upload coverage results + #---------------------------------------------- + - name: Upload pytest test results + uses: actions/upload-artifact@v2 + with: + name: pytest-results + path: htmlcov + # Use always() to always run this step to publish test results when there are test failures + if: ${{ always() }} diff --git a/.github/workflows/pypi-publish.yaml b/.github/workflows/pypi-publish.yaml new file mode 100644 index 0000000..7b248cf --- /dev/null +++ b/.github/workflows/pypi-publish.yaml @@ -0,0 +1,53 @@ +name: Publish Python Package + +on: + release: + types: [created] + +jobs: + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to PyPI + runs-on: ubuntu-latest + + #---------------------------------------------- + # check-out repo and set-up python + #---------------------------------------------- + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2.2.2 + with: + python-version: 3.9 + + #---------------------------------------------- + # install & configure poetry + #---------------------------------------------- + - name: Install Poetry + uses: snok/install-poetry@v1.1.6 + with: + virtualenvs-create: true + virtualenvs-in-project: true + + #---------------------------------------------- + # install dependencies + #---------------------------------------------- + - name: Install dependencies + run: poetry install --no-interaction + + #---------------------------------------------- + # build dist + #---------------------------------------------- + - name: Build source and wheel archives + run: | + poetry version $(git describe --tags --abbrev=0) + poetry build + + #---------------------------------------------- + # publish package to PyPI + #---------------------------------------------- + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@v1.2.2 + with: + user: __token__ + password: ${{ secrets.PYPI_PASSWORD }} diff --git a/README.md b/README.md index bd5f44d..5e2bb6e 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Docker containers will be provided in future Pass in a schema and a data file ```bash -poetry run python -m linkml_datalog.engines.datalog_engine -d tmp -s personinfo.yaml example_personinfo_data.yaml +poetry run linkml-dl -d tmp -s personinfo.yaml example_personinfo_data.yaml ``` The output will be a ValidationReport object, in yaml diff --git a/linkml_datalog/generators/dataloggen.py b/linkml_datalog/generators/dataloggen.py index 348c825..38f1465 100644 --- a/linkml_datalog/generators/dataloggen.py +++ b/linkml_datalog/generators/dataloggen.py @@ -399,6 +399,8 @@ def domains(self, slot: SlotDefinition) -> List[ClassDefinitionName]: for cn in sv.all_classes().keys(): if slot.name in sv.class_slots(cn, direct=True): domains.append(cn) + if slot.domain: + domains.append(slot.domain) return domains def get_slot_range(self, sn: SlotDefinitionName): diff --git a/pyproject.toml b/pyproject.toml index 29997ab..b1e1647 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] +version = "0.0.0" name = "linkml_datalog" -version = "0.1.0" description = "" authors = ["cmungall "] @@ -14,3 +14,6 @@ pytest = "^5.2" [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" + +[tool.poetry.scripts] +linkml-dl = "linkml_datalog.engines.datalog_engine:cli" diff --git a/tests/inputs/biolink-model.yaml b/tests/inputs/biolink-model.yaml index f16b1e8..9f6c956 100644 --- a/tests/inputs/biolink-model.yaml +++ b/tests/inputs/biolink-model.yaml @@ -4881,6 +4881,8 @@ slots: part of: is_a: overlaps + annotations: + transitive: true description: >- holds between parts and wholes (material entities or processes) in_subset: