summaryrefslogtreecommitdiff
path: root/data/ontology
diff options
context:
space:
mode:
Diffstat (limited to 'data/ontology')
-rw-r--r--data/ontology/bibliography.osxml42
-rw-r--r--data/ontology/book.osxml34
-rw-r--r--data/ontology/comments.osxml40
-rw-r--r--data/ontology/headings.osxml33
-rw-r--r--data/ontology/lists.osxml26
-rw-r--r--data/ontology/meta.osxml50
6 files changed, 225 insertions, 0 deletions
diff --git a/data/ontology/bibliography.osxml b/data/ontology/bibliography.osxml
new file mode 100644
index 0000000..e133a2b
--- /dev/null
+++ b/data/ontology/bibliography.osxml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<ontology name="bibliography">
+
+ <import rel="ontology" src="book"/>
+ <import rel="ontology" src="meta"/>
+
+ <struct name="bibliography" transparent="true">
+ <field>
+ <childRef ref="bibEntry"/>
+ </field>
+ <parentRef ref="book">
+ <field name="bibliography" isSubtree="true"/>
+ </parentRef>
+ </struct>
+ <struct name="bibEntry">
+ <field>
+ <childRef ref="meta.authors"/>
+ <childRef ref="title"/>
+ <childRef ref="year"/>
+ <childRef ref="journal"/>
+ <childRef ref="pages"/>
+ <childRef ref="location"/>
+ </field>
+ </struct>
+ <struct name="title" cardinality="{1}">
+ <primitive type="string"/>
+ </struct>
+ <struct name="year" cardinality="{1}">
+ <primitive type="int"/>
+ </struct>
+ <struct name="journal" cardinality="{0-1}">
+ <!-- here some kind of database reference would be better -->
+ <primitive type="string"/>
+ </struct>
+ <struct name="pages" cardinality="{0-1}">
+ <primitive type="cardinality"/>
+ </struct>
+ <struct name="location" cardinality="{0-1}">
+ <!-- here some kind of database reference would be better -->
+ <primitive type="string"/>
+ </struct>
+</ontology>
diff --git a/data/ontology/book.osxml b/data/ontology/book.osxml
new file mode 100644
index 0000000..41dc788
--- /dev/null
+++ b/data/ontology/book.osxml
@@ -0,0 +1,34 @@
+<?xml version="1.0" standalone="yes"?>
+<ontology name="book">
+ <struct name="book" cardinality="{1}" isRoot="true">
+ <field>
+ <childRef ref="book.chapter"/>
+ <childRef ref="book.paragraph"/>
+ </field>
+ </struct>
+ <struct name="chapter">
+ <field>
+ <childRef ref="book.section"/>
+ <childRef ref="book.paragraph"/>
+ </field>
+ </struct>
+ <struct name="section">
+ <field>
+ <childRef ref="book.subsection"/>
+ <childRef ref="book.paragraph"/>
+ </field>
+ </struct>
+ <struct name="subsection">
+ <field>
+ <childRef ref="book.paragraph"/>
+ </field>
+ </struct>
+ <struct name="paragraph" transparent="true">
+ <field>
+ <childRef ref="book.text"/>
+ </field>
+ </struct>
+ <struct name="text" transparent="true">
+ <primitive type="string"/>
+ </struct>
+</ontology>
diff --git a/data/ontology/comments.osxml b/data/ontology/comments.osxml
new file mode 100644
index 0000000..621fe1c
--- /dev/null
+++ b/data/ontology/comments.osxml
@@ -0,0 +1,40 @@
+<?xml version="1.0" standalone="yes"?>
+<ontology name="comments">
+ <import rel="ontology" src="book"/>
+
+ <!-- an annotation comment -->
+ <annotation name="comment">
+ <field name="replies" isSubtree="true">
+ <childRef ref="reply"/>
+ </field>
+ <field name="content">
+ <childRef ref="book.paragraph"/>
+ </field>
+ </annotation>
+
+ <!-- an point-like structure comment. -->
+ <struct name="comment">
+ <!-- Is there a chance to prevent users from having to redefine these
+ two fields in comment and reply? Could we use a fieldRef here?
+ Or would that be circular? -->
+ <field name="replies" isSubtree="true">
+ <childRef ref="reply"/>
+ </field>
+ <field name="content">
+ <childRef ref="book.paragraph"/>
+ </field>
+ <parentRef ref="book.paragraph">
+ <fieldRef ref="$default"/>
+ </parentRef>
+ </struct>
+ <!-- note that replies are organized in a tree fashion: One can also reply
+ to a reply -->
+ <struct name="reply">
+ <field name="replies" isSubtree="true">
+ <childRef ref="reply"/>
+ </field>
+ <field name="content">
+ <childRef ref="book.paragraph"/>
+ </field>
+ </struct>
+</ontology>
diff --git a/data/ontology/headings.osxml b/data/ontology/headings.osxml
new file mode 100644
index 0000000..1319306
--- /dev/null
+++ b/data/ontology/headings.osxml
@@ -0,0 +1,33 @@
+<?xml version="1.0" standalone="yes"?>
+<ontology name="headings">
+
+ <import rel="ontology" src="book"/>
+
+ <struct name="heading" cardinality="1" transparent="true">
+ <!-- The parent mechanism is a curious thing. Remind yourself
+ that parent-child-relationship in this sense are mediated
+ by fields. So we must either reference a field that is
+ already there or declare a new one on the fly. -->
+ <parentRef ref="book.book">
+ <field name="heading" isSubtree="true" optional="true"/>
+ </parentRef>
+ <parentRef ref="book.chapter">
+ <field name="heading" isSubtree="true" optional="true"/>
+ </parentRef>
+ <parentRef ref="book.section">
+ <field name="heading" isSubtree="true" optional="true"/>
+ </parentRef>
+ <parentRef ref="book.subsection">
+ <field name="heading" isSubtree="true" optional="true"/>
+ </parentRef>
+ <parentRef ref="book.paragraph">
+ <field name="heading" isSubtree="true" optional="true"/>
+ </parentRef>
+ <!-- regarding its fields we have a problem here. We do not want to
+ declare a new field, because in fact we want to allow every
+ bit of content that a paragraph would allow - also considering
+ possible extensions of paragraph by other ontologys.
+ So we need to reference the default field of paragraph. -->
+ <fieldRef ref="book.paragraph.$default"/>
+ </struct>
+</ontology>
diff --git a/data/ontology/lists.osxml b/data/ontology/lists.osxml
new file mode 100644
index 0000000..a177cd4
--- /dev/null
+++ b/data/ontology/lists.osxml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<ontology name="lists">
+ <import rel="ontology" src="book"/>
+
+ <struct name="ul" isa="book.paragraph">
+ <!-- Here we solve the problem of parents using the isa
+ mechanism, because a list may occur whereever a paragraph
+ may occur. However we do want to override the default field. -->
+ <field>
+ <childRef name="item"/>
+ </field>
+ </struct>
+ <struct name="ol" isa="book.paragraph">
+ <!-- Here we solve the problem of parents using the isa
+ mechanism, because a list may occur whereever a paragraph
+ may occur. However we do want to override the default field. -->
+ <field>
+ <childRef name="item"/>
+ </field>
+ </struct>
+ <struct name="item">
+ <field>
+ <childRef name="book.paragaph"/>
+ </field>
+ </struct>
+</ontology>
diff --git a/data/ontology/meta.osxml b/data/ontology/meta.osxml
new file mode 100644
index 0000000..6b25305
--- /dev/null
+++ b/data/ontology/meta.osxml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<ontology name="meta">
+
+ <import rel="typesystem" src="affiliation"/>
+ <import rel="typesystem" src="email"/>
+ <import rel="typesystem" src="version"/>
+ <import rel="ontology" src="book"/>
+ <import rel="ontology" src="headings"/>
+
+ <struct name="meta" cardinality="{1}" transparent="true">
+ <field>
+ <childRef ref="authors"/>
+ <childRef ref="version"/>
+ </field>
+ <parentRef ref="book">
+ <field name="meta" isSubtree="true" optional="true"/>
+ </parentRef>
+ <parentRef ref="chapter">
+ <field name="meta" isSubtree="true" optional="true"/>
+ </parentRef>
+ <!-- One could also include "article" and other things here -->
+ </struct>
+
+ <struct name="person">
+ <primitive isSubtree="true" name="firstName" type="string"/>
+ <primitive isSubtree="true" name="secondNames" type="string[]" optional="true"/>
+ <primitive isSubtree="true" name="lastName" type="string"/>
+ <primitive isSubtree="true" name="email" type="email" optional="true"/>
+ <primitive isSubtree="true" name="affiliation" type="affiliation" optional="true"/>
+ </struct>
+
+ <!-- wrapper author tag to allow specifying no authors whatsoever. But if
+ an author is specified it has to be at least one primary author. -->
+ <struct name="authors" transparent="true" cardinality="{0-1}">
+ <field>
+ <childRef ref="author"/>
+ </field>
+ </struct>
+
+ <!-- no explicit cardinality, because we might have multiple authors -->
+ <struct name="author" isa="person"/>
+
+ <!-- but we need at least one primary author -->
+ <struct name="primaryAuthor" cardinality="{>0}" isa="author"/>
+
+ <!-- version intermediate struct -->
+ <struct name="version" cardinality="{0-1}">
+ <primitive type="version"/>
+ </struct>
+</ontology>