From c6c15f452bc15d1a9a2bc78bebd831597b6cd403 Mon Sep 17 00:00:00 2001 From: Stephan Heunis Date: Tue, 21 Nov 2023 17:49:28 +0100 Subject: [PATCH] Ontology starting point --- .github/workflows/docbuild.yml | 67 ++++++++++++++++++++++++++++++++++ .gitignore | 4 ++ LICENSE | 24 ++++++++++++ Makefile | 39 ++++++++++++++++++++ README.md | 25 +++++++++++++ mkdocs.yml | 17 +++++++++ requirements.txt | 4 ++ src/extra-docs/about.md | 0 src/linkml/classes/author.yaml | 41 +++++++++++++++++++++ src/linkml/enums/.gitkeep | 0 src/linkml/root.yaml | 12 ++++++ src/linkml/slots/.gitkeep | 0 src/linkml/types/.gitkeep | 0 13 files changed, 233 insertions(+) create mode 100644 .github/workflows/docbuild.yml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 mkdocs.yml create mode 100644 requirements.txt create mode 100644 src/extra-docs/about.md create mode 100644 src/linkml/classes/author.yaml create mode 100644 src/linkml/enums/.gitkeep create mode 100644 src/linkml/root.yaml create mode 100644 src/linkml/slots/.gitkeep create mode 100644 src/linkml/types/.gitkeep diff --git a/.github/workflows/docbuild.yml b/.github/workflows/docbuild.yml new file mode 100644 index 0000000..766fe70 --- /dev/null +++ b/.github/workflows/docbuild.yml @@ -0,0 +1,67 @@ +name: Build and deploy docs + +on: + push: + branches: + - main + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Pages + id: pages + uses: actions/configure-pages@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Build + # this is building a branch specific site + # when multiple branches/versions are maintained concurrently + # we likely need to build all of them and do a joint upload + run: | + #mkdir -p ./build/upload + #export "SITEDIR=./build/upload/$(git branch --show-current)" + #export "SITEURL=https://concepts.datalad.org/$(git branch --show-current)" + make mkdocs-site + make build/context.jsonld + #mv ./build/mkdocs-site $SITEDIR + mv ./build/mkdocs-site ./build/upload + mv ./build/context.jsonld ./build/upload/ + + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + # Upload the directory created by mkdocs + path: ./build/upload + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..708362d --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# Generated +build/ +*-stamp +.*.swp diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d835653 --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +All contained works, including all examples, and attached +documentation are covered by the MIT license. + + The MIT License + + Copyright (c) 2023- DataLad Team + + 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. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..acd675d --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +all: mkdocs-site build/context.jsonld + +build/context.jsonld: src/linkml/root.yaml + mkdir -p build + gen-jsonld-context \ + --prefixes \ + --model \ + --mergeimports \ + $< > $@ + +linkml-docs: linkml-docs-stamp +linkml-docs-stamp: + gen-doc \ + --mergeimports \ + --hierarchical-class-view \ + --use-slot-uris \ + --include-top-level-diagram \ + --diagram-type er_diagram \ + --metadata \ + --format markdown \ + -d build/linkml-docs \ + src/linkml/root.yaml + touch $@ + +extra-docs: extra-docs-stamp +extra-docs-stamp: + mkdir -p build/linkml-docs + cp -r src/extra-docs/* build/linkml-docs + +mkdocs-site: mkdocs-site-stamp +mkdocs-site-stamp: linkml-docs extra-docs + mkdocs build + touch $@ + +clean: + rm -rf build + rm -f *-stamp + +.PHONY: clean linkml-docs extra-docs mkdocs-site diff --git a/README.md b/README.md new file mode 100644 index 0000000..0b56a66 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# DataLad Concept Ontology + +_WORK IN PROGRESS_ + +https://concepts.datalad.org + +## How to... + +Install (in a virtualenv) + +``` +pip install -r requirements.txt +``` + +Build docs: + +``` +make +``` + +Serve docs locally + +``` +mkdocs serve +``` diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..c637456 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,17 @@ +copyright: +docs_dir: build/linkml-docs +nav: + - Home: index.md + - About: about.md +plugins: + - mermaid2 +repo_url: https://github.com/psychoinformatics-de/datalad-concepts +site_author: +site_description: +site_dir: build/mkdocs-site +site_name: DataLad Concepts Ontology (DLCO) +site_url: !ENV [SITEURL, 'https://concepts.datalad.org'] +strict: true +theme: + name: gitbook + locale: en diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..20847b6 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +linkml +mkdocs +mkdocs-gitbook +mkdocs-mermaid2-plugin diff --git a/src/extra-docs/about.md b/src/extra-docs/about.md new file mode 100644 index 0000000..e69de29 diff --git a/src/linkml/classes/author.yaml b/src/linkml/classes/author.yaml new file mode 100644 index 0000000..507b6f5 --- /dev/null +++ b/src/linkml/classes/author.yaml @@ -0,0 +1,41 @@ +id: https://concepts.datalad.org/Author +name: Author + +prefixes: + linkml: https://w3id.org/linkml/ + obo: https://purl.obolibrary.org/obo/ + schema: http://schema.org/ +default_range: string + +imports: + - linkml:types + +classes: + Author: + class_uri: schema:Person + description: >- + An author of the Dataset or of a Publication linked to the + Dataset. + attributes: + affiliation: + slot_uri: schema:affiliation + required: false + description: >- + The author's affiliation to a group, institution, or + employer. + email: + slot_uri: schema:email + required: false + description: >- + The author's email address. + name: + slot_uri: schema:name + required: true + description: >- + The author's name in the format . + orcid: + slot_uri: obo:IAO_0000708 + required: false + description: >- + The path of the file relative to the root of the Dataset, + provided in the POSIX format. diff --git a/src/linkml/enums/.gitkeep b/src/linkml/enums/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/linkml/root.yaml b/src/linkml/root.yaml new file mode 100644 index 0000000..c7a3cf8 --- /dev/null +++ b/src/linkml/root.yaml @@ -0,0 +1,12 @@ +id: https://concepts.datalad.org +name: datalad-concepts-ontology +title: DataLad Concepts Ontology (DLCO) +description: |- + [DataLad Concepts Ontology](https://concepts.datalad.org) (DLCO) +license: MIT + +prefixes: + linkml: https://w3id.org/linkml/ + +imports: + - classes/author diff --git a/src/linkml/slots/.gitkeep b/src/linkml/slots/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/linkml/types/.gitkeep b/src/linkml/types/.gitkeep new file mode 100644 index 0000000..e69de29