expressir 0.2.4-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (520) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/rake.yml +46 -0
  3. data/.github/workflows/release.yml +75 -0
  4. data/.gitignore +15 -0
  5. data/.gitmodules +3 -0
  6. data/.rspec +2 -0
  7. data/.rubocop.yml +508 -0
  8. data/Gemfile +6 -0
  9. data/README.adoc +147 -0
  10. data/Rakefile +17 -0
  11. data/bin/console +12 -0
  12. data/bin/rspec +29 -0
  13. data/bin/setup +8 -0
  14. data/demo.rb +18 -0
  15. data/docs/development.md +90 -0
  16. data/exe/expressir +20 -0
  17. data/exe/generate-parser +48 -0
  18. data/expressir.gemspec +40 -0
  19. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/CMakeLists.txt +118 -0
  20. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj +637 -0
  21. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters +984 -0
  22. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj +652 -0
  23. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters +990 -0
  24. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj +652 -0
  25. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj.filters +990 -0
  26. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj +652 -0
  27. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj.filters +990 -0
  28. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp-ios/Info.plist +26 -0
  29. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp-ios/antlrcpp_ios.h +17 -0
  30. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj +3024 -0
  31. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  32. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  33. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4.xcscheme +76 -0
  34. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_ios.xcscheme +80 -0
  35. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_static.xcscheme +80 -0
  36. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorListener.cpp +10 -0
  37. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorListener.h +167 -0
  38. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorStrategy.cpp +10 -0
  39. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorStrategy.h +121 -0
  40. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +34 -0
  41. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.h +27 -0
  42. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +155 -0
  43. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +69 -0
  44. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BailErrorStrategy.cpp +61 -0
  45. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BailErrorStrategy.h +59 -0
  46. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BaseErrorListener.cpp +25 -0
  47. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BaseErrorListener.h +36 -0
  48. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BufferedTokenStream.cpp +414 -0
  49. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/BufferedTokenStream.h +200 -0
  50. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CharStream.cpp +11 -0
  51. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CharStream.h +37 -0
  52. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.cpp +195 -0
  53. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.h +158 -0
  54. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +39 -0
  55. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.h +74 -0
  56. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenStream.cpp +78 -0
  57. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenStream.h +79 -0
  58. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp +15 -0
  59. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ConsoleErrorListener.h +35 -0
  60. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp +333 -0
  61. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.h +466 -0
  62. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DiagnosticErrorListener.cpp +84 -0
  63. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DiagnosticErrorListener.h +80 -0
  64. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.cpp +64 -0
  65. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.h +99 -0
  66. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.cpp +51 -0
  67. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.h +32 -0
  68. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/InputMismatchException.cpp +18 -0
  69. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/InputMismatchException.h +24 -0
  70. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.cpp +12 -0
  71. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.h +218 -0
  72. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/InterpreterRuleContext.cpp +19 -0
  73. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/InterpreterRuleContext.h +45 -0
  74. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +295 -0
  75. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +196 -0
  76. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.cpp +75 -0
  77. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.h +52 -0
  78. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerNoViableAltException.cpp +36 -0
  79. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerNoViableAltException.h +31 -0
  80. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.cpp +92 -0
  81. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.h +88 -0
  82. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/NoViableAltException.cpp +46 -0
  83. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/NoViableAltException.h +42 -0
  84. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.cpp +648 -0
  85. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +467 -0
  86. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.cpp +306 -0
  87. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.h +179 -0
  88. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.cpp +141 -0
  89. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +147 -0
  90. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +53 -0
  91. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.h +38 -0
  92. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.cpp +66 -0
  93. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.h +98 -0
  94. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.cpp +167 -0
  95. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.h +164 -0
  96. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.cpp +143 -0
  97. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.h +137 -0
  98. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContextWithAltNum.cpp +27 -0
  99. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContextWithAltNum.h +32 -0
  100. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +53 -0
  101. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.h +155 -0
  102. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.cpp +9 -0
  103. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.h +92 -0
  104. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenFactory.h +30 -0
  105. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.cpp +9 -0
  106. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.h +85 -0
  107. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStream.cpp +11 -0
  108. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStream.h +137 -0
  109. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +425 -0
  110. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +293 -0
  111. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp +211 -0
  112. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.h +123 -0
  113. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedTokenStream.cpp +270 -0
  114. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedTokenStream.h +115 -0
  115. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.cpp +104 -0
  116. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +193 -0
  117. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/WritableToken.cpp +9 -0
  118. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/WritableToken.h +23 -0
  119. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +137 -0
  120. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-runtime.h +167 -0
  121. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.cpp +209 -0
  122. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +112 -0
  123. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +113 -0
  124. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +148 -0
  125. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp +228 -0
  126. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.h +110 -0
  127. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp +64 -0
  128. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h +50 -0
  129. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +758 -0
  130. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +85 -0
  131. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp +621 -0
  132. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.h +61 -0
  133. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp +63 -0
  134. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.h +87 -0
  135. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.cpp +72 -0
  136. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.h +133 -0
  137. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNType.h +20 -0
  138. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.cpp +14 -0
  139. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.h +24 -0
  140. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.cpp +33 -0
  141. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.h +33 -0
  142. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AmbiguityInfo.cpp +16 -0
  143. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AmbiguityInfo.h +68 -0
  144. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp +82 -0
  145. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h +43 -0
  146. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.cpp +31 -0
  147. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.h +30 -0
  148. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.cpp +12 -0
  149. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h +22 -0
  150. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.cpp +12 -0
  151. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.h +21 -0
  152. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.cpp +15 -0
  153. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.h +24 -0
  154. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.cpp +9 -0
  155. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.h +21 -0
  156. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.cpp +14 -0
  157. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.h +47 -0
  158. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionEventInfo.cpp +14 -0
  159. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionEventInfo.h +70 -0
  160. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.cpp +25 -0
  161. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.h +227 -0
  162. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.cpp +17 -0
  163. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.h +30 -0
  164. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.cpp +35 -0
  165. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.h +27 -0
  166. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp +35 -0
  167. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.h +39 -0
  168. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ErrorInfo.cpp +15 -0
  169. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ErrorInfo.h +43 -0
  170. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +158 -0
  171. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +109 -0
  172. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp +84 -0
  173. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.h +44 -0
  174. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp +628 -0
  175. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +210 -0
  176. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.cpp +9 -0
  177. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.h +66 -0
  178. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp +107 -0
  179. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h +115 -0
  180. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionType.h +55 -0
  181. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp +55 -0
  182. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.h +63 -0
  183. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp +62 -0
  184. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.h +87 -0
  185. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp +63 -0
  186. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h +82 -0
  187. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp +56 -0
  188. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.h +61 -0
  189. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp +47 -0
  190. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.h +57 -0
  191. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp +47 -0
  192. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h +57 -0
  193. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp +56 -0
  194. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h +61 -0
  195. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp +47 -0
  196. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.h +55 -0
  197. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp +56 -0
  198. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.h +55 -0
  199. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.cpp +16 -0
  200. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.h +42 -0
  201. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.cpp +12 -0
  202. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.h +22 -0
  203. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Makefile +67 -0
  204. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp +27 -0
  205. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.h +25 -0
  206. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp +12 -0
  207. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h +20 -0
  208. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParseInfo.cpp +102 -0
  209. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParseInfo.h +102 -0
  210. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +1366 -0
  211. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h +904 -0
  212. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.cpp +12 -0
  213. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h +25 -0
  214. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.cpp +12 -0
  215. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h +22 -0
  216. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp +32 -0
  217. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h +29 -0
  218. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp +17 -0
  219. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h +62 -0
  220. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp +34 -0
  221. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.h +39 -0
  222. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.cpp +662 -0
  223. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.h +254 -0
  224. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.cpp +201 -0
  225. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.h +436 -0
  226. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp +179 -0
  227. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h +60 -0
  228. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.cpp +30 -0
  229. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.h +29 -0
  230. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.cpp +16 -0
  231. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.h +25 -0
  232. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.cpp +12 -0
  233. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.h +25 -0
  234. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.cpp +37 -0
  235. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.h +40 -0
  236. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.cpp +377 -0
  237. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.h +222 -0
  238. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.cpp +32 -0
  239. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.h +30 -0
  240. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp +81 -0
  241. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h +36 -0
  242. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.cpp +12 -0
  243. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.h +21 -0
  244. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.cpp +15 -0
  245. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h +35 -0
  246. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp +19 -0
  247. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.h +21 -0
  248. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.cpp +12 -0
  249. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.h +21 -0
  250. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.cpp +44 -0
  251. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.h +76 -0
  252. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp +25 -0
  253. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.h +25 -0
  254. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.cpp +127 -0
  255. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.h +91 -0
  256. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +67 -0
  257. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.h +32 -0
  258. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.cpp +100 -0
  259. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.h +144 -0
  260. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp +20 -0
  261. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h +23 -0
  262. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.cpp +124 -0
  263. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.h +31 -0
  264. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.cpp +89 -0
  265. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.h +84 -0
  266. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +521 -0
  267. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.h +198 -0
  268. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.cpp +134 -0
  269. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.h +76 -0
  270. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Predicate.cpp +4 -0
  271. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Predicate.h +21 -0
  272. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.cpp +13 -0
  273. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.h +170 -0
  274. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.cpp +43 -0
  275. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.h +110 -0
  276. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/BitSet.h +76 -0
  277. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.cpp +248 -0
  278. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.h +78 -0
  279. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Declarations.h +163 -0
  280. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.cpp +36 -0
  281. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +54 -0
  282. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.cpp +303 -0
  283. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.h +112 -0
  284. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h +128 -0
  285. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.cpp +9 -0
  286. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.h +19 -0
  287. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp +23 -0
  288. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h +33 -0
  289. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.cpp +71 -0
  290. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.h +53 -0
  291. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.cpp +15 -0
  292. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.h +102 -0
  293. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeListener.cpp +9 -0
  294. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeListener.h +39 -0
  295. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeProperty.h +50 -0
  296. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.cpp +9 -0
  297. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h +57 -0
  298. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp +49 -0
  299. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +31 -0
  300. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.cpp +9 -0
  301. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.h +32 -0
  302. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp +57 -0
  303. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h +33 -0
  304. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.cpp +241 -0
  305. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.h +78 -0
  306. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/Chunk.cpp +9 -0
  307. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/Chunk.h +44 -0
  308. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.cpp +69 -0
  309. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.h +132 -0
  310. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +64 -0
  311. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.h +105 -0
  312. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +371 -0
  313. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.h +185 -0
  314. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.cpp +77 -0
  315. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.h +117 -0
  316. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TagChunk.cpp +39 -0
  317. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TagChunk.h +86 -0
  318. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TextChunk.cpp +28 -0
  319. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TextChunk.h +51 -0
  320. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.cpp +36 -0
  321. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.h +80 -0
  322. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +154 -0
  323. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.h +86 -0
  324. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathElement.cpp +31 -0
  325. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathElement.h +40 -0
  326. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp +173 -0
  327. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.g4 +64 -0
  328. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h +56 -0
  329. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.tokens +12 -0
  330. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp +13 -0
  331. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h +22 -0
  332. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp +20 -0
  333. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.h +27 -0
  334. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +30 -0
  335. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.h +26 -0
  336. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp +20 -0
  337. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.h +25 -0
  338. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +33 -0
  339. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.h +26 -0
  340. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp +23 -0
  341. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.h +23 -0
  342. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp +24 -0
  343. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.h +23 -0
  344. data/ext/express-parser/antlrgen/Express.interp +532 -0
  345. data/ext/express-parser/antlrgen/Express.tokens +190 -0
  346. data/ext/express-parser/antlrgen/ExpressBaseListener.cpp +7 -0
  347. data/ext/express-parser/antlrgen/ExpressBaseListener.h +623 -0
  348. data/ext/express-parser/antlrgen/ExpressBaseVisitor.cpp +7 -0
  349. data/ext/express-parser/antlrgen/ExpressBaseVisitor.h +816 -0
  350. data/ext/express-parser/antlrgen/ExpressLexer.cpp +1169 -0
  351. data/ext/express-parser/antlrgen/ExpressLexer.h +85 -0
  352. data/ext/express-parser/antlrgen/ExpressLexer.interp +534 -0
  353. data/ext/express-parser/antlrgen/ExpressLexer.tokens +190 -0
  354. data/ext/express-parser/antlrgen/ExpressListener.cpp +7 -0
  355. data/ext/express-parser/antlrgen/ExpressListener.h +616 -0
  356. data/ext/express-parser/antlrgen/ExpressParser.cpp +17284 -0
  357. data/ext/express-parser/antlrgen/ExpressParser.h +3696 -0
  358. data/ext/express-parser/antlrgen/ExpressVisitor.cpp +7 -0
  359. data/ext/express-parser/antlrgen/ExpressVisitor.h +422 -0
  360. data/ext/express-parser/express_parser.cpp +17931 -0
  361. data/ext/express-parser/extconf.rb +34 -0
  362. data/lib/express_parser.so +0 -0
  363. data/lib/expressir.rb +21 -0
  364. data/lib/expressir/cli.rb +27 -0
  365. data/lib/expressir/cli/ui.rb +36 -0
  366. data/lib/expressir/config.rb +23 -0
  367. data/lib/expressir/express.rb +11 -0
  368. data/lib/expressir/express/aggregate_dimension.rb +38 -0
  369. data/lib/expressir/express/attribute.rb +15 -0
  370. data/lib/expressir/express/comment.rb +7 -0
  371. data/lib/expressir/express/defined_type.rb +36 -0
  372. data/lib/expressir/express/derived.rb +65 -0
  373. data/lib/expressir/express/derived_aggregate.rb +43 -0
  374. data/lib/expressir/express/entity.rb +137 -0
  375. data/lib/expressir/express/explicit.rb +70 -0
  376. data/lib/expressir/express/explicit_aggregate.rb +46 -0
  377. data/lib/expressir/express/explicit_or_derived.rb +16 -0
  378. data/lib/expressir/express/global_rule.rb +44 -0
  379. data/lib/expressir/express/interface_specification.rb +51 -0
  380. data/lib/expressir/express/interfaced_item.rb +38 -0
  381. data/lib/expressir/express/inverse.rb +46 -0
  382. data/lib/expressir/express/inverse_aggregate.rb +37 -0
  383. data/lib/expressir/express/model_element.rb +7 -0
  384. data/lib/expressir/express/named_type.rb +19 -0
  385. data/lib/expressir/express/remark.rb +8 -0
  386. data/lib/expressir/express/repository.rb +306 -0
  387. data/lib/expressir/express/schema_definition.rb +96 -0
  388. data/lib/expressir/express/subtype_constraint.rb +14 -0
  389. data/lib/expressir/express/type.rb +26 -0
  390. data/lib/expressir/express/type_aggregate.rb +42 -0
  391. data/lib/expressir/express/type_enum.rb +29 -0
  392. data/lib/expressir/express/type_parser.rb +45 -0
  393. data/lib/expressir/express/type_select.rb +82 -0
  394. data/lib/expressir/express/unique_rule.rb +35 -0
  395. data/lib/expressir/express/where_rule.rb +32 -0
  396. data/lib/expressir/express_exp/formatter.rb +1450 -0
  397. data/lib/expressir/express_exp/parser.rb +36 -0
  398. data/lib/expressir/express_exp/visitor.rb +2451 -0
  399. data/lib/expressir/express_parser.rb +30 -0
  400. data/lib/expressir/model.rb +65 -0
  401. data/lib/expressir/model/attribute.rb +27 -0
  402. data/lib/expressir/model/constant.rb +17 -0
  403. data/lib/expressir/model/entity.rb +46 -0
  404. data/lib/expressir/model/enumeration_item.rb +11 -0
  405. data/lib/expressir/model/expressions/aggregate_initializer.rb +13 -0
  406. data/lib/expressir/model/expressions/aggregate_item.rb +15 -0
  407. data/lib/expressir/model/expressions/attribute_reference.rb +15 -0
  408. data/lib/expressir/model/expressions/binary_expression.rb +40 -0
  409. data/lib/expressir/model/expressions/call.rb +15 -0
  410. data/lib/expressir/model/expressions/entity_constructor.rb +15 -0
  411. data/lib/expressir/model/expressions/group_reference.rb +15 -0
  412. data/lib/expressir/model/expressions/index_reference.rb +17 -0
  413. data/lib/expressir/model/expressions/interval.rb +21 -0
  414. data/lib/expressir/model/expressions/query_expression.rb +26 -0
  415. data/lib/expressir/model/expressions/simple_reference.rb +13 -0
  416. data/lib/expressir/model/expressions/unary_expression.rb +19 -0
  417. data/lib/expressir/model/function.rb +62 -0
  418. data/lib/expressir/model/identifier.rb +9 -0
  419. data/lib/expressir/model/interface.rb +18 -0
  420. data/lib/expressir/model/literals/binary.rb +13 -0
  421. data/lib/expressir/model/literals/integer.rb +13 -0
  422. data/lib/expressir/model/literals/logical.rb +17 -0
  423. data/lib/expressir/model/literals/real.rb +13 -0
  424. data/lib/expressir/model/literals/string.rb +15 -0
  425. data/lib/expressir/model/parameter.rb +17 -0
  426. data/lib/expressir/model/procedure.rb +60 -0
  427. data/lib/expressir/model/renamed_ref.rb +13 -0
  428. data/lib/expressir/model/repository.rb +19 -0
  429. data/lib/expressir/model/rule.rb +62 -0
  430. data/lib/expressir/model/schema.rb +67 -0
  431. data/lib/expressir/model/scope.rb +17 -0
  432. data/lib/expressir/model/statements/alias.rb +26 -0
  433. data/lib/expressir/model/statements/assignment.rb +15 -0
  434. data/lib/expressir/model/statements/call.rb +15 -0
  435. data/lib/expressir/model/statements/case.rb +17 -0
  436. data/lib/expressir/model/statements/case_action.rb +15 -0
  437. data/lib/expressir/model/statements/compound.rb +13 -0
  438. data/lib/expressir/model/statements/escape.rb +8 -0
  439. data/lib/expressir/model/statements/if.rb +17 -0
  440. data/lib/expressir/model/statements/null.rb +8 -0
  441. data/lib/expressir/model/statements/repeat.rb +34 -0
  442. data/lib/expressir/model/statements/return.rb +13 -0
  443. data/lib/expressir/model/statements/skip.rb +8 -0
  444. data/lib/expressir/model/subtype_constraint.rb +27 -0
  445. data/lib/expressir/model/type.rb +24 -0
  446. data/lib/expressir/model/types/aggregate.rb +17 -0
  447. data/lib/expressir/model/types/array.rb +21 -0
  448. data/lib/expressir/model/types/bag.rb +17 -0
  449. data/lib/expressir/model/types/binary.rb +15 -0
  450. data/lib/expressir/model/types/boolean.rb +8 -0
  451. data/lib/expressir/model/types/enumeration.rb +19 -0
  452. data/lib/expressir/model/types/generic.rb +13 -0
  453. data/lib/expressir/model/types/generic_entity.rb +13 -0
  454. data/lib/expressir/model/types/integer.rb +8 -0
  455. data/lib/expressir/model/types/list.rb +19 -0
  456. data/lib/expressir/model/types/logical.rb +8 -0
  457. data/lib/expressir/model/types/number.rb +8 -0
  458. data/lib/expressir/model/types/real.rb +13 -0
  459. data/lib/expressir/model/types/select.rb +21 -0
  460. data/lib/expressir/model/types/set.rb +17 -0
  461. data/lib/expressir/model/types/string.rb +15 -0
  462. data/lib/expressir/model/unique.rb +15 -0
  463. data/lib/expressir/model/variable.rb +17 -0
  464. data/lib/expressir/model/where.rb +15 -0
  465. data/lib/expressir/parser.rb +6 -0
  466. data/lib/expressir/parser/owl_parser.rb +8 -0
  467. data/lib/expressir/version.rb +3 -0
  468. data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.exp +9589 -0
  469. data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.owl +36619 -0
  470. data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.xml +13294 -0
  471. data/original/examples/employment/eclipse/.project +17 -0
  472. data/original/examples/employment/eclipse/Export/Employment.png +0 -0
  473. data/original/examples/employment/eclipse/Express/employment_schema.exp +33 -0
  474. data/original/examples/employment/eclipse/Express/employment_schema.xmi +77 -0
  475. data/original/examples/employment/eclipse/Express/employment_schema.xml +93 -0
  476. data/original/examples/employment/eclipse/Models/Employment.uml +4 -0
  477. data/original/examples/employment/eclipse/Models/Employment.umldi +240 -0
  478. data/original/examples/employment/eclipse/readme.txt +7 -0
  479. data/original/examples/employment/employment_schema.exp +33 -0
  480. data/original/examples/employment/employment_schema.rb +232 -0
  481. data/original/examples/employment/employment_schema.xml +93 -0
  482. data/original/examples/employment/employment_schema___module.rb +46 -0
  483. data/original/examples/employment/employment_schema___p28attr.rb +126 -0
  484. data/original/examples/employment/employment_schema___p28inst.rb +26 -0
  485. data/original/examples/employment/example_employment_data.xml +1 -0
  486. data/original/examples/employment/example_employment_data_copy.xml +1 -0
  487. data/original/examples/employment/example_employment_reader.rb +30 -0
  488. data/original/examples/employment/example_employment_writer.rb +51 -0
  489. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.exp +3710 -0
  490. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.owl +35880 -0
  491. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xmi +15357 -0
  492. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xml +9468 -0
  493. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.exp +8404 -0
  494. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl +43147 -0
  495. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi +18341 -0
  496. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml +11632 -0
  497. data/original/examples/syntax/remark.exp +145 -0
  498. data/original/examples/syntax/remark_formatted.exp +174 -0
  499. data/original/examples/syntax/syntax.exp +310 -0
  500. data/original/examples/syntax/syntax_formatted.exp +1187 -0
  501. data/original/exp2ruby.rb +525 -0
  502. data/original/expsm.rb +34 -0
  503. data/original/mapping_owl.rb +1018 -0
  504. data/original/mapping_sysml.rb +2281 -0
  505. data/original/mapping_uml2.rb +599 -0
  506. data/original/mapping_uml2_eclipse.rb +433 -0
  507. data/original/reeper.rb +134 -0
  508. data/spec/acceptance/express_to_owl_spec.rb +18 -0
  509. data/spec/acceptance/version_spec.rb +12 -0
  510. data/spec/expressir/express/repository_spec.rb +25 -0
  511. data/spec/expressir/express_exp/ap233_spec.rb +22 -0
  512. data/spec/expressir/express_exp/format_remark_spec.rb +28 -0
  513. data/spec/expressir/express_exp/format_syntax_spec.rb +28 -0
  514. data/spec/expressir/express_exp/parse_remark_spec.rb +345 -0
  515. data/spec/expressir/express_exp/parse_syntax_spec.rb +2998 -0
  516. data/spec/expressir/model/find_spec.rb +110 -0
  517. data/spec/expressr_spec.rb +5 -0
  518. data/spec/spec_helper.rb +17 -0
  519. data/spec/support/console_helper.rb +29 -0
  520. metadata +695 -0
