Skip to content

Commit

Permalink
work webpage
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierr committed Jan 26, 2024
1 parent 9c0221b commit 56739d1
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 173 deletions.
117 changes: 0 additions & 117 deletions .github/utils/publish_ontologies.py

This file was deleted.

46 changes: 0 additions & 46 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,50 +30,4 @@ jobs:
--configfile=.github/utils/emmocheck_config.yml \
battinfo.ttl
documentation-build:
name: Documentation
runs-on: ubuntu-latest
env:
ONTODOC_DIR: doc/ontodoc
TMP_DIR: tmp
PAGES_DIR: gh-pages
PUBLISH_ONTOLOGIES_DIR: ontology

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Install pandoc 2.1.2
run: |
sudo apt-get update
#sudo apt-get install pandoc # we need v2.1.2
wget https://github.com/jgm/pandoc/releases/download/2.1.2/pandoc-2.1.2-1-amd64.deb
sudo apt-get install -y ./pandoc-2.1.2-1-amd64.deb
- name: Install other dependencies
run: |
sudo apt-get update
sudo apt-get install -y graphviz texlive-xetex texlive-latex-extra
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
pip install -r requirements.txt
- name: Setup git identity
run: |
cd ${GITHUB_WORKSPACE}
git config --global user.email "${GIT_USER_EMAIL}"
git config --global user.name "${GIT_USER_NAME}"
- name: Publish ontologies
run: python ${GITHUB_WORKSPACE}/.github/utils/publish_ontologies.py
- name: Update GitHub Pages
run: ${GITHUB_WORKSPACE}/${ONTODOC_DIR}/update-pages.sh TEST
34 changes: 34 additions & 0 deletions sphinx/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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;
}
19 changes: 19 additions & 0 deletions sphinx/resources.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Resources
=========

Best Practices
--------------
- `Data on the Web Best Practices <https://www.w3.org/TR/dwbp/>`_
- `Best Practices for Publishing Linked Data <https://www.w3.org/TR/ld-bp/>`_

Tabular Data
------------
- `Model for Tabular Data and Metadata on the Web <https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/>`_
- `Metadata Vocabulary for Tabular Data <https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/>`_

RDF Vocabularies
----------------
- `RDF Schema <https://www.w3.org/TR/rdf-schema/>`_
- `Simple Knowledge Organization System (SKOS) <https://www.w3.org/2004/02/skos/>`_
- `Dublin Core <https://www.dublincore.org/specifications/dublin-core/dcmi-terms/>`_
- `Schema.org <https://schema.org/>`_
19 changes: 10 additions & 9 deletions sphinx/ttl_to_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ def extract_terms_info_sparql(g: Graph)-> list:
PREFIXES = """
PREFIX emmo: <http://emmo.info/emmo#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
"""

list_entity_types = ["IRI", "prefLabel", "Elucidation", "Alternative Label(s)", "IEC Reference", "IUPAC Reference", "Wikipedia Reference"]
list_entity_types = ["IRI", "prefLabel", "Elucidation", "Alternative Label(s)", "IEC Reference", "IUPAC Reference", "Wikipedia Reference", "Wikidata Reference", "Comment", ]

query = PREFIXES + """
SELECT ?iri ?prefLabel ?elucidation (GROUP_CONCAT(?altLabel; SEPARATOR=", ") AS ?altLabels) ?iecref ?iupacref ?wikipediaref
SELECT ?iri ?prefLabel ?elucidation (GROUP_CONCAT(?altLabel; SEPARATOR=", ") AS ?altLabels) ?iecref ?iupacref ?wikipediaref ?wikidataref ?comment
WHERE {
?iri skos:prefLabel ?prefLabel.
Expand All @@ -37,6 +38,8 @@ def extract_terms_info_sparql(g: Graph)-> list:
OPTIONAL { ?iri emmo:EMMO_50c298c2_55a2_4068_b3ac_4e948c33181f ?iecref . }
OPTIONAL { ?iri emmo:EMMO_fe015383_afb3_44a6_ae86_043628697aa2 ?iupacref . }
OPTIONAL { ?iri emmo:EMMO_c84c6752_6d64_48cc_9500_e54a3c34898d ?wikipediaref . }
OPTIONAL { ?iri emmo:EMMO_26bf1bef_d192_4da6_b0eb_d2209698fb54 ?wikidataref . }
OPTIONAL { ?iri rdfs:comment ?comment . }
}
GROUP BY ?iri ?prefLabel ?elucidation
Expand All @@ -62,9 +65,9 @@ def extract_terms_info_sparql(g: Graph)-> list:
def render_rst_top() -> str:

top_rst = """
==========
References
==========
===========
Class Index
===========
"""

Expand Down Expand Up @@ -132,10 +135,8 @@ def rendering_workflow():

# PAGES
ttl_modules = [
{"section title": "Battery Concepts",
"path": "./battery.ttl"},
{"section title": "Battery Quantities",
"path": "./batteryquantities.ttl"}
{"section title": "BattINFO",
"path": "./battery.ttl"}
]

# GENERATE PAGES
Expand Down
2 changes: 1 addition & 1 deletion sphinx/util.el
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
(let ((outputbuffer (get-buffer-create "*buildoutput*")))
(pop-to-buffer outputbuffer)
(cd docdir)
(pyvenv-activate "~/Python/battinfo-doc-3.7-env/")
(pyvenv-activate "~/Python/battinfodoc.env/")
(erase-buffer)
(start-process "battinfo-build" outputbuffer "make" "html")
)
Expand Down

0 comments on commit 56739d1

Please sign in to comment.