Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Publish dev ontologies and doc in docs/dev
run-name: Publish dev ontologies and doc
on:
push:
branches:
- develop
paths:
- 'ontology/**/*.owl'
- 'ontology/**/*.ttl'
- 'ontology/**/*.rdf'
workflow_dispatch:

permissions:
contents: write

jobs:
generate-dev-documentation:
runs-on: ubuntu-latest

steps:
- name: Checkout develop branch
uses: actions/checkout@v4
with:
ref: develop
fetch-depth: 0

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install Python dependencies
run: pip install -r requirements.txt

- name: Generate documentation on develop
run: |
# Clean old dev documentation before generating new ones
echo "Cleaning old dev documentation..."
rm -rf docs/dev
mkdir -p docs/dev

find ontology -type f \( -name "*.owl" -o -name "*.ttl" -o -name "*.rdf" \) | while read ontology_file; do
echo "Processing $ontology_file (development version)"

# Extract relative path from ontology/
# Example: ontology/modules/core/0.1/core.owl -> modules/core/0.1
relative_path="${ontology_file#ontology/}"

# Get directory path (preserves modules/ or demo/)
dir_path=$(dirname "$relative_path")

# Get filename without extension
file_name=$(basename "$ontology_file")
base_name="${file_name%.*}"

# Dev docs preserve full structure: docs/dev/modules/core/0.1/
output_dir="docs/dev/$dir_path"
mkdir -p "$output_dir"

echo " Path: $dir_path"
echo " Ontology name: $base_name"
echo " Output directory: $output_dir"

java -jar tools/widoco-1.4.25.jar \
-ontFile "$ontology_file" \
-outFolder "$output_dir" \
-rewriteAll \
-webVowl \
-licensius

echo "Development documentation generated for $ontology_file in $output_dir"

if [ -f "$output_dir/index-en.html" ]; then
mv "$output_dir/index-en.html" "$output_dir/index.html"
echo "Renamed index-en.html to index.html"
fi

echo "---"
done

# Create 'latest' folders for each module in dev/modules/ and dev/demo/
echo "Creating dev/latest folders..."
for category_dir in docs/dev/*/; do
if [ -d "$category_dir" ]; then
category_name=$(basename "$category_dir")

echo "Processing dev category: $category_name"

# Process each module within the category
for module_dir in "$category_dir"*/; do
if [ -d "$module_dir" ]; then
module_name=$(basename "$module_dir")

# Find the highest version number (semantic versioning)
# Exclude 'latest' folder explicitly
latest_version=$(find "$module_dir" -mindepth 1 -maxdepth 1 -type d -not -name 'latest' | \
grep -E '/[0-9]+\.[0-9]+' | \
sort -V | \
tail -1)

if [ -n "$latest_version" ]; then
echo " Creating dev/latest folder for $category_name/$module_name"
echo " Latest version: $(basename $latest_version)"

# Copy the latest version to 'latest' folder
rm -rf "$module_dir/latest"
cp -r "$latest_version" "$module_dir/latest"

echo " Created: $module_dir/latest"
fi
fi
done
fi
done

# Build index page and copy to dev folder
echo "Building index page for dev..."
python build_index.py docs/dev/index.html
#cp docs/index.html docs/dev/index.html
#echo "Copied index.html to docs/dev/"

- name: Commit and push to main
run: |
git checkout main
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -f docs/dev/
git commit -m "publish dev ontologies [skip ci]"
git push origin main
141 changes: 141 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Publish main ontologies and doc in docs
run-name: Publish main ontologies and doc
on:
push:
branches:
- main
paths:
- 'ontology/**/*.owl'
- 'ontology/**/*.ttl'
- 'ontology/**/*.rdf'
workflow_dispatch:

permissions:
contents: write

jobs:
generate-documentation:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install Python dependencies
run: pip install -r requirements.txt

#- name: Download WIDOCO
# run: |
# wget https://github.com/dgarijo/Widoco/releases/download/v1.4.25/widoco-1.4.25-jar-with-dependencies_JDK-17.jar -O widoco.jar

- name: Generate documentation
run: |
find ontology -type f \( -name "*.owl" -o -name "*.ttl" -o -name "*.rdf" \) | while read ontology_file; do
echo "Processing $ontology_file"

# Extract the relative path from ontology/
# Example: ontology/modules/core/0.1/myonto.owl -> modules/core/0.1/myonto.owl
relative_path="${ontology_file#ontology/}"

# Get the directory path without the filename
# Example: modules/core/0.1/myonto.owl -> modules/core/0.1
dir_path=$(dirname "$relative_path")

# Get the filename without extension for logging
file_name=$(basename "$ontology_file")
base_name="${file_name%.*}"

# Create output directory maintaining the full structure
# Example: docs/modules/core/0.1/
output_dir="docs/$dir_path"
mkdir -p "$output_dir"

echo " Path: $dir_path"
echo " Ontology name: $base_name"
echo " Output directory: $output_dir"

java -jar tools/widoco-1.4.25.jar \
-ontFile "$ontology_file" \
-outFolder "$output_dir" \
-rewriteAll \
-webVowl \
-licensius

echo "Documentation generated for $ontology_file in $output_dir"

if [ -f "$output_dir/index-en.html" ]; then
mv "$output_dir/index-en.html" "$output_dir/index.html"
echo "Renamed index-en.html to index.html"
fi

echo "---"
done

# Create 'latest' folders for each module in modules/ and demo/
echo "Creating latest folders..."
for category_dir in docs/*/; do
if [ -d "$category_dir" ]; then
category_name=$(basename "$category_dir")

# Skip 'dev' folder
if [ "$category_name" = "dev" ]; then
continue
fi

echo "Processing category: $category_name"

# Process each module within the category
for module_dir in "$category_dir"*/; do
if [ -d "$module_dir" ]; then
module_name=$(basename "$module_dir")

# Find the highest version number (semantic versioning)
latest_version=$(find "$module_dir" -mindepth 1 -maxdepth 1 -type d | \
grep -E '/[0-9]+\.[0-9]+' | \
sort -V | \
tail -1)

if [ -n "$latest_version" ]; then
echo " Creating latest folder for $category_name/$module_name"
echo " Latest version: $(basename $latest_version)"

# Copy the latest version to 'latest' folder
rm -rf "$module_dir/latest"
cp -r "$latest_version" "$module_dir/latest"

echo " Created: $module_dir/latest"
fi
fi
done
fi
done

- name: Build index page
run: python build_index.py

- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -f docs/
git commit -m "update docs" -a

- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# WIDOCO jar file (downloaded by workflow)
#widoco*.jar

# Temporary files
*.tmp
*.temp
*.log

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Editor files
.vscode/
.idea/
*.swp
*.swo
*~

# Python (if using scripts)
__pycache__/
*.py[cod]
*$py.class
*.so
.Python

# Node (if using JavaScript tools)
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

#docs
docs/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Huanyu Li

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading