Skip to content

Commit

Permalink
Merge pull request #113 from emmo-repo/1.0.0-alpha2
Browse files Browse the repository at this point in the history
1.0.0 alpha2
  • Loading branch information
jesper-friis committed Oct 14, 2020
2 parents 2099fc3 + f0236fc commit e79e85e
Show file tree
Hide file tree
Showing 53 changed files with 6,047 additions and 24,350 deletions.
4 changes: 4 additions & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pages
tmp
keys
old
93 changes: 93 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Files used for continous testing and releases on GitHub
=======================================================
For check EMMO locally before a commit, you should install [EMMO-python][EMMO-python]
and run emmocheck from the root of the repository:

emmocheck --local --verbose --check-imported --configfile=.github/emmocheck_conf.yml emmo.owl

To test generation of documentation and inferred ontology locally, install
[EMMO-python][EMMO-python] and its dependencies and run

.github/scripts/update_pages.sh -n

Remove the -n option if you also want to push possible changes to
GitHub Pages.


Directory content
-----------------
- [workflows](workflows): YAML scripts defining GitHub Actions in response
to push requests.
- [scripts](scripts): Shell and puthon scripts for testing and creating
documentation
- pages: Local copy of
[GitHub Pages]([email protected]:emmo-repo/emmo-repo.github.io.git)
used for releasing documentation and inferred ontology.
Run `scripts/update_pages.sh` to create/update this local copy and push
to GitHub Pages.
- tmp: Temporary directory used when generating documentation.
- README.md: This file.

- [emmocheck_conf.yml](emmocheck_conf.yml): emmocheck configurations.
Example use when running emmocheck from the root directory:

emmocheck --local --verbose --check-imported --configfile=.github/emmocheck_conf.yml emmo.owl

- [versions.txt](versions.txt): List of versions that should be deployed to GitHub Pages.

The format is simple - each line starts with a version
number. Optionally it may be followed by label indicating the
status. Use either "unstable" or "latest" or leave it out as
default.


Scripts
-------
Scripts found in the [scripts](scripts) sub-directory:

### update_pages.sh [-glv]

Main script that calls the other scripts to update GitHub Pages.

Options:
- -n: Just update local copy of GitHub Pages, do not add and commit changes.
- -l: Just work on local copy of GitHub Pages. Do not push changes.
- -v: Verbose. Print commands as they are executed.

### init_pages.sh

Clones GitHub Pages to .github/pages.

### makeindex.sh

Creates index.html file in local copy of GitHub Pages.

### makeversions.sh [-rv]

Creates version sub-directories in local copy of GitHub Pages.
Calls makedoc.sh and fixinferred.sh.

Options:
- -r Recreate existing sub-directories and their content.
- -v Verbose. Print commands as they are executed.

### makedoc.sh inferred version outdir

Generates EMMO documentation in html and pdf formats.

Arguments:
- inferred: path to inferred ontology
- version: version to generate documentation for
- outdir: output directory

### fixinferred.sh owlfile

Fix inferred ontology modifying the target file in-place.
It is safe to run this script multiple times on the same file.

Arguments:
- owlfile: Inferred ontology up fix.



[EMMO-python]: https://github.com/emmo-repo/EMMO-python
4 changes: 4 additions & 0 deletions .github/emmocheck_conf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Configurations used when running emmocheck from the ci_emmocheck workflow
test_namespace:
exceptions:
- manufacturing.EngineeredMaterial
49 changes: 49 additions & 0 deletions .github/pages-index.html.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="Emanuele Ghedini, University of Bologne">
<meta name="author" content="Gerhard Goldbeck, Goldbeck Consulting">
<meta name="author" content="Jesper Friis, SINTEF">
<meta name="author" content="Adham Hashibon, Fraunhofer IWM">
<meta name="author" content="Georg Schmitz, ACCESS">
<meta name="institution" content="European Materials &#38 Modelling Council (EMMC)">
<meta name="keywords" content="EMMO, materials science, modelling, characterisation, materials, ontology">
<meta name="dcterms.date" content="${date}">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="icon" type="image/png" href="https://avatars1.githubusercontent.com/u/51194521?s=400&u=d9e0bbceb9a6e4901077e92b2426c8bca46b1009&v=4">
<title>Europeean Materials &#38 Modelling Ontology</title>
</head>
<body>

