lib/activefacts/cql/compiler/shared.rb in activefacts-cql-1.8.3 vs lib/activefacts/cql/compiler/shared.rb in activefacts-cql-1.9.1
- old
+ new
@@ -11,11 +11,11 @@
# In some situations a Binding will have some References with the same adjectives,
# and one or more References with no adjectives - this is called "loose binding".
class Binding
attr_reader :player # The ObjectType (object type)
attr_reader :refs # an array of the References
- attr_reader :role_name
+ attr_accessor :role_name
attr_accessor :rebound_to # Loose binding may set this to another binding
attr_reader :variable
attr_accessor :instance # When binding fact instances, the instance goes here
def initialize player, role_name = nil
@@ -33,11 +33,11 @@
end
def <=>(other)
key <=> other.key
end
-
+
def variable= v
@variable = v # A place for a breakpoint :)
end
def add_ref ref
@@ -109,39 +109,43 @@
@tree.text_value
end
end
class Vocabulary < Definition
- def initialize name
+ def initialize name, is_transform, version_number
@name = name
+ @is_transform = is_transform
+ @version_number = version_number
end
def compile
if @constellation.Vocabulary.size > 0
@constellation.Topic @name
else
- @constellation.Vocabulary @name
+ @constellation.Vocabulary(@name, is_transform: @is_transform, version_number: @version_number)
end
end
def to_s
@name
end
end
class Import < Definition
- def initialize parser, name, alias_hash
+ def initialize parser, name, import_role, version_pattern, alias_hash
@parser = parser
@name = name
+ @import_role = import_role
+ @version_pattern = version_pattern
@alias_hash = alias_hash
end
def to_s
"#{@vocabulary.to_s} imports #{@alias_hash.map{|k,v| "#{k} as #{v}" }*', '};"
end
def compile
- @parser.compile_import(@name, @alias_hash)
+ @parser.compile_import(@name, @import_role, @alias_hash)
end
end
class ObjectType < Definition
attr_reader :name