Skip to content

Commit

Permalink
Merge pull request #107 from DataONEorg/develop
Browse files Browse the repository at this point in the history
Add gh-pages website for repo, MOSAiC 1.0.1, and various MOSAiC extras
  • Loading branch information
amoeba authored Sep 14, 2021
2 parents 26c45df + baf43bd commit f3f39ff
Show file tree
Hide file tree
Showing 13 changed files with 10,226 additions and 9,807 deletions.
1 change: 1 addition & 0 deletions .github/ontologies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MOSAiC,The MOSAiC Ontology,./MOSAiC/MOSAiC.owl
11 changes: 11 additions & 0 deletions .github/validate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

set -e

RIOT="./apache-jena-4.1.0/bin/riot"
PATHS=$(cat .github/ontologies.txt | awk -F, '{print $3}')

for path in "$PATHS"
do
"$RIOT" --validate $path
done
113 changes: 113 additions & 0 deletions .github/website/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import os
import shutil
from pathlib import Path
import xml
import pylode
from jinja2 import Template


BASEDIR = os.path.dirname(os.path.realpath(__file__))
ONTOLOGIES_FILE = os.path.join(BASEDIR, "../ontologies.txt")
INDEX_TEMPLATE = os.path.join(BASEDIR, "index.template")


def get_build_dir():
return Path(BASEDIR, "_build")


def create_build_dir():
tmpdir = get_build_dir()

if not os.path.exists(tmpdir):
os.mkdir(tmpdir)


def get_ontologies():
with open(ONTOLOGIES_FILE) as onto_file:
files = [tuple(line.rstrip("\n").split(",")) for line in onto_file.readlines()]
return [{"name": file[0], "title": file[1], "path": file[2]} for file in files]


def parse_ontology(path):
return {"name": path.replace(".html", ""), "path": path}


def process_ontology(ontology):
path = ontology["path"]
print(f"Processing {path}...")

# Copy owl file to build dir so it's available
newpath = Path(get_build_dir(), os.path.basename(path))
shutil.copy(path, newpath)

# Try processing once. If it fails, try processing as Turtle
try:
return run_pylode(newpath)
except Exception:
print("Re-processing as Turtle...")
renamedpath = os.path.join(
get_build_dir(), os.path.basename(newpath).replace(".owl", ".ttl")
)
os.rename(newpath, renamedpath)

return run_pylode(renamedpath)


def run_pylode(path):
out_path = os.path.join(get_build_dir(), f"{path}.html")
out_path = out_path.replace(".ttl", "")
out_path = out_path.replace(".owl", "")

print(f"Running PyLODE on {path} with output path of {out_path}")
html = pylode.MakeDocco(
input_data_file=str(path), outputformat="html", profile="dataone"
).document()

with open(out_path, "w") as html_file:
html_file.write(str(html))

return out_path


def process_ontologies():
for ontology in get_ontologies():
process_ontology(ontology)


def copy_pylode_output():
new_paths = []

for path in get_build_dir().glob("*.html"):
print(f"Copying HTML for {path}")

basename = os.path.basename(path)
new_path = Path(BASEDIR, basename)
os.rename(path, new_path)
new_paths.append(os.path.basename(new_path))

return new_paths


def build_index():
print("Building index...")
ontologies = get_ontologies()

output = None

with open(INDEX_TEMPLATE, "r") as index_template:
tmpl_str = index_template.read()
tmpl = Template(tmpl_str)
output = tmpl.render(ontologies=ontologies)

with open(os.path.join(get_build_dir(), "index.html"), "w") as index_html:
index_html.write(str(output))


def main():
create_build_dir()
process_ontologies()
build_index()


if __name__ == "__main__":
main()
81 changes: 81 additions & 0 deletions .github/website/index.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>sem-prov-ontologies</title>
<style>
body {
font-size: 16px;
font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
max-width: 660px;
margin: 0 auto;
color: rgb(34, 34, 34);
padding: 1em;
}

header h1 {
margin: 0;
padding: 0;
}

header a {
font-variant: small-caps;
font-weight: normal;
text-decoration: none;
color: #14A2A7;
}

a {
color: #1EAEDB;
}

