summaryrefslogtreecommitdiff
path: root/testdata/osxmlparser
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-02-15 22:55:04 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-02-15 22:55:04 +0100
commitc566d4efb57b697159f88d3bcfb7170bc7699fb0 (patch)
treeead8ef3f06495744302f815f8590131fcfe52737 /testdata/osxmlparser
parentfabb174fd15d129e6b8d668cd3d621b0b9481c4f (diff)
Moved testdata path
Diffstat (limited to 'testdata/osxmlparser')
-rw-r--r--testdata/osxmlparser/affiliation.osxml10
-rw-r--r--testdata/osxmlparser/bibliography_domain.osxml26
-rw-r--r--testdata/osxmlparser/book_domain.osxml98
-rw-r--r--testdata/osxmlparser/color.osxml18
-rw-r--r--testdata/osxmlparser/comments_domain.osxml40
-rw-r--r--testdata/osxmlparser/complex_book.osxml106
-rw-r--r--testdata/osxmlparser/email.osxml8
-rw-r--r--testdata/osxmlparser/generic.osxml37
-rw-r--r--testdata/osxmlparser/headings_domain.osxml33
-rw-r--r--testdata/osxmlparser/lists_domain.osxml26
-rw-r--r--testdata/osxmlparser/meta_domain.osxml35
-rw-r--r--testdata/osxmlparser/mismatchedTag.osxml3
-rw-r--r--testdata/osxmlparser/simple_book.osxml18
-rw-r--r--testdata/osxmlparser/test.osxml15
-rw-r--r--testdata/osxmlparser/version.osxml8
15 files changed, 481 insertions, 0 deletions
diff --git a/testdata/osxmlparser/affiliation.osxml b/testdata/osxmlparser/affiliation.osxml
new file mode 100644
index 0000000..d84dc30
--- /dev/null
+++ b/testdata/osxmlparser/affiliation.osxml
@@ -0,0 +1,10 @@
+<?xml version="1.0" standalone="yes"?>
+<typesystem name="affiliation">
+ <struct name="affiliation">
+ <field name="workgroup" type="string"/>
+ <field name="departement" type="string"/>
+ <field name="institution" type="string"/>
+ </struct>
+
+ <constant name="citec.sc" type="affiliation" value="[workgroup=Semantic Computing Group,departement=Center of Excellence Cognitive Interaction Technology (CITEC), institution=Bielefeld University]"/>
+</typesystem>
diff --git a/testdata/osxmlparser/bibliography_domain.osxml b/testdata/osxmlparser/bibliography_domain.osxml
new file mode 100644
index 0000000..6418c61
--- /dev/null
+++ b/testdata/osxmlparser/bibliography_domain.osxml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<domain name="bibliography">
+
+ <import rel="domain" src="./book_domain.osxml"/>
+ <import rel="domain" src="./meta_domain.osxml"/>
+
+ <struct name="bibliography" transparent="true">
+ <field>
+ <childRef ref="bibEntry"/>
+ </field>
+ <parentRef ref="book">
+ <field name="bibliography" isSubtree="true"/>
+ </parentRef>
+ </struct>
+ <struct name="bibEntry">
+ <field name="authors" optional="true">
+ <childRef ref="meta.author"/>
+ </field>
+ <primitive name="name" type="string" isSubtree="true"/>
+ <primitive name="year" type="int" isSubtree="true"/>
+ <primitive name="journal" type="string" isSubtree="true" optional="true"/>
+ <primitive name="pages" type="cardinality" isSubtree="true" optional="true"/>
+ <!-- Here a geographical enum or something would be more exact -->
+ <primitive name="location" type="string" isSubtree="true" optional="true"/>
+ </struct>
+</domain>
diff --git a/testdata/osxmlparser/book_domain.osxml b/testdata/osxmlparser/book_domain.osxml
new file mode 100644
index 0000000..4218915
--- /dev/null
+++ b/testdata/osxmlparser/book_domain.osxml
@@ -0,0 +1,98 @@
+<?xml version="1.0" standalone="yes"?>
+<!-- The domain node is the root node of a single domain definition -->
+<domain name="book">
+ <!-- We start by declaring the structured classes. This implicitly defines
+ a context free grammar, which specifies the language of documents that
+ may be constructed using this domain. Note that this grammar may be
+ influenced by other domains depending on this one. -->
+ <!-- Note that we specify neither attributes,
+ nor parent, nor transparency, meaning that we refer to the default
+ values. Also note that we need to specify explicitly, which classes
+ are allowed as root nodes. -->
+ <struct name="book" cardinality="{1}" isRoot="true">
+ <!-- implicitly:
+ <struct name="book" cardinality="{1}" isRoot="true"
+ transparent="false" isa="" attributesDescriptor="">
+ -->
+ <!-- Note that we assume that, if not specified, a
+ field is assumed to have no name, be of type TREE
+ and not optional. -->
+ <field>
+ <!-- implicitly:
+ <field name="" isSubtree="false" optional="false">
+ -->
+ <!-- Using such child references might be problematic if
+ multiple nodes are matched. This should probably
+ result in an exception.
+ Also note that we only reference the child classes.
+ We do _not_ declare them here. This might lead to
+ some difficulties in the parsing process as I
+ effectively use forward declarations here. So the
+ resolve() process may only be started _after_ all
+ delcarations are read. -->
+ <childRef ref="book.chapter"/>
+ <!-- The dot notation as path separator might be changed
+ but I think it to be intuitive. If we want a more
+ CSS like style we can use whitespaces here. -->
+ <childRef ref="book.paragraph"/>
+ </field>
+ </struct>
+ <struct name="chapter">
+ <!-- implicitly:
+ <struct name="chapter" isRoot="false" cardinality="{*}"
+ transparent="false" isa="" attributesDescriptor="">
+ -->
+ <field>
+ <!-- implicitly:
+ <field name="" isSubtree="false" optional="false">
+ -->
+ <childRef ref="book.section"/>
+ <childRef ref="book.paragraph"/>
+ </field>
+ </struct>
+ <struct name="section">
+ <!-- implicitly:
+ <struct name="section" isRoot="false" cardinality="{*}"
+ transparent="false" isa="" attributesDescriptor="">
+ -->
+ <field>
+ <!-- implicitly:
+ <field name="" isSubtree="false" optional="false">
+ -->
+ <childRef ref="book.subsection"/>
+ <childRef ref="book.paragraph"/>
+ </field>
+ </struct>
+ <struct name="subsection">
+ <!-- implicitly:
+ <struct name="subsection" isRoot="false" cardinality="{*}"
+ transparent="false" isa="" attributesDescriptor="">
+ -->
+ <field>
+ <!-- implicitly:
+ <field name="" isSubtree="false" optional="false">
+ -->
+ <childRef ref="book.paragraph"/>
+ </field>
+ </struct>
+ <struct name="paragraph" transparent="true" role="paragraph">
+ <!-- implicitly:
+ <struct name="subsection" isRoot="false" cardinality="{*}"
+ transparent="true" isa="" attributesDescriptor="">
+ -->
+ <field>
+ <!-- implicitly:
+ <field name="" type="TREE" optional="false">
+ -->
+ <childRef ref="book.text"/>
+ </field>
+ </struct>
+ <struct name="text" transparent="true" role="text">
+ <!-- implicitly:
+ <struct name="text" isRoot="false" cardinality="{*}"
+ transparent="true" isa="" attributesDescriptor="">
+ -->
+ <!-- we might want to specify std.string here -->
+ <primitive type="string"/>
+ </struct>
+</domain>
diff --git a/testdata/osxmlparser/color.osxml b/testdata/osxmlparser/color.osxml
new file mode 100644
index 0000000..17adea4
--- /dev/null
+++ b/testdata/osxmlparser/color.osxml
@@ -0,0 +1,18 @@
+<?xml version="1.0" standalone="yes"?>
+<typesystem name="color">
+ <struct name="color">
+ <field name="r" type="int"/>
+ <field name="g" type="int"/>
+ <field name="b" type="int"/>
+ </struct>
+
+ <constant name="aquamarine1" type="color" value="[127,255,212]"/>
+ <constant name="aquamarine2" type="color" value="[118,238,198]"/>
+ <constant name="aquamarine3" type="color" value="[102,205,170]"/>
+ <constant name="aquamarine" type="color" value="[127,255,212]"/>
+ <constant name="azure1" type="color" value="[240,255,255]"/>
+ <constant name="azure2" type="color" value="[224,238,238]"/>
+ <constant name="azure3" type="color" value="[193,205,205]"/>
+ <constant name="azure4" type="color" value="[131,139,139]"/>
+ <constant name="azure" type="color" value="[240,255,255]"/>
+</typesystem>
diff --git a/testdata/osxmlparser/comments_domain.osxml b/testdata/osxmlparser/comments_domain.osxml
new file mode 100644
index 0000000..dc7742e
--- /dev/null
+++ b/testdata/osxmlparser/comments_domain.osxml
@@ -0,0 +1,40 @@
+<?xml version="1.0" standalone="yes"?>
+<domain name="comments">
+ <import rel="domain" src="./book_domain.osxml"/>
+
+ <!-- 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>
+</domain>
diff --git a/testdata/osxmlparser/complex_book.osxml b/testdata/osxmlparser/complex_book.osxml
new file mode 100644
index 0000000..b610454
--- /dev/null
+++ b/testdata/osxmlparser/complex_book.osxml
@@ -0,0 +1,106 @@
+<?xml version="1.0"?>
+<document>
+
+ <import rel="domain" src="./book_domain.osxml"/>
+ <import rel="domain" src="./headings_domain.osxml"/>
+ <import rel="domain" src="./meta_domain.osxml"/>
+ <import rel="domain" src="./bibliography_domain.osxml"/>
+ <!--<import rel="domain" src="emphasis.oxm"/>
+ <import rel="domain" src="comments.oxm"/>
+ <import rel="domain" src="lists.oxm"/>
+ <alias tag="paragraph" aka="p"/>
+ <alias tag="emphasized" aka="em"/>-->
+
+ <book>
+ <meta>
+ <primaryAuthor>
+ <firstName>Immanuel</firstName>
+ <lastName>Kant</lastName>
+ <email>[ikant,philo.albertus-koenigsberg,de]</email>
+ <affiliation>[Logic and Metaphysics, Faculty of Philosophy, Albertus-University Königsberg]</affiliation>
+ </primaryAuthor>
+ <!-- Using this version tag leads to a very interesting bug:
+ A new transparent meta element gets created for it. Because only
+ one meta tag is allowed this leads to an error. So what to do?
+
+ <version>[1,0,0]</version> -->
+ </meta>
+
+ <heading>
+ Beantwortung der Frage: Was ist Aufklärung?
+ </heading>
+
+ <chapter name="content">
+ <heading>Was ist Aufklärung?</heading>
+
+ Aufklärung ist der Ausgang des Menschen aus seiner
+ selbstverschuldeten Unmündigkeit. Unmündigkeit ist
+ das Unvermögen, sich seines Verstandes ohne Leitung eines anderen zu
+ bedienen. Selbstverschuldet ist diese Unmündigkeit, wenn
+ die Ursache derselben nicht am Mangel des Verstandes, sondern der
+ Entschließung und des Mutes liegt, sich seiner ohne Leitung eines
+ andern zu bedienen.
+ Sapere aude! Habe Mut, dich deines eigenen Verstandes zu
+ bedienen! ist also der Wahlspruch der Aufklärung.
+ </chapter>
+
+ <bibliography>
+ <bibEntry>
+ <name>Dezember-Heft</name>
+ <journal>Berlinische Monatsschrift</journal>
+ <year>1784</year>
+ <pages>{481-494}</pages>
+ </bibEntry>
+ <bibEntry>
+ <name>Kleine Schriften</name>
+ <primaryAuthor>
+ <firstName>Immanuel</firstName>
+ <lastName>Kant</lastName>
+ </primaryAuthor>
+ <year>1793</year>
+ <pages>{34-50}</pages>
+ <location>Neuwied</location>
+ </bibEntry>
+ <bibEntry>
+ <name>Zerstreute Aufsätze</name>
+ <primaryAuthor>
+ <firstName>Immanuel</firstName>
+ <lastName>Kant</lastName>
+ </primaryAuthor>
+ <year>1793</year>
+ <pages>{25-37}</pages>
+ <location>Frankfurt und Leipzig</location>
+ </bibEntry>
+ <bibEntry>
+ <name>Sämmtliche kleine Schriften</name>
+ <primaryAuthor>
+ <firstName>Immanuel</firstName>
+ <lastName>Kant</lastName>
+ </primaryAuthor>
+ <year>1798</year>
+ <pages>{159-172}</pages>
+ <location>Königsberg u. Leipzig</location>
+ </bibEntry>
+ <bibEntry>
+ <name>I. Kant's vermischte Schriften</name>
+ <primaryAuthor>
+ <firstName>Immanuel</firstName>
+ <lastName>Kant</lastName>
+ </primaryAuthor>
+ <year>1799</year>
+ <pages>{687-700}</pages>
+ <location>Halle</location>
+ </bibEntry>
+ <bibEntry>
+ <name>Vorzügliche kleine Schriften und Aufsätze</name>
+ <primaryAuthor>
+ <firstName>Immanuel</firstName>
+ <lastName>Kant</lastName>
+ </primaryAuthor>
+ <year>1833</year>
+ <pages>{75-84}</pages>
+ <location>Leipzig</location>
+ </bibEntry>
+ </bibliography>
+ </book>
+</document>
diff --git a/testdata/osxmlparser/email.osxml b/testdata/osxmlparser/email.osxml
new file mode 100644
index 0000000..325f89a
--- /dev/null
+++ b/testdata/osxmlparser/email.osxml
@@ -0,0 +1,8 @@
+<?xml version="1.0" standalone="yes"?>
+<typesystem name="email">
+ <struct name="email">
+ <field name="local" type="string"/>
+ <field name="domainName" type="string"/>
+ <field name="domainSuffix" type="string"/>
+ </struct>
+</typesystem>
diff --git a/testdata/osxmlparser/generic.osxml b/testdata/osxmlparser/generic.osxml
new file mode 100644
index 0000000..799ed41
--- /dev/null
+++ b/testdata/osxmlparser/generic.osxml
@@ -0,0 +1,37 @@
+<?xml version="1.0" standalone="yes"?>
+<typesystem name="border">
+ <import>./color.osxml</import>
+
+ <enum name="border-style">
+ <entry>none</entry>
+ <entry>dotted</entry>
+ <entry>dashed</entry>
+ <entry>solid</entry>
+ <entry>double</entry>
+ <entry>groove</entry>
+ <entry>ridge</entry>
+ <entry>inset</entry>
+ <entry>outset</entry>
+ </enum>
+
+ <constant name="zero" value="0" type="int" />
+ <constant name="black" value="[zero, zero, zero]" type="color" />
+
+ <struct name="border">
+ <field name="style" type="border-style"/>
+ <field name="color" type="color" default="black" />
+ </struct>
+
+ <constant name="beautifulBorder" type="border" value="[color=aquamarine,style=solid]" />
+ <constant name="moreBeautifulBorder" type="border" value="[dotted, azure]" />
+</typesystem>
+<!--<domain name="color">
+ <struct name="bla" cardinality="{1,2}" isa="blub"/>
+ <struct name="blub" cardinality="{1-3,5,>7}">
+ <fields>
+ <field></field>
+ <primitive type="bla"/>
+ </fields>
+ </struct>
+</domain>-->
+
diff --git a/testdata/osxmlparser/headings_domain.osxml b/testdata/osxmlparser/headings_domain.osxml
new file mode 100644
index 0000000..07d3db2
--- /dev/null
+++ b/testdata/osxmlparser/headings_domain.osxml
@@ -0,0 +1,33 @@
+<?xml version="1.0" standalone="yes"?>
+<domain name="headings">
+
+ <import rel="domain" src="./book_domain.osxml"/>
+
+ <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 domains.
+ So we need to reference the default field of paragraph. -->
+ <fieldRef ref="book.paragraph.$default"/>
+ </struct>
+</domain>
diff --git a/testdata/osxmlparser/lists_domain.osxml b/testdata/osxmlparser/lists_domain.osxml
new file mode 100644
index 0000000..cacb9cc
--- /dev/null
+++ b/testdata/osxmlparser/lists_domain.osxml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<domain name="lists">
+ <import rel="domain" src="book.osxml"/>
+
+ <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>
+</domain>
diff --git a/testdata/osxmlparser/meta_domain.osxml b/testdata/osxmlparser/meta_domain.osxml
new file mode 100644
index 0000000..52dffc5
--- /dev/null
+++ b/testdata/osxmlparser/meta_domain.osxml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<domain name="meta">
+
+ <import rel="typesystem" src="./affiliation.osxml"/>
+ <import rel="typesystem" src="./email.osxml"/>
+ <import rel="typesystem" src="./version.osxml"/>
+ <import rel="domain" src="./book_domain.osxml"/>
+
+ <struct name="meta" cardinality="{1}" transparent="true">
+ <field name="authors">
+ <childRef ref="author"/>
+ <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>
+ <!-- no explicit cardinality, because we might have multiple authors -->
+ <struct name="author">
+ <primitive isSubtree="true" name="firstName" type="string"/>
+ <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>
+ <!-- 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>
+</domain>
diff --git a/testdata/osxmlparser/mismatchedTag.osxml b/testdata/osxmlparser/mismatchedTag.osxml
new file mode 100644
index 0000000..5f15f0f
--- /dev/null
+++ b/testdata/osxmlparser/mismatchedTag.osxml
@@ -0,0 +1,3 @@
+<?xml version="1.0" standalone="yes"?>
+<document></document2>
+
diff --git a/testdata/osxmlparser/simple_book.osxml b/testdata/osxmlparser/simple_book.osxml
new file mode 100644
index 0000000..310a413
--- /dev/null
+++ b/testdata/osxmlparser/simple_book.osxml
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<document>
+ <import rel="domain" src="book_domain.osxml"/>
+ <book>
+ This might be some introductory text or a dedication.
+ <!-- Note that a better version of the book domain might specify
+ headings here. -->
+ <chapter name="myFirstChapter">
+ Here we might have an introduction to the chapter.
+ <section name="myFirstSection">
+ Here we might find the actual section content.
+ </section>
+ <section name="mySndSection">
+ Here we might find the actual section content.
+ </section>
+ </chapter>
+ </book>
+</document>
diff --git a/testdata/osxmlparser/test.osxml b/testdata/osxmlparser/test.osxml
new file mode 100644
index 0000000..e492488
--- /dev/null
+++ b/testdata/osxmlparser/test.osxml
@@ -0,0 +1,15 @@
+<?xml version="1.0" standalone="yes"?>
+<domain name="test">
+
+ <import rel="domain" src="./book_domain.osxml"/>
+ <import rel="typesystem" src="./color.osxml"/>
+
+ <struct name="fancycolor">
+
+ <primitive type="color"/>
+
+ <parentRef ref="book.book">
+ <fieldRef ref="$default"/>
+ </parentRef>
+ </struct>
+</domain>
diff --git a/testdata/osxmlparser/version.osxml b/testdata/osxmlparser/version.osxml
new file mode 100644
index 0000000..0d52736
--- /dev/null
+++ b/testdata/osxmlparser/version.osxml
@@ -0,0 +1,8 @@
+<?xml version="1.0" standalone="yes"?>
+<typesystem name="version">
+ <struct name="version">
+ <field name="major" type="int"/>
+ <field name="minor" type="int"/>
+ <field name="patch" type="int"/>
+ </struct>
+</typesystem>