@@ -0,0 +1,34 @@
1
+ ## EXPRESS STEPMod Model Ruby Classes
2
+ ## Version 0.1
3
+ ##
4
+ ## The Ruby classes in the model are based on the STEPMod DTD.
5
+ ##
6
+
7
+ ## process descriptions in external XML file
8
+ def load_descriptions( descxml, therepos )
9
+
10
+ desc_list = descxml.elements.to_a("//ext_descriptions/ext_description")
11
+ desclinkend_list = []
12
+ XPath.each( descxml, '//ext_descriptions/ext_description/@linkend' ) { |n| desclinkend_list.push n.to_s }
13
+ count_desc = desc_list.size
14
+ puts "-- Processing descriptions . Count is #{count_desc.to_s}"
15
+
16
+ for schema in therepos.schemas
17
+
18
+ for decl in schema.contents
19
+ if decl.kind_of? EXPSM::Entity
20
+ pos = desclinkend_list.index(schema.name + '.' + decl.name)
21
+ if pos != nil
22
+ if desc_list[pos].has_elements?
23
+ defn = 'ELEMENTS_FOUND'
24
+ else
25
+ defn = desc_list[pos].text
26
+ end
27
+ defn = defn.gsub('"','*')
28
+ decl.definition = defn.strip
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+
@@ -0,0 +1,1018 @@
1
+ require 'erb'
2
+ # EXPRESS to OWL Structural Mapping
3
+ # Version 0.5
4
+ # This function navigates the EXPRESS STEPMod Model Ruby Classes
5
+ # and performs a structural EXPRESS-to-OWL mapping using Ruby ERB templates.
6
+ # The output is in OWL RDF/XML abbreviated syntax.
7
+ # Mapping summary reports constructs where mapping is not sufficient (i.e. may need editing) or uses newer OWL capabilities
8
+ #
9
+ # Configurable items are:
10
+ # If file named definitions.csv is found, definitions of items are read from that CSV.
11
+ # Double quotes around ITEM and DEFINITION column values is required
12
+ # include_dublin_core - If true, import of the Dublin Core OWL is included. Set to true if dc used in annotation_list
13
+ # annotation_list - added to each construct created if found. Annotations are added if not 'nil'.
14
+ # usr_base of namespace for OWL constructs
15
+ # top_class - if not nil, makes every OWL class created a subclass if this class which is added to output
16
+ # thing_attributes - if specified, OWL DatatypeProperty domain is set to OWL Thing and range set to string
17
+ # datatype_hash - sets mappings for EXPRESS builtin to XSD datatypes
18
+ # post_processed_schema - If true, write post-processed schema data (e.g. propety hash) for inclusion in other program or script
19
+ #
20
+ # Mappings are:
21
+ # Entity Types and Subtypes are mapped to OWL Class hierarchy.
22
+ # Entity Type SUPERTYPE OF ONEOF( list-of-EntityTypes ) are mapped to OWL disjoint between Classes
23
+ # Select Types that resolve to all Entity Types are mapped to OWL Class hierarchy.
24
+ # Select Types that resolve to all Type are mapped to RDFS Datatype.
25
+ # Select Types that resolve to mixed Entity Types and Type are mapped to OWL Class hierarchy, so may need cleanup
26
+ # Enumeration Types are mapped to OWL Enumerated Classes
27
+ # Type = builtin are mapped to RDFS Datatypes that subtype XSD datatypes
28
+ # Type of Type of ... that ultimately resolve to builtin are mapped to datatype subtype hierarchy
29
+ # Explicit attrs of Type = builtin are mapped to OWL DatatypeProperties
30
+ # Type = AGGR are mapped to subClassOf rdf:List and type of element not specified
31
+
32
+ # Explicit attrs of 1-D LIST/ARRAY OF builtin/Type = builtin mapped to OWL ObjectProperty and subClassOf rdf:List and cardinality 1
33
+ # Explicit attrs of n-D AGGR mapped to OWL ObjectProperty and subClassOf rdf:List, type of element not specified, and cardinality 1
34
+
35
+ # Inverse attrs are mapped to OWL DatatypeProperties with inverseOf set, except inverse of inherited not mapped
36
+ # BOOLEAN attributes are mapped to OWL DatatypeProperties.
37
+
38
+ # Attribute redeclarations that ref Entity/Select are mapped to ObjectProperty that is subproperty of that it redeclares
39
+ # Attribute redeclarations that ref builting simple types are mapped to DatatypeProperty that is subproperty of that it redeclares
40
+ # Type = type that is a select are mapped to Class subclass of referenced select Class
41
+ # Single Attribute OPTIONAL or not maps to cardinality restriction on Class owning attribute
42
+ # 1D SET/BAG Attribute bound maps to cardinality restriction on Class owning attribute
43
+ # n-dimensional aggregates map to rdf List with no internal structure and type of element not specified
44
+
45
+
46
+ #
47
+ def map_from_express( mapinput )
48
+ puts ' '
49
+ puts 'EXPRESS to OWL Structural Mapping V0.5'
50
+ puts ' '
51
+
52
+ ######### Mapping Configuration Starts Here ##############
53
+
54
+ # Set the base of the URI (i.e. the namespace) for OWL constructs created during the mapping
55
+ uri_base = 'http://www.reeper.org'
56
+
57
+ # Add RDFS andor Dublin Core basic annotations
58
+
59
+ # Set to true if any annotation_list elements use Dublin Core (dc: or dcterms:)
60
+ include_dublin_core = false
61
+
62
+ annotation_list = Array.new
63
+ # rdfs:comment must be position 0 as definition assignment hardcoded there
64
+ #annotation_list[0] = ['rdfs:comment', nil]
65
+ #annotation_list[1] = ['owl:versionInfo', '1']
66
+ #annotation_list[2] = ['dc:creator', 'David Price, TopQuadrant Limited']
67
+ #annotation_list[3] = ['dcterms:created','2010-10-22']
68
+ #annotation_list[4] = ['dc:source', '{ iso standard 10303 part(214) version(2) object(1) automotive-design-schema(1) }']
69
+
70
+ # Read definitions from csv file if found
71
+ definition_hash = Hash.new
72
+ if FileTest.exist?('definitions.csv')
73
+ require 'csv'
74
+ puts '-- Definitions CSV File Found'
75
+ CSV.open('definitions.csv', 'r') do |row|
76
+ definition_hash[row[0].downcase] = row[1]
77
+ end
78
+ end
79
+
80
+ # set to class name (e.g. 'TOP-THING') to make all created OWL Classes subclasses of a topmost class
81
+ top_class = 'AP233-ARM-THING'
82
+
83
+ # add common string attributes to use OWL Thing as domain rather than schema classes
84
+ thing_attributes = []
85
+ #thing_attributes.push 'id'
86
+ #thing_attributes.push 'name'
87
+ #thing_attributes.push 'description'
88
+
89
+ # datatypes for simple and aggregates of simple type
90
+ datatype_hash = Hash.new
91
+ datatype_hash["INTEGER"] = 'http://www.w3.org/2001/XMLSchema#integer'
92
+ datatype_hash["REAL"] = 'http://www.w3.org/2001/XMLSchema#float'
93
+ datatype_hash["NUMBER"] = 'http://www.w3.org/2001/XMLSchema#float'
94
+ datatype_hash["BINARY"] = 'http://www.w3.org/2001/XMLSchema#hexBinary'
95
+ datatype_hash["BOOLEAN"] = 'http://www.w3.org/2001/XMLSchema#boolean'
96
+ datatype_hash["LOGICAL"] = 'http://www.w3.org/2001/XMLSchema#boolean'
97
+ datatype_hash["STRING"] = 'http://www.w3.org/2001/XMLSchema#string'
98
+
99
+ # Write the property_type_hash for inclusion in other scripts or not
100
+ post_processed_schema = false
101
+ post_processed_schema_file_name = 'postprocessed_schema.rb'
102
+ post_processed_schema_file = File.new(post_processed_schema_file_name,'w') if post_processed_schema
103
+
104
+ ######### Mapping Configuration Ends Here ##############
105
+
106
+
107
+ # Template covering the start of the output file
108
+ overall_start_template = %{<rdf:RDF
109
+ xmlns:owl="http://www.w3.org/2002/07/owl#"
110
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
111
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
112
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
113
+ <% if include_dublin_core %>
114
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
115
+ xmlns:dcterms="http://purl.org/dc/terms/"
116
+ <% end %>
117
+ }
118
+
119
+ # Template covering the output file contents for each schema start
120
+ schema_start_template = %{xmlns="<%= uri_base %>/<%= schema.name %>#"
121
+ xml:base="<%= uri_base %>/<%= schema.name %>#" >
122
+
123
+ <owl:Ontology rdf:about='' rdfs:label='<%= schema.name %>' >
124
+ <% annotation_list.each do |i| %><% if i[1] != nil and i[1] != '' %><<%= i[0] %> rdf:datatype="http://www.w3.org/2001/XMLSchema#string"><%= i[1] %></<%= i[0] %>><% end %>
125
+ <% end %>
126
+ <% if include_dublin_core %>
127
+ <owl:imports rdf:resource="http://purl.org/dc/terms/"/>
128
+ <owl:imports rdf:resource="http://purl.org/dc/elements/1.1/"/>
129
+ <% end %>
130
+ </owl:Ontology>
131
+ <% if top_class != nil %>
132
+ <owl:Class rdf:ID='<%= top_class %>' />
133
+ <% end %>
134
+ }
135
+
136
+ # Template covering the output file contents for each entity type start or start of type = type that is a select
137
+ entity_start_template = %{
138
+ <owl:Class rdf:ID='<%= class_name %>' >
139
+ <% annotation_list.each do |i| %><% if i[1] != nil and i[1] != '' %><<%= i[0] %> rdf:datatype="http://www.w3.org/2001/XMLSchema#string"><%= i[1] %></<%= i[0] %>><% end %>
140
+ <% end %>
141
+ }
142
+ # Template covering the output file contents for each entity type end or end of type = type that is a select
143
+ entity_end_template = %{
144
+ <% if top_class != nil %>
145
+ <rdfs:subClassOf rdf:resource='#<%= top_class %>' />
146
+ <% end %>
147
+ </owl:Class>
148
+ }
149
+
150
+ # Template covering the output file contents for end of type = type that is a select
151
+ class_end_template = %{</owl:Class>}
152
+
153
+ # Template covering the output file contents for each select type start
154
+ select_start_template = %{
155
+ <owl:Class rdf:ID='<%= select.name %>' >
156
+ <% annotation_list.each do |i| %><% if i[1] != nil and i[1] != '' %><<%= i[0] %> rdf:datatype="http://www.w3.org/2001/XMLSchema#string"><%= i[1] %></<%= i[0] %>><% end %>
157
+ <% end %>
158
+ }
159
+ # Template covering the output file contents for each select type end
160
+ select_end_template = %{<% if top_class != nil %>
161
+ <rdfs:subClassOf rdf:resource='#<%= top_class %>' />
162
+ <% end %>
163
+ </owl:Class>
164
+ }
165
+
166
+ # Template covering the supertype(s) for each entity type and type = type that is a select
167
+ supertype_template = %{<rdfs:subClassOf rdf:resource='#<%= superclass_name %>' />
168
+ }
169
+
170
+ # Template covering OWL collections of class contents
171
+ class_collection_template = %{<owl:Class><owl:unionOf rdf:parseType="Collection">
172
+ <% item_name_list.each do |name| %>
173
+ <rdf:Description rdf:about='#<%= name %>'/>
174
+ <% end %>
175
+ </owl:unionOf>
176
+ </owl:Class>}
177
+
178
+ # Template covering OWL collections of RDFS datatypes
179
+ datatype_collection_template = %{<rdfs:Datatype rdf:ID='<%= type_name %>'>
180
+ <owl:equivalentClass><rdfs:Datatype><owl:unionOf rdf:parseType="Collection">
181
+ <% type_name_list.each do |name| %>
182
+ <rdf:Description rdf:about='#<%= name %>' />
183
+ <% end %>
184
+ </owl:unionOf>
185
+ </rdfs:Datatype></owl:equivalentClass>
186
+ </rdfs:Datatype>}
187
+
188
+ # Template covering abstract entity types
189
+ abstract_entity_template = %{<rdfs:subClassOf rdf:resource='#<%= supertype.name %>' />
190
+ }
191
+
192
+ # Template covering the output file contents for each defined type of builtin datatype
193
+ type_builtin_template = %{
194
+ <rdfs:Datatype rdf:ID='<%= datatype_name %>'>
195
+ <rdfs:subClassOf rdf:resource='<%= superdatatype_name %>'/>
196
+ </rdfs:Datatype>
197
+ }
198
+
199
+ # Template covering the mappings to rdf list
200
+ rdflist_template = %{<rdfs:Class rdf:ID='<%= list_name %>'>
201
+ <rdfs:subClassOf rdf:resource='<%= superlist_name %>'/>
202
+ </rdfs:Class>}
203
+
204
+ # Template covering the output file contents for each attribute that is an aggregate
205
+ attribute_aggregate_template = %{}
206
+
207
+ # Template covering the output file contents for each attribute that is an aggregate of select of entity
208
+ attribute_aggregate_entity_select_template = %{}
209
+
210
+ # Template covering the output file contents for each attribute that is a select of entity
211
+ attribute_entity_select_template = %{}
212
+
213
+ # Template covering the output file contents for each attribute
214
+ attribute_template = %{}
215
+
216
+ # Template covering the output file contents for each attribute that is builtin datatype
217
+ attribute_builtin_template = %{<owl:DatatypeProperty rdf:ID='<%= owl_property_name %>'>
218
+ <% if owl_property_domain != nil %>
219
+ <rdfs:domain rdf:resource='#<%= owl_property_domain %>' />
220
+ <% end %>
221
+ <rdfs:range rdf:resource='<%= owl_property_range %>' />
222
+ <% annotation_list.each do |i| %><% if i[1] != nil and i[1] != '' %><<%= i[0] %> rdf:datatype="http://www.w3.org/2001/XMLSchema#string"><%= i[1] %></<%= i[0] %>><% end %>
223
+ <% end %>
224
+ <% if owl_super_property_name != nil %>
225
+ <rdfs:subPropertyOf rdf:resource='#<%= owl_super_property_name %>' />
226
+ <% end %>
227
+ </owl:DatatypeProperty>
228
+ }
229
+
230
+ # Template covering the output file contents for each attribute that is type that is builtin datatype
231
+ attribute_typebuiltin_template = %{<owl:DatatypeProperty rdf:ID='<%= owl_property_name %>'>
232
+ <% if owl_property_domain != nil %>
233
+ <rdfs:domain rdf:resource='#<%= owl_property_domain %>' />
234
+ <% end %>
235
+ <rdfs:range rdf:resource='#<%= owl_property_range %>' />
236
+ <% annotation_list.each do |i| %><% if i[1] != nil and i[1] != '' %><<%= i[0] %> rdf:datatype="http://www.w3.org/2001/XMLSchema#string"><%= i[1] %></<%= i[0] %>><% end %>
237
+ <% end %>
238
+ </owl:DatatypeProperty>
239
+ }
240
+
241
+ # Template covering the output file contents for each attribute that is entity or select type
242
+ attribute_entity_template = %{<owl:ObjectProperty rdf:ID='<%= owl_property_name %>'>
243
+ <rdfs:domain rdf:resource='#<%= owl_property_domain %>' />
244
+ <rdfs:range rdf:resource='#<%= owl_property_range %>' />
245
+ <% annotation_list.each do |i| %><% if i[1] != nil and i[1] != '' %><<%= i[0] %> rdf:datatype="http://www.w3.org/2001/XMLSchema#string"><%= i[1] %></<%= i[0] %>><% end %>
246
+ <% end %>
247
+ </owl:ObjectProperty>
248
+ }
249
+
250
+ # Template covering the output file contents for each attribute that is entity or select type
251
+ inverse_entity_template = %{<owl:ObjectProperty rdf:ID='<%= owl_property_name %>'>
252
+ <rdfs:domain rdf:resource='#<%= owl_property_domain %>' />
253
+ <rdfs:range rdf:resource='#<%= owl_property_range %>' />
254
+ <% annotation_list.each do |i| %><% if i[1] != nil and i[1] != '' %><<%= i[0] %> rdf:datatype="http://www.w3.org/2001/XMLSchema#string"><%= i[1] %></<%= i[0] %>><% end %>
255
+ <% end %>
256
+ <owl:inverseOf rdf:resource="#<%= owl_inverted_property_name %>"/>
257
+ </owl:ObjectProperty>
258
+ }
259
+
260
+ # Template covering the output file contents for each attribute that is a redeclaration and reference to an entity or select type
261
+ attribute_redeclare_entity_template = %{<owl:ObjectProperty rdf:ID='<%= owl_property_name %>'>
262
+ <rdfs:domain rdf:resource='#<%= owl_property_domain %>' />
263
+ <rdfs:range rdf:resource='#<%= owl_property_range %>' />
264
+ <rdfs:subPropertyOf rdf:resource='#<%= owl_super_property_name %>' />
265
+ <% annotation_list.each do |i| %><% if i[1] != nil and i[1] != '' %><<%= i[0] %> rdf:datatype="http://www.w3.org/2001/XMLSchema#string"><%= i[1] %></<%= i[0] %>><% end %>
266
+ <% end %>
267
+ </owl:ObjectProperty>
268
+ }
269
+
270
+
271
+
272
+ # Template covering the output file contents for each attribute that is enum datatype
273
+ class_enum_template = %{<owl:Class rdf:ID='<%= owl_class_name %>'>
274
+ <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
275
+ <owl:oneOf rdf:parseType="Collection">
276
+ <% enumitem_name_list.each do |name| %>
277
+ <rdf:Description rdf:ID="<%= owl_class_name + '.' + name %>"/>
278
+ <% end %>
279
+ </owl:oneOf>
280
+ </owl:Class>}
281
+
282
+
283
+ # Template covering the output file contents for each attribute that is enum datatype
284
+ attribute_enum_template = %{<owl:DatatypeProperty rdf:ID='<%= owl_property_name %>'>
285
+ <rdfs:domain rdf:resource='#<%= owl_property_domain %>' />
286
+ <rdfs:range><owl:DataRange><owl:oneOf><rdf:List>
287
+ <% enumitem_name_list.each do |name| %>
288
+ <rdf:first rdf:datatype="http://www.w3.org/2001/XMLSchema#string"><%= name %></rdf:first>
289
+ <% if enumitem_name_list[enumitem_name_list.size-1] != name %>
290
+ <rdf:rest><rdf:List>
291
+ <% end %>
292
+ <% if enumitem_name_list[enumitem_name_list.size-1] == name %>
293
+ <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/> </rdf:List>
294
+ <% end %>
295
+ <% end %>
296
+ <% (1..enumitem_name_list.size-1).each do %>
297
+ </rdf:rest></rdf:List>
298
+ <% end %>
299
+ </owl:oneOf></owl:DataRange></rdfs:range>
300
+ <% annotation_list.each do |i| %><% if i[1] != nil and i[1] != '' %><<%= i[0] %> rdf:datatype="http://www.w3.org/2001/XMLSchema#string"><%= i[1] %></<%= i[0] %>><% end %>
301
+ <% end %>
302
+ </owl:DatatypeProperty>}
303
+
304
+
305
+
306
+ # Template covering min cardinality
307
+ min_cardinality_template = %{<rdf:Description rdf:about='#<%= class_name %>'>
308
+ <rdfs:subClassOf>
309
+ <owl:Restriction>
310
+ <owl:onProperty rdf:resource='#<%= owl_property_name %>'/>
311
+ <owl:minCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger"><%= min_cardinality %></owl:minCardinality>
312
+ </owl:Restriction>
313
+ </rdfs:subClassOf>
314
+ </rdf:Description>}
315
+
316
+
317
+ # Template covering max cardinality
318
+ max_cardinality_template = %{<rdf:Description rdf:about='#<%= class_name %>'>
319
+ <rdfs:subClassOf>
320
+ <owl:Restriction>
321
+ <owl:onProperty rdf:resource='#<%= owl_property_name %>'/>
322
+ <owl:maxCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger"><%= max_cardinality %></owl:maxCardinality>
323
+ </owl:Restriction>
324
+ </rdfs:subClassOf>
325
+ </rdf:Description>}
326
+
327
+ # Template covering cardinality
328
+ cardinality_template = %{<rdf:Description rdf:about='#<%= class_name %>'>
329
+ <rdfs:subClassOf>
330
+ <owl:Restriction>
331
+ <owl:onProperty rdf:resource='#<%= owl_property_name %>'/>
332
+ <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger"><%= min_cardinality %></owl:cardinality>
333
+ </owl:Restriction>
334
+ </rdfs:subClassOf>
335
+ </rdf:Description>}
336
+
337
+ # Template covering the output file contents for each schema end
338
+ disjoint_template = %{
339
+ <rdf:Description rdf:about='#<%= first_class_name %>'>
340
+ <owl:disjointWith rdf:resource="#<%= disjoint_class_name %>"/>
341
+ </rdf:Description>}
342
+
343
+
344
+ # Template covering the output file contents for each schema end
345
+ schema_end_template = %{}
346
+
347
+ # Template covering the end of the output file
348
+ overall_end_template = %{ </rdf:RDF>}
349
+
350
+
351
+ def post_process_entity(entity, post_processed_schema_file, datatype_hash)
352
+ attribute_list = entity.attributes_all_array.find_all{ |a| a.kind_of? EXPSM::Explicit}
353
+
354
+ for attribute in attribute_list
355
+
356
+ express_attribute_domain = nil
357
+ if !attribute.isBuiltin
358
+ express_attribute_domain = NamedType.find_by_name( attribute.domain )
359
+ end
360
+ p28_property_name = entity.name.capitalize + '.' + attribute.name.capitalize
361
+ property_quoted = false
362
+ property_list = false
363
+ property_type = '"' + attribute.domain + '"'
364
+ if attribute.isBuiltin
365
+ property_type = '"' + datatype_hash[attribute.domain] + '"'
366
+ end
367
+ if attribute.isBuiltin and attribute.domain == 'STRING'
368
+ property_quoted = true
369
+ end
370
+ if (!attribute.redeclare_entity and express_attribute_domain.instance_of? EXPSM::Type and express_attribute_domain.isBuiltin and express_attribute_domain == 'STRING')
371
+ property_quoted = true
372
+ property_type = '"' + datatype_hash[express_attribute_domain.domain] + '"'
373
+ end
374
+ if ( attribute.isBuiltin and attribute.instance_of? EXPSM::ExplicitAggregate and attribute.rank == 1 and attribute.dimensions[0].aggrtype = 'LIST')
375
+ property_list = true
376
+ property_type = '"' + datatype_hash[attribute.domain] + '"'
377
+ end
378
+
379
+ if (express_attribute_domain.instance_of? EXPSM::Type and express_attribute_domain.isBuiltin and attribute.instance_of? EXPSM::ExplicitAggregate and attribute.rank == 1 and attribute.dimensions[0].aggrtype = 'LIST')
380
+ property_list = true
381
+ property_type = '"' + datatype_hash[express_attribute_domain.domain] + '"'
382
+ end
383
+
384
+ property_type = property_type.gsub('http://www.w3.org/2001/XMLSchema#','xsd:')
385
+ post_processed_schema_file.puts 'property_range_hash["' + p28_property_name + '"] = [' + property_quoted.to_s + ',' + property_list.to_s + ',' + property_type.to_s + ']'
386
+ end
387
+ end
388
+
389
+
390
+ # A recursive function to return complete set of items, following nested selects, for a select that are not selects themselves
391
+ def get_all_selections( item_list )
392
+ select_items = item_list.find_all{ |a| a.kind_of? EXPSM::TypeSelect}
393
+ if select_items.size == 0
394
+ return item_list
395
+ end
396
+ temp_item_list = item_list
397
+ for select in select_items
398
+ temp_item_list.delete( select )
399
+ temp_item_list = temp_item_list + select.selectitems_array
400
+ end
401
+ final_list = get_all_selections( temp_item_list )
402
+ end
403
+
404
+ # A recursive function to return the ultimate underlying type of a type
405
+ def is_utlimate_type_builtin( the_type )
406
+ return true if the_type.isBuiltin
407
+ base_type = NamedType.find_by_name( the_type.domain )
408
+ case
409
+ when (base_type.instance_of? EXPSM::TypeSelect or base_type.instance_of? EXPSM::Entity)
410
+ return false
411
+ when (base_type.kind_of? EXPSM::Type and base_type.isBuiltin)
412
+ return true
413
+ else
414
+ return is_utlimate_type_builtin( base_type )
415
+ end
416
+ end
417
+
418
+ # Set up list of schemas to process, input may be a repository containing schemas or a single schema
419
+ if mapinput.kind_of? EXPSM::Repository
420
+ schema_list = mapinput.schemas
421
+ elsif mapinput.kind_of? EXPSM::SchemaDefinition
422
+ schema_list = [mapinput]
423
+ else
424
+ puts "ERROR : map_from_express input no Repository instance or Schema instance"
425
+ exit
426
+ end
427
+
428
+
429
+ for schema in schema_list
430
+
431
+ type_mapped_list = []
432
+ entity_mapped_list = []
433
+ explicit_mapped_list = []
434
+ inverse_mapped_list = []
435
+ thing_attr_mapped_list = []
436
+ superexpression_mapped_list = []
437
+ list_mapped_attr_list = []
438
+ list_mapped_type_list = []
439
+ type_union_mapped_list = []
440
+ mixed_select_list = []
441
+ all_explicit_list = []
442
+ all_derived_list = []
443
+ all_inverse_list = []
444
+ all_superexpression_list = []
445
+
446
+ # Set up separate file for each schema
447
+ filename = schema.name.to_s + ".owl"
448
+ file = File.new(filename, "w")
449
+
450
+ # Evaluate and write file start template
451
+ res = ERB.new(overall_start_template)
452
+ t = res.result(binding)
453
+ file.puts t
454
+
455
+ # Evaluate and write schema start template
456
+ res = ERB.new(schema_start_template)
457
+ t = res.result(binding)
458
+ file.puts t
459
+
460
+ select_list = schema.contents.find_all{ |e| e.kind_of? EXPSM::TypeSelect }
461
+ entity_list = schema.contents.find_all{ |e| e.kind_of? EXPSM::Entity }
462
+ defined_type_list = schema.contents.find_all{ |e| e.kind_of? EXPSM::Type }
463
+ enum_type_list = schema.contents.find_all{ |e| e.kind_of? EXPSM::TypeEnum }
464
+ defined_type_not_builtin_list = defined_type_list.find_all{ |e| !e.isBuiltin }
465
+ defined_type_builtin_list = defined_type_list.find_all{ |e| e.isBuiltin }
466
+
467
+ # Handle enumeration type maps to RDFS Datatype string
468
+
469
+ for type_enum in enum_type_list
470
+ type_mapped_list.push type_enum
471
+ owl_class_name = type_enum.name
472
+ enumitem_name_list = type_enum.items.scan(/\w+/)
473
+ res = ERB.new(class_enum_template)
474
+ t = res.result(binding)
475
+ file.puts t
476
+ end
477
+
478
+
479
+ # Handle defined type maps to RDFS Datatype
480
+
481
+ for type_builtin in defined_type_builtin_list
482
+
483
+ # Handle defined type maps to RDFS Datatype
484
+ if !type_builtin.instance_of? EXPSM::TypeAggregate
485
+ type_mapped_list.push type_builtin
486
+ datatype_name = type_builtin.name
487
+ superdatatype_name = datatype_hash[type_builtin.domain]
488
+ res = ERB.new(type_builtin_template)
489
+ t = res.result(binding)
490
+ file.puts t
491
+ # Handle defined type maps to RDF List
492
+ else
493
+ list_mapped_type_list.push type_builtin
494
+ type_mapped_list.push type_builtin
495
+ list_name = type_builtin.name
496
+ superlist_name = "http://www.w3.org/1999/02/22-rdf-syntax-ns#List"
497
+ res = ERB.new(rdflist_template)
498
+ t = res.result(binding)
499
+ file.puts t
500
+ end
501
+ end
502
+
503
+
504
+ for type_not_builtin in defined_type_not_builtin_list
505
+
506
+ type_domain = NamedType.find_by_name( type_not_builtin.domain )
507
+ type_is_builtin = is_utlimate_type_builtin( type_not_builtin )
508
+
509
+ case
510
+
511
+ # Handle simple defined type refining simple defined type of builtin map to RDFS Datatype
512
+ when (!type_not_builtin.instance_of? EXPSM::TypeAggregate and type_is_builtin and !type_domain.instance_of? EXPSM::TypeAggregate)
513
+ type_mapped_list.push type_not_builtin
514
+ datatype_name = type_not_builtin.name
515
+ superdatatype_name = '#' + type_domain.name
516
+ res = ERB.new(type_builtin_template)
517
+ t = res.result(binding)
518
+ file.puts t
519
+
520
+ # Handle simple defined type of aggr defined type of builtin map to RDF List
521
+ when (!type_not_builtin.instance_of? EXPSM::TypeAggregate and type_domain.instance_of? EXPSM::TypeAggregate and type_is_builtin)
522
+ type_mapped_list.push type_not_builtin
523
+ list_mapped_type_list.push type_not_builtin
524
+ list_name = type_not_builtin.name
525
+ superlist_name = '#' + type_domain.name
526
+ res = ERB.new(rdflist_template)
527
+ t = res.result(binding)
528
+ file.puts t
529
+
530
+ # Handle aggr defined type of simple defined type of builtin map to RDF List
531
+ when (type_not_builtin.instance_of? EXPSM::TypeAggregate and type_domain.instance_of? EXPSM::Type and type_is_builtin)
532
+ type_mapped_list.push type_not_builtin
533
+ list_mapped_type_list.push type_not_builtin
534
+ list_name = type_not_builtin.name
535
+ superlist_name = "http://www.w3.org/1999/02/22-rdf-syntax-ns#List"
536
+ res = ERB.new(rdflist_template)
537
+ t = res.result(binding)
538
+ file.puts t
539
+
540
+ # Handle aggr of entity/select type map to RDF List
541
+ when (type_not_builtin.instance_of? EXPSM::TypeAggregate and (type_domain.instance_of? EXPSM::Entity or type_domain.instance_of? EXPSM::TypeSelect))
542
+ type_mapped_list.push type_not_builtin
543
+ list_mapped_type_list.push type_not_builtin
544
+ list_name = type_not_builtin.name
545
+ superlist_name = "http://www.w3.org/1999/02/22-rdf-syntax-ns#List"
546
+ res = ERB.new(rdflist_template)
547
+ t = res.result(binding)
548
+ file.puts t
549
+
550
+ # Handle defined type that are type = type that is a select
551
+ when (type_domain.kind_of? EXPSM::TypeSelect)
552
+ type_mapped_list.push type_not_builtin
553
+ superclass_name = type_not_builtin.domain
554
+ class_name = type_not_builtin.name
555
+ res = ERB.new(entity_start_template)
556
+ t = res.result(binding)
557
+ file.puts t
558
+
559
+ superclass_name = type_not_builtin.domain
560
+ res = ERB.new(supertype_template)
561
+ t = res.result(binding)
562
+ file.puts t
563
+
564
+ res = ERB.new(class_end_template)
565
+ t = res.result(binding)
566
+ file.puts t
567
+
568
+ else
569
+ puts 'ERROR : Not mapped = ' + type_not_builtin.name
570
+ end
571
+ end
572
+
573
+
574
+ # Handle EXPRESS SELECT Type mapping to OWL Class hierarchy and RDFS Datatypes
575
+
576
+ for select in select_list
577
+
578
+ item_name_list = select.selectitems.scan(/\w+/)
579
+
580
+ this_select_all_items = get_all_selections( select.selectitems_array )
581
+ this_select_type_items = this_select_all_items.find_all{ |a| a.kind_of? EXPSM::Type}
582
+
583
+ case
584
+
585
+ # Handle case of select items resolving to containing only items that are non-select Type
586
+ when this_select_type_items.size == this_select_all_items.size
587
+ type_mapped_list.push select
588
+ type_union_mapped_list.push select
589
+ type_name_list = item_name_list
590
+ type_name = select.name
591
+ res = ERB.new(datatype_collection_template)
592
+ t = res.result(binding)
593
+ file.puts t
594
+
595
+ # Handle case of select items resolving to containing no item that is a non-select Type
596
+ else
597
+ type_mapped_list.push select
598
+
599
+ res = ERB.new(select_start_template)
600
+ t = res.result(binding)
601
+ file.puts t
602
+ file.puts '<owl:equivalentClass>'
603
+
604
+ res = ERB.new(class_collection_template)
605
+ t = res.result(binding)
606
+ file.puts t
607
+ file.puts '</owl:equivalentClass>'
608
+
609
+ res = ERB.new(select_end_template)
610
+ t = res.result(binding)
611
+ file.puts t
612
+ if (this_select_type_items.size != 0 and this_select_type_items.size != this_select_all_items.size)
613
+ mixed_select_list.push select
614
+ end
615
+
616
+ end
617
+ end
618
+
619
+ # Handle EXPRESS Entity mappings to OWL Class hierarchy
620
+
621
+ for entity in entity_list
622
+
623
+ if definition_hash[entity.name.downcase] != nil
624
+ annotation_list[0] = ['rdfs:comment', definition_hash[entity.name.downcase]]
625
+ else
626
+ annotation_list[0] = ['rdfs:comment', nil]
627
+ end
628
+
629
+ entity_mapped_list.push entity
630
+
631
+ class_name = entity.name
632
+ res = ERB.new(entity_start_template)
633
+ t = res.result(binding)
634
+ file.puts t
635
+
636
+ for supertype in entity.supertypes_array
637
+ superclass_name = supertype.name
638
+ res = ERB.new(supertype_template)
639
+ t = res.result(binding)
640
+ file.puts t
641
+ end
642
+
643
+ res = ERB.new(entity_end_template)
644
+ t = res.result(binding)
645
+ file.puts t
646
+
647
+ # Post-process the entity
648
+ post_process_entity(entity, post_processed_schema_file, datatype_hash) if post_processed_schema
649
+
650
+
651
+ if entity.superexpression != nil
652
+ all_superexpression_list.push entity
653
+
654
+ # Handle simple case of one ONEOF in supertype expression mapped to disjoint between listed subclasses
655
+ case
656
+ # when (entity.superexpression.include?('ONEOF') and !entity.superexpression.include?('ANDOR') and !entity.superexpression.include?('TOTAL_OVER') and !entity.superexpression.include?('AND') and !entity.superexpression.include?('ABSTRACT'))
657
+
658
+ when (entity.superexpression.include?('ONEOF'))
659
+ superexpression_mapped_list.push entity
660
+ tempexpression = entity.superexpression
661
+ if entity.superexpression.index('ONEOF') != 0
662
+ puts 'WARNING: ' + entity.name + ' supertype mapping may be incomplete, only ONEOFs processed'
663
+ end
664
+ while (tempexpression.include?('ONEOF'))
665
+ posoneof = tempexpression.index('ONEOF')
666
+ tempexpression = tempexpression[posoneof + 5,tempexpression.length - 5]
667
+ posclose = tempexpression.index(')')
668
+ oneof_name_list = tempexpression[0,posclose].scan(/\w+/)
669
+ while oneof_name_list.size != 0
670
+ first_class_name = oneof_name_list[0]
671
+ oneof_name_list.delete(first_class_name)
672
+ for disjoint_class_name in oneof_name_list
673
+ res = ERB.new(disjoint_template)
674
+ t = res.result(binding)
675
+ file.puts t
676
+ end
677
+ end
678
+ end
679
+ else
680
+ end
681
+
682
+ end
683
+
684
+
685
+ end
686
+
687
+ # Handle mapping common string attributes to OWL DatatypeProperties of OWL Thing
688
+
689
+ for thing_attribute in thing_attributes
690
+ owl_property_name = thing_attribute
691
+ owl_property_range = 'http://www.w3.org/2001/XMLSchema#string'
692
+ owl_property_domain = nil
693
+ owl_super_property_name = nil
694
+ res = ERB.new(attribute_builtin_template)
695
+ t = res.result(binding)
696
+ file.puts t
697
+ end
698
+
699
+ # Handle EXPRESS attributes on an entity-by-entity basis
700
+ for entity in entity_list
701
+
702
+ class_name = entity.name
703
+
704
+ attribute_list = entity.attributes.find_all{ |a| a.kind_of? EXPSM::Explicit and !thing_attributes.include?(a.name)}
705
+ thing_attr_list = entity.attributes.find_all{ |a| a.kind_of? EXPSM::Explicit and thing_attributes.include?(a.name)}
706
+ inverse_list = entity.attributes.find_all{ |a| a.kind_of? EXPSM::Inverse and !thing_attributes.include?(a.name)}
707
+
708
+ thing_attr_mapped_list = thing_attr_mapped_list + thing_attr_list
709
+
710
+ all_explicit_list = all_explicit_list + entity.attributes.find_all{ |a| a.kind_of? EXPSM::Explicit}
711
+ all_derived_list = all_derived_list + entity.attributes.find_all{ |a| a.kind_of? EXPSM::Derived}
712
+
713
+ all_inverse_list = all_inverse_list + inverse_list
714
+
715
+ # Handle EXPRESS inverse attribute mapping to OWL inverse property
716
+ for attribute in inverse_list
717
+ if attribute.reverseAttr != []
718
+ inverse_mapped_list.push attribute
719
+ owl_property_range = attribute.domain
720
+ owl_property_name = entity.name + '.' + attribute.name
721
+ owl_property_domain = entity.name
722
+ owl_inverted_property_name = attribute.reverseEntity.name + '.' + attribute.reverseAttr.name
723
+ res = ERB.new(inverse_entity_template)
724
+ t = res.result(binding)
725
+ file.puts t
726
+ end
727
+ end
728
+
729
+ # Handle EXPRESS explicit attribute mapping to OWL property
730
+ for attribute in attribute_list
731
+
732
+ express_attribute_domain = nil
733
+ type_is_builtin = false
734
+ if !attribute.isBuiltin
735
+ express_attribute_domain = NamedType.find_by_name( attribute.domain )
736
+ if express_attribute_domain.instance_of? EXPSM::Type
737
+ type_is_builtin = is_utlimate_type_builtin( express_attribute_domain )
738
+ end
739
+ end
740
+
741
+ case
742
+
743
+ # Handle EXPRESS explicit attributes of LIST of built-in simple type, including redeclaration
744
+ when (attribute.isBuiltin and attribute.instance_of? EXPSM::ExplicitAggregate and attribute.rank == 1 and attribute.dimensions[0].aggrtype = 'LIST')
745
+ explicit_mapped_list.push attribute
746
+ list_mapped_attr_list.push attribute
747
+ list_name = entity.name + '.' + attribute.name + '-' + attribute.domain.to_s + '-List'
748
+ superlist_name = "http://www.w3.org/1999/02/22-rdf-syntax-ns#List"
749
+ res = ERB.new(rdflist_template)
750
+ t = res.result(binding)
751
+ file.puts t
752
+ owl_property_name = entity.name + '.' + attribute.name
753
+ owl_property_domain = entity.name
754
+ owl_property_range = list_name
755
+ res = ERB.new(attribute_entity_template)
756
+ t = res.result(binding)
757
+ file.puts t
758
+
759
+ # Handle EXPRESS explicit attributes of ARRAY of built-in simple type, including redeclaration
760
+ when (attribute.isBuiltin and attribute.instance_of? EXPSM::ExplicitAggregate and attribute.rank == 1 and attribute.dimensions[0].aggrtype = 'ARRAY')
761
+ explicit_mapped_list.push attribute
762
+ list_mapped_attr_list.push attribute
763
+ list_name = entity.name + '.' + attribute.name + '-' + attribute.domain.to_s + '-Array'
764
+ superlist_name = "http://www.w3.org/1999/02/22-rdf-syntax-ns#List"
765
+ res = ERB.new(rdflist_template)
766
+ t = res.result(binding)
767
+ file.puts t
768
+ owl_property_name = entity.name + '.' + attribute.name
769
+ owl_property_domain = entity.name
770
+ owl_property_range = list_name
771
+ res = ERB.new(attribute_entity_template)
772
+ t = res.result(binding)
773
+ file.puts t
774
+
775
+ # Handle EXPRESS explicit attributes of LIST of TYPE that is built-in simple type, including redeclaration
776
+ when (express_attribute_domain.instance_of? EXPSM::Type and type_is_builtin and attribute.instance_of? EXPSM::ExplicitAggregate and attribute.rank == 1 and attribute.dimensions[0].aggrtype = 'LIST')
777
+ explicit_mapped_list.push attribute
778
+ list_mapped_attr_list.push attribute
779
+ list_name = entity.name + '.' + attribute.name + '-' + attribute.domain.to_s + '-List'
780
+ superlist_name = "http://www.w3.org/1999/02/22-rdf-syntax-ns#List"
781
+ res = ERB.new(rdflist_template)
782
+ t = res.result(binding)
783
+ file.puts t
784
+ owl_property_name = entity.name + '.' + attribute.name
785
+ owl_property_domain = entity.name
786
+ owl_property_range = list_name
787
+ res = ERB.new(attribute_entity_template)
788
+ t = res.result(binding)
789
+ file.puts t
790
+
791
+ # Handle EXPRESS explicit attributes of ARRAY of TYPE that is built-in simple type, including redeclaration
792
+ when (express_attribute_domain.instance_of? EXPSM::Type and type_is_builtin and attribute.instance_of? EXPSM::ExplicitAggregate and attribute.rank == 1 and attribute.dimensions[0].aggrtype = 'ARRAY')
793
+ explicit_mapped_list.push attribute
794
+ list_mapped_attr_list.push attribute
795
+ list_name = entity.name + '.' + attribute.name + '-' + attribute.domain.to_s + '-Array'
796
+ superlist_name = "http://www.w3.org/1999/02/22-rdf-syntax-ns#List"
797
+ res = ERB.new(rdflist_template)
798
+ t = res.result(binding)
799
+ file.puts t
800
+ owl_property_name = entity.name + '.' + attribute.name
801
+ owl_property_domain = entity.name
802
+ owl_property_range = list_name
803
+ res = ERB.new(attribute_entity_template)
804
+ t = res.result(binding)
805
+ file.puts t
806
+
807
+
808
+ # Handle EXPRESS explicit attributes of built-in simple type, including redeclaration
809
+ when (attribute.isBuiltin)
810
+ explicit_mapped_list.push attribute
811
+ owl_property_range = datatype_hash[attribute.domain]
812
+ owl_property_name = entity.name + '.' + attribute.name
813
+ owl_property_domain = entity.name
814
+ owl_super_property_name = nil
815
+ if attribute.redeclare_entity != nil
816
+ if attribute.redeclare_oldname == nil
817
+ owl_super_property_name = attribute.redeclare_entity + '.' + attribute.name
818
+ else
819
+ owl_super_property_name = attribute.redeclare_entity + '.' + attribute.redeclare_oldname
820
+ end
821
+ end
822
+ res = ERB.new(attribute_builtin_template)
823
+ t = res.result(binding)
824
+ file.puts t
825
+
826
+ # Handle EXPRESS explicit attribute, not redeclaration, refers to Type that is Type = builtin datatype
827
+ when (!attribute.redeclare_entity and express_attribute_domain.instance_of? EXPSM::Type and type_is_builtin)
828
+ explicit_mapped_list.push attribute
829
+ owl_property_range = attribute.domain
830
+ owl_property_name = entity.name + '.' + attribute.name
831
+ owl_property_domain = entity.name
832
+ res = ERB.new(attribute_typebuiltin_template)
833
+ t = res.result(binding)
834
+ file.puts t
835
+
836
+ # Handle EXPRESS explicit attributes of enum type, ignoring redeclarations
837
+ when (express_attribute_domain.kind_of? EXPSM::TypeEnum)
838
+ explicit_mapped_list.push attribute
839
+ owl_property_name = entity.name + '.' + attribute.name
840
+ owl_property_domain = entity.name
841
+ owl_property_range = attribute.domain
842
+ res = ERB.new(attribute_entity_template)
843
+
844
+ # if !type_mapped_list.include?(express_attribute_domain)
845
+ # type_mapped_list.push express_attribute_domain
846
+ # end
847
+ # enumitem_name_list = express_attribute_domain.items.scan(/\w+/)
848
+ # res = ERB.new(attribute_enum_template)
849
+
850
+ t = res.result(binding)
851
+ file.puts t
852
+ if attribute.redeclare_entity
853
+ puts 'WARNING: ' + entity.name + ' ' + attribute.name + ' Attribute redeclaration for Enumerations not mapped'
854
+ end
855
+
856
+ # Handle EXPRESS explicit attribute, not redeclaration, and only refer to EXPRESS Select or Entity
857
+ when (!attribute.redeclare_entity and (express_attribute_domain.kind_of? EXPSM::Entity or express_attribute_domain.kind_of? EXPSM::TypeSelect))
858
+ explicit_mapped_list.push attribute
859
+ owl_property_range = attribute.domain
860
+ owl_property_name = entity.name + '.' + attribute.name
861
+ owl_property_domain = entity.name
862
+ res = ERB.new(attribute_entity_template)
863
+ t = res.result(binding)
864
+ file.puts t
865
+
866
+ # Handle EXPRESS explicit attribute, redeclaration, and only refer to EXPRESS Select or Entity
867
+ when (attribute.redeclare_entity and (express_attribute_domain.kind_of? EXPSM::Entity or express_attribute_domain.kind_of? EXPSM::TypeSelect))
868
+ explicit_mapped_list.push attribute
869
+ owl_property_range = attribute.domain
870
+ owl_property_name = entity.name + '.' + attribute.name
871
+ if attribute.redeclare_oldname == nil
872
+ owl_super_property_name = attribute.redeclare_entity + '.' + attribute.name
873
+ else
874
+ owl_super_property_name = attribute.redeclare_entity + '.' + attribute.redeclare_oldname
875
+ end
876
+ owl_property_domain = entity.name
877
+ res = ERB.new(attribute_redeclare_entity_template)
878
+ t = res.result(binding)
879
+ file.puts t
880
+
881
+ # Handle EXPRESS explicit attribute of EXPRESS Type = A Type name that is a Select
882
+ when (express_attribute_domain.kind_of? EXPSM::Type and NamedType.find_by_name( express_attribute_domain.domain ).kind_of? EXPSM::TypeSelect)
883
+ explicit_mapped_list.push attribute
884
+ owl_property_range = attribute.domain
885
+ owl_property_name = entity.name + '.' + attribute.name
886
+ owl_property_domain = entity.name
887
+ res = ERB.new(attribute_entity_template)
888
+ t = res.result(binding)
889
+ file.puts t
890
+
891
+ # Handle EXPRESS explicit attribute, redeclaration, and only refer to EXPRESS Type = A Type name that is a Select
892
+ when (attribute.redeclare_entity and (express_attribute_domain.kind_of? EXPSM::Type and NamedType.find_by_name( express_attribute_domain.domain ).kind_of? EXPSM::TypeSelect))
893
+
894
+ explicit_mapped_list.push attribute
895
+ owl_property_range = attribute.domain
896
+ owl_property_name = entity.name + '.' + attribute.name
897
+ if attribute.redeclare_oldname == nil
898
+ owl_super_property_name = attribute.redeclare_entity + '.' + attribute.name
899
+ else
900
+ owl_super_property_name = attribute.redeclare_entity + '.' + attribute.redeclare_oldname
901
+ end
902
+ owl_property_domain = entity.name
903
+ res = ERB.new(attribute_redeclare_entity_template)
904
+ t = res.result(binding)
905
+ file.puts t
906
+
907
+ else
908
+ puts 'WARNING: ' + entity.name + ' ' + attribute.name + ' Attribute type not yet mapped'
909
+ end
910
+
911
+ min_cardinality = 1
912
+ max_cardinality = 1
913
+
914
+ if attribute.isOptional == true
915
+ min_cardinality = 0
916
+ end
917
+
918
+ if (attribute.instance_of? EXPSM::ExplicitAggregate and attribute.rank == 1 and attribute.dimensions[0].aggrtype != 'LIST' and attribute.dimensions[0].aggrtype != 'ARRAY')
919
+ if attribute.isOptional == false
920
+ min_cardinality = attribute.dimensions[0].lower.to_i
921
+ end
922
+ if attribute.dimensions[0].upper == '?'
923
+ max_cardinality = -1
924
+ else
925
+ max_cardinality = attribute.dimensions[0].upper.to_i
926
+ end
927
+ if attribute.rank > 1
928
+ puts 'WARNING: ' + owl_property_name + ' n-dimensional aggregate attribute cardinalities not mapped '
929
+ max_cardinality = -1
930
+ end
931
+ end
932
+
933
+ if min_cardinality == max_cardinality
934
+ res = ERB.new(cardinality_template)
935
+ t = res.result(binding)
936
+ file.puts t
937
+ else
938
+ res = ERB.new(min_cardinality_template)
939
+ t = res.result(binding)
940
+ file.puts t
941
+ if max_cardinality != -1
942
+ res = ERB.new(max_cardinality_template)
943
+ t = res.result(binding)
944
+ file.puts t
945
+ end
946
+ end
947
+
948
+
949
+ if (attribute.redeclare_entity and !(express_attribute_domain.kind_of? EXPSM::Entity or express_attribute_domain.kind_of? EXPSM::TypeSelect))
950
+ if (attribute.redeclare_entity and !(express_attribute_domain.kind_of? EXPSM::Type and NamedType.find_by_name( express_attribute_domain.domain ).kind_of? EXPSM::TypeSelect))
951
+ if (attribute.redeclare_entity and !attribute.isBuiltin)
952
+ puts 'WARNING: ' + entity.name + ' ' + attribute.name + ' Attribute redeclaration may need hand editing'
953
+ end
954
+ end
955
+ end
956
+
957
+ end
958
+
959
+ end
960
+
961
+
962
+ res = ERB.new(schema_end_template)
963
+ t = res.result(binding)
964
+ file.puts t
965
+
966
+ puts ' '
967
+ puts 'Schema Mapping Summary for : ' + schema.name
968
+ all_type_list = schema.contents.find_all{ |e| e.kind_of? EXPSM::DefinedType }
969
+
970
+
971
+ puts ' ENTITYs mapped = ' + entity_mapped_list.size.to_s + ' of ' + entity_list.size.to_s
972
+ puts ' - ' + superexpression_mapped_list.size.to_s + ' of ' + all_superexpression_list.size.to_s + ' ENTITY SUPERTYPE expressions mapped (only simple ONEOF supported)'
973
+ for t in all_superexpression_list - superexpression_mapped_list
974
+ puts ' Not mapped: ' + t.name
975
+ end
976
+ puts ' - ' + inverse_mapped_list.size.to_s + ' of ' + all_inverse_list.size.to_s + ' inverse attributes mapped (inverse of inherited not supported)'
977
+ notmapped_list = all_inverse_list - inverse_mapped_list
978
+ for t in notmapped_list
979
+ puts ' Not mapped: ' + t.entity.name + '.' + t.name
980
+ end
981
+ puts ' - ' + thing_attr_mapped_list.size.to_s + ' of ' + all_explicit_list.size.to_s + ' explicit attributes mapped with owl:Thing as domain (configurable)'
982
+ puts ' - ' + explicit_mapped_list.size.to_s + ' of ' + all_explicit_list.size.to_s + ' explicit attributes mapped'
983
+ for t in list_mapped_attr_list
984
+ puts ' rdf:List mapped: ' + t.name
985
+ end
986
+
987
+ notmapped_list = all_explicit_list - explicit_mapped_list - thing_attr_mapped_list
988
+ for t in notmapped_list
989
+ puts ' Not mapped: ' + t.entity.name + '.' + t.name
990
+ end
991
+ puts ' - ' + all_derived_list.size.to_s + ' derived attributes not mapped, not supported'
992
+ puts ' TYPEs mapped = ' + type_mapped_list.size.to_s + ' of ' + all_type_list.size.to_s
993
+ for t in list_mapped_type_list
994
+ puts ' rdf:List mapped: ' + t.name
995
+ end
996
+ for t in mixed_select_list
997
+ puts ' Select of entity & type Class mapped: ' + t.name
998
+ end
999
+ for t in type_union_mapped_list
1000
+ puts ' Select RDFS Datatype owl:unionOf mapped: ' + t.name
1001
+ end
1002
+ notmapped_list = all_type_list - type_mapped_list
1003
+ for t in notmapped_list
1004
+ puts ' Not mapped: ' + t.name
1005
+ end
1006
+ puts ' '
1007
+ puts 'Wrote post-processed schema to file: ' + post_processed_schema_file_name if post_processed_schema
1008
+
1009
+
1010
+ end
1011
+
1012
+ res = ERB.new(overall_end_template)
1013
+ t = res.result(binding)
1014
+ file.puts t
1015
+
1016
+ post_processed_schema_file.close if post_processed_schema
1017
+
1018
+ end