footer {
font-size: 80%;
}
</style>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="DataONE Ontologies">
</head>
<body>
<header>
<h1>
<a href="/">
<svg width="245" height="55" viewBox="0 0 490 109" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient x1="1.12436655%" y1="50%" x2="97.6641681%" y2="50%" id="linearGradient-1">
<stop stop-color="#1B435D" offset="0%"></stop>
<stop stop-color="#14A2A7" offset="39.916443%"></stop>
<stop stop-color="#14A2A7" offset="53.6578157%"></stop>
<stop stop-color="#23678F" offset="100%"></stop>
</linearGradient>
</defs>
<g fill="url(#linearGradient-1)" fill-rule="evenodd"><path d="M363.432 1.568l61.682 92.105V1.568h6.288v105.389h-5.175l-61.836-92.112v92.112h-6.287V1.567h5.328zm124.524 0v6.788h-43.53v42.17h42.398v6.867h-42.398v42.773h44.593v6.79h-51.782V1.569h50.719zM300.057 0l.804.008c33.62-.245 58.535 30.538 52.255 64.726-4.254 24.254-26.264 44.089-52.255 43.593-32.562.305-57.253-29.14-52.408-62.351C251.635 21.152 273.134.37 299.256.005l.801-.005zM269.33 21.06c-24.017 24.619-13.954 70.073 21.55 78.605 15.425 3.323 31.051-.743 41.869-12.389C356.365 62.86 346.706 17.57 311.812 8.77c-15.567-3.534-31.529.61-42.482 12.29zm32.627-9.646c.104.382.57.505.74.481.827-.114 1.55.352 2.36.318.564-.023 1.1.198 1.56.601.368.326.327.73.23 1.058-.093.32-.457.403-.847.419-.522.02-.977-.219-1.434-.336-.574-.146-1.172-.292-1.749-.435-.564-.14-1.193-.031-1.78-.031-.203-.284.382-.438.057-.758-.244-.24-.561-.419-.777-.255-.298.224-.756.198-.922.607.106.294.585.375.478.83-.346.19-.756.149-1.104.081-2.056-.398-2.3-.357-3.984.518-.398.206-.84.432-.816.83.031.506.644.639 1.032.717 1.19.242 2.318.723 3.59.82 0 .346-.02.643.006.935.036.395.291.598.65.611.366.016.62-.218.618-.5-.01-.684.26-1.067.886-1.34.497-.216.489-.386.291-1.029-.314-1.02.055-1.53 1.126-1.546.301-.006.683-.118.888.023.385.266.842.25 1.235.48 1.096.642 1.114.621 2.406.314.182-.044.294-.013.45.086.613.385 1.26.721 1.865 1.114.712.464 1.437.875 2.264 1.107.384.107.764.297 1.031.633.445.557 1.136.895 1.388 1.63.057.164.265.273.496.338.762.214 1.362.677 1.918 1.383-.598.265-1.07.127-1.52.153-.473.029-.951.04-1.424-.005-.359-.034-.608-.24-.598-.661.01-.43.003-.862.003-1.287-.291-.187-.551-.223-.811.042-.21.216-.489.089-.733.094-.733.018-1.468-.018-2.2.013-.62.026-1.225.14-1.685.63.19.27.473.151.694.13.512-.047.9.091 1.227.508.501.638 1.18.896 1.995.81.297-.032.595-.006.923-.006.083.347.203.706-.021.977-.2.242-.512.505-.795.534-.478.049-.824.33-1.237.47-.395.136-.86.35-1.068-.356-.101-.341-.504-.445-.86-.278-.58.273-1.073.703-1.767.76-.223.018-.445.351-.403.718.029.243.135.56-.07.735-.203.171-.512.328-.762.31-.374-.03-.553.419-.93.286-.14-.05-.278.044-.317.153-.205.602-.728.98-1.055 1.503-.385.617-.538 1.21-.473 1.885.068.685-.182 1.132-.816 1.39-1.07.437-1.968 1.146-2.842 1.865l-.58.479c-1.008.825-1.234 1.054-.504 2.645.397.87.665 1.755.605 2.742-.044.708-.431 1.158-.904 1.57-.133.114-.44.132-.587-.03-.154-.166.194-.21.179-.371-.018-.203.093-.45-.133-.591-.306-.196-.392-.529-.543-.818-.296-.573-.686-1.067-.66-1.82.026-.698-.722-1.093-1.426-1.286-.832-.227-1.653-.219-2.49-.237-.348-.008-.629.036-.917.312-.351.339-.816.503-1.351.48-.905-.04-1.814.025-2.719-.024-.532-.029-.966.143-1.398.388-.641.367-1.296.721-1.798 1.284-.273.307-.517.645-.543 1.07-.05.864-.34 1.695-.582 2.491-.247.82-.174 1.591-.18 2.378-.004.908 1.399 2.627 2.225 2.77.704.12 1.409-.05 1.988-.484.377-.282.77-.612.998-1.01.642-1.115 1.627-1.399 2.801-1.35.302.014.603.003.92.003.294.633.06 1.203-.223 1.76-.31.607-.679 1.19-.939 1.818-.08.192-.241.325-.285.53-.273 1.258.02 1.62 1.35 1.597.326-.005.659.104.989-.112.706-.464 1.208.19 1.8.372.603.188.707.779 1.032 1.188.107.132-.125.302-.156.437-.218.95-.777 1.833-.61 2.867.067.411-.175.882.15 1.231.507.544.985 1.133 1.788 1.304.64.139.868.17 1.328-.038.792-.36 1.723-.323 2.362.09.66.428 1.517.167 1.957-.491.158-.24.293-.521.395-.75.153-.344.33-.492.647-.651 1.11-.555 2.32-.86 3.41-1.482.326-.187.96-.408 1.262-.276.61.271 1.387.295 1.811.95.416.646 1.149.8 1.79.98.663.184 1.401.278 2.085-.102.132-.075.327-.057.49-.057.822-.005 1.643-.044 2.459.013.556.039 1.037.2 1.393.797a9.396 9.396 0 002.812 2.989c.63.43 1.22.609 1.954.624 1.572.034 2.954.524 4.09 1.714.475.497.437 1.244 1.063 1.663.543.362.971.893 1.2 1.563.205.6.772.867 1.323 1 .566.135 1.07.398 1.517.707.57.396 1.162.688 1.822.592 1.19-.172 2.097.354 2.934 1.054.267.224.501.279.831.258.452 1.812-.127 3.424-1.06 4.908-.883 1.403-1.634 2.87-2.175 4.42-.387 1.113-.938 2.13-1.502 3.138-.252.453-.527.914-.777 1.372-.694 1.276-1.933 1.841-3.077 2.552-1 .62-1.99 1.257-2.954 1.93-.772.538-1.226 1.39-1.785 2.119-.411.536-.79 1.041-1.388 1.377-.543.305-.962.792-1.44 1.182-.995.813-2.079 1.409-3.23 1.932-.29.133-.61.284-.816.518-1.062 1.205-2.487 1.775-3.905 2.333l-.606.24c-1.484.596-2.95 1.192-4.056 2.387-.484.524-1.094.695-1.705.901-1.577.534-2.302.508-3.755.102-.673-.188-.837-.58-.42-1.076.246-.291.412-.62.566-.94.488-1.025 1.008-2.015 1.684-2.942.387-.53.52-1.244.701-1.91.26-.954.821-1.823 1.14-2.766.515-1.515 1.046-3.033.905-4.695-.07-.822-.364-1.408-1.117-1.765-.58-.273-1.193-.51-1.702-.883-1.596-1.163-2.968-2.522-3.953-4.293-.847-1.528-1.746-3.046-2.902-4.382a6.74 6.74 0 01-.694-1.007c-.632-1.07-.61-1.591-.299-3.317.101-.563.21-1.133.286-1.703a2.84 2.84 0 01.777-1.615c.78-.786 1.315-1.775 2.17-2.491.436-.365.694-.779.457-1.43-.14-.38-.05-.856-.02-1.288.043-.664-.006-1.24-.596-1.719-.231-.188-.382-.58-.468-.96-.166-.735-.631-.829-1.172-.32-.275.257-.283.249-.371.947-.832.148-1.528.008-2.305-.503-.858-.56-1.806-.96-2.523-1.742-.086-.094-.38-.255-.637-.307-.364-.07-.54-.38-.475-.773.077-.471-.133-.784-.46-1.114-1.146-1.156-2.534-1.927-3.955-2.661-.12-.06-.221-.12-.346-.105-.912.12-1.336-.414-1.741-1.137-.252-.45-.697-.8-1.211-1.06-.35-.177-.746-.234-.959-.104-.922.56-1.837.213-2.622-.117-1.549-.651-2.965-1.591-4.137-2.818-.774-.81-1.2-1.702-.704-2.926.216-.531-.122-1.242-.424-1.836-.382-.744-.836-1.505-.985-2.307-.29-1.57-1.104-3.051-.844-4.72.026-.167.026-.352-.224-.367-.218-.013-.26.107-.298.302-.149.755-.546 1.502.007 2.252-.192.86.307 1.633.286 2.49-.018.692.346 1.374.232 2.098-.019.12.07.268-.198.383.068-.021.016.013-.008 0-.78-.45-1.216-1.524-.92-2.357.091-.255.193-.541-.002-.692-.419-.323-.416-.943-1.136-1.253.33-.242.559-.419.795-.58.276-.188.21-.477.156-.703-.267-1.128-.231-1.115-.052-2.023.13-.654.276-1.39-.08-1.987-.585-.971-.31-1.864-.034-2.825.546-1.916 1.702-3.419 3.017-4.856.79-.864 1.442-1.82 1.886-2.973.343-.89 1.055-1.75 1.908-2.292a4.77 4.77 0 00.865-.692c.59-.599 1.297-1.018 2.014-1.414.73-.403 1.538-.672 2.269-1.078.207-.114.465-.172.634-.346 1.013-1.055 2.427-1.268 3.713-1.653.798-.24 1.58-.683 2.46-.638.396-.495 1.129.13 1.498-.45.73.174 1.374-.373 2.092-.256.52.083.899-.4 1.452-.284.447.094.933 0 1.403-.028.034-.003.06-.138.091-.211zm-2.11 34.28l.086.006c.477.105.958.23 1.408.44.346.16.295.632-.012.895-.192.166-.38.055-.579.116-.357.006-.605-.318-.894-.51-.163-.11-.574.009-.436-.457.073-.245.243-.542.513-.484zm5.033-1.218c.154-.148.345-.362.525-.159.256.292.554.164.836.198 1.411.167 2.616.769 3.727 1.657-.309.252-.49.677-.881.24-.227-.253-.44-.558-.826-.141-.104.112-.41.086-.614.054-.624-.101-.776.347-.982.826-.309-.529-.831-.737-1.294-.513-.431.208-.896-.198-1.267.203-.076.08-.437.031-.405-.138.062-.338-.473-.443-.233-.82.295-.17.648-.013.977-.07.392-.066.567-.376.366-.793-.117-.242-.104-.375.07-.544zm-7.986-3.16l.23.013c.696.088 1.362.396 2.042.6.466.14.866.375 1.264.661.908.647 1.92 1.11 2.927 1.577.147.068.26.206.411.334-.149.339-.383.467-.747.448-.509-.026-1.023.019-1.532-.013-.609-.039-1.385.308-1.624-.704-.036-.15-.393-.234-.609-.325-.367-.16-.79-.25-1.025-.6-.388-.579-.997-.57-1.47-.404-.737.258-1.385.334-2.107-.016-.272-.132-.66-.023-1.017-.023-.332-.933.462-.933.807-1.272.069-.065.246-.05.364-.023.805.174 1.55-.337 2.316-.24zM85.014 46.38c13.316-7.251 54.107-14.185 53.727 22.269.154 9.03-.554 30.534.927 38.311h-18.173l-1.195-6.494h-.398c-4.529 5.433-11.525 8.291-19.974 7.917-25.49-.666-32.806-45.62 18.516-44.637.875-13.376-21.072-9.914-29.716-4.374zm104.66 0c13.316-7.251 54.107-14.185 53.724 22.269l.007.447c.127 9.273-.535 30.213.922 37.864h-18.172l-1.195-6.494h-.398c-4.53 5.433-11.526 8.291-19.974 7.917-25.49-.666-32.806-45.62 18.516-44.637.875-13.376-21.072-9.914-29.716-4.374zm-19.55-22.932v18.536h14.398v14.827h-14.398v22.093c.021 9.183.757 14.576 13.872 12.196l.132 15.224c-39.97 9.183-33.242-19.858-33.686-49.513h-8.586V41.984h8.586V27.95l19.682-4.501zM0 18.453c17.694-2.424 48.676-4.789 63.941 7.697 13.26 9.387 19.006 29.78 12.512 51.35C66.466 108.266 32.333 109.943 0 106.31zm119.108 57.882c-22.189-1.631-23.675 16.838-11.273 17.888 6.53.198 11.583-5.024 11.273-10.86zm104.66 0c-22.19-1.631-23.675 16.838-11.273 17.888 6.53.198 11.583-5.024 11.273-10.86zM57.486 63.64C59.1 37.956 41.79 29.163 20.296 32.918v58.527c1.724.4 4.512.4 7.031.4 17.395.056 29.02-8.833 30.16-28.204z"/></g></svg>
Ontologies
</a>
</h1>
</header>
<main>
<p>
<a href="https://www.dataone.org/">DataONE</a> maintains and develops a family of both general-purpose and domain-specific <a href="https://www.w3.org/OWL/">OWL</a> ontologies:
</p>
<ul>
{% for ontology in ontologies %}
<li><a href="https://purl.dataone.org/provone-v1-dev">ProvONE</a></li>
<li><a href="http://ecoinformatics.org/oboe/oboe.1.2/oboe-core.owl">OBOE</a> [<a href="https://github.com/NCEAS/oboe/">GitHub</a>]</li>
<li><a href="https://purl.dataone.org/odo/ECSO_">ECSO</a></li>
<li><a href="./{{ontology.name}}.html">{{ontology.title}}</a> [<a href="{{ontology.name}}.owl">OWL</a>]</li>
<li>ARCRC (WIP)</li>
<li>SALMO (WIP)</li>
<li>SASAP (WIP)</li>
{% endfor %}
</ul>
<p>
<svg aria-hidden="true" class="octicon octicon-mark-github" height="18" role="img" version="1.1" viewBox="0 0 16 16" width="18"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59 0.4 0.07 0.55-0.17 0.55-0.38 0-0.19-0.01-0.82-0.01-1.49-2.01 0.37-2.53-0.49-2.69-0.94-0.09-0.23-0.48-0.94-0.82-1.13-0.28-0.15-0.68-0.52-0.01-0.53 0.63-0.01 1.08 0.58 1.23 0.82 0.72 1.21 1.87 0.87 2.33 0.66 0.07-0.52 0.28-0.87 0.51-1.07-1.78-0.2-3.64-0.89-3.64-3.95 0-0.87 0.31-1.59 0.82-2.15-0.08-0.2-0.36-1.02 0.08-2.12 0 0 0.67-0.21 2.2 0.82 0.64-0.18 1.32-0.27 2-0.27 0.68 0 1.36 0.09 2 0.27 1.53-1.04 2.2-0.82 2.2-0.82 0.44 1.1 0.16 1.92 0.08 2.12 0.51 0.56 0.82 1.27 0.82 2.15 0 3.07-1.87 3.75-3.65 3.95 0.29 0.25 0.54 0.73 0.54 1.48 0 1.07-0.01 1.93-0.01 2.2 0 0.21 0.15 0.46 0.55 0.38C13.71 14.53 16 11.53 16 8 16 3.58 12.42 0 8 0z"></path></svg>
Learn more or even get involved at our <a href="https://github.com/DataONEorg/sem-prov-ontologies">GitHub repository</a>
</p>
</main>
<footer>
DataONE is a collaboration among many partner organizations, and is funded by the US National Science Foundation (NSF) under a Cooperative Agreement. Acknowledgement: This material is based upon work supported by the National Science Foundation under Grant Numbers 0830944 and 1430508. Disclaimer: Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
</footer>
</body>
</html>
27 changes: 27 additions & 0 deletions .github/workflows/check_mosaic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check MOSAiC

on:
push:
branches:
- main
- develop

jobs:
correspondence:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- run: python -m pip install -r ./MOSAiC/dev/check/requirements.txt
- run: python ./MOSAiC/dev/check/check.py
schacl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- run: python -m pip install pyshacl
- run: pyshacl -s ./MOSAiC/dev/shapes.shacl -df xml -sf turtle ./MOSAiC/MOSAiC.owl
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
push:
branches:
- main
- develop

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- run: curl -O https://mirror.nodesdirect.com/apache/jena/binaries/apache-jena-4.1.0.tar.gz
- run: tar xzf apache-jena-4.1.0.tar.gz
- run: sh ./.github/validate.sh

website:
needs: validate
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- run: python -m pip install -r https://raw.githubusercontent.com/amoeba/pyLODE/master/requirements.txt
- run: python -m pip install git+https://github.com/amoeba/pylode.git
- run: python -m pip install jinja2
- run: python ./.github/website/build.py
- name: ghpages
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: ./.github/website/_build
Loading

0 comments on commit f3f39ff

Please sign in to comment.