lutaml-lml 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/lutaml/lml/association_label_resolver.rb +52 -0
- data/lib/lutaml/lml/cli.rb +262 -0
- data/lib/lutaml/lml/data_processor/attribute_processing.rb +81 -0
- data/lib/lutaml/lml/data_processor/collection_processing.rb +37 -0
- data/lib/lutaml/lml/data_processor/instance_processing.rb +63 -0
- data/lib/lutaml/lml/data_processor/value_processing.rb +98 -0
- data/lib/lutaml/lml/data_processor/view_processing.rb +25 -0
- data/lib/lutaml/lml/data_processor.rb +49 -0
- data/lib/lutaml/lml/document_builder.rb +139 -0
- data/lib/lutaml/lml/executor/adapter_helpers.rb +45 -0
- data/lib/lutaml/lml/executor/condition_evaluator.rb +169 -0
- data/lib/lutaml/lml/executor/csv_adapter.rb +88 -0
- data/lib/lutaml/lml/executor/format_adapter.rb +54 -0
- data/lib/lutaml/lml/executor/xml_adapter.rb +102 -0
- data/lib/lutaml/lml/executor.rb +89 -0
- data/lib/lutaml/lml/format/adapter/document.rb +11 -0
- data/lib/lutaml/lml/format/adapter/mapping.rb +19 -0
- data/lib/lutaml/lml/format/adapter/standard_adapter.rb +127 -0
- data/lib/lutaml/lml/format/adapter/transform.rb +11 -0
- data/lib/lutaml/lml/format.rb +29 -0
- data/lib/lutaml/lml/formatter/base.rb +79 -0
- data/lib/lutaml/lml/formatter/graphviz/document_formatter.rb +89 -0
- data/lib/lutaml/lml/formatter/graphviz/html_builder.rb +72 -0
- data/lib/lutaml/lml/formatter/graphviz/node_formatter.rb +74 -0
- data/lib/lutaml/lml/formatter/graphviz/relationship_formatter.rb +130 -0
- data/lib/lutaml/lml/formatter/graphviz.rb +90 -0
- data/lib/lutaml/lml/formatter.rb +8 -0
- data/lib/lutaml/lml/grammar/concerns/associations.rb +76 -0
- data/lib/lutaml/lml/grammar/concerns/attributes.rb +126 -0
- data/lib/lutaml/lml/grammar/concerns/data_structures.rb +84 -0
- data/lib/lutaml/lml/grammar/concerns/definitions.rb +222 -0
- data/lib/lutaml/lml/grammar/concerns/instance_rules.rb +59 -0
- data/lib/lutaml/lml/grammar/concerns/primitives.rb +89 -0
- data/lib/lutaml/lml/grammar/concerns/view_rules.rb +34 -0
- data/lib/lutaml/lml/grammar/concerns.rb +17 -0
- data/lib/lutaml/lml/grammar/core.rb +71 -0
- data/lib/lutaml/lml/grammar/full.rb +12 -0
- data/lib/lutaml/lml/grammar/instances.rb +38 -0
- data/lib/lutaml/lml/grammar.rb +12 -0
- data/lib/lutaml/lml/has_attributes.rb +14 -0
- data/lib/lutaml/lml/import_resolver.rb +89 -0
- data/lib/lutaml/lml/layout/engine.rb +17 -0
- data/lib/lutaml/lml/layout/graph_viz_engine.rb +19 -0
- data/lib/lutaml/lml/layout.rb +8 -0
- data/lib/lutaml/lml/model_compiler.rb +325 -0
- data/lib/lutaml/lml/models/action.rb +10 -0
- data/lib/lutaml/lml/models/association.rb +26 -0
- data/lib/lutaml/lml/models/cardinality.rb +10 -0
- data/lib/lutaml/lml/models/collection.rb +11 -0
- data/lib/lutaml/lml/models/constraint.rb +20 -0
- data/lib/lutaml/lml/models/data_type.rb +31 -0
- data/lib/lutaml/lml/models/diagram.rb +17 -0
- data/lib/lutaml/lml/models/document.rb +45 -0
- data/lib/lutaml/lml/models/enum.rb +28 -0
- data/lib/lutaml/lml/models/fidelity.rb +10 -0
- data/lib/lutaml/lml/models/group.rb +11 -0
- data/lib/lutaml/lml/models/instance.rb +13 -0
- data/lib/lutaml/lml/models/instance_collection.rb +12 -0
- data/lib/lutaml/lml/models/instances_export.rb +10 -0
- data/lib/lutaml/lml/models/instances_import.rb +11 -0
- data/lib/lutaml/lml/models/operation.rb +23 -0
- data/lib/lutaml/lml/models/operation_parameter.rb +11 -0
- data/lib/lutaml/lml/models/package.rb +22 -0
- data/lib/lutaml/lml/models/primitive_type.rb +26 -0
- data/lib/lutaml/lml/models/top_element_attribute.rb +31 -0
- data/lib/lutaml/lml/models/uml_class.rb +84 -0
- data/lib/lutaml/lml/models/value.rb +12 -0
- data/lib/lutaml/lml/models/view_filter.rb +11 -0
- data/lib/lutaml/lml/models/view_import.rb +11 -0
- data/lib/lutaml/lml/parser.rb +22 -0
- data/lib/lutaml/lml/pipeline.rb +64 -0
- data/lib/lutaml/lml/preprocessor.rb +56 -0
- data/lib/lutaml/lml/transform.rb +20 -0
- data/lib/lutaml/lml/version.rb +7 -0
- data/lib/lutaml/lml/view_resolver.rb +48 -0
- data/lib/lutaml/lml/yaml_parser.rb +17 -0
- data/lib/lutaml/lml.rb +67 -0
- metadata +178 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Lutaml
|
|
4
|
+
module Lml
|
|
5
|
+
class PrimitiveType < Lutaml::Model::Serializable
|
|
6
|
+
# Primitives in LML are name-only entities, but the formatter
|
|
7
|
+
# accesses the same attributes as DataType via format_class.
|
|
8
|
+
attribute :name, :string
|
|
9
|
+
attribute :keyword, :string, default: "primitive"
|
|
10
|
+
attribute :definition, :string
|
|
11
|
+
attribute :stereotype, :string, collection: true, default: -> { [] }
|
|
12
|
+
attribute :visibility, :string, default: "public"
|
|
13
|
+
attribute :is_abstract, :boolean, default: false
|
|
14
|
+
attribute :attributes, "Lutaml::Lml::TopElementAttribute", collection: true,
|
|
15
|
+
default: -> { [] }
|
|
16
|
+
attribute :operations, "Lutaml::Lml::Operation", collection: true,
|
|
17
|
+
default: -> { [] }
|
|
18
|
+
attribute :associations, "Lutaml::Lml::Association", collection: true,
|
|
19
|
+
default: -> { [] }
|
|
20
|
+
|
|
21
|
+
def self.entity_type
|
|
22
|
+
:primitives
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Lutaml
|
|
4
|
+
module Lml
|
|
5
|
+
class TopElementAttribute < Lutaml::Model::Serializable
|
|
6
|
+
# Core attributes
|
|
7
|
+
attribute :name, :string
|
|
8
|
+
attribute :visibility, :string, default: "public"
|
|
9
|
+
attribute :type, :string
|
|
10
|
+
attribute :id, :string
|
|
11
|
+
attribute :contain, :string
|
|
12
|
+
attribute :static, :string
|
|
13
|
+
attribute :cardinality, "Lutaml::Lml::Cardinality"
|
|
14
|
+
attribute :keyword, :string
|
|
15
|
+
attribute :is_derived, :boolean, default: false
|
|
16
|
+
attribute :is_static, :boolean, default: false
|
|
17
|
+
attribute :is_read_only, :boolean, default: false
|
|
18
|
+
attribute :stereotype, :string, collection: true, default: -> { [] }
|
|
19
|
+
attribute :definition, :string
|
|
20
|
+
attribute :association, :string
|
|
21
|
+
attribute :default, :string
|
|
22
|
+
|
|
23
|
+
# LML-specific attributes
|
|
24
|
+
attribute :properties, "Lutaml::Lml::TopElementAttribute", collection: true, default: []
|
|
25
|
+
attribute :value, "Lutaml::Lml::TopElementAttribute", collection: true
|
|
26
|
+
attribute :attributes, "Lutaml::Lml::TopElementAttribute", collection: true, default: []
|
|
27
|
+
attribute :extended, :boolean
|
|
28
|
+
attribute :instances, "Lutaml::Lml::Instance", collection: true, default: []
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Lutaml
|
|
4
|
+
module Lml
|
|
5
|
+
class UmlClass < Lutaml::Model::Serializable
|
|
6
|
+
# From TopElement
|
|
7
|
+
attribute :name, :string
|
|
8
|
+
attribute :definition, :string
|
|
9
|
+
attribute :keyword, :string
|
|
10
|
+
attribute :stereotype, :string, collection: true, default: -> { [] }
|
|
11
|
+
attribute :visibility, :string, default: "public"
|
|
12
|
+
attribute :comments, :string, collection: true
|
|
13
|
+
|
|
14
|
+
# From UmlClassifier
|
|
15
|
+
attribute :is_abstract, :boolean, default: false
|
|
16
|
+
|
|
17
|
+
# From UmlClass
|
|
18
|
+
attribute :nested_classifier, :string, collection: true, default: -> { [] }
|
|
19
|
+
attribute :type, :string
|
|
20
|
+
attribute :attributes, "Lutaml::Lml::TopElementAttribute", collection: true
|
|
21
|
+
attribute :modifier, :string
|
|
22
|
+
attribute :constraints, "Lutaml::Lml::Constraint", collection: true
|
|
23
|
+
attribute :operations, "Lutaml::Lml::Operation", collection: true
|
|
24
|
+
attribute :data_types, "Lutaml::Lml::DataType", collection: true
|
|
25
|
+
attribute :associations, "Lutaml::Lml::Association", collection: true
|
|
26
|
+
|
|
27
|
+
# LML-specific
|
|
28
|
+
attribute :parent_class, :string
|
|
29
|
+
|
|
30
|
+
yaml do
|
|
31
|
+
map "name", to: :name
|
|
32
|
+
map "keyword", to: :keyword
|
|
33
|
+
map "is_abstract", to: :is_abstract
|
|
34
|
+
map "definition", to: :definition, with: {
|
|
35
|
+
to: :definition_to_yaml, from: :definition_from_yaml
|
|
36
|
+
}
|
|
37
|
+
map "modifier", to: :modifier
|
|
38
|
+
map "stereotype", to: :stereotype
|
|
39
|
+
map "visibility", to: :visibility
|
|
40
|
+
map "type", to: :type
|
|
41
|
+
map "attributes", to: :attributes
|
|
42
|
+
map "operations", to: :operations
|
|
43
|
+
map "constraints", to: :constraints
|
|
44
|
+
map "data_types", to: :data_types
|
|
45
|
+
map "associations", to: :associations, with: {
|
|
46
|
+
to: :associations_to_yaml, from: :associations_from_yaml
|
|
47
|
+
}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def associations_to_yaml(model, doc)
|
|
51
|
+
return unless model.associations
|
|
52
|
+
|
|
53
|
+
associations = model.associations.map(&:to_hash)
|
|
54
|
+
doc["associations"] = associations unless associations.empty?
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def associations_from_yaml(model, values)
|
|
58
|
+
associations = values.map do |value|
|
|
59
|
+
value["owner_end"] = model.name if value["owner_end"].nil?
|
|
60
|
+
Association.from_yaml(value.to_yaml)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
model.associations = associations
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def definition_to_yaml(model, doc)
|
|
67
|
+
doc["definition"] = model.definition if model.definition
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def definition_from_yaml(model, value)
|
|
71
|
+
model.definition = value.to_s
|
|
72
|
+
.gsub(/\\}/, "}")
|
|
73
|
+
.gsub(/\\{/, "{")
|
|
74
|
+
.split("\n")
|
|
75
|
+
.map(&:strip)
|
|
76
|
+
.join("\n")
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def self.entity_type
|
|
80
|
+
:classes
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "parslet"
|
|
4
|
+
require "parslet/convenience"
|
|
5
|
+
|
|
6
|
+
module Lutaml
|
|
7
|
+
module Lml
|
|
8
|
+
class Parser < Parslet::Parser
|
|
9
|
+
include Grammar::Full
|
|
10
|
+
|
|
11
|
+
root(:diagram)
|
|
12
|
+
|
|
13
|
+
def self.parse(io)
|
|
14
|
+
Pipeline.call(io)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.parse_document(io)
|
|
18
|
+
Pipeline.call(io, resolve: false)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "parslet"
|
|
4
|
+
require "parslet/convenience"
|
|
5
|
+
|
|
6
|
+
module Lutaml
|
|
7
|
+
module Lml
|
|
8
|
+
class Pipeline
|
|
9
|
+
def self.call(input, resolve: true)
|
|
10
|
+
new(input, resolve: resolve).call
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def initialize(input, resolve: true)
|
|
14
|
+
@input = input
|
|
15
|
+
@resolve = resolve
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def call
|
|
19
|
+
data = Preprocessor.call(@input)
|
|
20
|
+
hash = parse_raw(data)
|
|
21
|
+
hash = DataProcessor.process(hash)
|
|
22
|
+
document = build_document(hash)
|
|
23
|
+
if @resolve
|
|
24
|
+
document = resolve_document(document)
|
|
25
|
+
AssociationLabelResolver.new.enrich(document)
|
|
26
|
+
end
|
|
27
|
+
document
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
def parse_raw(data)
|
|
33
|
+
reporter = Parslet::ErrorReporter::Deepest.new
|
|
34
|
+
Transform.new.apply(Parser.new.parse(data, reporter: reporter))
|
|
35
|
+
rescue Parslet::ParseFailed => e
|
|
36
|
+
raise(ParsingError,
|
|
37
|
+
"#{e.message}\ncause: #{e.parse_failure_cause.ascii_tree}")
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def build_document(hash)
|
|
41
|
+
DocumentBuilder.new(DocumentBuilder::DEFAULT_REGISTRY).build(:document, hash)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def resolve_document(document)
|
|
45
|
+
return document unless document.view_imports&.any?
|
|
46
|
+
|
|
47
|
+
base_path = @input.is_a?(StringIO) ? nil : @input.path
|
|
48
|
+
entities, associations = ImportResolver.new(base_path).resolve(document)
|
|
49
|
+
entities, associations = ViewResolver.new.resolve(document, entities, associations)
|
|
50
|
+
rebuild_document(document, entities, associations)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def rebuild_document(document, entities, associations)
|
|
54
|
+
grouped = entities.group_by { |e| e.class.entity_type }
|
|
55
|
+
|
|
56
|
+
document.classes = grouped[:classes] || []
|
|
57
|
+
document.enums = grouped[:enums] || []
|
|
58
|
+
document.data_types = grouped[:data_types] || []
|
|
59
|
+
document.associations = associations
|
|
60
|
+
document
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Lutaml
|
|
4
|
+
module Lml
|
|
5
|
+
class Preprocessor
|
|
6
|
+
attr_reader :input_file
|
|
7
|
+
|
|
8
|
+
def initialize(input_file)
|
|
9
|
+
@input_file = input_file
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class << self
|
|
13
|
+
def call(input_file)
|
|
14
|
+
new(input_file).call
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def call
|
|
19
|
+
input_file.rewind
|
|
20
|
+
include_root = input_file.is_a?(StringIO) ? Dir.pwd : File.dirname(input_file.path)
|
|
21
|
+
input_file.read.split("\n").reduce([]) do |res, line|
|
|
22
|
+
res.push(*process_dsl_line(include_root, line))
|
|
23
|
+
end.join("\n")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def process_dsl_line(include_root, line)
|
|
29
|
+
process_include_line(include_root, process_comment_line(line))
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def process_comment_line(line)
|
|
33
|
+
has_comment = line.match(%r{//.*})
|
|
34
|
+
return line if has_comment.nil?
|
|
35
|
+
|
|
36
|
+
line.gsub(%r{//.*}, "")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def process_include_line(include_root, line)
|
|
40
|
+
include_path_match = line.match(/^\s*include\s+(.+)/)
|
|
41
|
+
return line if include_path_match.nil? || line =~ /^\s\*\*/
|
|
42
|
+
|
|
43
|
+
path_to_file = File.expand_path(include_path_match[1].strip, include_root)
|
|
44
|
+
File.read(path_to_file).split("\n").map do |l|
|
|
45
|
+
process_comment_line(l)
|
|
46
|
+
end
|
|
47
|
+
rescue Errno::ENOENT
|
|
48
|
+
$stderr.puts(
|
|
49
|
+
"No such file or directory @ rb_sysopen - #{path_to_file}, " \
|
|
50
|
+
"include file paths need to be supplied relative to the main document"
|
|
51
|
+
)
|
|
52
|
+
[]
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'parslet'
|
|
4
|
+
|
|
5
|
+
module Lutaml
|
|
6
|
+
module Lml
|
|
7
|
+
class Transform < Parslet::Transform
|
|
8
|
+
VISIBILITY_MAP = {
|
|
9
|
+
'-' => 'private',
|
|
10
|
+
'#' => 'protected',
|
|
11
|
+
'~' => 'friendly'
|
|
12
|
+
}.freeze
|
|
13
|
+
|
|
14
|
+
rule(visibility_modifier: simple(:visibility_value)) do
|
|
15
|
+
VISIBILITY_MAP.fetch(visibility_value.to_s, 'public')
|
|
16
|
+
end
|
|
17
|
+
rule(simple(:member)) { member.nil? ? member : member.to_s.strip }
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Lutaml
|
|
4
|
+
module Lml
|
|
5
|
+
class ViewResolver
|
|
6
|
+
def resolve(document, entities, associations)
|
|
7
|
+
visible = apply_filters(document, entities)
|
|
8
|
+
filtered_associations = filter_associations(associations, visible)
|
|
9
|
+
|
|
10
|
+
[visible, filtered_associations]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def apply_filters(document, entities)
|
|
16
|
+
names = entities.each_with_object({}) { |e, h| h[e.name] = e }
|
|
17
|
+
|
|
18
|
+
names = apply_show_filter(names, document.show_filter)
|
|
19
|
+
names = apply_hide_filter(names, document.hide_filter)
|
|
20
|
+
|
|
21
|
+
names.values
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def apply_show_filter(names, filter)
|
|
25
|
+
return names unless filter
|
|
26
|
+
|
|
27
|
+
show_set = filter.entity_names.to_set
|
|
28
|
+
names.select { |name, _| show_set.include?(name) }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def apply_hide_filter(names, filter)
|
|
32
|
+
return names unless filter
|
|
33
|
+
|
|
34
|
+
hide_set = filter.entity_names.to_set
|
|
35
|
+
names.reject { |name, _| hide_set.include?(name) }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def filter_associations(associations, visible_entities)
|
|
39
|
+
visible_names = visible_entities.map(&:name).to_set
|
|
40
|
+
associations.select do |assoc|
|
|
41
|
+
owner_visible = visible_names.include?(assoc.owner_end.to_s)
|
|
42
|
+
member_visible = visible_names.include?(assoc.member_end.to_s)
|
|
43
|
+
owner_visible && member_visible
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "yaml"
|
|
4
|
+
|
|
5
|
+
module Lutaml
|
|
6
|
+
module Lml
|
|
7
|
+
class YamlParser
|
|
8
|
+
def self.parse(yaml_path, options = {})
|
|
9
|
+
new.parse(yaml_path, options)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def parse(yaml_path, _options = {})
|
|
13
|
+
Lutaml::Lml::Document.from_yaml(File.read(yaml_path))
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/lutaml/lml.rb
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
# Lutaml::Formatter and Lutaml::Layout are in the Lutaml top namespace,
|
|
6
|
+
# not Lutaml::Lml. Require their namespace files to set up autoloads.
|
|
7
|
+
require "lutaml/lml/formatter"
|
|
8
|
+
require "lutaml/lml/layout"
|
|
9
|
+
|
|
10
|
+
module Lutaml
|
|
11
|
+
class Error < StandardError; end
|
|
12
|
+
|
|
13
|
+
module Lml
|
|
14
|
+
class Error < Lutaml::Error; end
|
|
15
|
+
class ParsingError < Error; end
|
|
16
|
+
|
|
17
|
+
def self.compile(input, namespace: nil)
|
|
18
|
+
ModelCompiler.new(namespace: namespace).compile(input)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Top-level autoloads
|
|
22
|
+
autoload :Parser, "lutaml/lml/parser"
|
|
23
|
+
autoload :Pipeline, "lutaml/lml/pipeline"
|
|
24
|
+
autoload :Preprocessor, "lutaml/lml/preprocessor"
|
|
25
|
+
autoload :Transform, "lutaml/lml/transform"
|
|
26
|
+
autoload :DataProcessor, "lutaml/lml/data_processor"
|
|
27
|
+
autoload :DocumentBuilder, "lutaml/lml/document_builder"
|
|
28
|
+
autoload :ModelCompiler, "lutaml/lml/model_compiler"
|
|
29
|
+
autoload :ImportResolver, "lutaml/lml/import_resolver"
|
|
30
|
+
autoload :ViewResolver, "lutaml/lml/view_resolver"
|
|
31
|
+
autoload :AssociationLabelResolver, "lutaml/lml/association_label_resolver"
|
|
32
|
+
autoload :Executor, "lutaml/lml/executor"
|
|
33
|
+
autoload :YamlParser, "lutaml/lml/yaml_parser"
|
|
34
|
+
autoload :HasAttributes, "lutaml/lml/has_attributes"
|
|
35
|
+
autoload :VERSION, "lutaml/lml/version"
|
|
36
|
+
|
|
37
|
+
# Model classes (in Lutaml::Lml namespace, files in models/ directory)
|
|
38
|
+
autoload :Action, "lutaml/lml/models/action"
|
|
39
|
+
autoload :Association, "lutaml/lml/models/association"
|
|
40
|
+
autoload :Cardinality, "lutaml/lml/models/cardinality"
|
|
41
|
+
autoload :Collection, "lutaml/lml/models/collection"
|
|
42
|
+
autoload :Constraint, "lutaml/lml/models/constraint"
|
|
43
|
+
autoload :DataType, "lutaml/lml/models/data_type"
|
|
44
|
+
autoload :Diagram, "lutaml/lml/models/diagram"
|
|
45
|
+
autoload :Document, "lutaml/lml/models/document"
|
|
46
|
+
autoload :Enum, "lutaml/lml/models/enum"
|
|
47
|
+
autoload :Fidelity, "lutaml/lml/models/fidelity"
|
|
48
|
+
autoload :Group, "lutaml/lml/models/group"
|
|
49
|
+
autoload :Instance, "lutaml/lml/models/instance"
|
|
50
|
+
autoload :InstanceCollection, "lutaml/lml/models/instance_collection"
|
|
51
|
+
autoload :InstancesExport, "lutaml/lml/models/instances_export"
|
|
52
|
+
autoload :InstancesImport, "lutaml/lml/models/instances_import"
|
|
53
|
+
autoload :Operation, "lutaml/lml/models/operation"
|
|
54
|
+
autoload :OperationParameter, "lutaml/lml/models/operation_parameter"
|
|
55
|
+
autoload :Package, "lutaml/lml/models/package"
|
|
56
|
+
autoload :PrimitiveType, "lutaml/lml/models/primitive_type"
|
|
57
|
+
autoload :TopElementAttribute, "lutaml/lml/models/top_element_attribute"
|
|
58
|
+
autoload :UmlClass, "lutaml/lml/models/uml_class"
|
|
59
|
+
autoload :Value, "lutaml/lml/models/value"
|
|
60
|
+
autoload :ViewFilter, "lutaml/lml/models/view_filter"
|
|
61
|
+
autoload :ViewImport, "lutaml/lml/models/view_import"
|
|
62
|
+
|
|
63
|
+
# Namespaces with their own autoloads
|
|
64
|
+
autoload :Grammar, "lutaml/lml/grammar"
|
|
65
|
+
autoload :Format, "lutaml/lml/format"
|
|
66
|
+
end
|
|
67
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: lutaml-lml
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Ribose Inc.
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: lutaml-model
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 0.8.0
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: 0.8.0
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: parslet
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '2.0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '2.0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: moxml
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: 0.1.24
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 0.1.24
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: ruby-graphviz
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
68
|
+
description: 'Parses LML (.lml / .lutaml) text syntax into UML/LML domain models.
|
|
69
|
+
Supports two layers: model definitions (classes, enums, attributes) and data instances
|
|
70
|
+
(collections, imports, exports).'
|
|
71
|
+
email:
|
|
72
|
+
- open.source@ribose.com
|
|
73
|
+
executables: []
|
|
74
|
+
extensions: []
|
|
75
|
+
extra_rdoc_files: []
|
|
76
|
+
files:
|
|
77
|
+
- lib/lutaml/lml.rb
|
|
78
|
+
- lib/lutaml/lml/association_label_resolver.rb
|
|
79
|
+
- lib/lutaml/lml/cli.rb
|
|
80
|
+
- lib/lutaml/lml/data_processor.rb
|
|
81
|
+
- lib/lutaml/lml/data_processor/attribute_processing.rb
|
|
82
|
+
- lib/lutaml/lml/data_processor/collection_processing.rb
|
|
83
|
+
- lib/lutaml/lml/data_processor/instance_processing.rb
|
|
84
|
+
- lib/lutaml/lml/data_processor/value_processing.rb
|
|
85
|
+
- lib/lutaml/lml/data_processor/view_processing.rb
|
|
86
|
+
- lib/lutaml/lml/document_builder.rb
|
|
87
|
+
- lib/lutaml/lml/executor.rb
|
|
88
|
+
- lib/lutaml/lml/executor/adapter_helpers.rb
|
|
89
|
+
- lib/lutaml/lml/executor/condition_evaluator.rb
|
|
90
|
+
- lib/lutaml/lml/executor/csv_adapter.rb
|
|
91
|
+
- lib/lutaml/lml/executor/format_adapter.rb
|
|
92
|
+
- lib/lutaml/lml/executor/xml_adapter.rb
|
|
93
|
+
- lib/lutaml/lml/format.rb
|
|
94
|
+
- lib/lutaml/lml/format/adapter/document.rb
|
|
95
|
+
- lib/lutaml/lml/format/adapter/mapping.rb
|
|
96
|
+
- lib/lutaml/lml/format/adapter/standard_adapter.rb
|
|
97
|
+
- lib/lutaml/lml/format/adapter/transform.rb
|
|
98
|
+
- lib/lutaml/lml/formatter.rb
|
|
99
|
+
- lib/lutaml/lml/formatter/base.rb
|
|
100
|
+
- lib/lutaml/lml/formatter/graphviz.rb
|
|
101
|
+
- lib/lutaml/lml/formatter/graphviz/document_formatter.rb
|
|
102
|
+
- lib/lutaml/lml/formatter/graphviz/html_builder.rb
|
|
103
|
+
- lib/lutaml/lml/formatter/graphviz/node_formatter.rb
|
|
104
|
+
- lib/lutaml/lml/formatter/graphviz/relationship_formatter.rb
|
|
105
|
+
- lib/lutaml/lml/grammar.rb
|
|
106
|
+
- lib/lutaml/lml/grammar/concerns.rb
|
|
107
|
+
- lib/lutaml/lml/grammar/concerns/associations.rb
|
|
108
|
+
- lib/lutaml/lml/grammar/concerns/attributes.rb
|
|
109
|
+
- lib/lutaml/lml/grammar/concerns/data_structures.rb
|
|
110
|
+
- lib/lutaml/lml/grammar/concerns/definitions.rb
|
|
111
|
+
- lib/lutaml/lml/grammar/concerns/instance_rules.rb
|
|
112
|
+
- lib/lutaml/lml/grammar/concerns/primitives.rb
|
|
113
|
+
- lib/lutaml/lml/grammar/concerns/view_rules.rb
|
|
114
|
+
- lib/lutaml/lml/grammar/core.rb
|
|
115
|
+
- lib/lutaml/lml/grammar/full.rb
|
|
116
|
+
- lib/lutaml/lml/grammar/instances.rb
|
|
117
|
+
- lib/lutaml/lml/has_attributes.rb
|
|
118
|
+
- lib/lutaml/lml/import_resolver.rb
|
|
119
|
+
- lib/lutaml/lml/layout.rb
|
|
120
|
+
- lib/lutaml/lml/layout/engine.rb
|
|
121
|
+
- lib/lutaml/lml/layout/graph_viz_engine.rb
|
|
122
|
+
- lib/lutaml/lml/model_compiler.rb
|
|
123
|
+
- lib/lutaml/lml/models/action.rb
|
|
124
|
+
- lib/lutaml/lml/models/association.rb
|
|
125
|
+
- lib/lutaml/lml/models/cardinality.rb
|
|
126
|
+
- lib/lutaml/lml/models/collection.rb
|
|
127
|
+
- lib/lutaml/lml/models/constraint.rb
|
|
128
|
+
- lib/lutaml/lml/models/data_type.rb
|
|
129
|
+
- lib/lutaml/lml/models/diagram.rb
|
|
130
|
+
- lib/lutaml/lml/models/document.rb
|
|
131
|
+
- lib/lutaml/lml/models/enum.rb
|
|
132
|
+
- lib/lutaml/lml/models/fidelity.rb
|
|
133
|
+
- lib/lutaml/lml/models/group.rb
|
|
134
|
+
- lib/lutaml/lml/models/instance.rb
|
|
135
|
+
- lib/lutaml/lml/models/instance_collection.rb
|
|
136
|
+
- lib/lutaml/lml/models/instances_export.rb
|
|
137
|
+
- lib/lutaml/lml/models/instances_import.rb
|
|
138
|
+
- lib/lutaml/lml/models/operation.rb
|
|
139
|
+
- lib/lutaml/lml/models/operation_parameter.rb
|
|
140
|
+
- lib/lutaml/lml/models/package.rb
|
|
141
|
+
- lib/lutaml/lml/models/primitive_type.rb
|
|
142
|
+
- lib/lutaml/lml/models/top_element_attribute.rb
|
|
143
|
+
- lib/lutaml/lml/models/uml_class.rb
|
|
144
|
+
- lib/lutaml/lml/models/value.rb
|
|
145
|
+
- lib/lutaml/lml/models/view_filter.rb
|
|
146
|
+
- lib/lutaml/lml/models/view_import.rb
|
|
147
|
+
- lib/lutaml/lml/parser.rb
|
|
148
|
+
- lib/lutaml/lml/pipeline.rb
|
|
149
|
+
- lib/lutaml/lml/preprocessor.rb
|
|
150
|
+
- lib/lutaml/lml/transform.rb
|
|
151
|
+
- lib/lutaml/lml/version.rb
|
|
152
|
+
- lib/lutaml/lml/view_resolver.rb
|
|
153
|
+
- lib/lutaml/lml/yaml_parser.rb
|
|
154
|
+
homepage: https://github.com/lutaml/lutaml-lml
|
|
155
|
+
licenses:
|
|
156
|
+
- MIT
|
|
157
|
+
metadata:
|
|
158
|
+
homepage_uri: https://github.com/lutaml/lutaml-lml
|
|
159
|
+
source_code_uri: https://github.com/lutaml/lutaml-lml
|
|
160
|
+
changelog_uri: https://github.com/lutaml/lutaml-lml/releases
|
|
161
|
+
rdoc_options: []
|
|
162
|
+
require_paths:
|
|
163
|
+
- lib
|
|
164
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
|
+
requirements:
|
|
166
|
+
- - ">="
|
|
167
|
+
- !ruby/object:Gem::Version
|
|
168
|
+
version: '3.0'
|
|
169
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
|
+
requirements:
|
|
171
|
+
- - ">="
|
|
172
|
+
- !ruby/object:Gem::Version
|
|
173
|
+
version: '0'
|
|
174
|
+
requirements: []
|
|
175
|
+
rubygems_version: 3.6.9
|
|
176
|
+
specification_version: 4
|
|
177
|
+
summary: LutaML Model Language (LML) parser and converter
|
|
178
|
+
test_files: []
|