expressir 2.4.41-x86_64-linux → 2.4.42-x86_64-linux

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/performance-release.yml +124 -0
  3. data/TODO.compat/00-overview.md +35 -0
  4. data/TODO.compat/01-interchange-cli.md +34 -0
  5. data/TODO.compat/02-compat-guide.md +21 -0
  6. data/TODO.compat/03-scoreboard.md +24 -0
  7. data/TODO.compat/04-unified-receipt.md +26 -0
  8. data/TODO.compat/05-p28-configured.md +26 -0
  9. data/TODO.compat/06-change-classification.md +26 -0
  10. data/TODO.compat/07-evaluator-matrix.md +22 -0
  11. data/TODO.compat/08-wasm.md +24 -0
  12. data/docs/_guides/compat/eval-builtin-matrix.adoc +42 -0
  13. data/docs/_guides/compat/index.adoc +16 -0
  14. data/docs/_guides/compat/interchange.adoc +79 -0
  15. data/docs/_guides/compat/toolchain.adoc +57 -0
  16. data/docs/_guides/reference/grammar-crosswalk.adoc +1 -0
  17. data/lib/expressir/3.2/expressir_core.so +0 -0
  18. data/lib/expressir/3.3/expressir_core.so +0 -0
  19. data/lib/expressir/3.4/expressir_core.so +0 -0
  20. data/lib/expressir/4.0/expressir_core.so +0 -0
  21. data/lib/expressir/cli.rb +22 -0
  22. data/lib/expressir/commands/compare.rb +177 -0
  23. data/lib/expressir/commands/doctor.rb +81 -0
  24. data/lib/expressir/commands/receipt.rb +30 -0
  25. data/lib/expressir/commands/validate.rb +7 -0
  26. data/lib/expressir/commands/validate_remarks.rb +283 -0
  27. data/lib/expressir/commands.rb +4 -0
  28. data/lib/expressir/eengine/modified_object.rb +6 -0
  29. data/lib/expressir/eval/builtin_matrix.rb +83 -0
  30. data/lib/expressir/eval/interpreter.rb +13 -0
  31. data/lib/expressir/eval.rb +1 -0
  32. data/lib/expressir/express/builders/expression_builder.rb +4 -3
  33. data/lib/expressir/express/change_classification.rb +75 -0
  34. data/lib/expressir/express/formatters/declarations_formatter.rb +11 -10
  35. data/lib/expressir/express/grammar/parser.rb +15 -2
  36. data/lib/expressir/express/parser.rb +16 -0
  37. data/lib/expressir/express/schema_compare.rb +2 -1
  38. data/lib/expressir/express.rb +2 -0
  39. data/lib/expressir/p28/configuration.rb +124 -0
  40. data/lib/expressir/p28/xsd.rb +73 -32
  41. data/lib/expressir/p28.rb +1 -0
  42. data/lib/expressir/receipt.rb +237 -0
  43. data/lib/expressir/reference/grammar_crosswalk.yml +4 -0
  44. data/lib/expressir/scoreboard.rb +151 -0
  45. data/lib/expressir/version.rb +1 -1
  46. data/lib/expressir.rb +2 -0
  47. data/lib/tasks/scoreboard.rake +59 -0
  48. data/scoreboard-baseline.json +7 -0
  49. metadata +27 -2
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Eval
5
+ # The built-in conformance matrix (TODO.compat/07): the ISO
6
+ # 10303-11 standard functions (clause 15), each row cited per
7
+ # clause with its coverage status in Expressir::Eval. The
8
+ # generated matrix (docs/_guides/compat/eval-builtin-matrix.adoc)
9
+ # is produced by this table; the spec mutates every implemented
10
+ # function per clause examples.
11
+ module BuiltinMatrix
12
+ Row = Struct.new(:name, :clause, :status, :note, keyword_init: true)
13
+
14
+ IMPLEMENTED = "implemented"
15
+ DIVERGENT = "divergent"
16
+
17
+ ROWS = [
18
+ Row.new(name: "ABS", clause: "15.1", status: IMPLEMENTED),
19
+ Row.new(name: "ACOS", clause: "15.2", status: IMPLEMENTED),
20
+ Row.new(name: "ASIN", clause: "15.3", status: IMPLEMENTED),
21
+ Row.new(name: "ATAN", clause: "15.4", status: IMPLEMENTED),
22
+ Row.new(name: "ATAN2", clause: "15.4", status: IMPLEMENTED,
23
+ note: "two-argument arctangent"),
24
+ Row.new(name: "BLENGTH", clause: "15.5", status: IMPLEMENTED),
25
+ Row.new(name: "BOUNDS", clause: "15.6", status: IMPLEMENTED,
26
+ note: "evaluated aggregates: [1, size]"),
27
+ Row.new(name: "COS", clause: "15.7", status: IMPLEMENTED),
28
+ Row.new(name: "EXISTS", clause: "15.8", status: IMPLEMENTED),
29
+ Row.new(name: "EXP", clause: "15.9", status: IMPLEMENTED),
30
+ Row.new(name: "FORMAT", clause: "15.10", status: DIVERGENT,
31
+ note: "not evaluated (D-06)"),
32
+ Row.new(name: "HIBOUND", clause: "15.11", status: IMPLEMENTED,
33
+ note: "evaluated aggregates: size"),
34
+ Row.new(name: "HIINDEX", clause: "15.12", status: IMPLEMENTED,
35
+ note: "evaluated aggregates: size"),
36
+ Row.new(name: "LENGTH", clause: "15.13", status: IMPLEMENTED),
37
+ Row.new(name: "LOBOUND", clause: "15.14", status: IMPLEMENTED,
38
+ note: "evaluated aggregates: 1"),
39
+ Row.new(name: "LOINDEX", clause: "15.15", status: IMPLEMENTED,
40
+ note: "evaluated aggregates: 1"),
41
+ Row.new(name: "LOG", clause: "15.16", status: IMPLEMENTED),
42
+ Row.new(name: "LOG2", clause: "15.16", status: IMPLEMENTED),
43
+ Row.new(name: "LOG10", clause: "15.16", status: IMPLEMENTED),
44
+ Row.new(name: "NVL", clause: "15.19", status: IMPLEMENTED),
45
+ Row.new(name: "ODD", clause: "15.20", status: IMPLEMENTED),
46
+ Row.new(name: "ROLESOF", clause: "15.21", status: IMPLEMENTED,
47
+ note: "degenerate: no role metadata — empty set (D-06)"),
48
+ Row.new(name: "SIN", clause: "15.22", status: IMPLEMENTED),
49
+ Row.new(name: "SIZEOF", clause: "15.23", status: IMPLEMENTED),
50
+ Row.new(name: "SQRT", clause: "15.24", status: IMPLEMENTED),
51
+ Row.new(name: "TAN", clause: "15.25", status: IMPLEMENTED),
52
+ Row.new(name: "TYPEOF", clause: "15.26", status: IMPLEMENTED),
53
+ Row.new(name: "USEDIN", clause: "15.27", status: IMPLEMENTED),
54
+ Row.new(name: "VALUE", clause: "15.28", status: IMPLEMENTED),
55
+ Row.new(name: "VALUE_IN", clause: "15.29", status: IMPLEMENTED),
56
+ Row.new(name: "VALUE_UA", clause: "15.29", status: DIVERGENT,
57
+ note: "not evaluated (D-06)"),
58
+ ].freeze
59
+
60
+ module_function
61
+
62
+ def to_adoc
63
+ lines = [
64
+ "= Eval built-in function matrix",
65
+ "",
66
+ "Coverage of the ISO 10303-11 clause 15 standard functions in",
67
+ "`Expressir::Eval`, generated from `Expressir::Eval::BuiltinMatrix`.",
68
+ "Divergent rows are registered in",
69
+ "xref:interchange[the interchange and divergences page].",
70
+ "",
71
+ "[cols=\"1,1,1,2\"]",
72
+ "|===",
73
+ "| Function | Clause | Status | Note",
74
+ ]
75
+ ROWS.each do |row|
76
+ lines << "| `#{row.name}` | #{row.clause} | #{row.status} | #{row.note} |"
77
+ end
78
+ lines << "|==="
79
+ lines.join("\n") << "\n"
80
+ end
81
+ end
82
+ end
83
+ end
@@ -239,6 +239,19 @@ module Expressir
239
239
  when "USEDIN" then usedin_value(arguments[0], arguments[1])
