Skip to content

Commit

Permalink
Merge pull request #124 from jmccrae/example-sources
Browse files Browse the repository at this point in the history
Example sources
  • Loading branch information
michmech authored May 17, 2024
2 parents 48c45d4 + fc857d4 commit 127679e
Show file tree
Hide file tree
Showing 152 changed files with 2,263 additions and 106 deletions.
77 changes: 1 addition & 76 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,81 +21,6 @@ dmlex-v1.0/specification/dmlex_uml.png
dmlex-v1.0/specification/dmlex_uml.svg
dmlex-v1.0/specification/dmlex_uml_core.png
dmlex-v1.0/specification/dmlex_uml_core_sm.png
dmlex-v1.0/specification/examples/examples/source/0.json
dmlex-v1.0/specification/examples/examples/source/0.rdf
dmlex-v1.0/specification/examples/examples/source/0.xml
dmlex-v1.0/specification/examples/examples/source/1.json
dmlex-v1.0/specification/examples/examples/source/1.rdf
dmlex-v1.0/specification/examples/examples/source/1.xml
dmlex-v1.0/specification/examples/examples/source/10.json
dmlex-v1.0/specification/examples/examples/source/10.rdf
dmlex-v1.0/specification/examples/examples/source/10.xml
dmlex-v1.0/specification/examples/examples/source/11.json
dmlex-v1.0/specification/examples/examples/source/11.rdf
dmlex-v1.0/specification/examples/examples/source/11.xml
dmlex-v1.0/specification/examples/examples/source/12.json
dmlex-v1.0/specification/examples/examples/source/12.rdf
dmlex-v1.0/specification/examples/examples/source/12.xml
dmlex-v1.0/specification/examples/examples/source/13.json
dmlex-v1.0/specification/examples/examples/source/13.rdf
dmlex-v1.0/specification/examples/examples/source/13.xml
dmlex-v1.0/specification/examples/examples/source/14.json
dmlex-v1.0/specification/examples/examples/source/14.rdf
dmlex-v1.0/specification/examples/examples/source/14.xml
dmlex-v1.0/specification/examples/examples/source/15.json
dmlex-v1.0/specification/examples/examples/source/15.rdf
dmlex-v1.0/specification/examples/examples/source/15.xml
dmlex-v1.0/specification/examples/examples/source/16.json
dmlex-v1.0/specification/examples/examples/source/16.rdf
dmlex-v1.0/specification/examples/examples/source/16.xml
dmlex-v1.0/specification/examples/examples/source/17.json
dmlex-v1.0/specification/examples/examples/source/17.rdf
dmlex-v1.0/specification/examples/examples/source/17.xml
dmlex-v1.0/specification/examples/examples/source/18.json
dmlex-v1.0/specification/examples/examples/source/18.rdf
dmlex-v1.0/specification/examples/examples/source/18.xml
dmlex-v1.0/specification/examples/examples/source/19.json
dmlex-v1.0/specification/examples/examples/source/19.rdf
dmlex-v1.0/specification/examples/examples/source/19.xml
dmlex-v1.0/specification/examples/examples/source/2.json
dmlex-v1.0/specification/examples/examples/source/2.rdf
dmlex-v1.0/specification/examples/examples/source/2.xml
dmlex-v1.0/specification/examples/examples/source/20.json
dmlex-v1.0/specification/examples/examples/source/20.rdf
dmlex-v1.0/specification/examples/examples/source/20.xml
dmlex-v1.0/specification/examples/examples/source/21.json
dmlex-v1.0/specification/examples/examples/source/21.rdf
dmlex-v1.0/specification/examples/examples/source/21.xml
dmlex-v1.0/specification/examples/examples/source/22.json
dmlex-v1.0/specification/examples/examples/source/22.rdf
dmlex-v1.0/specification/examples/examples/source/22.xml
dmlex-v1.0/specification/examples/examples/source/23.json
dmlex-v1.0/specification/examples/examples/source/23.rdf
dmlex-v1.0/specification/examples/examples/source/23.xml
dmlex-v1.0/specification/examples/examples/source/24.json
dmlex-v1.0/specification/examples/examples/source/24.rdf
dmlex-v1.0/specification/examples/examples/source/24.xml
dmlex-v1.0/specification/examples/examples/source/3.json
dmlex-v1.0/specification/examples/examples/source/3.rdf
dmlex-v1.0/specification/examples/examples/source/3.xml
dmlex-v1.0/specification/examples/examples/source/4.json
dmlex-v1.0/specification/examples/examples/source/4.rdf
dmlex-v1.0/specification/examples/examples/source/4.xml
dmlex-v1.0/specification/examples/examples/source/5.json
dmlex-v1.0/specification/examples/examples/source/5.rdf
dmlex-v1.0/specification/examples/examples/source/5.xml
dmlex-v1.0/specification/examples/examples/source/6.json
dmlex-v1.0/specification/examples/examples/source/6.rdf
dmlex-v1.0/specification/examples/examples/source/6.xml
dmlex-v1.0/specification/examples/examples/source/7.json
dmlex-v1.0/specification/examples/examples/source/7.rdf
dmlex-v1.0/specification/examples/examples/source/7.xml
dmlex-v1.0/specification/examples/examples/source/8.json
dmlex-v1.0/specification/examples/examples/source/8.rdf
dmlex-v1.0/specification/examples/examples/source/8.xml
dmlex-v1.0/specification/examples/examples/source/9.json
dmlex-v1.0/specification/examples/examples/source/9.rdf
dmlex-v1.0/specification/examples/examples/source/9.xml
dmlex-v1.0/specification/dmlex-v1.0-csd02.fo
dmlex-v1.0/specification/dmlex-v1.0-csd02.pdf
dmlex-v1.0/specification/dmlex-v1.0-csd02.xml
dmlex-v1.0/specification/dmlex-v1.0-csd02.xml
13 changes: 5 additions & 8 deletions dmlex-v1.0/specification/examples/examples/build_source.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
## Build all the source files so they can be included in the examples
## To use this delete all files in source/ and then
## copy the basic files from jmccrae/dmlex-converter
## and run this script
## e.g.,
## rm source/*
## cp ~/projects/jmccrae/dmlex-converter/dmlex/examples/* source/
## python build_source.py

