expressir 1.2.3-aarch64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.cross_rubies +21 -0
- data/.github/workflows/rake.yml +96 -0
- data/.github/workflows/release.yml +120 -0
- data/.gitignore +17 -0
- data/.gitmodules +3 -0
- data/.hound.yml +3 -0
- data/.rspec +2 -0
- data/.rubocop.yml +8 -0
- data/.yardopts +11 -0
- data/Gemfile +4 -0
- data/README.adoc +147 -0
- data/Rakefile +14 -0
- data/bin/console +12 -0
- data/bin/rspec +29 -0
- data/bin/setup +8 -0
- data/demo.rb +18 -0
- data/docs/development.md +90 -0
- data/exe/expressir +20 -0
- data/exe/format +18 -0
- data/exe/format-test +81 -0
- data/exe/generate-parser +48 -0
- data/expressir.gemspec +46 -0
- data/lib/expressir/cli/ui.rb +36 -0
- data/lib/expressir/cli.rb +21 -0
- data/lib/expressir/config.rb +23 -0
- data/lib/expressir/express/2.7/express_parser.so +0 -0
- data/lib/expressir/express/3.0/express_parser.so +0 -0
- data/lib/expressir/express/3.1/express_parser.so +0 -0
- data/lib/expressir/express/cache.rb +51 -0
- data/lib/expressir/express/formatter.rb +1608 -0
- data/lib/expressir/express/hyperlink_formatter.rb +36 -0
- data/lib/expressir/express/model_visitor.rb +24 -0
- data/lib/expressir/express/parser.rb +81 -0
- data/lib/expressir/express/resolve_references_model_visitor.rb +31 -0
- data/lib/expressir/express/schema_head_formatter.rb +23 -0
- data/lib/expressir/express/visitor.rb +2574 -0
- data/lib/expressir/model/cache.rb +17 -0
- data/lib/expressir/model/data_type.rb +9 -0
- data/lib/expressir/model/data_types/aggregate.rb +31 -0
- data/lib/expressir/model/data_types/array.rb +31 -0
- data/lib/expressir/model/data_types/bag.rb +25 -0
- data/lib/expressir/model/data_types/binary.rb +22 -0
- data/lib/expressir/model/data_types/boolean.rb +10 -0
- data/lib/expressir/model/data_types/enumeration.rb +25 -0
- data/lib/expressir/model/data_types/enumeration_item.rb +26 -0
- data/lib/expressir/model/data_types/generic.rb +26 -0
- data/lib/expressir/model/data_types/generic_entity.rb +26 -0
- data/lib/expressir/model/data_types/integer.rb +10 -0
- data/lib/expressir/model/data_types/list.rb +28 -0
- data/lib/expressir/model/data_types/logical.rb +10 -0
- data/lib/expressir/model/data_types/number.rb +10 -0
- data/lib/expressir/model/data_types/real.rb +19 -0
- data/lib/expressir/model/data_types/select.rb +28 -0
- data/lib/expressir/model/data_types/set.rb +25 -0
- data/lib/expressir/model/data_types/string.rb +22 -0
- data/lib/expressir/model/declaration.rb +9 -0
- data/lib/expressir/model/declarations/attribute.rb +47 -0
- data/lib/expressir/model/declarations/constant.rb +34 -0
- data/lib/expressir/model/declarations/entity.rb +53 -0
- data/lib/expressir/model/declarations/function.rb +67 -0
- data/lib/expressir/model/declarations/interface.rb +28 -0
- data/lib/expressir/model/declarations/interface_item.rb +23 -0
- data/lib/expressir/model/declarations/interfaced_item.rb +37 -0
- data/lib/expressir/model/declarations/parameter.rb +34 -0
- data/lib/expressir/model/declarations/procedure.rb +64 -0
- data/lib/expressir/model/declarations/remark_item.rb +21 -0
- data/lib/expressir/model/declarations/rule.rb +71 -0
- data/lib/expressir/model/declarations/schema.rb +117 -0
- data/lib/expressir/model/declarations/schema_version.rb +22 -0
- data/lib/expressir/model/declarations/schema_version_item.rb +22 -0
- data/lib/expressir/model/declarations/subtype_constraint.rb +40 -0
- data/lib/expressir/model/declarations/type.rb +45 -0
- data/lib/expressir/model/declarations/unique_rule.rb +31 -0
- data/lib/expressir/model/declarations/variable.rb +34 -0
- data/lib/expressir/model/declarations/where_rule.rb +31 -0
- data/lib/expressir/model/expression.rb +9 -0
- data/lib/expressir/model/expressions/aggregate_initializer.rb +19 -0
- data/lib/expressir/model/expressions/aggregate_initializer_item.rb +22 -0
- data/lib/expressir/model/expressions/binary_expression.rb +53 -0
- data/lib/expressir/model/expressions/entity_constructor.rb +22 -0
- data/lib/expressir/model/expressions/function_call.rb +22 -0
- data/lib/expressir/model/expressions/interval.rb +34 -0
- data/lib/expressir/model/expressions/query_expression.rb +35 -0
- data/lib/expressir/model/expressions/unary_expression.rb +27 -0
- data/lib/expressir/model/identifier.rb +34 -0
- data/lib/expressir/model/literal.rb +9 -0
- data/lib/expressir/model/literals/binary.rb +19 -0
- data/lib/expressir/model/literals/integer.rb +19 -0
- data/lib/expressir/model/literals/logical.rb +23 -0
- data/lib/expressir/model/literals/real.rb +19 -0
- data/lib/expressir/model/literals/string.rb +22 -0
- data/lib/expressir/model/model_element.rb +208 -0
- data/lib/expressir/model/reference.rb +9 -0
- data/lib/expressir/model/references/attribute_reference.rb +22 -0
- data/lib/expressir/model/references/group_reference.rb +22 -0
- data/lib/expressir/model/references/index_reference.rb +27 -0
- data/lib/expressir/model/references/simple_reference.rb +24 -0
- data/lib/expressir/model/repository.rb +23 -0
- data/lib/expressir/model/statement.rb +9 -0
- data/lib/expressir/model/statements/alias.rb +35 -0
- data/lib/expressir/model/statements/assignment.rb +22 -0
- data/lib/expressir/model/statements/case.rb +25 -0
- data/lib/expressir/model/statements/case_action.rb +22 -0
- data/lib/expressir/model/statements/compound.rb +19 -0
- data/lib/expressir/model/statements/escape.rb +10 -0
- data/lib/expressir/model/statements/if.rb +25 -0
- data/lib/expressir/model/statements/null.rb +10 -0
- data/lib/expressir/model/statements/procedure_call.rb +22 -0
- data/lib/expressir/model/statements/repeat.rb +47 -0
- data/lib/expressir/model/statements/return.rb +19 -0
- data/lib/expressir/model/statements/skip.rb +10 -0
- data/lib/expressir/model/supertype_expression.rb +9 -0
- data/lib/expressir/model/supertype_expressions/binary_supertype_expression.rb +29 -0
- data/lib/expressir/model/supertype_expressions/oneof_supertype_expression.rb +19 -0
- data/lib/expressir/model.rb +79 -0
- data/lib/expressir/version.rb +3 -0
- data/lib/expressir.rb +20 -0
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.exp +9589 -0
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.owl +36619 -0
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.xml +13294 -0
- data/original/examples/employment/eclipse/.project +17 -0
- data/original/examples/employment/eclipse/Export/Employment.png +0 -0
- data/original/examples/employment/eclipse/Express/employment_schema.exp +33 -0
- data/original/examples/employment/eclipse/Express/employment_schema.xmi +77 -0
- data/original/examples/employment/eclipse/Express/employment_schema.xml +93 -0
- data/original/examples/employment/eclipse/Models/Employment.uml +4 -0
- data/original/examples/employment/eclipse/Models/Employment.umldi +240 -0
- data/original/examples/employment/eclipse/readme.txt +7 -0
- data/original/examples/employment/employment_schema.exp +33 -0
- data/original/examples/employment/employment_schema.rb +232 -0
- data/original/examples/employment/employment_schema.xml +93 -0
- data/original/examples/employment/employment_schema___module.rb +46 -0
- data/original/examples/employment/employment_schema___p28attr.rb +126 -0
- data/original/examples/employment/employment_schema___p28inst.rb +26 -0
- data/original/examples/employment/example_employment_data.xml +1 -0
- data/original/examples/employment/example_employment_data_copy.xml +1 -0
- data/original/examples/employment/example_employment_reader.rb +30 -0
- data/original/examples/employment/example_employment_writer.rb +51 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.exp +3710 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.owl +35880 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xmi +15357 -0
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xml +9468 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.exp +8404 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl +43147 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi +18341 -0
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml +11632 -0
- data/original/exp2ruby.rb +525 -0
- data/original/expsm.rb +34 -0
- data/original/mapping_owl.rb +1018 -0
- data/original/mapping_sysml.rb +2281 -0
- data/original/mapping_uml2.rb +599 -0
- data/original/mapping_uml2_eclipse.rb +433 -0
- data/original/reeper.rb +134 -0
- data/rakelib/cross-ruby.rake +316 -0
- data/spec/acceptance/version_spec.rb +12 -0
- data/spec/expressir/express/cache_spec.rb +64 -0
- data/spec/expressir/express/formatter_spec.rb +127 -0
- data/spec/expressir/express/parser_spec.rb +98 -0
- data/spec/expressir/model/model_element_spec.rb +266 -0
- data/spec/expressr_spec.rb +5 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/support/console_helper.rb +29 -0
- data/spec/syntax/multiple.exp +23 -0
- data/spec/syntax/multiple.yaml +198 -0
- data/spec/syntax/multiple_formatted.exp +71 -0
- data/spec/syntax/multiple_hyperlink_formatted.exp +71 -0
- data/spec/syntax/multiple_schema_head_hyperlink_formatted.exp +13 -0
- data/spec/syntax/remark.exp +191 -0
- data/spec/syntax/remark.yaml +466 -0
- data/spec/syntax/remark_formatted.exp +227 -0
- data/spec/syntax/single.exp +4 -0
- data/spec/syntax/single.yaml +18 -0
- data/spec/syntax/single_formatted.exp +10 -0
- data/spec/syntax/single_formatted.yaml +36 -0
- data/spec/syntax/syntax.exp +333 -0
- data/spec/syntax/syntax.yaml +3509 -0
- data/spec/syntax/syntax_formatted.exp +902 -0
- data/spec/syntax/syntax_hyperlink_formatted.exp +902 -0
- data/spec/syntax/syntax_schema_head_formatted.exp +18 -0
- metadata +398 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0741012d69317d90f9304926651592a0ee660dc82d0fc521840ca11e01f5f001
|
4
|
+
data.tar.gz: f6aa0940d377d4bfce25ac0fa9740a73420cf522cb0552c5f142a839e8d551de
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2ac17878ee21343042508e98f81286717fb122fdc6af4e49a8eccd1cf86a8dfe10437a42d1e035cb6e383088feeecc41be2df809ff3087a694277856e802c72e
|
7
|
+
data.tar.gz: b3e1a54ab6609d7c327a6f5c900a36b4dfa0ac88a244b9d1ed25ff8b82b288588ebe0a7adb1aedb1fd118ff480795acb45a4ce423e5598e7aba7d6ffbc2b85be
|
data/.cross_rubies
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
3.1.0:i686-w64-mingw32
|
2
|
+
3.1.0:x86_64-w64-mingw32
|
3
|
+
3.1.0:i686-linux-gnu
|
4
|
+
3.1.0:x86_64-linux-gnu
|
5
|
+
3.1.0:aarch64-linux-gnu
|
6
|
+
3.1.0:x86_64-darwin
|
7
|
+
3.1.0:arm64-darwin
|
8
|
+
3.0.0:i686-w64-mingw32
|
9
|
+
3.0.0:x86_64-w64-mingw32
|
10
|
+
3.0.0:i686-linux-gnu
|
11
|
+
3.0.0:x86_64-linux-gnu
|
12
|
+
3.0.0:aarch64-linux-gnu
|
13
|
+
3.0.0:x86_64-darwin
|
14
|
+
3.0.0:arm64-darwin
|
15
|
+
2.7.0:i686-w64-mingw32
|
16
|
+
2.7.0:x86_64-w64-mingw32
|
17
|
+
2.7.0:i686-linux-gnu
|
18
|
+
2.7.0:x86_64-linux-gnu
|
19
|
+
2.7.0:aarch64-linux-gnu
|
20
|
+
2.7.0:x86_64-darwin
|
21
|
+
2.7.0:arm64-darwin
|
@@ -0,0 +1,96 @@
|
|
1
|
+
name: rake
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master, main ]
|
6
|
+
pull_request:
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
rake:
|
10
|
+
name: test on ruby-${{ matrix.ruby }} ${{ matrix.os }}
|
11
|
+
runs-on: ${{ matrix.os }}
|
12
|
+
continue-on-error: ${{ matrix.experimental }}
|
13
|
+
strategy:
|
14
|
+
fail-fast: false
|
15
|
+
matrix:
|
16
|
+
ruby: [ '3.1', '3.0', '2.7' ]
|
17
|
+
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
18
|
+
experimental: [ false ]
|
19
|
+
include:
|
20
|
+
- ruby: 'head'
|
21
|
+
os: 'ubuntu-latest'
|
22
|
+
experimental: true
|
23
|
+
- ruby: 'head'
|
24
|
+
os: 'windows-latest'
|
25
|
+
experimental: true
|
26
|
+
- ruby: 'head'
|
27
|
+
os: 'macos-latest'
|
28
|
+
experimental: true
|
29
|
+
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v2
|
32
|
+
with:
|
33
|
+
submodules: recursive
|
34
|
+
|
35
|
+
- if: matrix.os == 'macos-latest'
|
36
|
+
run: brew install autoconf automake libtool
|
37
|
+
|
38
|
+
- uses: ruby/setup-ruby@v1
|
39
|
+
with:
|
40
|
+
ruby-version: ${{ matrix.ruby }}
|
41
|
+
bundler-cache: true
|
42
|
+
|
43
|
+
- uses: actions/cache@v2
|
44
|
+
with:
|
45
|
+
path: lib/expressir/express/express_parser.*
|
46
|
+
key: v4-${{ runner.os }}-${{ matrix.ruby }}-${{ hashFiles('ext/express-parser/extconf.rb', 'ext/express-parser/antlrgen/**', 'ext/express-parser/express_parser.cpp', '.git/modules/ext/express-parser/antlr4-upstream/HEAD') }}
|
47
|
+
|
48
|
+
- if: hashFiles('lib/expressir/express/express_parser.*') == ''
|
49
|
+
run: bundle exec rake compile
|
50
|
+
|
51
|
+
- run: bundle exec rake
|
52
|
+
|
53
|
+
# test release workflow
|
54
|
+
pack:
|
55
|
+
runs-on: ubuntu-18.04
|
56
|
+
strategy:
|
57
|
+
fail-fast: false
|
58
|
+
matrix:
|
59
|
+
host: [ linux, windows, darwin ]
|
60
|
+
steps:
|
61
|
+
- uses: actions/checkout@v2
|
62
|
+
with:
|
63
|
+
submodules: recursive
|
64
|
+
|
65
|
+
- uses: ruby/setup-ruby@v1
|
66
|
+
with:
|
67
|
+
ruby-version: '3.0'
|
68
|
+
# bundler-cache: true important to not use cache because it leads to "cannot find -lrice"
|
69
|
+
# more info https://github.com/lutaml/expressir/runs/2097658383?check_suite_focus=true#step:7:2126
|
70
|
+
|
71
|
+
- run: bundle install --jobs 4 --retry 3
|
72
|
+
|
73
|
+
# build gem WITHOUT pre-built native extension
|
74
|
+
- run: gem build expressir.gemspec
|
75
|
+
|
76
|
+
- if: matrix.host == 'linux'
|
77
|
+
uses: actions/upload-artifact@v2
|
78
|
+
with:
|
79
|
+
name: pkg-ruby
|
80
|
+
path: expressir-*.gem
|
81
|
+
|
82
|
+
- name: Enable swap
|
83
|
+
run: |
|
84
|
+
sudo fallocate -l 15g /compile.swap
|
85
|
+
sudo chmod 600 /compile.swap
|
86
|
+
sudo mkswap /compile.swap
|
87
|
+
sudo swapon /compile.swap
|
88
|
+
sudo swapon --all --verbose
|
89
|
+
|
90
|
+
# build gem WITH pre-built native extension
|
91
|
+
- run: bundle exec rake gem:${{ matrix.host }}
|
92
|
+
|
93
|
+
- uses: actions/upload-artifact@v2
|
94
|
+
with:
|
95
|
+
name: pkg-${{ matrix.host }}
|
96
|
+
path: pkg/*.gem
|
@@ -0,0 +1,120 @@
|
|
1
|
+
name: release
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
inputs:
|
6
|
+
next_version:
|
7
|
+
description: |
|
8
|
+
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
|
9
|
+
required: true
|
10
|
+
default: 'patch'
|
11
|
+
push:
|
12
|
+
tags: [ v* ]
|
13
|
+
|
14
|
+
jobs:
|
15
|
+
bump:
|
16
|
+
runs-on: ubuntu-18.04
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
with:
|
20
|
+
submodules: recursive
|
21
|
+
|
22
|
+
- uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: '3.0'
|
25
|
+
|
26
|
+
- if: ${{ github.event_name == 'workflow_dispatch' }} # unfortunatelly cannot keep this condition on job level
|
27
|
+
run: |
|
28
|
+
git config user.name github-actions
|
29
|
+
git config user.email github-actions@github.com
|
30
|
+
gem install gem-release
|
31
|
+
gem bump --version ${{ github.event.inputs.next_version }} --tag --push
|
32
|
+
|
33
|
+
pack:
|
34
|
+
runs-on: ubuntu-18.04
|
35
|
+
needs: bump
|
36
|
+
strategy:
|
37
|
+
fail-fast: false
|
38
|
+
matrix:
|
39
|
+
host: [ linux, windows, darwin ]
|
40
|
+
steps:
|
41
|
+
- uses: actions/checkout@v2
|
42
|
+
with:
|
43
|
+
submodules: recursive
|
44
|
+
ref: main # https://github.com/actions/checkout/issues/439#issuecomment-830862188
|
45
|
+
|
46
|
+
- uses: ruby/setup-ruby@v1
|
47
|
+
with:
|
48
|
+
ruby-version: '3.0'
|
49
|
+
# bundler-cache: true important to not use cache because it leads to "cannot find -lrice"
|
50
|
+
# more info https://github.com/lutaml/expressir/runs/2097658383?check_suite_focus=true#step:7:2126
|
51
|
+
|
52
|
+
- run: bundle install --jobs 4 --retry 3
|
53
|
+
|
54
|
+
# build gem WITHOUT pre-built native extension
|
55
|
+
- run: gem build expressir.gemspec
|
56
|
+
|
57
|
+
- if: matrix.host == 'linux'
|
58
|
+
uses: actions/upload-artifact@v2
|
59
|
+
with:
|
60
|
+
name: pkg-ruby
|
61
|
+
path: expressir-*.gem
|
62
|
+
|
63
|
+
- name: Enable swap
|
64
|
+
run: |
|
65
|
+
sudo fallocate -l 15g /compile.swap
|
66
|
+
sudo chmod 600 /compile.swap
|
67
|
+
sudo mkswap /compile.swap
|
68
|
+
sudo swapon /compile.swap
|
69
|
+
sudo swapon --all --verbose
|
70
|
+
|
71
|
+
# build gem WITH pre-built native extension
|
72
|
+
- run: bundle exec rake gem:${{ matrix.host }}
|
73
|
+
|
74
|
+
- uses: actions/upload-artifact@v2
|
75
|
+
with:
|
76
|
+
name: pkg-${{ matrix.host }}
|
77
|
+
path: pkg/*.gem
|
78
|
+
|
79
|
+
publish:
|
80
|
+
runs-on: ubuntu-18.04
|
81
|
+
needs: pack
|
82
|
+
steps:
|
83
|
+
- uses: actions/download-artifact@v2
|
84
|
+
with:
|
85
|
+
name: pkg-ruby
|
86
|
+
path: pkg
|
87
|
+
|
88
|
+
- uses: actions/download-artifact@v2
|
89
|
+
with:
|
90
|
+
name: pkg-linux
|
91
|
+
path: pkg
|
92
|
+
|
93
|
+
- uses: actions/download-artifact@v2
|
94
|
+
with:
|
95
|
+
name: pkg-windows
|
96
|
+
path: pkg
|
97
|
+
|
98
|
+
- uses: actions/download-artifact@v2
|
99
|
+
with:
|
100
|
+
name: pkg-darwin
|
101
|
+
path: pkg
|
102
|
+
|
103
|
+
- uses: ruby/setup-ruby@v1
|
104
|
+
with:
|
105
|
+
ruby-version: '3.0'
|
106
|
+
|
107
|
+
- run: ls -l pkg/
|
108
|
+
|
109
|
+
- name: Publish to rubygems.org
|
110
|
+
env:
|
111
|
+
RUBYGEMS_API_KEY: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
|
112
|
+
run: |
|
113
|
+
mkdir -p ~/.gem
|
114
|
+
cat > ~/.gem/credentials << EOF
|
115
|
+
---
|
116
|
+
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
117
|
+
EOF
|
118
|
+
chmod 0600 ~/.gem/credentials
|
119
|
+
gem signin
|
120
|
+
for gem in pkg/*.gem; do gem push $gem -V; done
|
data/.gitignore
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
9
|
+
/Gemfile.lock
|
10
|
+
/.idea
|
11
|
+
/lib/expressir/express/express_parser.bundle
|
12
|
+
/spec/syntax/*-pretty.exp
|
13
|
+
|
14
|
+
# rspec failure tracking
|
15
|
+
.rspec_status
|
16
|
+
|
17
|
+
/ext/express-parser/rice-embed
|
data/.gitmodules
ADDED
data/.hound.yml
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.yardopts
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# macro must be defined first, see https://stackoverflow.com/a/10344776/1823988
|
2
|
+
lib/expressir/model/model_element.rb
|
3
|
+
lib/expressir/model/data_type.rb
|
4
|
+
lib/expressir/model/declaration.rb
|
5
|
+
lib/expressir/model/expression.rb
|
6
|
+
lib/expressir/model/literal.rb
|
7
|
+
lib/expressir/model/reference.rb
|
8
|
+
lib/expressir/model/statement.rb
|
9
|
+
lib/expressir/model/supertype_expression.rb
|
10
|
+
|
11
|
+
lib/**/*.rb
|
data/Gemfile
ADDED
data/README.adoc
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
= Expressir: EXPRESS in Ruby
|
2
|
+
|
3
|
+
image:https://img.shields.io/gem/v/expressir.svg["Gem Version", link="https://rubygems.org/gems/expressir"]
|
4
|
+
// image:https://codeclimate.com/github/lutaml/expressir/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/lutaml/expressir"]
|
5
|
+
image:https://github.com/lutaml/expressir/workflows/rake/badge.svg["Build Status", link="https://github.com/lutaml/expressir/actions?workflow=rake"]
|
6
|
+
|
7
|
+
== Purpose
|
8
|
+
|
9
|
+
Expressir ("`EXPRESS in Ruby`") is a Ruby parser for EXPRESS and
|
10
|
+
a set of Ruby tools for accessing ISO EXPRESS data models.
|
11
|
+
|
12
|
+
== Architecture
|
13
|
+
|
14
|
+
Expressir consists of 3 parts:
|
15
|
+
|
16
|
+
. Parsers. A parser allows Expressir to read EXPRESS files, including:
|
17
|
+
|
18
|
+
** EXPRESS data modelling language (ISO 10303-11:2007)
|
19
|
+
** EXPRESS data modelling language in XML (STEPmod)
|
20
|
+
** EXPRESS XML (ISO 10303-28:2007)
|
21
|
+
"`Industrial automation systems and integration — Product data representation and exchange — Part 28: Implementation methods: XML representations of EXPRESS schemas and data, using XML schemas`")
|
22
|
+
|
23
|
+
. Data model. The data model (`lib/expressir/express`) is the Ruby data model that fully represents an EXPRESS data model.
|
24
|
+
|
25
|
+
. Converters. A converter transforms the EXPRESS Ruby data model into an interoperable export format, including:
|
26
|
+
** EXPRESS data modelling language (ISO 10303-11:2007)
|
27
|
+
** W3C OWL
|
28
|
+
** OMG SysML (XMI 2.1, XMI 2.5)
|
29
|
+
** OMG UML 2 (XMI 2.1)
|
30
|
+
** OMG UML 2 for Eclipse (XMI 2.1)
|
31
|
+
|
32
|
+
|
33
|
+
== Usage
|
34
|
+
|
35
|
+
This gem ships with a CLI tool. To check what's available you can simply run
|
36
|
+
the script directly from `exe/expressir`, by default it will display some usage
|
37
|
+
instructions.
|
38
|
+
|
39
|
+
[source, sh]
|
40
|
+
----
|
41
|
+
./exe/expressir
|
42
|
+
|
43
|
+
Commands:
|
44
|
+
expressir help [COMMAND] # Describe available commands or one specific command
|
45
|
+
expressir version # The Expressir Version
|
46
|
+
----
|
47
|
+
|
48
|
+
== Development
|
49
|
+
|
50
|
+
We are following Sandi Metz's Rules for this gem, you can read
|
51
|
+
the http://robots.thoughtbot.com/post/50655960596/sandi-metz-rules-for-developers[description of the rules here] All new code should follow these rules.
|
52
|
+
If you make changes in a pre-existing file that violates these rules you should
|
53
|
+
fix the violations as part of your contribution.
|
54
|
+
|
55
|
+
=== Setup
|
56
|
+
|
57
|
+
Clone the repository.
|
58
|
+
|
59
|
+
[source, sh]
|
60
|
+
----
|
61
|
+
git clone https://github.com/metanorma/expressir
|
62
|
+
----
|
63
|
+
|
64
|
+
Setup your environment.
|
65
|
+
|
66
|
+
[source, sh]
|
67
|
+
----
|
68
|
+
bin/setup
|
69
|
+
----
|
70
|
+
|
71
|
+
Run the test suite
|
72
|
+
|
73
|
+
[source, sh]
|
74
|
+
----
|
75
|
+
bin/rspec
|
76
|
+
----
|
77
|
+
|
78
|
+
== Installation
|
79
|
+
|
80
|
+
Add this line to your application's `Gemfile`:
|
81
|
+
|
82
|
+
[source, sh]
|
83
|
+
----
|
84
|
+
gem "expressir"
|
85
|
+
----
|
86
|
+
|
87
|
+
And then execute:
|
88
|
+
|
89
|
+
[source, sh]
|
90
|
+
----
|
91
|
+
$ bundle install
|
92
|
+
----
|
93
|
+
|
94
|
+
Or install it yourself as:
|
95
|
+
|
96
|
+
[source, sh]
|
97
|
+
----
|
98
|
+
$ gem install expressir
|
99
|
+
----
|
100
|
+
|
101
|
+
|
102
|
+
== Contributing
|
103
|
+
|
104
|
+
First, thank you for contributing! We love pull requests from everyone. By
|
105
|
+
participating in this project, you hereby grant
|
106
|
+
https://www.ribose.com[Ribose Inc.] the right to grant or transfer an unlimited
|
107
|
+
number of non exclusive licenses or sub-licenses to third parties, under the
|
108
|
+
copyright covering the contribution to use the contribution by all means.
|
109
|
+
|
110
|
+
Here are a few technical guidelines to follow:
|
111
|
+
|
112
|
+
* Open an https://github.com/lutaml/expressir/issues[issues] to discuss a new
|
113
|
+
feature.
|
114
|
+
* Write tests to support your new feature.
|
115
|
+
* Make sure the entire test suite passes locally and on CI.
|
116
|
+
* Open a Pull Request.
|
117
|
+
* https://github.com/thoughtbot/guides/tree/master/protocol/git#write-a-feature[Squash your commits] after receiving feedback.
|
118
|
+
* Party!
|
119
|
+
|
120
|
+
|
121
|
+
== License
|
122
|
+
|
123
|
+
Expressir is distributed under the BSD 2-clause license.
|
124
|
+
|
125
|
+
Expressir is built on code originally from the NIST Reeper project.
|
126
|
+
|
127
|
+
The https://www.nist.gov/services-resources/software/reeper[NIST Reeper license]
|
128
|
+
is reproduced below:
|
129
|
+
|
130
|
+
[quote]
|
131
|
+
____
|
132
|
+
This software was funded by NIST and developed by EuroSTEP.
|
133
|
+
Pursuant to title 17 Section 105 of the United States Code this
|
134
|
+
software is not subject to copyright protection and is in the public
|
135
|
+
domain.
|
136
|
+
|
137
|
+
We would appreciate acknowledgment if the software is used. Links to
|
138
|
+
non-Federal Government Web sites do not imply NIST endorsement of any
|
139
|
+
particular product, service, organization, company, information
|
140
|
+
provider, or content.
|
141
|
+
____
|
142
|
+
|
143
|
+
|
144
|
+
== Credits
|
145
|
+
|
146
|
+
Expressir is created using the structure and examples provided by
|
147
|
+
the NIST Reeper software on https://sourceforge.net/p/reeper/[Sourceforge].
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
require "rake/extensiontask"
|
4
|
+
require "yard"
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
task :default => :spec
|
9
|
+
|
10
|
+
GEMSPEC = Gem::Specification.load("expressir.gemspec")
|
11
|
+
|
12
|
+
Gem::PackageTask.new(GEMSPEC).define
|
13
|
+
|
14
|
+
YARD::Rake::YardocTask.new
|
data/bin/console
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "reeper"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
require "pry"
|
11
|
+
Pry.start
|
12
|
+
|
data/bin/rspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/setup
ADDED
data/demo.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'expressir'
|
4
|
+
require 'expressir/express/parser'
|
5
|
+
|
6
|
+
# This file is from:
|
7
|
+
# https://github.com/metanorma/annotated-express/blob/master/data/resources/action_schema/action_schema.exp
|
8
|
+
file = 'action_schema.exp'
|
9
|
+
|
10
|
+
# repo = Expressir::Express::Parser.from_exp(file)
|
11
|
+
# schema = repo.schemas.find{|schema| schema.id == "support_resource_schema"}
|
12
|
+
|
13
|
+
repo = Expressir::Express::Parser.from_exp(file)
|
14
|
+
schema = repo.schemas.find{|schema| schema.id == "action_schema"}
|
15
|
+
entity = schema.entities.find{|entity| entity.id == "action_directive_relationship"}
|
16
|
+
where_rule = entity.where_rules.find{|where_rule| where_rule.id == "WR1"}
|
17
|
+
|
18
|
+
puts where_rule.inspect
|
data/docs/development.md
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
## Development Plan
|
2
|
+
|
3
|
+
This document is a draft to understand the basic of the original library, and
|
4
|
+
how the whole tool chain is working at the moment. Once, we've an understanding
|
5
|
+
then let's look at the potential area of improvement, and plan out a high level
|
6
|
+
plan to start the development.
|
7
|
+
|
8
|
+
### What is it, expressir?
|
9
|
+
|
10
|
+
* Expressir is a ruby tool to harvest iso express data model
|
11
|
+
* Express is one of the language to represent data model
|
12
|
+
* Expressir tool is used to manipulate iso express data model
|
13
|
+
* The input for the expressir is a standard xml document
|
14
|
+
* XML Spec: http://stepmod.sourceforge.net/express_model_spec/
|
15
|
+
* Expressir does the job of representing express model as ruby class
|
16
|
+
* REXML-based parser that reads EXPRESS as XML and creates the dictionary (i.e.
|
17
|
+
instances of the EXPRESS Ruby Classes) and then calls a mapper, that may be
|
18
|
+
specified as an option at runtime
|
19
|
+
* Mappers that read the EXPRESS dictionary and perform the conversion to the
|
20
|
+
desired language or format
|
21
|
+
* Express to UML2 Mapper - Convert the express model to UML2
|
22
|
+
* Express to OWL Structure - Convert the express model to OWL Structure
|
23
|
+
* Ruby API generator for express language
|
24
|
+
* Current Ruby API is super slow, it takes 2 hours to generate 400 entity
|
25
|
+
|
26
|
+
### How does the original version work?
|
27
|
+
|
28
|
+
At the core the `expressir.rb` is responsible for everything at moment, it takes
|
29
|
+
an Express XML file as an input and then it parses that XML file and build the
|
30
|
+
correct ruby interface for further processing.
|
31
|
+
|
32
|
+
This `expressir.rb` also expect one mapping file `deafult to mapping.rb`, and it
|
33
|
+
also expect the file to specify a custom method `map_from_express` to take the
|
34
|
+
`Ruby Express Representation` and convert this ruby representation to the
|
35
|
+
desire output format.
|
36
|
+
|
37
|
+
The library also provides couple mapping for UM2, OWL and SysML, so anyone can
|
38
|
+
export their data to any of those format if necessary, and the use cases for
|
39
|
+
those library are as following:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
ruby expressir.rb expxml=<schema.xml> map=<mapping_owl.rb>
|
43
|
+
```
|
44
|
+
|
45
|
+
### What are potential improvement area?
|
46
|
+
|
47
|
+
* The interface is not well defined, someone needs to dig deeper to understand
|
48
|
+
just the basic of the library and how to use for their use cases. This is
|
49
|
+
something that could be improved as initial step.
|
50
|
+
* At the moment, these are some ruby files, so potentially we could group those
|
51
|
+
together as a CLI tool and group some of the common functionality, and provide
|
52
|
+
a straight forward interface for users.
|
53
|
+
* The good part about this library is author had the extensibility in mind from
|
54
|
+
the beginning, so we should keep that functionality as flexible as possible.
|
55
|
+
* There are lot of boilerplate code in the library, but it's understandable as
|
56
|
+
it was written quite long time ago, so maybe most of the tool was not even
|
57
|
+
available back then, so this is the another area we could improve.
|
58
|
+
* Another improvement we could do in terms of actual codebase, we should be able
|
59
|
+
to refactor this library and cleanup as much as possible.
|
60
|
+
|
61
|
+
### What are the initial changes?
|
62
|
+
|
63
|
+
Initially, we can start by creating a ruby cli gem, group these functionality
|
64
|
+
together. This could be named as `expressir`, and this gem will be shipped with an
|
65
|
+
executable called `expressir`.
|
66
|
+
|
67
|
+
Second of all, let's add some dedicated interface for the default type, so user
|
68
|
+
does not need to know all the details but the name of the interface, for example
|
69
|
+
we could expose the transformation as follows:
|
70
|
+
|
71
|
+
```sh
|
72
|
+
# Convert to owl
|
73
|
+
expressir express2owl file=[express_xml_file] [**options]
|
74
|
+
|
75
|
+
# Convert to UML
|
76
|
+
expressir express2uml file=[express_xml_file] [**options]
|
77
|
+
|
78
|
+
# Convert to SysML
|
79
|
+
expressir express2sysml file=[express_xml_file] [**options]
|
80
|
+
|
81
|
+
# Custom conversion
|
82
|
+
expressir express2custom file=[express_xml_file] mapping=[custom_mapping.rb]
|
83
|
+
```
|
84
|
+
|
85
|
+
Third of all once this library is functional as the original version then we
|
86
|
+
will go through each of the existing types, and refactor those as necessary.
|
87
|
+
|
88
|
+
### References
|
89
|
+
|
90
|
+
* https://martinfowler.com/bliki/MovingToNokogiri.html
|
data/exe/expressir
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
# resolve bin path, ignoring symlinks
|
5
|
+
require "pathname"
|
6
|
+
bin_file = Pathname.new(__FILE__).realpath
|
7
|
+
|
8
|
+
# add self to libpath
|
9
|
+
$:.unshift File.expand_path("../../lib", bin_file)
|
10
|
+
|
11
|
+
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
12
|
+
require "rubygems/specification"
|
13
|
+
|
14
|
+
class Gem::Specification
|
15
|
+
def this; self; end
|
16
|
+
end
|
17
|
+
|
18
|
+
# start up the CLI
|
19
|
+
require "expressir"
|
20
|
+
Expressir::Cli.start(ARGV)
|
data/exe/format
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "yaml"
|
4
|
+
require "expressir/express/parser"
|
5
|
+
require "expressir/express/formatter"
|
6
|
+
require "expressir/express/schema_head_formatter"
|
7
|
+
require "expressir/express/hyperlink_formatter"
|
8
|
+
|
9
|
+
exp_files = ARGV
|
10
|
+
|
11
|
+
repository = Expressir::Express::Parser.from_files(exp_files)
|
12
|
+
formatter = Class.new(Expressir::Express::Formatter) do
|
13
|
+
include Expressir::Express::SchemaHeadFormatter
|
14
|
+
include Expressir::Express::HyperlinkFormatter
|
15
|
+
end
|
16
|
+
result = repository.to_hash(formatter: formatter, skip_empty: true)
|
17
|
+
|
18
|
+
puts YAML.dump(result)
|