# Ontology Use Patterns Repository Notes
Author: James A. Overton, 2021-04-09
Audience: Jonathan Bona, Mathias Brochhausen, Joseph Utecht
## Context
I could use something like this:
- OBO now has pretty good coverage for domains and terms
- we're working on improved ontology quality and interoperability
- we're working on a shared upper level in COB
- we're not so good on instance data
- the next big thing is shared modelling
It has to be open:
open source code,
open content license,
open to contributions.
It has to be reliable.
It does not have to be OBO-specific.
It's your idea and you get the credit for it.
But if you guys don't want to build or maintain
this patterns repository thing,
then I'll build it myself.
I'd prefer to collaborate.
It's always faster to build a quick prototype yourself,
but in the long run you get more done together.
I don't want to chase funding for this.
My proposal will not require any maintenance costs.
You can chase funding for the content, or other improvements.
I don't care about publications but I would pitch in a little.
## Overview
- Ontology *Use* Patterns
- not quite the same as Ontology Design Patterns
- I have an intuition for the distinction
but I can't draw a sharp line
- more about instance than classes
- tables, Turtle, RDF, SPARQL
- core example for me: quantitative measurements
- reading the paper
- an RDF representation is fine, but it should be secondary not primary
- I understand the temptation to do everything in triples,
but I think it's a mistake:
RDF is good for general data exchange,
but it's not good for authoring any specific sort of data
- the point is to document patterns, so use documentation tools
- purl.org is probably fine,
but # is problematic for the static server approach that I propose
- how are diagrams represented?
- fully automatic diagrams are never great
- use QNames/CURIEs, or better yet labels
## Connections
In my mind, these are related ideas:
- RDF pattern languages: ShEX, ShACL
- OWL templates, DOS-DP, ROBOT
- their intersection in LinkML? <https://linkml.github.io>
Not exactly related,
but it reminds me of <https://www.protocols.io>.
The proposal below is based on experience with:
- the OBO registry and PURL config system
- executable documentation for ROBOT, cob-data-demo
- recent push for standardized OBO documentation
- years of working with non-technical users
- long experience of not having funding for stuff
## How I Would Do It
- GitHub repo
- you get hosting, access control, issues, basic CI, etc.
- pretty clear off ramps
- static site hosting
- GitHub Pages, Jekyll
- GitHub Actions
- Mkdocs or something
- optional client-side scripting
- some sort of PURLs
- don't get locked into GitHub URLs
- some sort of stable ID policy
- purl.org is find, or pay for a domain, or use OBO or w3id or identifiers
- YAMLdown files
- metadata: title, author (ORCID), date, schema version
- this can be YAML-LD
- versioning
- development status
- obsoletion
- replacement
- usage?
- links to ontologies and terms?
- description
- discussion
- diagrams
- SVGBob <https://ivanceras.github.io/svgbob-editor/>
- Graphviz
- draw.io
- examples: interactive?
- tables: editable
- RDF: Turtle, JSON-LD
- SPARQL: editable, result table
- RDFTab?
- templates
- ROBOT
- DOS-DP ?
- VALVE
- validation
- ShEX/ShACL
- LinkML
- integration test suite
- run on GitHub Actions
- check YAML metadata against JSON-Schema
- check Markdown content
- basic formatting
- required elements
- execute examples
- build RDF
- run SPARQL
- compare expected vs actual output
- build system
- tasks
- run tests
- generate HTML+RDFa
- generate images
- generate ShEX
- build templates
- convert to RDF
- tools
- Make
- Pandoc
- SVGBob
- ROBOT
- DROID
- editing interface
# 2021-04-23
Main decision: we don't have to commit to a template language yet.
Technical options:
- current RDF examples
- SPARQL CONSTRUCT
- ROBOT templates
- DOS-DP
- LinkML
- OTTR
What's the most generic solution?
AI James: just draft the prototype
AI Mathias: ask some questions about OTTR
## 2021-04-24
### Maternal history of opioid use
- namespaces: rdf rdfs xsd owl oio ex some draw
- ontologies: ERO IAO NCBITaxon OGMS PATO RO OBI
This pattern represents a maternal history of opioid use for the participant under investigation.
This patterns uses these terms:
id | label | type
---|---|---
ERO:0002043 | parent relationship | class
IAO:0000136 | is about | object property
IAO:0000142 | mentions | object property
NCBITaxon:9606 | human | class
OBI:0000097 | participant under investigation role | class
OGMS:0000015 | clinical history | class
PATO:0000383 | gender | class
RO:0000053 | bearer of | object property
some:clinicalHistory1 | clinical history 1 | clinial history
some:gender1 | gender 1 | female
some:opioidUse1 | opioid use 1 | opioid use
some:participant1 | participant 1 | participant under investigation role
some:person1 | person 1 | human
some:person2 | person 2 | human
ex:opioiduse | opioid use | class
rdf:type | has type | property
If we know that person 1 has a maternal history of opioid use, then we know that:
- person 1 has a participant under investigation role
- person 1 has a mother (person 2): a parent who is female
- there is a clinical history about opioid use that mentions person 2
subject | predicate | object
---|---|---
person 1 | is bearer of | participant 1
person 2 | parent relationship | person 1
person 2 | is bearer of | female
clinical history 1 | is about | opioid use 1
clinical history 1 | mentions | person 2
Draw the nodes in this grid
(the primary rendering can hide this table):
grid | 2 | 3
---|---|---
opioid use 1 | gender 1 | participant 1
clinical history 1 | person 2 | person 1
Override the drawing as follows
(the primary rendering can hide this table):
subject | draw | object
---|---|---
participant under investigation role | label | participant under<BR/>investigation role
```graphviz
digraph {
node [shape=plaintext fontname=Arial];
edge [fontname=Arial]
subgraph {
rank=same
"-1,1" [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="black"><FONT COLOR="white"> opioid use </FONT></TD></TR>
<TR><TD> opioid use 1 </TD></TR>
</TABLE>>]
"0,1" [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#929222"><FONT COLOR="white"> female </FONT></TD></TR>
<TR><TD> gender 1 </TD></TR>
</TABLE>>]
"1,1" [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#229922"><FONT COLOR="white"> participant under <BR/> investigation role </FONT></TD></TR>
<TR><TD> participant 1 </TD></TR>
</TABLE>>]
}
subgraph {
rank=same
"-1,0" [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#222299"><FONT COLOR="white"> clinical history </FONT></TD></TR>
<TR><TD> clinical history 1 </TD></TR>
</TABLE>>]
"0,0" [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#992222"><FONT COLOR="white"> Homo sapiens </FONT></TD></TR>
<TR><TD> person 2 </TD></TR>
</TABLE>>]
"1,0" [href="http://www.example.com" label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#992222"><FONT COLOR="white"> Homo sapiens </FONT></TD></TR>
<TR><TD> person 1 </TD></TR>
</TABLE>>]
}
// Rows
"-1,1" -> "-1,0" [label=" is about " dir=back]
"-1,0" -> "0,0" [label=" mentions " color="#992222"]
"0,1" -> "0,0" [label=" bearer of" color="#929222" dir=back]
"0,0" -> "1,0" [label=" is parent of "]
"1,1" -> "1,0" [label=" bearer of " color="#929222" dir=back]
//"1,0" -> "-1,1" [constraint=false label="example "]
}
```
### Insulin Measurement
<https://github.com/obi-ontology/obi/issues/1318>
A | B | C | D | E
---|---|---|---|--
blood vessel | | diameter | | diabetic retinopathy
blood | insulin concentration mesurement assay | insulin concentration measurement data item | | pulmonary artery vasoconstriction
insulin | | signalling receptor activity | kinase activity | vasoconstriction