Skip to content

Commit

Permalink
feat (modl): Very first initial use of LinkML! (see enola-dev#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
vorburger committed Jun 28, 2024
1 parent c8c7d98 commit 93d6f93
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@
"yaml.schemas": {
// https://squidfunk.github.io/mkdocs-material/creating-your-site/#configuration
"https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yaml",

// TODO https://github.com/linkml/linkml/issues/2179
"https://raw.githubusercontent.com/linkml/linkml-model/main/linkml_model/jsonschema/meta.schema.json": "*.linkml.yaml",

// Keep this in sync with check-jsonschema in .pre-commit-config.yaml
"docs/models/enola/schemas/Thing.schema.json": "*.thing.yaml"
},
Expand Down
27 changes: 27 additions & 0 deletions models/.linkmllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2024 The Enola <https://enola.dev> Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# https://linkml.io/linkml/schemas/linter.html
extends: recommended

rules:
# TODO https://github.com/linkml/prefixmaps/issues/73
canonical_prefixes:
level: disabled

no_empty_title:
# name becomes title, if no title; that's fine
level: disabled
4 changes: 4 additions & 0 deletions models/build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ find models/ -type d -exec mkdir -p docs/{} \;
find models/ -type f -exec ln -f {} docs/{} \;
rm docs/models/{BUILD,build.bash}

# https://linkml.io
find docs/models/ -name "*.linkml.yaml" -print0 | xargs -n 1 -0 linkml-lint --validate --config models/.linkmllint.yaml
find docs/models/ -name "*.linkml.yaml" -print0 | xargs -n 1 -0 gen-project -d docs/models

./enola -vvv docgen --load=file:"docs/models/**.{ttl,owl,rdf}" --output=file://"$PWD"/docs/models/

# TODO Support GLOBs in rosetta like in docgen? (Low priority, because DocGen will gen. embedded JSON-LD anyway.)
Expand Down
63 changes: 63 additions & 0 deletions models/enola.dev/enola.linkml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2024 The Enola <https://enola.dev> Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

id: https://enola.dev/ontology
name: Enola
created_by: https://www.vorburger.ch
license: ASL

# TODO Shouldn't (can't) [all] slot_uri be automatically inferred?!

types:
GKG:
description:
ID in Google's Public Knowledge Graph (formerly AKA Freebase), see e.g.
https://developers.google.com/knowledge-graph/; starts without slash, but with 'm' or 'g' following by a slash and
lower case characters, numbers and underscores.
examples:
- value: g/11bwcf511s
description: Alphabet Inc.
object: https://g.co/kg/g/11bwcf511s

slots:
url:
description:
URL of this Thing (to be typed into a web browser, for a human to look at HTML). Not to be confused with each
Thing's IRI Identity!
range: schema:URL

wikipedia:
description: Wikipedia EN page ID (not URL), e.g. 'Wikipedia' (for https://en.wikipedia.org/wiki/Wikipedia)
slot_uri: https://enola.dev/wikipedia
pattern: "^[a-zA-Z0-9_]+$"
# TODO How-to? schema:image <https://upload.wikimedia.org/wikipedia/commons/8/80/Wikipedia-logo-v2.svg>
# TODO How-to? schema:url "https://en.wikipedia.org/wiki/{VALUE}"^^enola:IRITemplate
# for https://docs.enola.dev/models/example.org/templates/

classes:
Software:
description:
Parent (abstract) Class for 'soft ware', i.e. 'virtual computer stuff' - you can think of but cannot physically
touch this.
# TODO enola:wikipedia "Software". # https://en.wikipedia.org/wiki/Software

SoftwareWithURL:
subclass_of: Software
description:
Parent (abstract) Class for a piece of [[Software]] which has a URL that you can type into a web browser to look
at (the UI of) it.
slots:
- url
54 changes: 54 additions & 0 deletions models/enola.dev/files.linkml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2024 The Enola <https://enola.dev> Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

id: https://enola.dev/Files
name: Files
imports:
- enola.linkml
prefixes:
schema: https://schema.org/

slots:
# TODO Are names adjusted in generation? https://linkml.io/linkml/schemas/linter.html#standard-naming
parent_folder:
description: Parent Folder which this File or Folder is in.
subproperty_of: parent
range: Folder

classes:
File:
description: File holds [[Data]], identified by a [[Path]] on a [[Filesystem]], with a [[MediaType]].
subclass_of: SoftwareWithURL
slots:
- parentFolder
attributes:
size:
description: Number of bytes of data.
range: xsd:unsignedLong
examples:
- value: https://enola.dev/file/localhost/tmp/example.txt
# TODO enola:iriTemplate "https://enola.dev/file/{FILESYSTEM}/{PATH}";
# TODO enola:filesystem "fs:{FILESYSTEM}"^^enola:IRITemplate;
# TODO enola:wikipedia "Computer_file"; # https://en.wikipedia.org/wiki/Computer_file
# TODO enola:emoji "πŸ—Ž".

Folder:
description: Folder is a [[Container]] of other Folders and [[File]]s.
subclass_of: SoftwareWithURL
slots:
- parentFolder
# TODO enola:wikipedia "Directory_(computing)"; # https://en.wikipedia.org/wiki/Directory_(computing)
# TODO enola:emoji "πŸ“".
7 changes: 5 additions & 2 deletions models/enola.dev/files.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ enola:fileOntology a owl:Ontology;
rdfs:label "An Ontology by Enola.dev about Files on Computers.".

enola:File a rdfs:Class;
rdfs:comment "File holds [[Data]], identified by a [[Path]] on a [[Filesystem]], with a [[MediaType]].";
rdfs:isDefinedBy enola:fileOntology;
rdfs:subClassOf enola:SoftwareWithURL;
enola:example <https://enola.dev/file/localhost/tmp/example.txt>;
Expand All @@ -36,6 +37,7 @@ enola:File a rdfs:Class;
enola:emoji "πŸ—Ž".

enola:Folder a rdfs:Class;
rdfs:comment "Folder is a [[Container]] of other Folders and [[File]]s";
rdfs:subClassOf enola:SoftwareWithURL;
enola:wikipedia "Directory_(computing)"; # https://en.wikipedia.org/wiki/Directory_(computing)
enola:emoji "πŸ“".
Expand All @@ -61,8 +63,9 @@ enola:path a rdf:Property;
rdfs:domain enola:File.

enola:size a rdf:Property;
rdfs:range xsd:unsignedLong; # TODO Use a Datatype which permits KiB/MB etc. (from UoM?)
rdfs:domain enola:File.
rdfs:comment "Number of bytes of data.";
rdfs:range xsd:unsignedLong; # TODO Use a Datatype which permits KiB/MB etc. (from UoM?)
rdfs:domain enola:File.

enola:MediaType a rdfs:Datatype;
rdfs:comment "Internet Media Type, also known as a MIME Type or Content Type.";
Expand Down

0 comments on commit 93d6f93

Please sign in to comment.