<div class="header">
<img src="https://avatars1.githubusercontent.com/u/51194521?s=400&u=d9e0bbceb9a6e4901077e92b2426c8bca46b1009&v=4" class="logo" width="64" alt="EMMO">
<h1 class="logo">The Europeean Materials &#38 Modelling Ontology (EMMO)</h1>
<img src="https://i2.wp.com/emmc.info/wp-content/uploads/2018/10/emmc_logo-low.jpg?fit=1701%2C1701&ssl=1" class="emmclogo" width="64" alt="EMMC">
</div>
The European Materials Modelling Ontology (EMMO) is the result of a multidisciplinary effort within the EMMC, aimed at the development of a standard representational ontology framework based on current materials modelling and characterization knowledge. Instead of starting from general upper level concepts, as done by other ontologies, the EMMO development started from the very bottom level, using the actual picture of the physical world coming from applied sciences, and in particular from physics and material sciences.
<p>
The EMMO has grown from the bottom (i.e. scientific application field) to the top (i.e. conceptualization), staying focused on the original scope while at the same time maintaining an approach as general as possible. The ontological framework has been built around concepts like elementary particles, wave-particle dualism, finiteness of space and time intervals coming from the perspective for experimental physics. The development of the middle and upper layers of the ontology has been functional to the respect of these low level concepts, to facilitate the understanding of the high level concepts to users with limited or no philosophical background.

<h2>Links</h2>
<ul>
<li><a href="https://emmc.info/emmo-info/">EMMC site</a></li>
<li><a href="https://github.com/emmo-repo/EMMO">Github repository</a></li>
<li><a href="https://github.com/emmo-repo/EMMO-python">Python API</a></li>
</ul>

<h2>Releases</h2>
<table class"reltable">
<tr>
<th>Version</th>
<th>Ontology IRI</th>
<th>Inferred ontology IRI</th>
<th>HTML documentation</th>
<th>PDF documentation</th>
</tr>
${versions}
</table>


</body>
</html>
67 changes: 67 additions & 0 deletions .github/scripts/fixinferred.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/sh

# Usage: fixinferred.sh filename
#
# Fix inferred ontology modifying the target file in-place.
# It is safe to run this script multiple times on the same file.
set -e

rootdir="$(git rev-parse --show-toplevel)"
ghdir="$rootdir/.github"
tmpfile="$ghdir/tmp/fixinferred.owl"



