lutaml 0.7.6 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -6
- data/.rubocop.yml +1 -0
- data/LUTAML.adoc +372 -0
- data/Makefile +2 -0
- data/bin/console +5 -0
- data/bin/folder_yaml2lutaml.sh +6 -0
- data/bin/plantuml2lutaml +59 -0
- data/bin/yaml2lutaml +144 -0
- data/exe/lutaml-sysml +20 -0
- data/exe/lutaml-wsd2uml +59 -0
- data/exe/lutaml-yaml2uml +144 -0
- data/lib/lutaml/express/README.adoc +55 -0
- data/lib/lutaml/express/parsers/exp.rb +21 -0
- data/lib/lutaml/express/version.rb +7 -0
- data/lib/lutaml/express.rb +9 -0
- data/lib/lutaml/lutaml_path/document_wrapper.rb +7 -3
- data/lib/lutaml/parser.rb +7 -0
- data/lib/lutaml/sysml/README.md +40 -0
- data/lib/lutaml/sysml/allocate.rb +8 -0
- data/lib/lutaml/sysml/allocated.rb +7 -0
- data/lib/lutaml/sysml/binding_connector.rb +7 -0
- data/lib/lutaml/sysml/block.rb +27 -0
- data/lib/lutaml/sysml/constraint_block.rb +12 -0
- data/lib/lutaml/sysml/copy.rb +6 -0
- data/lib/lutaml/sysml/derive_requirement.rb +7 -0
- data/lib/lutaml/sysml/nested_connector_end.rb +11 -0
- data/lib/lutaml/sysml/refine.rb +7 -0
- data/lib/lutaml/sysml/requirement.rb +34 -0
- data/lib/lutaml/sysml/requirement_related.rb +7 -0
- data/lib/lutaml/sysml/satisfy.rb +7 -0
- data/lib/lutaml/sysml/test_case.rb +22 -0
- data/lib/lutaml/sysml/trace.rb +7 -0
- data/lib/lutaml/sysml/verify.rb +6 -0
- data/lib/lutaml/sysml/version.rb +5 -0
- data/lib/lutaml/sysml/xmi_file.rb +417 -0
- data/lib/lutaml/sysml.rb +10 -0
- data/lib/lutaml/uml/README.adoc +44 -0
- data/lib/lutaml/uml/abstraction.rb +11 -0
- data/lib/lutaml/uml/activity.rb +11 -0
- data/lib/lutaml/uml/actor.rb +19 -0
- data/lib/lutaml/uml/association.rb +43 -0
- data/lib/lutaml/uml/behavior.rb +11 -0
- data/lib/lutaml/uml/class.rb +83 -0
- data/lib/lutaml/uml/classifier.rb +11 -0
- data/lib/lutaml/uml/connector.rb +21 -0
- data/lib/lutaml/uml/constraint.rb +12 -0
- data/lib/lutaml/uml/constructor_end.rb +16 -0
- data/lib/lutaml/uml/data_type.rb +75 -0
- data/lib/lutaml/uml/dependency.rb +21 -0
- data/lib/lutaml/uml/diagram.rb +8 -0
- data/lib/lutaml/uml/document.rb +81 -0
- data/lib/lutaml/uml/enum.rb +45 -0
- data/lib/lutaml/uml/event.rb +12 -0
- data/lib/lutaml/uml/final_state.rb +11 -0
- data/lib/lutaml/uml/formatter/base.rb +67 -0
- data/lib/lutaml/uml/formatter/graphviz.rb +334 -0
- data/lib/lutaml/uml/formatter.rb +21 -0
- data/lib/lutaml/uml/has_attributes.rb +14 -0
- data/lib/lutaml/uml/has_members.rb +30 -0
- data/lib/lutaml/uml/instance.rb +17 -0
- data/lib/lutaml/uml/model.rb +13 -0
- data/lib/lutaml/uml/node/base.rb +21 -0
- data/lib/lutaml/uml/node/class_node.rb +57 -0
- data/lib/lutaml/uml/node/class_relationship.rb +14 -0
- data/lib/lutaml/uml/node/document.rb +18 -0
- data/lib/lutaml/uml/node/field.rb +34 -0
- data/lib/lutaml/uml/node/has_name.rb +15 -0
- data/lib/lutaml/uml/node/has_type.rb +15 -0
- data/lib/lutaml/uml/node/method.rb +29 -0
- data/lib/lutaml/uml/node/method_argument.rb +16 -0
- data/lib/lutaml/uml/node/relationship.rb +28 -0
- data/lib/lutaml/uml/opaque_behavior.rb +11 -0
- data/lib/lutaml/uml/operation.rb +31 -0
- data/lib/lutaml/uml/package.rb +53 -0
- data/lib/lutaml/uml/parsers/attribute.rb +70 -0
- data/lib/lutaml/uml/parsers/dsl.rb +413 -0
- data/lib/lutaml/uml/parsers/dsl_preprocessor.rb +59 -0
- data/lib/lutaml/uml/parsers/dsl_transform.rb +27 -0
- data/lib/lutaml/uml/parsers/yaml.rb +46 -0
- data/lib/lutaml/uml/port.rb +8 -0
- data/lib/lutaml/uml/primitive_type.rb +14 -0
- data/lib/lutaml/uml/property.rb +27 -0
- data/lib/lutaml/uml/pseudostate.rb +11 -0
- data/lib/lutaml/uml/realization.rb +11 -0
- data/lib/lutaml/uml/region.rb +12 -0
- data/lib/lutaml/uml/serializers/association.rb +58 -0
- data/lib/lutaml/uml/serializers/base.rb +16 -0
- data/lib/lutaml/uml/serializers/class.rb +29 -0
- data/lib/lutaml/uml/serializers/top_element_attribute.rb +14 -0
- data/lib/lutaml/uml/serializers/yaml_view.rb +18 -0
- data/lib/lutaml/uml/state.rb +12 -0
- data/lib/lutaml/uml/state_machine.rb +12 -0
- data/lib/lutaml/uml/top_element.rb +58 -0
- data/lib/lutaml/uml/top_element_attribute.rb +39 -0
- data/lib/lutaml/uml/transition.rb +12 -0
- data/lib/lutaml/uml/trigger.rb +12 -0
- data/lib/lutaml/uml/value.rb +31 -0
- data/lib/lutaml/uml/version.rb +7 -0
- data/lib/lutaml/uml/vertex.rb +11 -0
- data/lib/lutaml/uml.rb +13 -0
- data/lib/lutaml/version.rb +1 -1
- data/lib/lutaml/xmi/README.adoc +24 -0
- data/lib/lutaml/xmi/parsers/xml.rb +600 -0
- data/lib/lutaml/xmi/version.rb +5 -0
- data/lib/lutaml/xmi.rb +7 -0
- data/lib/lutaml/xml/lutaml_path/document_wrapper.rb +45 -0
- data/lib/lutaml/xml/mapper.rb +448 -0
- data/lib/lutaml/xml/parsers/xml.rb +57 -0
- data/lib/lutaml/xml.rb +9 -0
- data/lutaml.gemspec +8 -3
- metadata +192 -16
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "hashie"
|
4
|
+
|
5
|
+
module Lutaml
|
6
|
+
module Uml
|
7
|
+
module Serializers
|
8
|
+
class Base < Hashie::Dash
|
9
|
+
include Hashie::Extensions::Dash::PropertyTranslation
|
10
|
+
include Hashie::Extensions::Dash::IndifferentAccess
|
11
|
+
include Hashie::Extensions::Dash::Coercion
|
12
|
+
include Hashie::Extensions::IgnoreUndeclared
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "lutaml/uml/serializers/base"
|
4
|
+
require "lutaml/uml/serializers/top_element_attribute"
|
5
|
+
require "lutaml/uml/serializers/association"
|
6
|
+
|
7
|
+
module Lutaml
|
8
|
+
module Uml
|
9
|
+
module Serializers
|
10
|
+
class Class < Base
|
11
|
+
property :attributes,
|
12
|
+
transform_with: (lambda do |entry|
|
13
|
+
entry
|
14
|
+
.to_a
|
15
|
+
.map do |(name, attributes)|
|
16
|
+
attributes.merge(name: name)
|
17
|
+
end
|
18
|
+
end)
|
19
|
+
property :associations,
|
20
|
+
from: :relations,
|
21
|
+
coerce: Array[::Lutaml::Uml::Serializers::Association]
|
22
|
+
property :name
|
23
|
+
# property :type, from: :modelType
|
24
|
+
# property :relations,
|
25
|
+
# coerce: Array[Relation]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "lutaml/uml/serializers/base"
|
4
|
+
require "lutaml/uml/serializers/class"
|
5
|
+
|
6
|
+
module Lutaml
|
7
|
+
module Uml
|
8
|
+
module Serializers
|
9
|
+
class YamlView < Base
|
10
|
+
property :name
|
11
|
+
property :title
|
12
|
+
property :caption
|
13
|
+
property :groups
|
14
|
+
property :fidelity
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Uml
|
5
|
+
class TopElement
|
6
|
+
include HasAttributes
|
7
|
+
|
8
|
+
attr_accessor :name,
|
9
|
+
:definition,
|
10
|
+
:xmi_id,
|
11
|
+
:xmi_uuid,
|
12
|
+
:namespace,
|
13
|
+
:keyword,
|
14
|
+
:stereotype,
|
15
|
+
:href,
|
16
|
+
:visibility,
|
17
|
+
:comments
|
18
|
+
|
19
|
+
# rubocop:disable Rails/ActiveRecordAliases
|
20
|
+
def initialize(attributes = {})
|
21
|
+
@visibility = "public"
|
22
|
+
@name = attributes["name"]
|
23
|
+
update_attributes(attributes)
|
24
|
+
end
|
25
|
+
# rubocop:enable Rails/ActiveRecordAliases
|
26
|
+
|
27
|
+
def full_name
|
28
|
+
if name == nil
|
29
|
+
return nil
|
30
|
+
end
|
31
|
+
|
32
|
+
the_name = name
|
33
|
+
next_namespace = namespace
|
34
|
+
|
35
|
+
while !next_namespace.nil?
|
36
|
+
the_name = if !next_namespace.name.nil?
|
37
|
+
next_namespace.name + "::" + the_name
|
38
|
+
else
|
39
|
+
"::" + the_name
|
40
|
+
end
|
41
|
+
next_namespace = next_namespace.namespace
|
42
|
+
end
|
43
|
+
|
44
|
+
the_name
|
45
|
+
end
|
46
|
+
|
47
|
+
def definition=(value)
|
48
|
+
@definition = value
|
49
|
+
.to_s
|
50
|
+
.gsub(/\\}/, '}')
|
51
|
+
.gsub(/\\{/, '{')
|
52
|
+
.split("\n")
|
53
|
+
.map(&:strip)
|
54
|
+
.join("\n")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Uml
|
5
|
+
class TopElementAttribute
|
6
|
+
include HasAttributes
|
7
|
+
include HasMembers
|
8
|
+
|
9
|
+
attr_accessor :name,
|
10
|
+
:visibility,
|
11
|
+
:type,
|
12
|
+
:id,
|
13
|
+
:xmi_id,
|
14
|
+
:definition,
|
15
|
+
:contain,
|
16
|
+
:static,
|
17
|
+
:cardinality,
|
18
|
+
:keyword,
|
19
|
+
:is_derived
|
20
|
+
|
21
|
+
# rubocop:disable Rails/ActiveRecordAliases
|
22
|
+
def initialize(attributes = {})
|
23
|
+
@visibility = "public"
|
24
|
+
update_attributes(attributes)
|
25
|
+
end
|
26
|
+
# rubocop:enable Rails/ActiveRecordAliases
|
27
|
+
|
28
|
+
def definition=(value)
|
29
|
+
@definition = value
|
30
|
+
.to_s
|
31
|
+
.gsub(/\\}/, '}')
|
32
|
+
.gsub(/\\{/, '{')
|
33
|
+
.split("\n")
|
34
|
+
.map(&:strip)
|
35
|
+
.join("\n")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Uml
|
5
|
+
class Value
|
6
|
+
include HasAttributes
|
7
|
+
include HasMembers
|
8
|
+
|
9
|
+
attr_accessor :definition,
|
10
|
+
:name,
|
11
|
+
:id,
|
12
|
+
:type
|
13
|
+
|
14
|
+
# rubocop:disable Rails/ActiveRecordAliases
|
15
|
+
def initialize(attributes = {})
|
16
|
+
update_attributes(attributes)
|
17
|
+
end
|
18
|
+
# rubocop:enable Rails/ActiveRecordAliases
|
19
|
+
|
20
|
+
def definition=(value)
|
21
|
+
@definition = value
|
22
|
+
.to_s
|
23
|
+
.gsub(/\\}/, '}')
|
24
|
+
.gsub(/\\{/, '{')
|
25
|
+
.split("\n")
|
26
|
+
.map(&:strip)
|
27
|
+
.join("\n")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/lutaml/uml.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "lutaml/uml/version"
|
4
|
+
require "lutaml/uml/parsers/dsl"
|
5
|
+
require "lutaml/uml/parsers/yaml"
|
6
|
+
require "lutaml/uml/parsers/attribute"
|
7
|
+
require "lutaml/uml/formatter"
|
8
|
+
|
9
|
+
module Lutaml
|
10
|
+
module Uml
|
11
|
+
class Error < StandardError; end
|
12
|
+
end
|
13
|
+
end
|
data/lib/lutaml/version.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Lutaml::Uml
|
2
|
+
|
3
|
+
Lutaml-xmi is a parser for XML Metadata Interchange (XMI) Specification files.
|
4
|
+
|
5
|
+
## Install
|
6
|
+
|
7
|
+
### Bundler: `gem "lutaml-xmi"`
|
8
|
+
|
9
|
+
### RubyGems: `gem install lutaml-xmi`
|
10
|
+
|
11
|
+
## Development
|
12
|
+
|
13
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
14
|
+
|
15
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
16
|
+
|
17
|
+
## Contributing
|
18
|
+
|
19
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lutaml-xmi. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/lutaml-xmi/blob/master/CODE_OF_CONDUCT.md).
|
20
|
+
|
21
|
+
|
22
|
+
## Code of Conduct
|
23
|
+
|
24
|
+
Everyone interacting in the Lutaml::Uml project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/lutaml-xmi/blob/master/CODE_OF_CONDUCT.md).
|