Class: Dialect::Lookup
- Inherits:
-
Object
- Object
- Dialect::Lookup
- Defined in:
- lib/sql.rb,
lib/lookup.rb,
lib/dialect_lookup.rb,
lib/lookup/data/3.GenData2Dest.rb,
lib/lookup/data/4.Results2GenData.rb,
lib/lookup/data/2.GetData2Elements.rb,
lib/lookup/data/1.ModReceive2GetData.rb,
lib/lookup/functional/1.Expect2Events.rb,
lib/lookup/functional/7.ElementChains.rb,
lib/lookup/constructors/Element2ModSend.rb,
lib/lookup/functional/6.ModElementsSpecs.rb,
lib/lookup/functional/2.1.Events2AppEvent.rb,
lib/lookup/functional/3.Appevent2EventBus.rb,
lib/lookup/functional/5.2.Element2ModSend.rb,
lib/lookup/constructors/ElementsInElements.rb,
lib/lookup/functional/4.1.AppEvent2Elements.rb,
lib/lookup/functional/4.2.Elements2AppEvent.rb,
lib/lookup/functional/2.2.1.Events2ModReceive.rb,
lib/lookup/functional/5.1.Element2ModElements.rb,
lib/lookup/functional/2.2.2.ModReceive2AppEvent.rb,
lib/lookup/constructors/DockedGroupings2AppFunctions.rb
Instance Method Summary collapse
- #dialectLookup(args, state, viewId, viewType) ⇒ Object
- #dialectRepack(args, state, viewId, viewType, queryName) ⇒ Object
- #getObjects(args, state) ⇒ Object
- #getObjectsFromSQL(args, state, viewId, viewProps) ⇒ Object
- #getProp(args, state, conProp, direction) ⇒ Object
- #lookup_constructors_DockedGroupings2AppFunctions(args, state, viewId, viewType) ⇒ Object
- #lookup_constructors_Element2ModSend(args, state, viewId, viewType) ⇒ Object
- #lookup_constructors_ElementsInElements(args, state, viewId, viewType) ⇒ Object
- #lookup_data_GenData2Dest(args, state, viewId, viewType) ⇒ Object
- #lookup_data_GetData2Elements(args, state, viewId, viewType) ⇒ Object
- #lookup_data_ModReceive2GetData(args, state, viewId, viewType) ⇒ Object
- #lookup_data_Results2GenData(args, state, viewId, viewType) ⇒ Object
- #lookup_functional_AppEvent2Elements(args, state, viewId, viewType) ⇒ Object
- #lookup_functional_Appevent2EventBus(args, state, viewId, viewType) ⇒ Object
- #lookup_functional_Element2ModElements(args, state, viewId, viewType) ⇒ Object
- #lookup_functional_Element2ModSend(args, state, viewId, viewType) ⇒ Object
- #lookup_functional_ElementChains(args, state, viewId, viewType) ⇒ Object
- #lookup_functional_Elements2AppEvent(args, state, viewId, viewType) ⇒ Object
- #lookup_functional_Events2AppEvent(args, state, viewId, viewType) ⇒ Object
- #lookup_functional_Events2ModReceive(args, state, viewId, viewType) ⇒ Object
- #lookup_functional_Expect2Events(args, state, viewId, viewType) ⇒ Object
- #lookup_functional_ModElementsSpecs(args, state, viewId, viewType) ⇒ Object
- #lookup_functional_ModReceive2AppEvent(args, state, viewId, viewType) ⇒ Object
- #lookup_run(args, lookupStruct, state, viewId, viewType) ⇒ Object
- #lookupDebug(name, prop) ⇒ Object
- #run(state) ⇒ Object
Instance Method Details
#dialectLookup(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/lookup.rb', line 16 def dialectLookup(args,state,viewId,viewType) queryName = args[:dialectLookupQuery][:queryName] if args[:objects][viewId][:links][args[:dialectLookupQuery][:cClass]].is_a?(Hash) args[:objects][viewId][:links][args[:dialectLookupQuery][:cClass]].each do |conPairId, conProp| if conProp[:viewID] == viewId and conProp[:fClass] =~ /^#{args[:dialectLookupQuery][:fClass]}/ and conProp[:fFqn] =~ /^#{args[:dialectLookupQuery][:fFqn]}/ and conProp[:tClass] =~ /^#{args[:dialectLookupQuery][:tClass]}/ and conProp[:tFqn] =~ /^#{args[:dialectLookupQuery][:tFqn]}/ conProp[:cClass] = args[:dialectLookupQuery][:cClass] prop = getProp(args,state,conProp,'from') conProp[:fProp] = prop if not prop.nil? prop = getProp(args,state,conProp,'to') conProp[:tProp] = prop if not prop.nil? if args[:dialectLookupQuery].has_key?(:fPropKey) conProp[:fProp][args[:dialectLookupQuery][:fPropKey]] == args[:dialectLookupQuery][:fPropValue] ? store = true : store = false else store = true end if store == true # Dialog.logger.debug "In view #{viewId} by query '#{queryName}' we have a #{args[:dialectLookupQuery][:cClass]} connection: CONNPARID #{conPairId} FROM fClass = #{conProp[:fClass]} fqn = #{conProp[:fFqn]} fId = #{conProp[:fId]} NAME #{conProp[:fName]} FPROP #{conProp[:fProp]} [[ TO ]] tClass = #{conProp[:tClass]} fqn = #{conProp[:tFqn]} tId = #{conProp[:tId]} NAME #{conProp[:tName]} TPROP #{conProp[:tProp]}\n" hash_fName = Digest::SHA256.hexdigest("#{conProp[:fName]}")[0..20] hash_tName = Digest::SHA256.hexdigest("#{conProp[:tName]}")[0..20] hash_fName_fId_tId = Digest::SHA256.hexdigest("#{conProp[:fName]}#{conProp[:fOID]}#{conProp[:tOID]}")[0..20] # puts conProp args[:stages][state[:dialectFolder]][viewType] ||= {} args[:stages][state[:dialectFolder]][viewType][state[:myAppName]] ||= {} case viewType when :perView args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][viewId] ||= {} args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][viewId][queryName] ||= {} args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][viewId][queryName][:lookup] ||= {} args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][viewId][queryName][:lookup][hash_tName] ||= {} args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][viewId][queryName][:lookup][hash_tName][hash_fName_fId_tId] = conProp when :constructors args[:stages][state[:dialectFolder]][viewType][state[:myAppName]] ||= {} args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][queryName] ||= {} args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][queryName][:lookup] ||= {} args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][queryName][:lookup][hash_tName] ||= {} args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][queryName][:lookup][hash_tName][hash_fName_fId_tId] = conProp end end end end end end |
#dialectRepack(args, state, viewId, viewType, queryName) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/lookup.rb', line 101 def dialectRepack(args, state, viewId, viewType, queryName) case viewType when :perView base = args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][viewId][queryName] when :constructors base = args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][queryName] end if base.is_a?(Hash) repackNames = [:fFqn, :tFqn, :fOID, :tOID, :fEID, :tEID] base[:repack] = {} repackNames.each do |repackName| res = {} base[:repack][repackName] ||= {} base[:lookup].each do |tName, hash_tNameProp| hash_tNameProp.each do |fName, hash_fNameProp| res[hash_fNameProp[repackName]] = hash_fNameProp end end case viewType when :perView args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][viewId][queryName][:repack][repackName] = res when :constructors args[:stages][state[:dialectFolder]][viewType][state[:myAppName]][queryName][:repack][repackName] = res end end end end |
#getObjects(args, state) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/sql.rb', line 16 def getObjects(args, state) args[:views].each do |viewId, viewProps| getObjectsFromSQL(args, state, viewId, viewProps) end args[:con_views].each do |viewId, viewProps| getObjectsFromSQL(args, state, viewId, viewProps) end return args end |
#getObjectsFromSQL(args, state, viewId, viewProps) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/sql.rb', line 26 def getObjectsFromSQL(args, state, viewId, viewProps) args[:x] = {} viewIdOrig = viewId.to_s.tr("_", "-") args[:objects] ||= {} args[:objects][viewId] = {} rows={} links = {} i = 1 # (views_objects.id in ('views_connections'.`source_object_id`) AND views_objects.id not in ('views_connections'.`target_object_id`)) state[:dbhandler].execute( " select views_objects.id, elements.id, elements.class, relationships.class, elements.name, views_connections.source_object_id, views_connections.target_object_id, elements.documentation, relationships.version, elements.version, views_objects.element_version, properties.value from views_connections_in_view INNER JOIN views_connections ON views_connections_in_view.connection_id = views_connections.id AND views_connections.version = (select max(views_connections.version) from views_connections where views_connections.id = views_connections_in_view.connection_id ) INNER JOIN relationships ON relationships.id = views_connections.relationship_id INNER JOIN views_objects ON (views_objects.id = views_connections.source_object_id OR views_objects.id = views_connections.target_object_id) AND views_objects.version = (select max(views_objects.version) from views_objects where ( (views_objects.id in ('views_connections'.`target_object_id`) AND views_objects.id not in ('views_connections'.`source_object_id`)) )) INNER JOIN elements ON elements.id = views_objects.element_id AND elements.version = (select max(elements.version) from elements where elements.id in ('views_objects'.`element_id`)) LEFT JOIN properties ON properties.parent_id = elements.id AND properties.parent_version = (select max(properties.parent_version) from properties where properties.parent_id in ('elements'.`id`)) AND properties.name LIKE 'fqn' where views_connections_in_view.view_id like '#{viewIdOrig}' and views_connections_in_view.view_version = (select max(views_connections_in_view.view_version) from views_connections_in_view where views_connections_in_view.view_id like '#{viewIdOrig}') and relationships.class in ('AggregationRelationship', 'TriggeringRelationship', 'FlowRelationship', 'AccessRelationship', 'SpecializationRelationship', 'CompositionRelationship', 'ServingRelationship', 'RealizationRelationship') and (elements.class LIKE 'Application%' OR elements.class in ('DataObject', 'Grouping')) and elements.version = (select max(elements.version) from elements where elements.id in ('views_objects'.`element_id`)) ") do |row| # Bot.logger.debug "### ROW ##{i}: #{row}" # hash_tName_fId_tId = Digest::SHA256.hexdigest("#{row[0]}_#{row[4]}_#{row[5]}")[0..20] hash_tName_fId_tId = Digest::SHA256.hexdigest("#{row[4]}_#{row[5]}")[0..20] rows[row[0]] ||= {} rows[row[0]][:e_id] = row[1] rows[row[0]][:e_class] = row[2] rows[row[0]][:o_name] = row[4] rows[row[0]][:e_doc] = row[7] rows[row[0]][:e_ver] = row[9] rows[row[0]][:p_fqn] = row[11] rows[row[0]][row[3]] ||= {} rows[row[0]][row[3]][hash_tName_fId_tId] ||= {} rows[row[0]][row[3]][hash_tName_fId_tId] = {from: row[5], to: row[6] } i = i + 1 end i = 1 rows.each do |objId, objProps| objProps.each do |objProp, objVal| if objProp.to_s =~ /Relationship/ links[objProp] ||= {} objVal.each do |conPairId, conProps| if ! rows[conProps[:from]].nil? and ! rows[conProps[:to]].nil? links[objProp][conPairId] ||= {} # Bot.logger.debug "### AAA #{i}: #{rows[conProps[:from]] }" links[objProp][conPairId][:connUUID] = "#{conProps[:from]}#{conProps[:to]}".unpack("H8H4H4H4H12").join('-') links[objProp][conPairId][:viewID] = viewId links[objProp][conPairId][:fOID] = conProps[:from].tr("-", "_") links[objProp][conPairId][:fEID] = rows[conProps[:from]][:e_id].tr("-", "_") links[objProp][conPairId][:fEVer] = rows[conProps[:from]][:e_ver] links[objProp][conPairId][:fDoc] = rows[conProps[:from]][:e_doc] == "" ? 0 : rows[conProps[:from]][:e_doc] links[objProp][conPairId][:fName] = rows[conProps[:from]][:o_name] links[objProp][conPairId][:fClass] = rows[conProps[:from]][:e_class] links[objProp][conPairId][:fFqn] = rows[conProps[:from]][:p_fqn] links[objProp][conPairId][:tOID] = conProps[:to].tr("-", "_") links[objProp][conPairId][:tEID] = rows[conProps[:to]][:e_id].tr("-", "_") links[objProp][conPairId][:tEVer] = rows[conProps[:to]][:e_ver] links[objProp][conPairId][:tDoc] = rows[conProps[:to]][:e_doc] == "" ? 0 : rows[conProps[:to]][:e_doc] links[objProp][conPairId][:tName] = rows[conProps[:to]][:o_name] links[objProp][conPairId][:tClass] = rows[conProps[:to]][:e_class] links[objProp][conPairId][:tFqn] = rows[conProps[:to]][:p_fqn] # Bot.logger.debug "### AAA #{i}: #{links[objProp][conPairId]}" i = i + 1 end end end end end args[:objects][viewId][:objects] = rows args[:objects][viewId][:links] = links end |
#getProp(args, state, conProp, direction) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/lookup.rb', line 74 def getProp(args,state,conProp,direction) rows = {} case direction when 'from' eID = conProp[:fEID] eVer = conProp[:fEVer] when 'to' eID = conProp[:tEID] eVer = conProp[:tEVer] end state[:dbhandler].execute( " select name, value from properties where parent_id like '#{eID}' AND parent_version = '#{eVer}' AND name NOT LIKE 'fqn' ") do |row| # Bot.logger.debug "### ROW #{eID} #: #{row}" # rows[eID] ||= {} rows[row[0].to_sym] = row[1] end return rows if not rows.empty? end |
#lookup_constructors_DockedGroupings2AppFunctions(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/lookup/constructors/DockedGroupings2AppFunctions.rb', line 16 def lookup_constructors_DockedGroupings2AppFunctions(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_constructors_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'CompositionRelationship', fPropKey: :docked, fPropValue: "true", fClass: 'Grouping', fFqn: "#{state[:myAppName]}Element*", tClass: 'ApplicationFunction', tFqn: "#{state[:myAppName]}Element*" } dialectLookup(args, state, viewId, viewType) # dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_constructors_Element2ModSend(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/lookup/constructors/Element2ModSend.rb', line 16 def lookup_constructors_Element2ModSend(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_constructors_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'AccessRelationship', fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Element*", tClass: 'DataObject', tFqn: "#{state[:myAppName]}ModSend*" } dialectLookup(args, state, viewId, viewType) dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_constructors_ElementsInElements(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/lookup/constructors/ElementsInElements.rb', line 16 def lookup_constructors_ElementsInElements(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_constructors_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'SpecializationRelationship', fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Element*", tClass: 'ApplicationFunction', tFqn: "#{state[:myAppName]}Element*" } dialectLookup(args, state, viewId, viewType) # dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_data_GenData2Dest(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/lookup/data/3.GenData2Dest.rb', line 16 def lookup_data_GenData2Dest(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_data_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'ServingRelationship', fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Element*", tClass: 'ApplicationService', tFqn: "#{state[:myAppName]}ArchiGendata*" } dialectLookup(args, state, viewId, viewType) dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_data_GetData2Elements(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/lookup/data/2.GetData2Elements.rb', line 16 def lookup_data_GetData2Elements(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_data_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'TriggeringRelationship', fClass: 'ApplicationService', fFqn: "#{state[:myAppName]}ArchiGetdata*", tClass: 'ApplicationFunction', tFqn: "#{state[:myAppName]}Element*" } dialectLookup(args, state, viewId, viewType) dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_data_ModReceive2GetData(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/lookup/data/1.ModReceive2GetData.rb', line 16 def lookup_data_ModReceive2GetData(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_data_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'AccessRelationship', fClass: 'ApplicationService', fFqn: "#{state[:myAppName]}ArchiGetdata*", tClass: 'DataObject', tFqn: "#{state[:myAppName]}ModReceiveData*" } dialectLookup(args, state, viewId, viewType) dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_data_Results2GenData(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/lookup/data/4.Results2GenData.rb', line 16 def lookup_data_Results2GenData(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_data_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'RealizationRelationship', fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Element*", tClass: 'ApplicationService', tFqn: "#{state[:myAppName]}ArchiGendata*" } dialectLookup(args, state, viewId, viewType) dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_functional_AppEvent2Elements(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/lookup/functional/4.1.AppEvent2Elements.rb', line 16 def lookup_functional_AppEvent2Elements(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'TriggeringRelationship', fClass: 'ApplicationEvent', fFqn: "#{state[:myAppName]}ArchiAppevent*", tClass: 'ApplicationFunction', tFqn: "#{state[:myAppName]}Element*" } dialectLookup(args, state, viewId, viewType) dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_functional_Appevent2EventBus(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/lookup/functional/3.Appevent2EventBus.rb', line 16 def lookup_functional_Appevent2EventBus(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'ServingRelationship', fClass: 'ApplicationService', fFqn: "#{state[:myAppName]}ArchiEventBus", tClass: 'ApplicationEvent', tFqn: "#{state[:myAppName]}ArchiAppevent*" } dialectLookup(args, state, viewId, viewType) dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_functional_Element2ModElements(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/lookup/functional/5.1.Element2ModElements.rb', line 16 def lookup_functional_Element2ModElements(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'AccessRelationship', fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Element*", tClass: 'DataObject', tFqn: "#{state[:myAppName]}ModElement*" } dialectLookup(args, state, viewId, viewType) dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_functional_Element2ModSend(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/lookup/functional/5.2.Element2ModSend.rb', line 16 def lookup_functional_Element2ModSend(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'AccessRelationship', fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Element*", tClass: 'DataObject', tFqn: "#{state[:myAppName]}ModSend*" } dialectLookup(args, state, viewId, viewType) end |
#lookup_functional_ElementChains(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/lookup/functional/7.ElementChains.rb', line 16 def lookup_functional_ElementChains(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'TriggeringRelationship', fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}ElementSend*", tClass: 'ApplicationFunction', tFqn: "#{state[:myAppName]}ElementSend*" } dialectLookup(args, state, viewId, viewType) dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_functional_Elements2AppEvent(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/lookup/functional/4.2.Elements2AppEvent.rb', line 16 def lookup_functional_Elements2AppEvent(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'ServingRelationship', fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Element*", tClass: 'ApplicationEvent', tFqn: "#{state[:myAppName]}ArchiAppevent*"} dialectLookup(args, state, viewId, viewType) dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_functional_Events2AppEvent(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/lookup/functional/2.1.Events2AppEvent.rb', line 16 def lookup_functional_Events2AppEvent(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'FlowRelationship', fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Event*", tClass: 'ApplicationEvent', tFqn: "#{state[:myAppName]}ArchiAppevent*" } dialectLookup(args, state, viewId, viewType) dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_functional_Events2ModReceive(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/lookup/functional/2.2.1.Events2ModReceive.rb', line 16 def lookup_functional_Events2ModReceive(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'AccessRelationship', fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}Event*", tClass: 'DataObject', tFqn: "#{state[:myAppName]}ModReceiveData*" } dialectLookup(args, state, viewId, viewType) dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_functional_Expect2Events(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/lookup/functional/1.Expect2Events.rb', line 16 def lookup_functional_Expect2Events(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'AggregationRelationship', fClass: 'ApplicationFunction', fFqn: "#{state[:myAppName]}ArchiEventExpect", tClass: 'ApplicationFunction', tFqn: "#{state[:myAppName]}Event*" } dialectLookup(args, state, viewId, viewType) dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_functional_ModElementsSpecs(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/lookup/functional/6.ModElementsSpecs.rb', line 16 def lookup_functional_ModElementsSpecs(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'SpecializationRelationship', fClass: 'DataObject', fFqn: "#{state[:myAppName]}ModSend*", tClass: 'DataObject', tFqn: "#{state[:myAppName]}ModElement*" } dialectLookup(args, state, viewId, viewType) dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_functional_ModReceive2AppEvent(args, state, viewId, viewType) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/lookup/functional/2.2.2.ModReceive2AppEvent.rb', line 16 def lookup_functional_ModReceive2AppEvent(args, state, viewId, viewType) queryName = __method__.to_s; queryName.slice! 'lookup_functional_'; queryName.to_sym args[:dialectLookupQuery] = {queryName: queryName, cClass: 'AccessRelationship', fClass: 'ApplicationEvent', fFqn: "#{state[:myAppName]}ArchiAppevent*", tClass: 'DataObject', tFqn: "#{state[:myAppName]}ModReceiveData*" } dialectLookup(args, state, viewId, viewType) dialectRepack(args, state, viewId, viewType, queryName) end |
#lookup_run(args, lookupStruct, state, viewId, viewType) ⇒ Object
136 137 138 139 140 141 142 143 144 |
# File 'lib/lookup.rb', line 136 def lookup_run(args, lookupStruct, state, viewId, viewType) lookupStruct.each do |type,lookups| lookups.each do |lookup| run = "lookup_#{type}_#{lookup}" # Dialog.logger.debug "### Dialect_lookup call - #{run}" send(run, args, state, viewId, viewType) end end end |
#lookupDebug(name, prop) ⇒ Object
131 132 133 |
# File 'lib/lookup.rb', line 131 def lookupDebug(name, prop) Bot.logger.debug "### #{name} :: F:: '#{prop[:fName]}' fqn:#{prop[:fFqn]} o:#{prop[:fOID]} e:#{prop[:fEID]} p '#{prop[:fProp]}' :: T :: '#{prop[:tName]}' fqn:#{prop[:tFqn]} o:#{prop[:tOID]} e:#{prop[:tEID]} p '#{prop[:tProp]}'" end |
#run(state) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/dialect_lookup.rb', line 23 def run(state) args = {views: {}, con_views: {}, exec: {}, stages: {} } state.has_key?(:sqlite) ? db = state[:sqlite] : db = "/tmp/dialect.sqlite" state[:dbhandler] = SQLite3::Database.new db ###functional views folderMain = state[:dbhandler].execute("select id from folders where name in ('#{state[:dialectFolder]}')")[0][0] folderId = state[:dbhandler].execute("select folder_id from folders_in_model where parent_folder_id in ('#{folderMain}') and model_version = (select max(model_version) from folders_in_model where parent_folder_id in ('#{folderMain}')) and folder_version = (select max(folder_version) from folders_in_model where parent_folder_id in ('#{folderMain}'))").each do |conFolder| folderDialog = state[:dbhandler].execute("select id from folders where name in ('Dialog') and id in ('#{conFolder[0]}')")[0] if folderDialog.is_a?(Array) state[:dbhandler].execute("select view_id as view_id2, view_version, model_version from views_in_model where parent_folder_id in ('#{folderDialog[0]}') and model_version = (select max(model_version) from views_in_model where view_id in (view_id2))") do |row| viewAtr = state[:dbhandler].execute("select name, version from views where id in ('#{row[0]}') and version = (select max(version) from views where id in ('#{row[0]}'))") if row[1] == viewAtr[0][1] id = row[0].tr("-", "_") args[:views][id] ||= {} args[:views][id][:version] = row[1] args[:views][id][:name] = state[:dialectFolder] Dialog.logger.info "Dialect functional view '#{viewAtr[0][0]}' (id #{id}, view ver.#{row[1]}, model ver.#{row[2]}) of folder '#{Dialog.config.dialect.folder}' for bot '#{Dialog.config.naming.instance}' suits for me!" end end end end ###_constructors views folderId = state[:dbhandler].execute("select id from folders where name in ('_constructors')")[0][0] constructorFolders = state[:dbhandler].execute("select folder_id, folder_version, model_version from folders_in_model where parent_folder_id in ('#{folderId}') and model_version = (select max(model_version) from folders_in_model where parent_folder_id in ('#{folderId}')) and folder_version = (select max(folder_version) from folders_in_model where parent_folder_id in ('#{folderId}'))").each do |conFolder| state[:dbhandler].execute("select view_id as view_id2, view_version, model_version from views_in_model where parent_folder_id in ('#{conFolder[0]}') and model_version = (select max(model_version) from views_in_model where view_id in (view_id2))") do |row| viewAtr = state[:dbhandler].execute("select name, version from views where id in ('#{row[0]}') and version = (select max(version) from views where id in ('#{row[0]}'))") id = row[0].tr("-", "_") args[:con_views][id] ||= {} args[:con_views][id][:version] = row[1] args[:con_views][id][:name] = state[:dialectFolder] Dialog.logger.info "Dialect constructor view '#{viewAtr[0][0]}' (id #{id}, view ver.#{row[1]}, model ver.#{row[2]}) suits for me!" end end args[:stages][state[:dialectFolder]] = {} args[:stages][state[:dialectFolder]] = {codegenGlobal: {}, codegenPerView: {}, x: {}, panView: {lookup: {}}, perView: {}, constructor: {}} getObjects(args, state) args[:con_views].each do |viewId, viewProps| viewType = :constructors lookup_constructors_DockedGroupings2AppFunctions(args, state, viewId, viewType) lookup_constructors_Element2ModSend(args, state, viewId, viewType) lookup_constructors_ElementsInElements(args, state, viewId, viewType) end args[:views].each do |viewId, viewProps| viewType = :perView fullName = "#{state[:dialectFolder]}_#{viewId}" fullNameSym = fullName.to_sym Dialog.logger.debug "#Dialect_lookup RUN instance #{state[:dialectFolder]}" ###functional lookupStruct = {'functional' => [ 'Expect2Events', 'Events2AppEvent', 'Events2ModReceive', 'ModReceive2AppEvent', 'Appevent2EventBus', 'AppEvent2Elements', 'Elements2AppEvent', 'Element2ModElements', 'Element2ModSend', 'ModElementsSpecs', 'ElementChains']} #1 lookup_run(args, lookupStruct, state, viewId, viewType) ###data lookupStruct = {'data' => [ 'ModReceive2GetData', 'GetData2Elements', 'GenData2Dest', 'Results2GenData']} #1 lookup_run(args, lookupStruct, state, viewId, viewType) ### end state[:dbhandler].close json = Oj.dump(args) # File.delete(db) FileUtils.mkdir_p("#{state[:jsonFolder]}") FileUtils.rm_rf(Dir.glob("#{state[:jsonFolder]}/*.json")) jsonDump = "#{state[:jsonFolder]}/#{state[:dialectFolder]}_#{state[:myAppName]}.json" File.open(jsonDump, 'w') { |file| file.write(json) } end |