filename=$1
[ $# -ne 1 ] && echo "Usage: fixinferred.sh filename" && exit 1


# Do nothing if filename is already fixed
grep -q "fixinferred.sh" "$filename" && exit 0


# Create temporary file
mkdir -p $(dirname "$tmpfile")
sed -e 's|</rdf:RDF>||p' "$filename" > "$tmpfile"
cat <<EOF >> "$tmpfile"
<!-- Fixes by fixinferred.sh -->
EOF

# Add annotation superproperties
# The table below associates annotation property IRIs with their superproperties
while read iri superprop; do
[ -z "$iri" ] && continue
cat <<EOF >> "$tmpfile"
<!-- $iri -->
<owl:AnnotationProperty rdf:about="$iri">
<rdfs:subPropertyOf rdf:resource="$superprop"/>
</owl:AnnotationProperty>
EOF
done <<EOF
http://www.w3.org/2004/02/skos/core#prefLabel http://www.w3.org/2000/01/rdf-schema#label
http://www.w3.org/2004/02/skos/core#altLabel http://www.w3.org/2000/01/rdf-schema#label
http://www.w3.org/2004/02/skos/core#hiddenLabel http://www.w3.org/2000/01/rdf-schema#label
http://emmo.info/emmo/top/annotations#EMMO_70fe84ff_99b6_4206_a9fc_9a8931836d84 http://www.w3.org/2000/01/rdf-schema#comment
http://emmo.info/emmo/top/annotations#EMMO_967080e5_2f42_4eb2_a3a9_c58143e835f9 http://www.w3.org/2000/01/rdf-schema#comment
http://emmo.info/emmo/top/annotations#EMMO_b432d2d5_25f4_4165_99c5_5935a7763c1a http://www.w3.org/2000/01/rdf-schema#comment
http://emmo.info/emmo/middle/isq#EMMO_de178b12_5d35_4bca_8efa_a4193162571d http://www.w3.org/2000/01/rdf-schema#comment
http://emmo.info/emmo/top/annotations#EMMO_b306ae38_938e_48fe_83e9_6141e08b596f http://www.w3.org/2000/01/rdf-schema#seeAlso
http://emmo.info/emmo/top/annotations#EMMO_6dd685dd_1895_46e4_b227_be9f7d643c25 http://www.w3.org/2000/01/rdf-schema#seeAlso
http://emmo.info/emmo/top/annotations#EMMO_50c298c2_55a2_4068_b3ac_4e948c33181f http://www.w3.org/2000/01/rdf-schema#seeAlso
http://emmo.info/emmo/top/annotations#EMMO_8de5d5bf_db1c_40ac_b698_095ba3b18578 http://www.w3.org/2000/01/rdf-schema#seeAlso
http://emmo.info/emmo/top/annotations#EMMO_fe015383_afb3_44a6_ae86_043628697aa2 http://www.w3.org/2000/01/rdf-schema#seeAlso
http://emmo.info/emmo/top/annotations#EMMO_e55f2d7c_9893_48cd_b4a4_fdf38253bd20 http://www.w3.org/2000/01/rdf-schema#seeAlso
http://emmo.info/emmo/top/annotations#EMMO_1f1b164d_ec6a_4faa_8d5e_88bda62316cc http://www.w3.org/2000/01/rdf-schema#seeAlso
http://emmo.info/emmo/top/annotations#EMMO_c84c6752_6d64_48cc_9500_e54a3c34898d http://www.w3.org/2000/01/rdf-schema#seeAlso
EOF

echo "</rdf:RDF>" >> "$tmpfile"


# Overwrite filename
cat "$tmpfile" > "$filename"
16 changes: 16 additions & 0 deletions .github/scripts/init_pages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

# Usage: init_pages.sh
#
# Check out github pages under .github/pages if the directory does not
# already exists.
set -e

rootdir="$(git rev-parse --show-toplevel)"
pagesdir="$rootdir/.github/pages"
[email protected]:emmo-repo/emmo-repo.github.io.git

if [ ! -d "$pagesdir" ]; then
set -x
git clone $pagesurl "$pagesdir"
fi
32 changes: 32 additions & 0 deletions .github/scripts/makedoc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

# Usage: makedoc.sh inferred version outdir
#
# Generates EMMO html and pdf documentation.
#
# Arguments:
# - inferred: path to inferred ontology
# - version: version to generate documentation for
# - outdir: output directory
set -e

rootdir="$(git rev-parse --show-toplevel)"
scriptsdir="$rootdir/.github/scripts"

inferred=$1
version=$2
outdir=$3
[ $# -ne 3 ] && echo "Usage: makedoc.sh inferred version outdir" && exit 1

emmodir=$(python -c 'import os, emmo; print(os.path.dirname(emmo.__file__))')
[ -d "$emmodir/examples" ] && ex="$emmodir/examples" || \
ex="$emmodir/../examples"
cd "$ex/emmodoc"


set -x
ontodoc --template=emmo.md --format=html -p variable=version:$version \
"$inferred" "$outdir/emmo.html"

ontodoc --template=emmo.md -p variable=version:$version \
"$inferred" "$outdir/emmo.pdf"
53 changes: 53 additions & 0 deletions .github/scripts/makeindex.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/sh

# Usage: makeindex.sh
#
# Parse $rootdir/.github/versions.txt and generate index.html file on
# github pages.
set -e

# Configurations
pages_url="https://emmo-repo.github.io"
pages_versions_url="$pages_url/versions"
emmo_url="http://emmo.info/emmo"

rootdir="$(git rev-parse --show-toplevel)"
ghdir="$rootdir/.github"
tmpdir="$ghdir/tmp"
pagesdir="$ghdir/pages"

versionsfile="$ghdir/versions.txt"
tmpfile="$tmpdir/versions_html_table.txt"


# Initiate github pages
"$rootdir/.github/scripts/init_pages.sh"


# Parse versions.sh and save html table rows in tmpfile
tdlink() {
echo " <td><a href=\"$1\" target=\"_blank\">$2</a></td>"
}
rm -rf "$tmpfile"
while read version name; do
[ -z "$name" ] && name=$version
iri=$emmo_url/$version
inferred=$pages_url/versions/$version/emmo-inferred.owl
inferred_iri=$iri/emmo-inferred.owl
html=$pages_url/versions/$version/emmo.html
pdf=$pages_url/versions/$version/emmo.pdf
echo " <tr>" >> "$tmpfile"
echo " <td>$name</td>" >> "$tmpfile"
tdlink $iri $iri >> "$tmpfile"
tdlink $inferred $inferred_iri >> "$tmpfile"
tdlink $html $version >> "$tmpfile"
tdlink $pdf $version >> "$tmpfile"
echo " </tr>" >> "$tmpfile"
done < "$versionsfile"


# Generate index.html
sed -e "/\${versions}/ r $tmpfile" \
-e 's/\${versions}//' \
-e "s|\${date}|$(date +%F)|" \
"$ghdir/pages-index.html.in" > "$pagesdir/index.html"
73 changes: 73 additions & 0 deletions .github/scripts/makeversions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/sh

# Usage: makeversions.sh [-r -v]
#
# Creates versions sub-directories in local copy of GitHub Pages.
#
# Options:
# -r Recreate existing sub-directories and their content.
# -v Verbose. Print commands as they are executed.
set -e

rootdir="$(git rev-parse --show-toplevel)"
ghdir="$rootdir/.github"
pagesdir="$ghdir/pages"
scriptsdir="$ghdir/scripts"

$scriptsdir/init_pages.sh

# Parse options
recreate=false
verbose=false
while getopts "rv" arg; do
case $arg in
r) recreate=true;;
v) verbose=true;;
esac
done