240
240
  when "NVL"
241
241
  arguments[0].equal?(V::INDETERMINATE) ? arguments[1] : arguments[0]
242
+ when "BOUNDS"
243
+ # 15.6 over evaluated aggregates: the LOINDEX..HIBOUND pair
244
+ V::Aggregate.of(:list, [1, arguments[0].elements.size])
245
+ when "ROLESOF"
246
+ # 15.21: no role metadata in the evaluated population — the
247
+ # empty set (D-06)
248
+ V::Aggregate.of(:set, [])
249
+ when "VALUE_IN"
250
+ # 15.29: membership of a value in an aggregate of values
251
+ present = Array(arguments[1].elements).any? do |candidate|
252
+ EX.values_equal?(candidate, arguments[0])
253
+ end
254
+ V::Logical.new(value: present ? V::LOGICAL_TRUE : V::LOGICAL_FALSE)
242
255
  when "VALUE"
243
256
  return arguments[0] if arguments[0].is_a?(Numeric)
244
257
 
@@ -14,5 +14,6 @@ module Expressir
14
14
  autoload :Interpreter, "#{__dir__}/eval/interpreter"
15
15
  autoload :Rules, "#{__dir__}/eval/rules"
16
16
  autoload :Population, "#{__dir__}/eval/population"
