diff --git a/.github/emmocheck_conf.yml b/.github/emmocheck_conf.yml new file mode 100644 index 0000000..83b916d --- /dev/null +++ b/.github/emmocheck_conf.yml @@ -0,0 +1,11 @@ +# Configurations used when running emmocheck from the ci_emmocheck workflow +skip: + - test_description + +test_number_of_labels: + exceptions: + - 0.1.Person # foaf:Person + - 0.1.mbox # foaf:mbox + - 22-rdf-syntax-ns.Statement # rdf:Statement + - dcat.Distribution + - dcat.Dataset diff --git a/.github/workflows/cd_publish.yml b/.github/workflows/cd_publish.yml index 5a580d4..6f7fcb8 100644 --- a/.github/workflows/cd_publish.yml +++ b/.github/workflows/cd_publish.yml @@ -2,13 +2,9 @@ name: CD_publish on: push: + branches: + - master -#on: -# push: -# branches: -# - '[0-9]+.[0-9]+.[0-9]+' -# - '[0-9]+.[0-9]+.[0-9]+-*' -# # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -24,37 +20,70 @@ jobs: with: python-version: 3.11 - - name: Install EMMOntoPy and pyvode + - name: Install ROBOT + run: | + mkdir bin + wget -nv https://github.com/ontodev/robot/releases/download/v1.9.6/robot.jar + mv robot.jar bin/. + curl https://raw.githubusercontent.com/ontodev/robot/master/bin/robot > bin/robot + chmod +x bin/robot + ls -l bin/ + + - name: Install EMMOntoPy and Sphinx run: | pip install --upgrade pip - pip install pylode==2.13.2 git+https://github.com/EMMO-REPO/EMMOntoPy.git - - - name: Create build directory - run: mkdir build - - - name: Copy json-ld context - run: cp -r context build/. - - - name: Generate squashed ontology - run: ontoconvert -saw - -c 'http://www.w3.org/2004/02/skos/core#prefLabel-->http://www.w3.org/2000/01/rdf-schema#label' - -c 'elucidation-->http://www.w3.org/2000/01/rdf-schema#comment' - -c 'definition-->http://www.w3.org/2000/01/rdf-schema#comment' - oteio.ttl build/oteio.ttl - #-c 'comment-->http://www.w3.org/2000/01/rdf-schema#comment' - - - name: Generate inferred ontology - run: ontoconvert -saw --reasoner=HermiT - -c 'http://www.w3.org/2004/02/skos/core#prefLabel-->http://www.w3.org/2000/01/rdf-schema#label' - -c 'elucidation-->http://www.w3.org/2000/01/rdf-schema#comment' - -c 'definition-->http://www.w3.org/2000/01/rdf-schema#comment' - oteio.ttl build/oteio-inferred.ttl - #-c 'comment-->http://www.w3.org/2000/01/rdf-schema#comment' - - - name: Generate documentation - run: pylode -i build/oteio-inferred.ttl -o build/oteio.html -p ontdoc - - - name: Deploy - uses: JamesIves/github-pages-deploy-action@v4 - with: - folder: build # The folder the action should deploy. + #pip install pylode==2.13.2 git+https://github.com/EMMO-REPO/EMMOntoPy.git + pip install sphinx sphinxcontrib-globalsubs sphinx_design nbsphinx pydata-sphinx-theme + pip install git+https://github.com/emmo-repo/EMMOntoPy.git@master + #pip install git+https://github.com/emmo-repo/EMMOntoPy.git@fix-rename-iris + + - name: Create and prepare build and public directories + run: | + mkdir -p build public + if [ -d doc/_static ]; then cp -rf doc/_static/* build/. ; fi + + - name: Create ontologies for publishing + run: | + ontoconvert -sawe --base-iri="https://w3id.org/emmo/domain/oteio#" --iri=https://w3id.org/emmo/domain/oteio oteio.ttl public/oteio.ttl + #ontoconvert -sawe --base-iri="https://w3id.org/emmo/domain/oteio#" --iri=https://w3id.org/emmo/domain/oteio --reasoner=HermiT public/oteio.ttl public/oteio-inferred.ttl + bin/robot reason --reasoner HermiT --input public/oteio.ttl --output public/oteio-inferred.ttl + + - name: Generate html documentation (based on emmo-full) + run: | + ontodoc --iri-regex='.*/oteio.*' oteio.ttl build/oteio.rst + sphinx-build "build/" "public/" + + + + + +# - name: Create build directory +# run: mkdir build +# +# - name: Copy json-ld context +# run: cp -r context build/. +# +# - name: Generate squashed ontology +# run: ontoconvert -saw +# -c 'http://www.w3.org/2004/02/skos/core#prefLabel-->http://www.w3.org/2000/01/rdf-schema#label' +# -c 'elucidation-->http://www.w3.org/2000/01/rdf-schema#comment' +# -c 'definition-->http://www.w3.org/2000/01/rdf-schema#comment' +# oteio.ttl build/oteio.ttl +# #-c 'comment-->http://www.w3.org/2000/01/rdf-schema#comment' +# +# - name: Generate inferred ontology +# run: ontoconvert -saw --reasoner=HermiT +# -c 'http://www.w3.org/2004/02/skos/core#prefLabel-->http://www.w3.org/2000/01/rdf-schema#label' +# -c 'elucidation-->http://www.w3.org/2000/01/rdf-schema#comment' +# -c 'definition-->http://www.w3.org/2000/01/rdf-schema#comment' +# oteio.ttl build/oteio-inferred.ttl +# #-c 'comment-->http://www.w3.org/2000/01/rdf-schema#comment' +# +# - name: Generate documentation +# run: pylode -i build/oteio-inferred.ttl -o build/oteio.html -p ontdoc +# +# - name: Deploy +# uses: JamesIves/github-pages-deploy-action@v4 +# with: +# folder: build # The folder the action should deploy. +# diff --git a/.github/workflows/ci_emmocheck.yml b/.github/workflows/ci_emmocheck.yml new file mode 100644 index 0000000..2d5530c --- /dev/null +++ b/.github/workflows/ci_emmocheck.yml @@ -0,0 +1,30 @@ +name: Check conventions +on: [push] + +jobs: + + build: + runs-on: ubuntu-latest + strategy: + max-parallel: 1 + matrix: + python-version: [3.11] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install EMMOntoPy + run: | + pip install --upgrade pip + #pip install EMMOntoPy + pip install git+https://github.com/emmo-repo/EMMOntoPy.git@master + + - name: Check EMMO + run: | + emmocheck --local --url-from-catalog --verbose --check-imported \ + --configfile=.github/emmocheck_conf.yml oteio.ttl diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c46e10 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +build/ +public/ + +pylode.log diff --git a/doc/_static/conf.py b/doc/_static/conf.py new file mode 100644 index 0000000..664b470 --- /dev/null +++ b/doc/_static/conf.py @@ -0,0 +1,75 @@ + +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = 'OTEIO' +copyright = '2025, EMMC' +author = 'J. Friis, F.L. Bleken' +release = '0.4.0' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +autoclass_content = 'both' +autodoc_member_order = 'bysource' + +extensions = ['sphinxcontrib.globalsubs', + 'sphinx.ext.intersphinx', + 'sphinx.ext.autosectionlabel', + 'sphinx_design', + 'nbsphinx'] + +autosectionlabel_prefix_document = True + +global_substitutions = { +} + + +templates_path = ['_templates'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +#html_theme = 'alabaster' +html_theme = 'pydata_sphinx_theme' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_theme_options = { + # "show_nav_level": 4 +} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['../doc/_static'] +html_css_files = ['custom.css'] + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = '../doc/emmo-logo.png' + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_flavicon = '../doc/figs/emmo-logo.ico' diff --git a/doc/_static/custom.css b/doc/_static/custom.css new file mode 100644 index 0000000..c6d2b5d --- /dev/null +++ b/doc/_static/custom.css @@ -0,0 +1,39 @@ +td.element-table-key, td.element-table-value { + vertical-align: top; +} + +td.element-table-key { + text-align: right; + padding-right: 2mm; + width: 20%; +} + +span.element-table-key { + font-weight: bold; +} + +table.element-table { + width: 100%; + text-align: left; +} + +html table.element-table tr:nth-child(odd) td{ + background-color: Gainsboro; +} + +table.element-table tr:nth-child(even) td{ + background-color: GhostWhite; +} + +html[data-theme=dark] table.element-table tr:nth-child(odd) td{ + background-color: black; +} + +html[data-theme=dark] table.element-table tr:nth-child(even) td{ + background-color: black; +} +/* this fixes darkmode within the json-ld playground iframe +by inverting all colors if darkmode is active */ +html[data-theme="dark"] iframe[src*="json-ld.org/playground"] { + filter: invert(0.9); +} \ No newline at end of file diff --git a/doc/_static/index.rst b/doc/_static/index.rst new file mode 100644 index 0000000..f16db30 --- /dev/null +++ b/doc/_static/index.rst @@ -0,0 +1,6 @@ + +.. toctree:: + :includehidden: + :hidden: + + Reference Index