Skip to content

Commit

Permalink
added XML schema and JSON schema, examples fixed accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
mjakubicek committed Apr 8, 2024
1 parent 132e978 commit bda92c7
Show file tree
Hide file tree
Showing 16 changed files with 3,023 additions and 29 deletions.
946 changes: 946 additions & 0 deletions dmlex-v1.0/schemas/JSON/dmlex.schema.json

Large diffs are not rendered by default.

786 changes: 786 additions & 0 deletions dmlex-v1.0/schemas/JSON/dmlex_no-crosslingual.schema.json

Large diffs are not rendered by default.

674 changes: 674 additions & 0 deletions dmlex-v1.0/schemas/XML/dmlex.xsd

Large diffs are not rendered by default.

572 changes: 572 additions & 0 deletions dmlex-v1.0/schemas/XML/dmlex_no-crosslingual.xsd

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions dmlex-v1.0/schemas/helper_scripts/validate_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/python3
import json
from jsonschema import validate
import glob
schema = json.load(open('dmlex.schema.json'))
for file in glob.glob("*.json"):
if file.endswith('.schema.json'):
continue
print(file)
validate(json.load(open(file)), schema)

8 changes: 8 additions & 0 deletions dmlex-v1.0/schemas/helper_scripts/validate_xml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/python3
import xmlschema
import glob
schema = xmlschema.XMLSchema11('dmlex.xsd')
for file in glob.glob("*.xml"):
print(file)
schema.validate(file)

3 changes: 1 addition & 2 deletions dmlex-v1.0/specification/examples/examples/source/0.xml.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<programlisting>
&lt;lexicographicResource uri="http://example.com" langCode="en"&gt;
&lt;title&gt;Example Dictionary&lt;/title&gt;
&lt;lexicographicResource title="Example Dictionary" uri="http://example.com" langCode="en"&gt;
&lt;entry id="abandon-verb"&gt;
&lt;headword&gt;abandon&lt;/headword&gt;
&lt;partOfSpeech tag="verb"/&gt;
Expand Down
3 changes: 1 addition & 2 deletions dmlex-v1.0/specification/examples/examples/source/10.xml.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<programlisting>
&lt;lexicographicResource uri="http://example.com" langCode="ga"&gt;
&lt;title&gt;My Irish-Multilingual Dictionary&lt;/title&gt;
&lt;lexicographicResource title="My Irish-Multilingual Dictionary" uri="http://example.com" langCode="ga"&gt;
&lt;translationLanguage langCode="en"/&gt;
&lt;translationLanguage langCode="de"/&gt;
&lt;translationLanguage langCode="cs"/&gt;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<programlisting>
&lt;lexicographicResource uri="http://example.com" langCode="de"&gt;
&lt;translationLanguage langCode="en"/&gt;
&lt;entry id="die-see"&gt;
&lt;headword&gt;See&lt;/headword&gt;
&lt;partOfSpeech tag="n-fem"/&gt;
Expand All @@ -22,6 +21,7 @@
&lt;headwordTranslation&gt;&lt;text&gt;ocean&lt;/text&gt;&lt;/headwordTranslation&gt;
&lt;/sense&gt;
&lt;/entry&gt;
&lt;translationLanguage langCode="en"/&gt;
&lt;relation type="synonyms"&gt;
&lt;description&gt;words that mean sea and ocean&lt;/description&gt;
&lt;member ref="die-see-1"/&gt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
&lt;headword&gt;beat &lt;placeholderMarker&gt;sb.&lt;/placeholderMarker&gt; up&lt;/headword
&gt;
&lt;sense id="beat-up-1"&gt;
&lt;headwordTranslation&gt;
&lt;headwordTranslation langCode="de"&gt;
&lt;text&gt;&lt;placeholderMarker&gt;jemanden&lt;/placeholderMarker&gt; verprügeln&lt;/
text&gt;
&lt;/headwordTranslation&gt;
Expand Down
4 changes: 2 additions & 2 deletions dmlex-v1.0/specification/examples/examples/source/21.xml.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
&lt;entry id="autopsy"&gt;
&lt;headword&gt;autopsy&lt;/headword&gt;
&lt;sense id="autopsy-1"&gt;
&lt;headwordTranslation&gt;&lt;text&gt;pitva&lt;/text&gt;&lt;/headwordTranslation&gt;
&lt;example&gt;
&lt;text&gt;The coroner performed an &lt;headwordMarker&gt;autopsy&lt;/headwo
rdMarker&gt;.&lt;/text&gt;
&lt;exampleTranslation&gt;
&lt;exampleTranslation langCode="cs"&gt;
&lt;text&gt;Koroner provedl &lt;headwordMarker&gt;pitvu&lt;/headwordMarke
r&gt;.&lt;/text&gt;
&lt;/exampleTranslation&gt;
&lt;/example&gt;
&lt;headwordTranslation langCode="cs"&gt;&lt;text&gt;pitva&lt;/text&gt;&lt;/headwordTranslation&gt;
&lt;/sense&gt;
&lt;/entry&gt;