17
+ autoload :BuiltinMatrix, "#{__dir__}/eval/builtin_matrix"
17
18
  end
18
19
  end
@@ -276,14 +276,15 @@ module Expressir
276
276
  ast_data[:function_ref])
277
277
  end
278
278
 
279
+ # nil parameters = no paren list in the source (a plain
280
+ # reference); [] = explicit `f()` — the formatter writes
281
+ # the distinction back (#556).
279
282
  params = if ast_data[:actual_parameter_list]
280
283
  Builder.build_node(:actual_parameter_list,
281
284
  ast_data[:actual_parameter_list])
282
- else
283
- []
284
285
  end
285
286
 
286
- if params.empty?
287
+ if params.nil?
287
288
  func_ref
288
289
  else
289
290
  Expressir::Model::Expressions::FunctionCall.new(
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Expressir
4
+ module Express
5
+ # Semantic change classification (TODO.compat/06): SchemaCompare
6
+ # deltas classified breaking vs additive through the subtype
7
+ # graph, with the ISO 10303-11 Annex K deprecation policy applied.
8
+ #
9
+ # Rules:
10
+ # - :added → additive (a new declaration, subtype or attribute
11
+ # extends the schema without constraining existing instances).
12
+ # - :removed → breaking; the subtype graph names every direct
13
+ # subtype that loses the declaration. When the path is in the
14
+ # deprecation set the removal is the Annex K announced transition
15
+ # (flagged `deprecated`, still classified breaking).
16
+ # - :changed → breaking (a signature change constrains consumers);
17
+ # flagged deprecated when the path is in the deprecation set.
18
+ module ChangeClassification
19
+ BREAKING = "breaking"
20
+ ADDITIVE = "additive"
21
+
22
+ Verdict = Struct.new(:value, :deprecated, :affected_subtypes,
23
+ keyword_init: true)
24
+
25
+ module_function
26
+
27
+ # @param deprecated [Array<String>] schema.ELEMENT paths the
28
+ # schema edition already announced for removal (Annex K)
29
+ def apply(deltas, base_schema, deprecated: [])
30
+ graph = subtype_map(base_schema)
31
+ announced = deprecated.map(&:safe_downcase).to_h { |p| [p, true] }
32
+ deltas.each do |delta|
33
+ delta.classification = verdict(delta, graph, announced)
34
+ end
35
+ deltas
36
+ end
37
+
38
+ def verdict(delta, graph, announced)
39
+ path = delta.path.safe_downcase
40
+ # attribute-level deltas (schema.entity.attr) inherit the
41
+ # owning entity's subtype reach
42
+ owner = path.split(".").first(2).join(".")
43
+ case delta.op
44
+ when :added
45
+ Verdict.new(value: ADDITIVE, deprecated: false,
46
+ affected_subtypes: [])
47
+ else
48
+ Verdict.new(
49
+ value: BREAKING,
50
+ deprecated: announced.key?(path),
51
+ affected_subtypes: Array(graph[owner]),
52
+ )
53
+ end
54
+ end
55
+
56
+ # Direct subtypes per entity, schema-qualified to match delta
57
+ # paths, from the base schema's subtype_of references.
58
+ def subtype_map(schema)
59
+ map = Hash.new { |hash, key| hash[key] = [] }
60
+ schema_id = schema.id&.safe_downcase
61
+ Array(schema.entities).each do |entity|
62
+ next unless entity.id
63
+
64
+ Array(entity.subtype_of).each do |ref|
65
+ name = ref.respond_to?(:id) ? ref.id : ref
66
+ next unless name
67
+
68
+ map["#{schema_id}.#{name.safe_downcase}"] << entity.id.safe_downcase
69
+ end
70
+ end
71
+ map
72
+ end
73
+ end
74
+ end
75
+ end
@@ -440,8 +440,10 @@ module Expressir
440
440
  end
441
441
 
442
442
  def format_declarations_rule(node)
443
- # Filter out statements that only exist to hold remarks in rules
444
- # (ALIAS/REPEAT with only Null sub-statements, query assignments, or Null statements)
443
+ # Filter out statements that only exist to hold remarks in
444
+ # rules (ALIAS/REPEAT with only Null sub-statements, or Null
445
+ # statements). A query assignment is executable rule code
446
+ # (#555) — it is never dropped.
445
447
  formatted_statements = []
446
448
  if node.statements&.length&.positive?
447
449
  formatted_statements = node.statements.reject do |stmt|
@@ -451,14 +453,8 @@ module Expressir
451
453
  # different content from this formatter.
452
454
  if carries_placed_remark?(stmt)
453
455
  false
454
- # Filter ALIAS/REPEAT with only Null statements
455
456
  elsif stmt.is_a?(Model::Statements::Alias) || stmt.is_a?(Model::Statements::Repeat)
456
457
  stmt.statements&.all?(Model::Statements::Null)
457
- # Filter query assignments (assignments with QueryExpression that exist only for remarks)
458
- elsif stmt.is_a?(Model::Statements::Assignment) &&
459
- stmt.expression.is_a?(Model::Expressions::QueryExpression)
460
- true
461
- # Filter Null statements
462
458
  elsif stmt.is_a?(Model::Statements::Null)
463
459
  true
464
460
  else
@@ -639,11 +635,16 @@ module Expressir
639
635
  format(node.applies_to),
640
636
  ";",
641
637
  ].join,
