Skip to content

Commit

Permalink
Merge pull request #109 from glosis-ld/develop
Browse files Browse the repository at this point in the history
Release v1.2.1
  • Loading branch information
Montanaz0r authored Jul 25, 2023
2 parents ca727d7 + 6e41157 commit c42a2f2
Show file tree
Hide file tree
Showing 172 changed files with 76,293 additions and 157,252 deletions.
1,712 changes: 856 additions & 856 deletions csv_codelists/glosis_cl.csv

Large diffs are not rendered by default.

528 changes: 264 additions & 264 deletions csv_codelists/glosis_procedure.csv

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
env
*.config
18 changes: 14 additions & 4 deletions docs/README_WiDoco.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ WiDoco auto-config
==================

This folder contains the assets necessary to generate the documentation of the
various ontology modules. Ultimatelly, the documentation is created by WiDoco,
various ontology modules. Ultimately, the documentation is created by WiDoco,
but some pre-processing is necessary to transform the ontology meta-data into
WiDoco input config files.

Expand All @@ -14,10 +14,10 @@ longer be necessary.
config
------

The auto-config programme needs to be awere of the location of the WiDoco `.jar`
The auto-config programme needs to be aware of the location of the WiDoco `.jar`
file. This information is set up in the `config` file, an input to the programme.
This file also stores the location of the WiDoco template, stored in a separate
file for convinience (`template.json`, see below).
file for convenience (`template.json`, see below).

Before running the programme edit the `config` file, inserting the right path to the
WiDoco `.jar` in your system.
Expand All @@ -40,7 +40,7 @@ requirements.txt
----------------

The auto-config programme depends on a few Python libraries enumerated in the
`requirements.txt` file. A virtual environment is a simple and convinient method
`requirements.txt` file. A virtual environment is a simple and convenient method
to set up these libraries:

```
Expand All @@ -65,3 +65,13 @@ create the documentation for the `glosis_common` module:
python3 generateDoc.py glosis_common
```

Complete run
------------

To regenerate the documentation for all modules in one go run the script
`generate_all.sh`. It expects the virtual environment to be created beforehand
in the `env` folder.

```
./generate_all.sh
```
37 changes: 25 additions & 12 deletions docs/generateDoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
# SPDX-License-Identifier: CC-BY-NC-SA-3.0-IGO

import os
import os
import sys
import json
import configparser
Expand All @@ -32,10 +32,11 @@
creators = []
contributors = []


def addCreators(g, config):

global creators

for s, dc_creator, creator in g.triples((None, DCT.creator, None)):
for s2, p2, name in g.triples((creator, FOAF.name, None)):
if (name in creators):
Expand Down Expand Up @@ -83,11 +84,20 @@ def addContributors(g, config):
return(config)


def addModuleDesc(g, config):

for ont, rdfs_comment, desc in g.triples((None, RDFS.comment, None)):
for ont, rdf_type, owl_ontology in g.triples((ont, RDF.type, OWL.Ontology)):

config["abstract"] = "%s<br>%s" % (config["abstract"], desc)
return(config)


if __name__ == "__main__":

if (len(sys.argv) > 1):
ont_file = sys.argv[1]

config = configparser.ConfigParser()
config.read('config')
widoco_jar = config['WiDoco']['jar_path']
Expand All @@ -97,46 +107,49 @@ def addContributors(g, config):
file = open(templ_file)
config = json.load(file)
file.close()

# Parse ontology file
g = Graph()
g.parse("../%s.ttl" % ont_file)

# Ontology namespace
for s, p, o in g.triples((None, RDF.type, OWL.Ontology)):
config["ontologyNamespaceURI"] = s

# Simple predicates: Title, abstract and similar
for item in mapPreds.items():
for s, p, o in g.triples((None, item[1], None)):
config[item[0]] = o

# Creators
config = addCreators(g, config)
config = addCreators(g, config)

# Contributors
config = addContributors(g, config)

# Module description
config = addModuleDesc(g, config)

# Imported ontologies
for s, p, ontology in g.triples((None, OWL.imports, None)):
config["importedOntologyNames"] += ontology + ";"
config["importedOntologyURIs"] += ontology + ";"
g_ext = Graph()
try:
g_ext.parse(ontology, format="turtle")
config = addCreators(g_ext, config)
config = addCreators(g_ext, config)
config = addContributors(g_ext, config)
except:
print("Faild to parse ontology: %s" % ontology)

# Dump WiDoco config file
config_file = "%s.config" % ont_file
textfile = open(config_file, "w")

for key in config:
a = textfile.write("%s=%s\n" % (key, config[key]))
print("Outputed key: %s", key)

textfile.close()

# Execute WiDoco
Expand All @@ -149,4 +162,4 @@ def addContributors(g, config):
-uniteSections \
-webVowl \
-rewriteAll""" % (widoco_jar, ont_file, ont_file, config_file))

18 changes: 18 additions & 0 deletions docs/generate_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

source env/bin/activate

python3 generateDoc.py glosis_cl
python3 generateDoc.py glosis_common
python3 generateDoc.py glosis_ext_property
python3 generateDoc.py glosis_layer_horizon
python3 generateDoc.py glosis_main
python3 generateDoc.py glosis_observation
python3 generateDoc.py glosis_procedure
python3 generateDoc.py glosis_profile
python3 generateDoc.py glosis_siteplot
python3 generateDoc.py glosis_surface
python3 generateDoc.py glosis_unit
python3 generateDoc.py iso28258

deactivate
20 changes: 0 additions & 20 deletions docs/glosis_cl.config

This file was deleted.

Loading

0 comments on commit c42a2f2

Please sign in to comment.