# If verbose, print commands as they are executed
if $verbose; then
set -x
fi

# Initiate local GitHub Pages
"$scriptsdir/init_pages.sh"


# Parse versions.sh and save html table rows in tmpfile
while read version name; do
$verbose && echo
d="$pagesdir/versions/$version"
if $recreate || [ ! -d "$d" ]; then
mkdir -p "$d"
cd "$rootdir"
cp -f README.md LICENSE.md "$d/."
fi

# Generate inferred ontology
if $recreate || [ ! -f "$d/emmo-inferred.owl" ]; then
# TODO: add tool for automatic generation of inferred ontology
echo "Missing inferred ontology: $d/emmo-inferred.owl"
echo "Please add this file and rerun this script."
exit 1
fi
"$scriptsdir/fixinferred.sh" "$d/emmo-inferred.owl"

# Generate documentation
if $recreate || [ ! -f "$d/emmo.html" ]; then
echo "Generate documentation"
"$scriptsdir/makedoc.sh" "$d/emmo-inferred.owl" $version "$d"
fi

# Create symlinks
cd "$pagesdir"
if [ ! -z "$name" ]; then
rm -f $name
ln -sf versions/$version $name
fi
done < "$ghdir/versions.txt"


# Make sure that we exit with non-zero
exit 0
Loading

0 comments on commit e79e85e

Please sign in to comment.