642
- # ISO 10303-11: abstract_supertype_constraint = ABSTRACT ';' —
643
- # the ABSTRACT SUPERTYPE form is entity-header syntax.
638
+ # ISO 10303-11:2004 syntax 314 subtype_constraint_body =
639
+ # [ abstract_supertype ] ... with syntax 165
640
+ # abstract_supertype = ABSTRACT SUPERTYPE ';' — the
641
+ # constraint body carries the SUPERTYPE keyword (unlike
642
+ # the entity header's abstract_supertype_constraint).
644
643
  *if node.abstract
645
644
  indent([
646
645
  "ABSTRACT",
646
+ " ",
647
+ "SUPERTYPE",
647
648
  ";",
648
649
  ].join)
649
650
  end,
@@ -309,9 +309,19 @@ module Expressir
309
309
  (entityHead >> entityBody >> tEND_ENTITY >> op_delim).as(:entityDecl)
310
310
  end
311
311
  rule(:entityHead) do
312
- (tENTITY >> entityId >> subsuper >> op_delim).as(:entityHead)
312
+ # ISO 10303-11 requires the header delimiter, but real-world
313
+ # corpora (STEPmod resources) omit it — eengine accepts the
314
+ # form, and the corpus gate demands it (#537). The tail is
315
+ # one atomic rule (trivia + optional delimiter) so the
316
+ # native evaluator consumes the header remark inside a
317
+ # single Named capture (#537: bare spaces.maybe at this
318
+ # seam diverges on the native engine).
319
+ (tENTITY >> entityId >> subsuper >> entityHeaderTail.maybe).as(:entityHead)
313
320
  end
314
321
  rule(:entityId) { simpleId.as(:entityId) }