from glob import glob

N = 74

for f in glob("source/*.xml"):
if f.endswith(".xml.xml") or f.endswith(".rdf.xml") or f.endswith(".json.xml"):
continue
with open(f) as inf:
with open(f + ".xml", "w") as outf:
outf.write("<!-- This example is automatically generated. DO NOT EDIT -->\n")
outf.write("<programlisting>\n")
for line in inf.readlines():
while len(line) > N:
Expand All @@ -27,6 +22,7 @@
with open(f) as inf:
with open(f + ".xml", "w") as outf:
n = 1
outf.write("<!-- This example is automatically generated. DO NOT EDIT -->\n")
outf.write("<programlisting>\n")
for line in inf.readlines():
if "PREFIX" not in line and line.strip() != "":
Expand All @@ -40,6 +36,7 @@
for f in glob("source/*.json"):
with open(f) as inf:
with open(f + ".xml", "w") as outf:
outf.write("<!-- This example is automatically generated. DO NOT EDIT -->\n")
outf.write("<programlisting>\n")
for line in inf.readlines():
while len(line) > N:
Expand Down
29 changes: 29 additions & 0 deletions dmlex-v1.0/specification/examples/examples/source/0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"uri": "http://example.com",
"langCode": "en",
"title": "Example Dictionary",
"entries": [{
"id": "abandon-verb",
"headword": "abandon",
"partsOfSpeech": ["verb"],
"senses": [{
"id": "abandon-verb-1",
"definitions": [{
"text": "to suddenly leave a place or a person"
}],
"examples": [{
"text": "I'm sorry I abandoned you like that."
}, {
"text": "Abandon ship!",
"labels": ["idiom"]
}]
}, {
"id": "abandon-verb-2",
"labels": ["mostly-passive"],
"definitions": [{"text":"to stop supporting an idea"}],
"examples": [{
"text": "That theory has been abandoned."
}]
}]
}]
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- This example is automatically generated. DO NOT EDIT -->
<programlisting>
{
"uri": "http://example.com",
Expand Down
47 changes: 47 additions & 0 deletions dmlex-v1.0/specification/examples/examples/source/0.rdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dmlex: <http://www.oasis-open.org/to-be-confirmed/dmlex#>
PREFIX ex: <http://www.example.com/#>

ex:lexicon a dmlex:LexicographicResource;
dmlex:title "Example Dictionary";
dmlex:uri "http://example.com";
dmlex:langCode "en";
dmlex:entry ex:abandon-verb.

ex:abandon-verb a dmlex:Entry;
dmlex:sense ex:abandon-verb-1,
ex:abandon-verb-2;
dmlex:partOfSpeech [
dmlex:tag "verb";
dmlex:listingOrder "1"^^xsd:unsignedInt ];
dmlex:headword "abandon".

ex:abandon-verb-1 a dmlex:Sense;
dmlex:definition [ a dmlex:Definition;
dmlex:text "to suddenly leave a place or a person";
dmlex:listingOrder "1"^^xsd:unsignedInt ];
dmlex:example [ a dmlex:Example;
dmlex:text "I'm sorry I abandoned you like that.";
dmlex:listingOrder "1"^^xsd:unsignedInt ],
[ a dmlex:Example;
dmlex:text "Abandon ship!";
dmlex:label [
dmlex:listingOrder "1"^^xsd:unsignedInt;
dmlex:tag "idiom" ];
dmlex:listingOrder "2"^^xsd:unsignedInt ];
dmlex:listingOrder "1"^^xsd:unsignedInt.

ex:abandon-verb-2 a dmlex:Sense;
dmlex:listingOrder "2"^^xsd:unsignedInt;
dmlex:label [
dmlex:tag "mostly-passive";
dmlex:listingOrder "1"^^xsd:unsignedInt ];
dmlex:example [ a dmlex:Example;
dmlex:listingOrder "1"^^xsd:unsignedInt;
dmlex:text "That theory has been abandoned." ];
dmlex:definition [ a dmlex:Definition;
dmlex:listingOrder "1"^^xsd:unsignedInt;
dmlex:text "to stop supporting an idea" ].

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- This example is automatically generated. DO NOT EDIT -->
<programlisting>
ex:lexicon a dmlex:LexicographicResource;
dmlex:title "Example Dictionary";
Expand Down
29 changes: 29 additions & 0 deletions dmlex-v1.0/specification/examples/examples/source/0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<lexicographicResource title="Example Dictionary"
uri="http://example.com" langCode="en">
<entry id="abandon-verb">
<headword>abandon</headword>
<partOfSpeech tag="verb"/>
<sense id="abandon-verb-1">
<definition>
<text>to suddenly leave a place or a person</text>
</definition>
<example>
<text>I'm sorry I abandoned you like that.</text>
</example>
<example>
<text>Abandon ship!</text>
<label tag="idiom"/>
</example>
</sense>
<sense id="abandon-verb-2">
<label tag="mostly-passive"/>
<definition>
<text>to stop supporting an idea</text>
</definition>
<example>
<text>That theory has been abandoned.</text>
</example>
</sense>
</entry>
</lexicographicResource>

5 changes: 3 additions & 2 deletions dmlex-v1.0/specification/examples/examples/source/0.xml.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- This example is automatically generated. DO NOT EDIT -->
<programlisting>
&lt;lexicographicResource title="Example Dictionary"
uri="http://example.com" langCode="en"&gt;
Expand All @@ -6,7 +7,7 @@
&lt;partOfSpeech tag="verb"/&gt;
&lt;sense id="abandon-verb-1"&gt;
&lt;definition&gt;
&lt;text>to suddenly leave a place or a person&lt;/text>
&lt;text&gt;to suddenly leave a place or a person&lt;/text&gt;
&lt;/definition&gt;
&lt;example&gt;
&lt;text&gt;I'm sorry I abandoned you like that.&lt;/text&gt;
Expand All @@ -19,7 +20,7 @@
&lt;sense id="abandon-verb-2"&gt;
&lt;label tag="mostly-passive"/&gt;
&lt;definition&gt;
&lt;text>to stop supporting an idea&lt;/text>
&lt;text&gt;to stop supporting an idea&lt;/text&gt;
&lt;/definition&gt;
&lt;example&gt;
&lt;text&gt;That theory has been abandoned.&lt;/text&gt;
Expand Down
13 changes: 13 additions & 0 deletions dmlex-v1.0/specification/examples/examples/source/1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"id": "folúsghlantóir-n",
"headword": "folúsghlantóir",
"partsOfSpeech": ["n-masc"],
"inflectedForms": [{
"tag": "sg-gen",
"text": "folúsghlantóra"
}, {
"tag": "pl",
"text": "folúsghlantóirí"
}],
"senses": []
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- This example is automatically generated. DO NOT EDIT -->
<programlisting>
{
"id": "folúsghlantóir-n",
Expand Down
12 changes: 12 additions & 0 deletions dmlex-v1.0/specification/examples/examples/source/1.rdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dmlex: <http://www.oasis-open.org/to-be-confirmed/dmlex#>
PREFIX ex: <http://www.example.com/#>

ex:folúsghlantóir-n a dmlex:Entry;
dmlex:headword "folúsghlantóir";
dmlex:partOfSpeech [
dmlex:listingOrder "1"^^xsd:unsignedInt;
dmlex:tag "n-masc" ].

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- This example is automatically generated. DO NOT EDIT -->
<programlisting>
ex:folúsghlantóir-n a dmlex:Entry;
dmlex:headword "folúsghlantóir";
Expand Down
10 changes: 10 additions & 0 deletions dmlex-v1.0/specification/examples/examples/source/1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<entry id="folúsghlantóir-n">
<headword>folúsghlantóir</headword>
<partOfSpeech tag="n-masc"/>
<inflectedForm tag="sg-gen">
<text>folúsghlantóra</text>
</inflectedForm>
<inflectedForm tag="pl">
<text>folúsghlantóirí</text>
</inflectedForm>
</entry>
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- This example is automatically generated. DO NOT EDIT -->
<programlisting>
&lt;entry id="folúsghlantóir-n"&gt;
&lt;headword&gt;folúsghlantóir&lt;/headword&gt;
Expand Down
7 changes: 7 additions & 0 deletions dmlex-v1.0/specification/examples/examples/source/10.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"title": "My Irish-Multilingual Dictionary",
"uri": "http://example.com",
"langCode": "ga",
"translationLanguages": ["en", "de", "cs"]
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- This example is automatically generated. DO NOT EDIT -->
<programlisting>
{
"title": "My Irish-Multilingual Dictionary",
Expand Down
20 changes: 20 additions & 0 deletions dmlex-v1.0/specification/examples/examples/source/10.rdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dmlex: <http://www.oasis-open.org/to-be-confirmed/dmlex#>
PREFIX ex: <http://www.example.com/#>

ex:lexicon a dmlex:LexicographicResource;
dmlex:title "My Irish-Multilingual Dictionary";
dmlex:uri "http://example.com";
dmlex:translationLanguage [
dmlex:langCode "cs" ;
dmlex:listingOrder 1
] , [
dmlex:langCode "en" ;
dmlex:listingOrder 2
] , [
dmlex:langCode "de" ;
dmlex:listingOrder 3 ] ;
dmlex:langCode "ga".

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- This example is automatically generated. DO NOT EDIT -->
<programlisting>
ex:lexicon a dmlex:LexicographicResource;
dmlex:title "My Irish-Multilingual Dictionary";
Expand Down
7 changes: 7 additions & 0 deletions dmlex-v1.0/specification/examples/examples/source/10.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<lexicographicResource title="My Irish-Multilingual Dictionary"
uri="http://example.com" langCode="ga">
<translationLanguage langCode="en"/>
<translationLanguage langCode="de"/>
<translationLanguage langCode="cs"/>
</lexicographicResource>

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- This example is automatically generated. DO NOT EDIT -->
<programlisting>
&lt;lexicographicResource title="My Irish-Multilingual Dictionary"
uri="http://example.com" langCode="ga"&gt;
Expand Down
Loading

0 comments on commit 127679e

Please sign in to comment.