This repository hosts ontology files and automatically generates documentation using WIDOCO whenever ontology files are updated.
.
├── .github/
│ └── workflows/
│ └── generate-docs.yml # GitHub Actions workflow
├── ontology/ # Ontology files organized by module/version
│ ├── module1/
│ │ ├── 0.1/
│ │ │ └── ontology.owl
│ │ └── 0.2/
│ │ └── ontology.owl
│ └── module2/
│ └── 1.0/
│ └── ontology.ttl
├── docs/ # Generated documentation (auto-generated)
│ ├── module1/
│ │ ├── 0.1/
│ │ │ └── index.html
│ │ └── 0.2/
│ │ └── index.html
│ └── module2/
│ └── 1.0/
│ └── index.html
├── generate_docs_local.py # Local testing script
└── README.md # This file
Ontology files should be organized as: ontology/{module}/{version}/{ontology-file}.{owl|ttl|rdf}
This structure:
- Keeps different modules separated
- Maintains version history
- Generates documentation at:
docs/{module}/{version}/index.html - Creates clean URLs on GitHub Pages:
https://username.github.io/repo/module/version/
- Add or update ontology files: Place your ontology files (
.owl,.ttl, or.rdf) in theontology/{module}/{version}/directory structure - Push to GitHub: Commit and push your changes to the
mainormasterbranch - Automatic documentation generation: The GitHub Actions workflow will:
- Detect changes to ontology files
- Download WIDOCO (JDK-17 version)
- Generate comprehensive documentation for each ontology
- Maintain the module/version folder structure
- Rename
index-en.htmltoindex.html - Commit and push the generated documentation to the
docs/directory
Your documentation will be available at: https://[username].github.io/[repo]/[module]/[version]/index.html
- Create a new GitHub repository
- Clone this repository structure to your local machine
- Add your ontology files to the
ontology/directory
To allow the workflow to commit generated documentation:
- Go to your repository on GitHub
- Navigate to Settings → Actions → General
- Scroll down to Workflow permissions
- Select Read and write permissions
- Check Allow GitHub Actions to create and approve pull requests
- Click Save
To host your documentation online:
- Go to Settings → Pages
- Under Source, select Deploy from a branch
- Select the
mainormasterbranch and/docsfolder - Click Save
- Your documentation will be available at
https://[username].github.io/[repository-name]/
Before pushing to GitHub, you can test documentation generation locally using the provided Python script.
- Python 3.6+
- Java 17+ (Download here)
-
Organize your ontology files in the module/version structure:
ontology/ ├── module1/ │ ├── 0.1/ │ │ └── ontology.owl │ └── 0.2/ │ └── ontology.owl └── module2/ └── 1.0/ └── ontology.ttl -
Run the test script:
python3 generate_docs_local.py
-
View the documentation:
The script will offer to start a local web server automatically. Type
ywhen prompted.Or manually start a server:
cd docs python3 -m http.server 8000Then open in your browser:
http://localhost:8000/module/version/index.html
index.html files directly (using file:// protocol). WIDOCO documentation requires an HTTP server due to JavaScript cross-origin restrictions. Always use a web server for local viewing.
The local testing script:
- Downloads WIDOCO automatically
- Generates documentation with the same settings as GitHub Actions
- Maintains the module/version folder structure
- Renames
index-en.htmltoindex.html - Offers to start a web server for immediate viewing
See LOCAL-TESTING-README.md and VIEWING-DOCS-LOCALLY.md for detailed instructions.
You can also manually trigger the documentation generation:
- Go to the Actions tab in your repository
- Select Generate Ontology Documentation
- Click Run workflow
The workflow uses the following WIDOCO options:
-rewriteAll: Overwrites previous documentation-webVowl: Includes WebVOWL visualization-licensius: Adds license information
Note: The workflow generates documentation directly in docs/{module}/{version}/ structure and automatically renames index-en.html to index.html.
Edit .github/workflows/generate-docs.yml and adjust the java -jar widoco.jar command parameters according to your needs. See WIDOCO documentation for available options.
By default, the workflow triggers on:
- Push to
mainormasterbranch - Changes to ontology files in the
ontology/directory
You can modify the trigger conditions in the workflow file under the on: section.
The workflow supports .owl, .ttl, and .rdf files by default. To add support for other formats, modify the file patterns in the workflow.
- Check the Actions tab for error logs
- Ensure GitHub Actions has write permissions
- Verify your ontology files are valid
- Check that files are in the correct directory
- Ensure GitHub Pages is configured to use the
/docsfolder - Wait a few minutes for GitHub Pages to deploy
- Check that the
docs/directory contains generated files
Here's a minimal example ontology you can use for testing:
@prefix : <http://example.org/ontology#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<http://example.org/ontology> rdf:type owl:Ontology ;
rdfs:label "Example Ontology" ;
rdfs:comment "An example ontology for testing WIDOCO documentation generation" .
:ExampleClass rdf:type owl:Class ;
rdfs:label "Example Class" ;
rdfs:comment "An example class in the ontology" .Save this in the proper structure:
mkdir -p ontology/example/0.1
# Save the above content as ontology/example/0.1/example.ttlAfter pushing, documentation will be generated at docs/example/0.1/index.html
# 1. Create module/version structure
mkdir -p ontology/mymodule/0.1
# 2. Add your ontology file
cp your-ontology.owl ontology/mymodule/0.1/
# 3. Test locally (optional)
python3 generate_docs_local.py
# 4. Commit and push
git add ontology/mymodule/
git commit -m "Add mymodule v0.1"
git push
# Documentation will be auto-generated at:
# https://[username].github.io/[repo]/mymodule/0.1/index.html[Add your license information here]
[Add contribution guidelines here]