322
+ rule(:entityHeaderTail) do
323
+ (space.repeat >> op_delim.maybe).as(:entityHeaderTail)
324
+ end
315
325
  rule(:entityRef) { entityId.as(:entityRef) }
316
326
  rule(:enumerationExtension) do
317
327
  (tBASED_ON >> typeRef >> (tWITH >> enumerationItems).maybe).as(:enumerationExtension)
@@ -689,7 +699,10 @@ module Expressir
689
699
  (entityRef | oneOf | (op_leftparen >> supertypeExpression >> op_rightparen)).as(:supertypeTerm)
690
700
  end
691
701
  rule(:syntax) do
692
- (spaces.as(:spaces) >> schemaDecl.repeat(1).as(:schemaDecl) >> spaces.as(:trailer)).as(:syntax)
702
+ # zero-or-more: remark-only fragments (no SCHEMA wrapper)
703
+ # parse to an empty model so the facade raises the clean
704
+ # "no schema found" error (#537 part 2) instead of a dump
705
+ (spaces.as(:spaces) >> schemaDecl.repeat(0).as(:schemaDecl) >> spaces.as(:trailer)).as(:syntax)
693
706
  end
694
707
  rule(:tailRemark) do
695
708
  (str("--") >> (str("\n").absent? >> any).repeat >> str("\n").maybe).as(:tailRemark)
@@ -91,6 +91,15 @@ module Expressir
91
91
  exp_file = ::Expressir::Express::Builder.build_with_remarks(ast, source: source,
92
92
  include_source: include_source)
93
93
 
94
+ # issue #537 part 2: a remark-only fragment (no SCHEMA
95
+ # wrapper — e.g. conversion artifacts) parses to an empty
96
+ # model; report it as the missing schema it is rather than a
97
+ # grammar dump.
98
+ if Array(exp_file&.schemas).empty?
99
+ raise Expressir::SchemaNotFoundError,
100
+ "no schema found in #{schema_file} (remark-only or empty input)"
101
+ end
102
+
94
103
  transfer_header_to_schema(exp_file, source)
95
104
 
96
105
  exp_file.path = schema_file
@@ -484,6 +493,13 @@ include_source: nil, root_path: nil, use_native: nil, &block)
484
493
  source: content,
485
494
  include_source: include_source)
486
495
 
496
+ # issue #537 part 2: same gate as from_file — a remark-only
497
+ # fragment is a missing schema, not a grammar dump
498
+ if Array(exp_file&.schemas).empty?
499
+ raise Expressir::SchemaNotFoundError,
500
+ "no schema found in (from string) (remark-only or empty input)"
501
+ end
502
+
487
503
  transfer_header_to_schema(exp_file, content)
488
504
 
489
505
  exp_file.schemas.each do |schema|
@@ -14,7 +14,8 @@ module Expressir
14
14
  module SchemaCompare
15
15
  # `node` carries the revised declaration for :added and :changed
16
16
  # (nil for :removed) so {SchemaPatch.apply} can rebuild.
17
- Delta = Struct.new(:op, :path, :node, keyword_init: true)
17
+ # `classification` is set by {ChangeClassification.apply}.
18
+ Delta = Struct.new(:op, :path, :node, :classification, keyword_init: true)
18
19
 
19
20
  # Resolution artifacts and presentation metadata are not part of
20
21
  # a declaration's structure.
@@ -46,6 +46,8 @@ module Expressir
46
46
  autoload :SchemaSourceFormatter, "#{__dir__}/express/schema_source_formatter"
47
47
  autoload :SchemaCompare, "#{__dir__}/express/schema_compare"
48
48
  autoload :SchemaPatch, "#{__dir__}/express/schema_compare"
49
+ autoload :ChangeClassification,
50
+ "#{__dir__}/express/change_classification"
49
51
  autoload :ScopeResolver, "#{__dir__}/express/scope_resolver"
50
52
  autoload :LazyRepository, "#{__dir__}/express/lazy_repository"
51
53
  autoload :SmrlXml, "#{__dir__}/express/smrl_xml"
