From 8b543f95087b9af8177c51a9364d352e27a6aa98 Mon Sep 17 00:00:00 2001 From: "John P. McCrae" Date: Thu, 26 Nov 2026 10:32:55 +0000 Subject: [PATCH 1/2] Bring the specification in line with the OntoLex style guide - Example files are generated from the listings in index.md by scripts/extract_examples.py (named by src, prefixes from the Namespaces section); CI checks that they are up to date and runs on pull requests. - Captions without the redundant "Example:" prefix, and without Markdown or CURIEs in them. - References to the core use data-cite with a single "ontolex" localBiblio entry for the published OntoLex-Lemon report, with anchors that exist there. - Prose: code-style and CURIE references replaced by term links and natural wording; example words in italics. - LexInfo: accusative -> accusativeCase; stem types that LexInfo does not define move to the example namespace. - English labels in Title Case with lang="en". Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/publish.yaml | 52 ++++++---- examples/example_1.ttl | 11 +-- examples/example_10.ttl | 11 +-- examples/example_11.ttl | 12 +-- examples/example_12.ttl | 11 +-- examples/example_13.ttl | 11 +-- examples/example_14.ttl | 13 +-- examples/example_15.ttl | 12 +-- examples/example_16.ttl | 12 +-- examples/example_17.ttl | 12 +-- examples/example_18.ttl | 12 +-- examples/example_19.ttl | 12 +-- examples/example_2.ttl | 12 +-- examples/example_20.ttl | 12 +-- examples/example_21.ttl | 12 +-- examples/example_22.ttl | 12 +-- examples/example_23.ttl | 12 +-- examples/example_3.ttl | 12 +-- examples/example_4.ttl | 11 +-- examples/example_5.ttl | 12 +-- examples/example_6.ttl | 11 +-- examples/example_7.ttl | 12 +-- examples/example_8.ttl | 12 +-- examples/example_9.ttl | 12 +-- index.md | 157 +++++++++++++++--------------- respec.template | 21 +--- scripts/extract_examples.py | 169 +++++++++++++++++++++++++++------ scripts/extract_examples.sh | 8 -- 28 files changed, 338 insertions(+), 340 deletions(-) delete mode 100644 scripts/extract_examples.sh diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 52e7e35..e33a32f 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -4,6 +4,12 @@ on: push: branches: - master + # Build (but do not deploy) on pull requests so that a broken specification, + # out-of-date example files or a failing ontology extraction are caught + # before they are merged. + pull_request: + branches: + - master workflow_dispatch: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages @@ -12,17 +18,8 @@ permissions: pages: write id-token: write -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - jobs: - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} + build: runs-on: ubuntu-latest steps: # Step 1: Check out the repository @@ -30,36 +27,51 @@ jobs: uses: actions/checkout@v4 - name: Setup Pages + if: github.event_name != 'pull_request' uses: actions/configure-pages@v5 - # Step 2: Set up Pandoc - - name: Install Pandoc + # Step 2: Install the tools + - name: Install Pandoc and Rapper run: | sudo apt-get update - sudo apt-get install -y pandoc - - name: Install Rapper - run: | - sudo apt-get update - sudo apt-get install -y raptor2-utils - + sudo apt-get install -y pandoc raptor2-utils - name: Install Python Packages run: | python3 -m pip install --upgrade pip python3 -m pip install beautifulsoup4 rdflib - # Step 3: Convert index.md to index.html + # Step 3: Check that the example files match their listings in index.md + - name: Check examples + run: python3 scripts/extract_examples.py --check + + # Step 4: Convert index.md to index.html and extract the ontology - name: Convert Markdown to HTML with Pandoc run: pandoc --template respec.template -f markdown-auto_identifiers --wrap=none index.md -o index.html - name: Expand tags run: python3 expand_tags.py index.html index.html - name: Convert RDFa to Turtle run: rapper -i rdfa index.html -o turtle | python3 build_ontology.py morph + - name: Upload artifact + if: github.event_name != 'pull_request' uses: actions/upload-pages-artifact@v3 with: # Upload entire repository path: '.' + + deploy: + if: github.event_name != 'pull_request' + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. + # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. + concurrency: + group: "pages" + cancel-in-progress: false + steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 - diff --git a/examples/example_1.ttl b/examples/example_1.ttl index 93af1f5..e67c69e 100644 --- a/examples/example_1.ttl +++ b/examples/example_1.ttl @@ -1,13 +1,8 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : .:cats a ontolex:Form ; + +:cats a ontolex:Form ; ontolex:writtenRep "cats"@en ; morph:consistsOf :cat, :s . diff --git a/examples/example_10.ttl b/examples/example_10.ttl index f0c8716..c856d5a 100644 --- a/examples/example_10.ttl +++ b/examples/example_10.ttl @@ -1,13 +1,8 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : .:aufgestanden a ontolex:Form ; + +:aufgestanden a ontolex:Form ; morph:consistsOf :auf , :ge, :stand , :en . :perfect_tense_rule a morph:Rule ; diff --git a/examples/example_11.ttl b/examples/example_11.ttl index 4d4d3f5..584a906 100644 --- a/examples/example_11.ttl +++ b/examples/example_11.ttl @@ -1,13 +1,7 @@ -@prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . -@prefix morph: . -@prefix vartrans: . -@prefix paralex: . @prefix : . +@prefix morph: . + + :perfect_tense_rule a morph:Rule ; morph:generates :aufgestanden-form . diff --git a/examples/example_12.ttl b/examples/example_12.ttl index d4b4226..3c6df7d 100644 --- a/examples/example_12.ttl +++ b/examples/example_12.ttl @@ -1,13 +1,8 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : .:lupus a ontolex:LexicalEntry ; + +:lupus a ontolex:LexicalEntry ; ontolex:canonicalForm :lupus_form ; ontolex:morphologicalPattern :secondDeclension . diff --git a/examples/example_13.ttl b/examples/example_13.ttl index 3f45fdd..52dc8c3 100644 --- a/examples/example_13.ttl +++ b/examples/example_13.ttl @@ -1,13 +1,8 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : .:gen_sg_rule morph:generates :lupi ; + +:gen_sg_rule morph:generates :lupi ; morph:involves :i . :i a ontolex:Affix ; diff --git a/examples/example_14.ttl b/examples/example_14.ttl index b546683..f2392fd 100644 --- a/examples/example_14.ttl +++ b/examples/example_14.ttl @@ -1,13 +1,10 @@ -@prefix ontolex: . -@prefix skos: . -@prefix rdf: . +@prefix : . @prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . +@prefix ontolex: . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : .:adam a ontolex:LexicalEntry ; +@prefix lexinfo: . + +:adam a ontolex:LexicalEntry ; ontolex:canonicalForm :adam_form ; ontolex:morphologicalPattern :noun1_infl_vowelHarmony1 . diff --git a/examples/example_15.ttl b/examples/example_15.ttl index c7f94a3..b68a202 100644 --- a/examples/example_15.ttl +++ b/examples/example_15.ttl @@ -1,13 +1,9 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : .:adamlari a ontolex:Form ; +@prefix lexinfo: . + +:adamlari a ontolex:Form ; ontolex:writtenRep "adamlari"@tr ; morph:grammaticalMeaning [ lexinfo:case lexinfo:accusative ; diff --git a/examples/example_16.ttl b/examples/example_16.ttl index 5a00f17..c806567 100644 --- a/examples/example_16.ttl +++ b/examples/example_16.ttl @@ -1,13 +1,9 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : .:rumpo a ontolex:LexicalEntry ; +@prefix lexinfo: . + +:rumpo a ontolex:LexicalEntry ; ontolex:canonicalForm :rumpo_form ; morph:baseForm :rupi_form , :ruptum_form ; ontolex:morphologicalPattern :ThirdConjugation . diff --git a/examples/example_17.ttl b/examples/example_17.ttl index 9b976af..d156a56 100644 --- a/examples/example_17.ttl +++ b/examples/example_17.ttl @@ -1,13 +1,9 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : .:rumpis_form a ontolex:Form ; +@prefix lexinfo: . + +:rumpis_form a ontolex:Form ; ontolex:writtenRep "rumpis"@la ; morph:grammaticalMeaning :prs.act.ind.2.sg ; morph:baseType lexinfo:presentStem . diff --git a/examples/example_18.ttl b/examples/example_18.ttl index 6be35ba..71f2877 100644 --- a/examples/example_18.ttl +++ b/examples/example_18.ttl @@ -1,13 +1,9 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . -@prefix morph: . @prefix vartrans: . -@prefix paralex: . -@prefix : .:schoenheit-entry a ontolex:LexicalEntry; +@prefix morph: . + +:schoenheit-entry a ontolex:LexicalEntry; ontolex:canonicalForm [ ontolex:writtenRep "Schönheit"@de ]. :schoen-entry a ontolex:LexicalEntry; ontolex:canonicalForm [ ontolex:writtenRep "schön"@de ]. diff --git a/examples/example_19.ttl b/examples/example_19.ttl index 9c38f11..5eb0235 100644 --- a/examples/example_19.ttl +++ b/examples/example_19.ttl @@ -1,13 +1,9 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . -@prefix morph: . @prefix vartrans: . -@prefix paralex: . -@prefix : .:capostazione-entry a ontolex:LexicalEntry; +@prefix morph: . + +:capostazione-entry a ontolex:LexicalEntry; ontolex:canonicalForm [ ontolex:writtenRep "capostazione"@it ]. :capo-entry a ontolex:LexicalEntry; ontolex:canonicalForm [ ontolex:writtenRep "capo"@it ]. diff --git a/examples/example_2.ttl b/examples/example_2.ttl index 3796727..b38bf3b 100644 --- a/examples/example_2.ttl +++ b/examples/example_2.ttl @@ -1,13 +1,9 @@ -@prefix ontolex: . -@prefix skos: . +@prefix : . @prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . +@prefix ontolex: . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : .:cats a ontolex:Form ; + +:cats a ontolex:Form ; ontolex:writtenRep "cats"@en ; morph:consistsOf :cat, :s ; rdf:_1 :cat ; diff --git a/examples/example_20.ttl b/examples/example_20.ttl index a8117e7..188349a 100644 --- a/examples/example_20.ttl +++ b/examples/example_20.ttl @@ -1,13 +1,9 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . -@prefix morph: . @prefix vartrans: . -@prefix paralex: . -@prefix : . +@prefix morph: . + + :schoen_heit a morph:WordFormationRelation; vartrans:source :schoen-entry; vartrans:target :schoenheit-entry; diff --git a/examples/example_21.ttl b/examples/example_21.ttl index b4bc0d4..1610ac5 100644 --- a/examples/example_21.ttl +++ b/examples/example_21.ttl @@ -1,13 +1,7 @@ -@prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . -@prefix morph: . -@prefix vartrans: . -@prefix paralex: . @prefix : . +@prefix morph: . + + :_heit-rule a morph:DerivationRule; morph:replacement [ morph:sourceRegex "$" ; diff --git a/examples/example_22.ttl b/examples/example_22.ttl index 04596fb..a4f90ea 100644 --- a/examples/example_22.ttl +++ b/examples/example_22.ttl @@ -1,13 +1,9 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . -@prefix morph: . @prefix vartrans: . -@prefix paralex: . -@prefix : . +@prefix morph: . + + :schaapskop-entry a ontolex:LexicalEntry ; ontolex:canonicalForm [ ontolex:writtenRep "schaapskop"@nl ] . :schaap-entry a ontolex:LexicalEntry ; diff --git a/examples/example_23.ttl b/examples/example_23.ttl index 49da145..8de5890 100644 --- a/examples/example_23.ttl +++ b/examples/example_23.ttl @@ -1,13 +1,9 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : . +@prefix lexinfo: . + + :scribo a ontolex:LexicalEntry ; ontolex:canonicalForm :scribo_form ; morph:baseForm :scriptum_form . diff --git a/examples/example_3.ttl b/examples/example_3.ttl index 1025a78..a163cd2 100644 --- a/examples/example_3.ttl +++ b/examples/example_3.ttl @@ -1,13 +1,9 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : .:cats a ontolex:Form ; +@prefix lexinfo: . + +:cats a ontolex:Form ; ontolex:writtenRep "cats"@en ; morph:grammaticalMeaning [ lexinfo:number lexinfo:plural ; ] ; morph:consistsOf :cat, :s . diff --git a/examples/example_4.ttl b/examples/example_4.ttl index db1dd07..ef40e43 100644 --- a/examples/example_4.ttl +++ b/examples/example_4.ttl @@ -1,13 +1,10 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . @prefix morph: . -@prefix vartrans: . +@prefix lexinfo: . @prefix paralex: . -@prefix : .:lupus a ontolex:Form ; + +:lupus a ontolex:Form ; ontolex:writtenRep "lupus"@la ; morph:grammaticalMeaning :nom.sg ; morph:consistsOf :lup , :us . diff --git a/examples/example_5.ttl b/examples/example_5.ttl index d118a79..bd02d70 100644 --- a/examples/example_5.ttl +++ b/examples/example_5.ttl @@ -1,13 +1,9 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : .:s_pl a ontolex:Affix ; +@prefix lexinfo: . + +:s_pl a ontolex:Affix ; morph:grammaticalMeaning lexinfo:plural ; morph:baseConstraint [ lexinfo:partOfSpeech lexinfo:noun ] . diff --git a/examples/example_6.ttl b/examples/example_6.ttl index 15bba12..229f486 100644 --- a/examples/example_6.ttl +++ b/examples/example_6.ttl @@ -1,13 +1,8 @@ +@prefix : . @prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : .:gehen a ontolex:LexicalEntry ; + +:gehen a ontolex:LexicalEntry ; ontolex:canonicalForm :gehen_form ; morph:baseForm :geh_form . diff --git a/examples/example_7.ttl b/examples/example_7.ttl index d9ece14..dcc2450 100644 --- a/examples/example_7.ttl +++ b/examples/example_7.ttl @@ -1,11 +1,5 @@ -@prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . +@prefix : . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : .:lenition_rule a morph:Rule ; + +:lenition_rule a morph:Rule ; morph:ruleExample "bhean"@ga . diff --git a/examples/example_8.ttl b/examples/example_8.ttl index 1532fac..60a4b21 100644 --- a/examples/example_8.ttl +++ b/examples/example_8.ttl @@ -1,13 +1,7 @@ -@prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . +@prefix : . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : .:gen_sg_rule a morph:Rule ; + +:gen_sg_rule a morph:Rule ; morph:replacement [ a morph:RegexReplacement ; morph:sourceRegex "us$" ; diff --git a/examples/example_9.ttl b/examples/example_9.ttl index 6169e47..b6897c5 100644 --- a/examples/example_9.ttl +++ b/examples/example_9.ttl @@ -1,13 +1,7 @@ -@prefix ontolex: . -@prefix skos: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix lexinfo: . +@prefix : . @prefix morph: . -@prefix vartrans: . -@prefix paralex: . -@prefix : .:perfect_rule a morph:Rule ; + +:perfect_rule a morph:Rule ; morph:replacement [ a morph:RegexReplacement ; morph:sourceRegex "^(.*)en$" ; diff --git a/index.md b/index.md index da2388e..e3457d4 100644 --- a/index.md +++ b/index.md @@ -122,7 +122,7 @@ The OntoLex-Morph module aims to represent both traditional dictionary content ( ![Overall structure of the OntoLex-Morph module](OntoLex Morph.drawio.png) -The diagram above follows UML class diagram conventions: boxes are classes (with datatype properties listed as attributes), arrows with a hollow triangle head denote `rdfs:subClassOf`, plain arrows labelled with a property name denote object properties from domain to range, and the diamond on `consistsOf` marks that a form consists of morphs. Grey boxes and grey labels are classes and properties defined outside this module, in the OntoLex core and the Variation and Translation module; all other classes are defined by the Morph module. +The diagram above follows UML class diagram conventions: boxes are classes (with datatype properties listed as attributes), arrows with a hollow triangle head denote [subclass](https://www.w3.org/TR/rdf-schema/#ch_subclassof) relations, plain arrows labelled with a property name denote object properties from domain to range, and the diamond on [=consists of=] marks that a form consists of morphs. Grey boxes and grey labels are classes and properties defined outside this module, in the OntoLex core and the Variation and Translation module; all other classes are defined by the Morph module. OntoLex-Morph is an extension of the OntoLex model designed to represent morphological processes—such as inflection, derivation, and compounding—across languages, supporting both structural and semantic aspects of morphemes, rules, and grammatical constraints. It enables the formalization of morphological data from various sources, facilitates interoperability between computational morphologies, and supports use cases like generating linguistic labels for ontologies or modelling morphology as a knowledge graph. Central to the model are three classes—morph, rule, and grammatical meaning—which interact to describe how base forms are transformed into surface forms while capturing their morphosyntactic and semantic features. @@ -145,11 +145,12 @@ The following namespace prefixes are used throughout this document, including in @prefix skos: . @prefix lexinfo: . @prefix paralex: . +@prefix : . ``` `morph:` is the namespace defined by this module. `ontolex:` and `vartrans:` are namespaces of the OntoLex-Lemon core model and its variation & translation module, which this module extends. `rdf:`, `rdfs:`, `owl:` and `xsd:` are standard W3C namespaces used throughout. `skos:`, `lexinfo:` and `paralex:` are external vocabularies used in the examples to represent grammatical meanings and concepts. -In addition, examples use the prefix `:` bound to `http://www.example.com/#` for illustrative data that is not part of any of the above namespaces. +The empty prefix `:` is used in the examples for illustrative data that is not part of any of the above namespaces. Other namespaces are declared in the example that uses them. @@ -196,7 +197,7 @@ The property [=consists of=] relates a form with the morphs from which it is con
-consists of +Consists of
Consists of states into which morph resources a form resource can be segmented. @@ -215,7 +216,7 @@ While it might seem counterintuitive that forms Here is a simple example of a segmentation of the English plural form *cats*: -