Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

1
0

thgttg.py 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Thu Mar 20 08:58:56 2014
  4. Script to generate intro-example.odml
  5. @author: zehl
  6. """
  7. import odml
  8. import datetime
  9. odmlrepo = 'http://portal.g-node.org/odml/terminologies/v1.0/terminologies.xml'
  10. # CREATE A DOCUMENT
  11. doc = odml.Document(author="D. N. Adams",
  12. date=datetime.date(1979, 10, 12),
  13. version=42)
  14. # repository=odmlrepo)
  15. # CREATE AND APPEND THE MAIN SECTIONs
  16. doc.append(odml.Section(name="TheCrew",
  17. definition="Information on the crew",
  18. type="crew"))
  19. doc.append(odml.Section(name="TheStarship",
  20. definition="Information on the crew",
  21. type="crew"))
  22. # SET NEW PARENT NODE
  23. parent = doc['TheCrew']
  24. # APPEND SUBSECTIONS
  25. parent.append(odml.Section(name="Arthur Philip Dent",
  26. type="crew/person",
  27. definition="Information on Arthur Dent"))
  28. parent.append(odml.Section(name="Zaphod Beeblebrox",
  29. type="crew/person",
  30. definition="Information on Zaphod Beeblebrox"))
  31. parent.append(odml.Section(name="Tricia Marie McMillan",
  32. type="crew/person",
  33. definition="Information on Trillian Astra"))
  34. parent.append(odml.Section(name="Ford Prefect",
  35. type="crew/person",
  36. definition="Information on Ford Prefect"))
  37. # APPEND PROPERTIES WITH VALUES
  38. parent.append(odml.Property(name="NameCrewMembers",
  39. value=[odml.Value(data="Arthur Philip Dent",
  40. dtype=odml.DType.person),
  41. odml.Value(data="Zaphod Beeblebrox",
  42. dtype=odml.DType.person),
  43. odml.Value(data="Tricia Marie McMillan",
  44. dtype=odml.DType.person),
  45. odml.Value(data="Ford Prefect",
  46. dtype=odml.DType.person)],
  47. definition="List of crew members names"))
  48. parent.append(odml.Property(name="NoCrewMembers",
  49. value=odml.Value(data=4,
  50. dtype=odml.DType.int),
  51. definition="Number of crew members"))
  52. # SET NEW PARENT NODE
  53. parent = doc['TheCrew']['Arthur Philip Dent']
  54. # APPEND SUBSECTIONS
  55. # APPEND PROPERTIES WITH VALUES
  56. parent.append(odml.Property(name="Species",
  57. value=odml.Value(data="Human",
  58. dtype=odml.DType.string),
  59. definition="Species to which subject belongs to"))
  60. parent.append(odml.Property(name="Nickname",
  61. value=odml.Value(data="The sandwich-maker",
  62. dtype=odml.DType.string),
  63. definition="Nickname(s) of the subject"))
  64. parent.append(odml.Property(name="Occupation",
  65. value=odml.Value(data="-",
  66. dtype=odml.DType.string),
  67. definition="Occupation of the subject"))
  68. parent.append(odml.Property(name="Gender",
  69. value=odml.Value(data="male",
  70. dtype=odml.DType.string),
  71. definition="Sex of the subject"))
  72. parent.append(odml.Property(name="HomePlanet",
  73. value=odml.Value(data="Earth",
  74. dtype=odml.DType.string),
  75. definition="Home planet of the subject"))
  76. # SET NEW PARENT NODE
  77. parent = doc['TheCrew']['Zaphod Beeblebrox']
  78. # APPEND SUBSECTIONS
  79. # APPEND PROPERTIES WITH VALUES
  80. parent.append(odml.Property(name="Species",
  81. value=odml.Value(data="Betelgeusian",
  82. dtype=odml.DType.string),
  83. definition="Species to which subject belongs to"))
  84. parent.append(odml.Property(name="Nickname",
  85. value=odml.Value(data="-",
  86. dtype=odml.DType.string),
  87. definition="Nickname(s) of the subject"))
  88. parent.append(odml.Property(name="Occupation",
  89. value=odml.Value(data="Ex-Galactic President",
  90. dtype=odml.DType.string),
  91. definition="Occupation of the subject"))
  92. parent.append(odml.Property(name="Gender",
  93. value=odml.Value(data="male",
  94. dtype=odml.DType.string),
  95. definition="Sex of the subject"))
  96. parent.append(odml.Property(name="HomePlanet",
  97. value=odml.Value(data="A planet in the vicinity "
  98. "of Betelgeuse",
  99. dtype=odml.DType.string),
  100. definition="Home planet of the subject"))
  101. # SET NEW PARENT NODE
  102. parent = doc['TheCrew']['Tricia Marie McMillan']
  103. # APPEND SUBSECTIONS
  104. # APPEND PROPERTIES WITH VALUES
  105. parent.append(odml.Property(name="Species",
  106. value=odml.Value(data="Betelgeusian",
  107. dtype=odml.DType.string),
  108. definition="Species to which subject belongs to"))
  109. parent.append(odml.Property(name="Nickname",
  110. value=odml.Value(data="Trillian Astra",
  111. dtype=odml.DType.string),
  112. definition="Nickname(s) of the subject"))
  113. parent.append(odml.Property(name="Occupation",
  114. value=odml.Value(data="-",
  115. dtype=odml.DType.string),
  116. definition="Occupation of the subject"))
  117. parent.append(odml.Property(name="Gender",
  118. value=odml.Value(data="female",
  119. dtype=odml.DType.string),
  120. definition="Sex of the subject"))
  121. parent.append(odml.Property(name="HomePlanet",
  122. value=odml.Value(data="Earth",
  123. dtype=odml.DType.string),
  124. definition="Home planet of the subject"))
  125. # SET NEW PARENT NODE
  126. parent = doc['TheCrew']['Ford Prefect']
  127. # APPEND SUBSECTIONS
  128. # APPEND PROPERTIES WITH VALUES
  129. parent.append(odml.Property(name="Species",
  130. value=odml.Value(data="Betelgeusian",
  131. dtype=odml.DType.string),
  132. definition="Species to which subject belongs to"))
  133. parent.append(odml.Property(name="Nickname",
  134. value=odml.Value(data="Ix",
  135. dtype=odml.DType.string),
  136. definition="Nickname(s) of the subject"))
  137. parent.append(odml.Property(name="Occupation",
  138. value=odml.Value(data="Researcher for the "
  139. "Hitchhiker's Guide to the "
  140. "Galaxy",
  141. dtype=odml.DType.string),
  142. definition="Occupation of the subject"))
  143. parent.append(odml.Property(name="Gender",
  144. value=odml.Value(data="male",
  145. dtype=odml.DType.string),
  146. definition="Sex of the subject"))
  147. parent.append(odml.Property(name="HomePlanet",
  148. value=odml.Value(data="A planet in the vicinity "
  149. "of Betelgeuse",
  150. dtype=odml.DType.string),
  151. definition="Home planet of the subject"))
  152. # SET NEW PARENT NODE
  153. parent = doc['TheStarship']
  154. # APPEND SUBSECTIONS
  155. parent.append(odml.Section(name='Cybernetics',
  156. type="starship/cybernetics",
  157. definition="Information on cybernetics present on "
  158. "the ship"))
  159. # APPEND PROPERTIES WITH VALUES
  160. parent.append(odml.Property(name="Name",
  161. value=odml.Value(data="Heart of Gold",
  162. dtype=odml.DType.string),
  163. definition="Name of person/device"))
  164. parent.append(odml.Property(name="OwnerStatus",
  165. value=odml.Value(data="stolen",
  166. dtype=odml.DType.string),
  167. definition="Owner status of device"))
  168. parent.append(odml.Property(name="DriveType",
  169. value=odml.Value(data="Infinite Propability Drive",
  170. dtype=odml.DType.string),
  171. definition="Type of drive"))
  172. parent.append(odml.Property(name="Technology",
  173. value=odml.Value(data="secret",
  174. dtype=odml.DType.string),
  175. definition="Technology used to built device"))
  176. parent.append(odml.Property(name="Length",
  177. value=odml.Value(data=150.00,
  178. dtype=odml.DType.float,
  179. unit='m'),
  180. definition="Length of device"))
  181. parent.append(odml.Property(name="Shape",
  182. value=odml.Value(data="various",
  183. dtype=odml.DType.string),
  184. definition="Shape of device"))
  185. parent.append(odml.Property(name="FactoryPlanet",
  186. value=odml.Value(data="Damogran",
  187. dtype=odml.DType.string),
  188. definition="Planet where device was constructed"))
  189. # SET NEW PARENT NODE
  190. parent = doc['TheStarship']['Cybernetics']
  191. # APPEND SUBSECTIONS
  192. parent.append(odml.Section(name='Marvin',
  193. type="starship/cybernetics",
  194. definition="Information on Marvin"))
  195. parent.append(odml.Section(name='Eddie',
  196. type="starship/cybernetics",
  197. definition="Information on Eddie"))
  198. # APPEND PROPERTIES WITH VALUES
  199. parent.append(odml.Property(name="RobotType",
  200. value=odml.Value(data="Genuine People "
  201. "Personalities",
  202. dtype=odml.DType.string),
  203. definition="Type of robots"))
  204. parent.append(odml.Property(name="Manufacturer",
  205. value=odml.Value(data="Sirius Cybernetics "
  206. "Corporation",
  207. dtype=odml.DType.string),
  208. definition="Manufacturer of robots"))
  209. parent.append(odml.Property(name="NoOfCybernetics",
  210. value=odml.Value(data=2,
  211. dtype=odml.DType.int),
  212. definition="Number of cybernetic robots on the "
  213. "ship"))
  214. homedir = "/home/zehl/Projects/toolbox/"
  215. save_to = homedir + "/python-odml/doc/example_odMLs/THGTTG.odml"
  216. odml.tools.xmlparser.XMLWriter(doc).write_file(save_to)