@@ -0,0 +1,124 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "moxml"
4
+
5
+ module Expressir
6
+ module P28
7
+ # The binding configuration (TODO.p28/05): ISO 10303-28:2007
8
+ # clause 8 directives over the clause 7 default binding, read from
9
+ # the configuration document (annex D configuration.xsd, namespace
10
+ # urn:iso10303-28:ex).
11
+ #
12
+ # Applied by the derived XML schema:
13
+ # - configuration/@targetNamespace — the 7.7.2 namespace URI is
14
+ # configuration-chosen instead of default;
15
+ # - option/@naming-convention — the 7.1.2 identifier mapping
16
+ # (initial-upper is the default; camel-case, preserve-case);
17
+ # - type/@name, entity/@name, attribute/@name — explicit renames,
18
+ # clause 8.
19
+ #
20
+ # Every other directive in the configuration document (exp-type,
21
+ # exp-attribute, content, flatten, sparse, tagless, keep, use-id,
22
+ # invert, tag-source/tag-values, notation, map, inheritance,
23
+ # occurrence bounds) is parsed and preserved but not applied by
24
+ # this derivation — registered as divergence D-04 in
25
+ # docs/_guides/compat/interchange.adoc.
26
+ class Configuration
27
+ NAMING_CONVENTIONS = %w[initial-upper camel-case preserve-case].freeze
28
+ CONFIG_NS = "urn:iso10303-28:ex"
29
+
30
+ Scope = Struct.new(:types, :entities, :attributes, keyword_init: true)
31
+
32
+ attr_reader :target_namespace, :scopes
33
+ attr_accessor :naming_convention
34
+
35
+ def initialize(naming_convention: "initial-upper",
36
+ target_namespace: nil, scopes: Scope.new(
37
+ types: {}, entities: {}, attributes: {},
38
+ ))
39
+ @naming_convention = naming_convention
40
+ @target_namespace = target_namespace
41
+ @scopes = scopes
42
+ end
43
+
44
+ class << self
45
+ # A configuration with no directives: the derivation must be
46
+ # byte-identical to the unconfigured default binding (clause 8:
47
+ # configuration absent ⇒ default binding).
48
+ def empty
49
+ @empty ||= new
50
+ end
51
+
52
+ # Parses the clause 8 configuration document.
53
+ def parse(xml)
54
+ doc = Moxml::Context.new.parse(xml)
55
+ root = doc.root
56
+ unless root&.name == "configuration"
57
+ raise Expressir::UsageError,
58
+ "configuration document root must be ex:configuration"
59
+ end
60
+
61
+ config = new(
62
+ target_namespace: root.attribute("targetNamespace")&.value,
63
+ )
64
+ walk(config, root)
65
+ config
66
+ end
67
+
68
+ private
69
+
70
+ def walk(config, root)
71
+ scopes = config.scopes
72
+ root.children.each do |node|
73
+ next unless node.element?
74
+
75
+ case node.name
76
+ when "option"
77
+ convention = node.attribute("naming-convention")&.value
78
+ if convention && !NAMING_CONVENTIONS.include?(convention)
79
+ raise Expressir::UsageError,
80
+ "unknown naming-convention #{convention}"
81
+ end
82
+ config.naming_convention = convention if convention
83
+ when "type"
84
+ name = node.attribute("name")&.value
85
+ scopes.types[node.attribute("select").value] = name if name
86
+ when "entity"
87
+ rename_entity(config, node)
88
+ when "attribute"
89
+ # attributes are scoped to their nearest entity ancestor
90
+ entity = ancestor_entity(node)
91
+ name = node.attribute("name")&.value
92
+ if entity && name
93
+ select = node.attribute("select").value
94
+ scopes.attributes["#{entity}.#{select}"] = name
95
+ end
96
+ end
97
+ walk(config, node)
98
+ end
99
+ end
100
+
101
+ def rename_entity(config, node)
102
+ name = node.attribute("name")&.value
103
+ select = node.attribute("select")&.value
104
+ return unless name && select
105
+
106
+ select.split.each do |entity|
107
+ config.scopes.entities[entity] = name
108
+ end
109
+ end
110
+
111
+ def ancestor_entity(node)
112
+ parent = node.parent
113
+ while parent
114
+ return parent.attribute("select").value if parent.element? &&
115
+ parent.name == "entity"
116
+
117
+ parent = parent.parent
118
+ end
119
+ nil
120
+ end
121
+ end
122
+ end
123
+ end
124
+ end