Expand Down
12 changes: 6 additions & 6 deletions dmlex-v1.0/specification/examples/examples/source/24.xml.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ ion&gt;
&lt;/etymon&gt;
&lt;/etymology&gt;
&lt;/entry&gt;
&lt;etymonLanguage langCode="dum"&gt;
&lt;displayName&gt;Middle Dutch&lt;/displayName&gt;
&lt;/etymonLanguage&gt;
&lt;etymonLanguage langCode="gem-pro"&gt;
&lt;displayName&gt;Proto-Germanic&lt;/displayName&gt;
&lt;/etymonLanguage&gt;
&lt;etymonType type="derivation"&gt;
&lt;description&gt;A historical form of the word&lt;/description&gt;
&lt;/etymonType&gt;
&lt;etymonType type="doublet"&gt;
&lt;description&gt;Two words derived from the same etymological root&lt;/de
scription&gt;
&lt;/etymonType&gt;
&lt;etymonLanguage langCode="dum"&gt;
&lt;displayName&gt;Middle Dutch&lt;/displayName&gt;
&lt;/etymonLanguage&gt;
&lt;etymonLanguage langCode="gem-pro"&gt;
&lt;displayName&gt;Proto-Germanic&lt;/displayName&gt;
&lt;/etymonLanguage&gt;
&lt;/lexicographicResource&gt;

</programlisting>
12 changes: 6 additions & 6 deletions dmlex-v1.0/specification/examples/examples/source/5.xml.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
&lt;text&gt;folúsghlantóirí&lt;/text&gt;
&lt;/inflectedForm&gt;
&lt;/entry&gt;
&lt;partOfSpeechTag tag="n-masc"&gt;
&lt;description&gt;masculine noun&lt;/description&gt;
&lt;/partOfSpeechTag&gt;
&lt;partOfSpeechTag tag="n-fem"&gt;
&lt;description&gt;feminine noun&lt;/description&gt;
&lt;/partOfSpeechTag&gt;
&lt;inflectedFormTag tag="sg-gen"&gt;
&lt;description&gt;singular genitive&lt;/description&gt;
&lt;/inflectedFormTag&gt;
&lt;inflectedFormTag tag="pl"&gt;
&lt;description&gt;plural&lt;/description&gt;
&lt;/inflectedFormTag&gt;
&lt;partOfSpeechTag tag="n-masc"&gt;
&lt;description&gt;masculine noun&lt;/description&gt;
&lt;/partOfSpeechTag&gt;
&lt;partOfSpeechTag tag="n-fem"&gt;
&lt;description&gt;feminine noun&lt;/description&gt;
&lt;/partOfSpeechTag&gt;
&lt;/lexicographicResource&gt;
</programlisting>
3 changes: 1 addition & 2 deletions dmlex-v1.0/specification/examples/examples/source/7.xml.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<programlisting>
&lt;lexicographicResource uri="http://example.com" langCode="de"&gt;
&lt;title&gt;My German-English Dictionary&lt;/title&gt;
&lt;lexicographicResource title="My German-English Dictionary" uri="http://example.com" langCode="de"&gt;
&lt;translationLanguage langCode="en"/&gt;
&lt;/lexicographicResource&gt;
</programlisting>
8 changes: 4 additions & 4 deletions dmlex-v1.0/specification/examples/examples/source/8.xml.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
&lt;headword&gt;doctor&lt;/headword&gt;
&lt;sense id="doctor-n-1"&gt;
&lt;indicator&gt;medical doctor&lt;/indicator&gt;
&lt;headwordTranslation&gt;
&lt;headwordTranslation langCode="en"&gt;
&lt;text&gt;Arzt&lt;/text&gt;
&lt;partOfSpeech tag="n-masc"/&gt;
&lt;/headwordTranslation&gt;
&lt;headwordTranslation&gt;
&lt;headwordTranslation langCode="en"&gt;
&lt;text&gt;Ärztin&lt;/text&gt;
&lt;partOfSpeech tag="n-fem"/&gt;
&lt;/headwordTranslation&gt;
&lt;/sense&gt;
&lt;sense id="doctor-n-2"&gt;
&lt;indicator&gt;academic title&lt;/indicator&gt;
&lt;headwordTranslation&gt;
&lt;headwordTranslation langCode="en"&gt;
&lt;text&gt;Doktor&lt;/text&gt;
&lt;partOfSpeech tag="n-masc"/&gt;
&lt;/headwordTranslation&gt;
&lt;headwordTranslation&gt;
&lt;headwordTranslation langCode="en"&gt;
&lt;text&gt;Doktorin&lt;/text&gt;
&lt;partOfSpeech tag="n-fem"/&gt;
&lt;/headwordTranslation&gt;
Expand Down
6 changes: 3 additions & 3 deletions dmlex-v1.0/specification/examples/examples/source/9.xml.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
&lt;headword&gt;Treppenwitz&lt;/headword&gt;
&lt;partOfSpeech tag="n-masc"/&gt;
&lt;sense id="treppenwitz-1"&gt;
&lt;headwordExplanation&gt;belated realisation of what one could have sa
id&lt;/headwordExplanation&gt;
&lt;headwordTranslation&gt;
&lt;headwordExplanation langCode="en"&gt;belated realisation of what one
could have said&lt;/headwordExplanation&gt;
&lt;headwordTranslation langCode="en"&gt;
&lt;text&gt;staircase wit&lt;/text&gt;
&lt;/headwordTranslation&gt;
&lt;/sense&gt;
Expand Down

0 comments on commit bda92c7

Please sign in to comment.