CN109976805A - A kind of event-driven architecture mode recognition methods based on ontology - Google Patents

A kind of event-driven architecture mode recognition methods based on ontology Download PDF

Info

Publication number
CN109976805A
CN109976805A CN201910254649.9A CN201910254649A CN109976805A CN 109976805 A CN109976805 A CN 109976805A CN 201910254649 A CN201910254649 A CN 201910254649A CN 109976805 A CN109976805 A CN 109976805A
Authority
CN
China
Prior art keywords
ontology
event
driven
mode
architecture mode
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910254649.9A
Other languages
Chinese (zh)
Other versions
CN109976805B (en
Inventor
王璐璐
汪小飞
李必信
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Southeast University
Original Assignee
Southeast University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Southeast University filed Critical Southeast University
Priority to CN201910254649.9A priority Critical patent/CN109976805B/en
Publication of CN109976805A publication Critical patent/CN109976805A/en
Application granted granted Critical
Publication of CN109976805B publication Critical patent/CN109976805B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/74Reverse engineering; Extracting design information from source code

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The event-driven architecture mode recognition methods based on ontology that the invention discloses a kind of, Dependency Specification between source code is obtained required for identification events driving architecture mode using the source code of source code analytical tool parsing goal systems and is built into program relationship graph, the instance layer ontology that ontology is constructed according to program relationship graph, uses ontology description language to describe event-driven architecture mode as conceptual level ontology.By conceptual level ontology, instance layer ontology, and the input of the inference rule three that is write by conceptual level ontology as ontology inference machine.Inference machine obtains the ontology of the expansion comprising new knowledge by reasoning, obtains the event-driven architecture mode example of goal systems using the query statement of ontology.The degree of automation that identification process can be improved using the method identification events driving architecture mode of ontology, will be limited to the accurate rate that identification is improved under specific application scenarios to the identification of event-driven architecture mode.

Description

A kind of event-driven architecture mode recognition methods based on ontology
Technical field
The event-driven architecture mode recognition methods based on ontology that the present invention relates to a kind of, belongs to soft project reverse-engineering In architecture mode identify field.
Background technique
Software architecture pattern-recognition is one of most important step in soft project reverse-engineering, in document deletion condition Under, architecture mode identification is carried out to goal systems based on static system source code in software evolution process, obtains goal systems Architecture mode example facilitates maintenance of the global understanding and later period to whole system to system.
Architecture mode is that new Similar Problems are solved according to known solution to the problem.In conceptual level level, framework Mode is to solve the problems, such as being abstracted for thought, passes through some principle and method etc. and embodies this thought solved the problems, such as.In skill Face, architecture mode are the basic component of system and being abstracted for correlation to art layer by layer.
Event-driven framework (Event Driven Architecture) is a kind of instantly popular architecture mode, It is one kind using event as medium, realizes the mode of maximum loose coupling between component or service.In event driven framework, because The decoupling of height between component, component can be disposed independently, extend and test, because decoupling between event and event handler And can independent maintenance, therefore the agility of event-driven architecture mode is very high.Event-driven framework is generally used for agility It is required with response speed in relatively high system.
Event-driven architecture mode identification based on ontology is to describe event-driven architecture mode with bulk form, then use Whether there is the code for meeting event-driven architecture mode internal relation in inference machine reasoning goal systems source code.Using ontology come into Programmer can be mitigated in the description of event-driven architecture mode and event-driven mode and mesh by acting part driving framework pattern-recognition The coding work amount of mark system source code compatible portion.It is driven since common event-driven mode system is all based on specific event It is developed under dynamic frame, the identification of event-driven mode is limited in object-oriented field by this method, by identifying target system The multiplexing behavioural characteristic united to event-driven mechanism frame assembly, the event-driven architecture mode of identification is confined to specifically have Have under event-driven developing mechanism frame.The identification of event-driven architecture mode will be limited in object-oriented field specifically The accuracy of recognition result can be improved under Development Framework.The automation of mode identification procedure can be improved using the method for ontology Degree.
Summary of the invention
The present invention exactly for the technical problems in the prior art, provides a kind of event-driven framework based on ontology Mode identification method.This method describes event-driven architecture mode with bulk form and has well solved event bogie structure mould Schema abstraction in formula identification process indicates problem, has well solved event-driven mode using the powerful inferential capability of ontology The matching problem of event-driven mode conceptual abstraction and the event-driven mode example in goal systems in identification process.Use this The degree of automation of mode identification procedure can be improved in the method for body.Meanwhile this method is by the knowledge to event-driven architecture mode It is not limited to the accuracy that recognition result can be improved in object-oriented field under specific Development Framework.
To achieve the goals above, technical scheme is as follows: a kind of event-driven architecture mode based on ontology Recognition methods, which is characterized in that the described method comprises the following steps:
1) target system information is extracted;
Goal systems source code is parsed using source code analytical tool, obtains goal systems program relationship graph G;
2) the instance layer ontological construction of event-driven mode;
Using ontology construction tool, goal systems program relationship graph G obtained in step 1 is converted into RDF ternary Group, the instance layer ontology O as characterization goal systems source code Dependency Specificationinstance
3) the conceptual level ontological construction of event-driven mode;
In ontology construction tool, the mode configuration feature and mode row of event-driven mode are described using ontology description language It is characterized the ontology O for constructing event-driven modeeventdriven
4) reasoning and inquiry;
In ontology construction tool, according to the structure and behavior feature of event-driven mode, write needed for ontology inference Inference rule Reventdriven;By Oinstance, Oeventdriven, ReventdrivenThree inputs inference machine, and reasoning is obtained comprising new knowledge Expansion ontology, using ontology construction tool query function inquiry the event for including in goal systems is obtained to Ontology Query Drive framework schema instance.
As an improvement of the present invention, the step 1) target system information is extracted, the specific steps are as follows:
11) the AST tree of source program is obtained by source code analytical tool, traversal AST tree obtains program relationship graph G;
12) entity of the main extraction of information extraction has a class and method, the coupled relation of extraction have succession, realization, combination, Association (excluding combination) calls, instantiation, parameter type coupling, returns to Value Types coupling and the coupling of variable declarations type.
The purpose that interim target system information is extracted: being to extract the program that pattern-recognition needs from system source code to rely on Information specifically includes: entity has class and method, and the coupled relation of extraction has succession, realization, combination, association (excluding combination), adjusts With, instantiation, parameter type coupling, return Value Types coupling and variable declarations type coupling.Finally obtained is characterization target The program relationship graph G of dependence between system program.Specific steps: being originally inputted for identification process only corresponds to target system The project source code of system needs to attempt to carry out architecture mode identification to goal systems by using source code analytical tool solution The source code of analysis goal systems obtains AST tree, traverses AST tree, phase during traversing AST tree between extraction procedure entity Mutual dependence, and be built into program relationship graph G and be stored in associative container.Source code analysis can be by active Code analysis tool carries out morphology syntactic analysis to source code by tool, converts AST (abstract syntax tree) for source code Tree, and be based on to AST traversal of tree, the essential information of extraction system entity and mutual Dependency Specification, and be finally built into Program relationship graph is deposited G and is placed in associative container.
AST in view of saving entire goal systems institute source code in memory simultaneously can consume a large amount of memories, also can Influence target system information extraction rate.In the realization of concrete scheme to each source code file while generating AST tree Required information is just extracted, and extracted information is stored in database or disk file, the process after convenience repeats to make With.
As an improvement of the present invention, the building of step 2) the instance layer ontology is specific as follows:
21) instance layer ontological construction process is that the program dependency graph G for obtaining information extraction is built into the example in ontology Layer ontology (RDF triple) Oinstance
22) node a large amount of in program dependency graph G and side (band attribute) are exactly converted to RDF by the building process of instance layer Triple, the instance layer ontology built in fact be substantially also one figure, only this figure be using ontology describing, Ontological construction process is exactly that the figure extracted from source code is converted to RDF graph in ontology, and the RDF graph in ontology characterizes target system The program relational dependence information of system.
Wherein the purpose of instance layer ontological construction is the program relationship graph building for extracting target system information At the instance layer ontology O of ontologyinstance(RDF triple), and the initial true collection in the next steps as inference machine is defeated Enter in inference machine.
As an improvement of the present invention, step 3) the conceptual level ontological construction, specific as follows:
31) the mode configuration feature and Mode behavior feature of event-driven mode are described using ontology description language;Specifically Ground describes event driven mode role using Ontological concept class, describes each mode using Ontology attribute and ontology value attribute The building of correlation between role, conceptual level ontology is completed in ontology construction tool, the conceptual level ontology being built into OeventdrivenIt is saved in a manner of ontology file;
32) this method event-driven architecture mode to be identified is the common software architecture mould of one of soft project Formula, three schema component events of event-driven architecture mode, event sniffer, there are apparent phase interactions between event source With;It is developed under specific Event-Driven Framework since common event-driven mode system is all based on, this method is by event The identification of drive mode is limited in object-oriented field, by identifying that goal systems answers event-driven mechanism frame assembly With behavioural characteristic, the event-driven architecture mode of identification is confined to specifically have under event-driven developing mechanism frame;Institute With the conceptual level ontology O of event-driven architecture modeeventdrivenIt is to be described on ontological construction platform using ontology description language The mode configuration feature and Mode behavior feature of event-driven architecture mode and the multiplexing behavior of event-driven mechanism frame assembly Feature.Wherein, the target of conceptual level ontological construction: the structure and behavior for describing event-driven mode using ontology description language is special Sign obtains the conceptual level ontology of the structure and behavior feature of characterization event-driven architecture mode, and will conduct in the next steps In the rule set input inference machine of inference machine.Its specific steps: instance layer ontological construction process is exactly to use ontology description language The structure and behavior feature for describing event-driven mode obtains the general of the structure and behavior feature of characterization event-driven architecture mode Read layer ontology.Specifically the concept class on ontology development platform using ontology describes event driven mode role, uses this The object properties and value attribute of body describe the correlation between each mode role.Obtain the knot of characterization event-driven architecture mode The conceptual level ontology of structure and behavioural characteristic, conceptual level ontology on ontology development platform after the completion of constructing in the form of ontology file It stores in database or disk file.And it will be in the next steps as the input of inference machine.It can be by concept inside inference machine The related notion and attribute of the event-driven architecture mode of layer ontology describing are converted to many rules, the rule as inference machine Collection.
As an improvement of the present invention, 4) reasoning and inquiry, it is specific as follows: 41) by step 2 by goal systems journey The instance layer ontology O that order relation dependency graph G is constructedinstanceRdf triple, by step 3 using ontology description language in ontology The conceptual level ontology file O that architecture mode is described on the build tooleventdriven, in ontology construction tool in this step On, according to the multiplexing behavioural characteristic of the structure and behavior feature of event-driven mode and event-driven mechanism frame assembly, write Inference rule R needed for ontology inferenceeventdriven, with the preservation of ontology rule document form, by instance layer ontology Oinstancerdf Triple, conceptual level ontology OeventdrivenFile, ontology inference rule ReventdrivenInput of the file three as inference machine, The ontology of expansion after obtaining reasoning with the rule-based reasoning of inference machine comprising event-driven architecture mode example, the knowledge of architecture mode Other process is mainly that architecture mode example and architecture mode are abstracted matched process,
42) ontology of the expansion obtained by reasoning in step 41) uses the Ontology Query function provided in ontology development tool Ontology query language inquiry can be used to be served as between the entity and entity of each event-driven mode role in goal systems source code Correlation, the result inquired is the event-driven architecture mode example in goal systems.The mesh of reasoning and inquiry Mark: in ontology construction tool, according to the structure and behavior feature of event-driven mode, the rule of reasoning needed for writing ontology inference Then, with the preservation of ontology rule document form.By instance layer ontology rdf triple, conceptual level ontology file, ontology inference rule text Input of the part three as inference machine, comprising event-driven architecture mode example after obtaining reasoning with the rule-based reasoning of inference machine The ontology of expansion.The Ontology Query function of being provided using ontology development tool is inquired using Ontology query language in goal systems source The correlation in event-driven mode between the entity and entity of each mode role is served as in code.Inquiring obtained result is Event-driven architecture mode example in goal systems.
Compared with the existing technology, beneficial effects of the present invention are as follows, and the method for the present invention is by using a kind of based on ontology The event-driven architecture mode of method recognition software system,
(1) accuracy rate of event-driven architecture mode identification is improved.Event-driven proposed by the present invention based on ontology The more previous method of the recognition methods of architecture mode has more pointedly deeply considered structure and the behavior spy of event-driven mode The identification of event-driven mode is innovatively limited to the specific event-driven in object-oriented field and develops frame by sign and application scenarios Under frame, since event-driven architecture mode has changeable implementation under different scenes.The identification of event-driven mode is limited It is scheduled under the specific event-driven Development Framework in object-oriented field, concentrates the thing of identification object-oriented field Specification Design exploitation Part drives framework software systems.It defines the field of event-driven architecture mode identification while just eliminating event-driven framework mould Many and diverse realization of the formula in different field, eliminates the accuracy rate that identification is improved while interference.
(2) the degree of automation of event-driven architecture mode identification is improved.Use to method innovation proposed by the present invention Ontology description language describes the structure behavioural characteristic of architecture mode.Event-driven architecture mode identification process is exactly event-driven frame Structure schema abstraction and goal systems source code realize the matching process of the schema instance of layer.Developer is according to event-driven framework mould The structure behavioural characteristic of formula writes inference rule, and specific matching process is completed by the inference step of inference machine.Reasoning is by reasoning Machine completion does not need programmer and coding is gone to realize again, which thereby enhances the degree of automation of event-driven architecture mode identification.
Detailed description of the invention
Fig. 1 is overview flow chart of the invention.
Fig. 2 is target system information extraction process figure of the invention.
Fig. 3 is ontology inference procedure chart of the invention.
Fig. 4 is event-driven mode concept map of the invention.
Fig. 5 is the program relationship graph of the embodiment of the present invention.
Specific embodiment
The technical solution of invention is described in detail with reference to the accompanying drawing:
Embodiment 1: referring to Fig. 1-Fig. 5, a kind of event-driven architecture mode recognition methods based on ontology, the method packet Include following steps:
1) target system information is extracted;
Goal systems source code is parsed using source code analytical tool, obtains goal systems program relationship graph G;
2) the instance layer ontological construction of event-driven mode;
Using ontology construction tool, goal systems program relationship graph G obtained in step 1 is converted into RDF ternary Group, the instance layer ontology O as characterization goal systems source code Dependency Specificationinstance
3) the conceptual level ontological construction of event-driven mode;
In ontology construction tool, the mode configuration feature and mode row of event-driven mode are described using ontology description language It is characterized the ontology O for constructing event-driven modeeventdriven
4) reasoning and inquiry;
In ontology construction tool, according to the structure and behavior feature of event-driven mode, write needed for ontology inference Inference rule Reventdriven;By Oinstance, Oeventdriven, ReventdrivenThree inputs inference machine, and reasoning is obtained comprising new knowledge Expansion ontology, using ontology construction tool query function inquiry the event for including in goal systems is obtained to Ontology Query Drive framework schema instance.
Step 1) the target system information is extracted, the specific steps are as follows:
11) the AST tree of source program is obtained by source code analytical tool, traversal AST tree obtains program relationship graph G;
12) entity of the main extraction of information extraction has a class and method, the coupled relation of extraction have succession, realization, combination, Association (excluding combination) calls, instantiation, parameter type coupling, returns to Value Types coupling and the coupling of variable declarations type.
The purpose that interim target system information is extracted: being to extract the program that pattern-recognition needs from system source code to rely on Information specifically includes: entity has class and method, and the coupled relation of extraction has succession, realization, combination, association (excluding combination), adjusts With, instantiation, parameter type coupling, return Value Types coupling and variable declarations type coupling.Finally obtained is characterization target The program relationship graph G of dependence between system program.Specific steps: being originally inputted for identification process only corresponds to target system The project source code of system needs to attempt to carry out architecture mode identification to goal systems by using source code analytical tool solution The source code of analysis goal systems obtains AST tree, traverses AST tree, phase during traversing AST tree between extraction procedure entity Mutual dependence, and be built into program relationship graph G and be stored in associative container.Source code analysis can be by active Code analysis tool carries out morphology syntactic analysis to source code by tool, converts AST (abstract syntax tree) for source code Tree, and be based on to AST traversal of tree, the essential information of extraction system entity and mutual Dependency Specification, and be finally built into Program relationship graph is deposited G and is placed in associative container.
AST in view of saving entire goal systems institute source code in memory simultaneously can consume a large amount of memories, also can Influence target system information extraction rate.In the realization of concrete scheme to each source code file while generating AST tree Required information is just extracted, and extracted information is stored in database or disk file, the process after convenience repeats to make With.
The building of step 2) the instance layer ontology is specific as follows:
21) instance layer ontological construction process is that the program dependency graph G for obtaining information extraction is built into the example in ontology Layer ontology (RDF triple) Oinstance
22) node a large amount of in program dependency graph G and side (band attribute) are exactly converted to RDF by the building process of instance layer Triple, the instance layer ontology built in fact be substantially also one figure, only this figure be using ontology describing, Ontological construction process is exactly that the figure extracted from source code is converted to RDF graph in ontology, and the RDF graph in ontology characterizes target system The program relational dependence information of system.
Wherein the purpose of instance layer ontological construction is the program relationship graph building for extracting target system information At the instance layer ontology O of ontologyinstance(RDF triple), and the initial true collection in the next steps as inference machine is defeated Enter in inference machine.
Step 3) the conceptual level ontological construction, specific as follows:
31) the mode configuration feature and Mode behavior feature of event-driven mode are described using ontology description language;Specifically Ground describes event driven mode role using Ontological concept class, describes each mode using Ontology attribute and ontology value attribute The building of correlation between role, conceptual level ontology is completed in ontology construction tool, the conceptual level ontology being built into OeventdrivenIt is saved in a manner of ontology file;
32) this method event-driven architecture mode to be identified is the common software architecture mould of one of soft project Formula, three schema component events of event-driven architecture mode, event sniffer, there are apparent phase interactions between event source With;It is developed under specific Event-Driven Framework since common event-driven mode system is all based on, this method is by event The identification of drive mode is limited in object-oriented field, by identifying that goal systems answers event-driven mechanism frame assembly With behavioural characteristic, the event-driven architecture mode of identification is confined to specifically have under event-driven developing mechanism frame;Institute With the conceptual level ontology O of event-driven architecture modeeventdrivenIt is to be described on ontological construction platform using ontology description language The mode configuration feature and Mode behavior feature of event-driven architecture mode and the multiplexing behavior of event-driven mechanism frame assembly Feature.Wherein, the target of conceptual level ontological construction: the structure and behavior for describing event-driven mode using ontology description language is special Sign obtains the conceptual level ontology of the structure and behavior feature of characterization event-driven architecture mode, and will conduct in the next steps In the rule set input inference machine of inference machine.Its specific steps: instance layer ontological construction process is exactly to use ontology description language The structure and behavior feature for describing event-driven mode obtains the general of the structure and behavior feature of characterization event-driven architecture mode Read layer ontology.Specifically the concept class on ontology development platform using ontology describes event driven mode role, uses this The object properties and value attribute of body describe the correlation between each mode role.Obtain the knot of characterization event-driven architecture mode The conceptual level ontology of structure and behavioural characteristic, conceptual level ontology on ontology development platform after the completion of constructing in the form of ontology file It stores in database or disk file.And it will be in the next steps as the input of inference machine.It can be by concept inside inference machine The related notion and attribute of the event-driven architecture mode of layer ontology describing are converted to many rules, the rule as inference machine Collection.
4) reasoning and inquiry, it is specific as follows: 41) to be constructed by step 2 by goal systems program relationship graph G Instance layer ontology OinstanceRdf triple retouches architecture mode in ontology construction tool using ontology description language by step 3 The conceptual level ontology file O statedeventdriven, in this step in ontology construction tool, according to the knot of event-driven mode The multiplexing behavioural characteristic of structure and behavioural characteristic and event-driven mechanism frame assembly, inference rule needed for writing ontology inference Reventdriven, with the preservation of ontology rule document form, by instance layer ontology OinstanceRdf triple, conceptual level ontology OeventdrivenFile, ontology inference rule ReventdrivenInput of the file three as inference machine, with the rule-based reasoning of inference machine The ontology of the expansion after reasoning comprising event-driven architecture mode example is obtained, the identification process of architecture mode is mainly frame Structure schema instance and architecture mode are abstracted matched process,
42) ontology of the expansion obtained by reasoning in step 41) uses the Ontology Query function provided in ontology development tool Ontology query language inquiry can be used to be served as between the entity and entity of each event-driven mode role in goal systems source code Correlation, the result inquired is the event-driven architecture mode example in goal systems.The mesh of reasoning and inquiry Mark: in ontology construction tool, according to the structure and behavior feature of event-driven mode, the rule of reasoning needed for writing ontology inference Then, with the preservation of ontology rule document form.By instance layer ontology rdf triple, conceptual level ontology file, ontology inference rule text Input of the part three as inference machine, comprising event-driven architecture mode example after obtaining reasoning with the rule-based reasoning of inference machine The ontology of expansion.The Ontology Query function of being provided using ontology development tool is inquired using Ontology query language in goal systems source The correlation in event-driven mode between the entity and entity of each mode role is served as in code.Inquiring obtained result is Event-driven architecture mode example in goal systems.
Concrete application embodiment:
Current invention assumes that be identified developed under JavaSwing frame using Java language with event-driven frame The object-oriented goal systems of structure mode.For the convenience of description, it is assumed that having application example simplified as follows: target program source Code is as follows, and there are three class, 27 line codes altogether.
Referring to figures 1-4, realization of a kind of event-driven architecture mode recognition methods based on ontology in the embodiment Journey has following steps:
1) target system information is extracted;
2) the instance layer ontological construction of event-driven mode;
3) the conceptual level ontological construction of event-driven mode;
4) reasoning and inquiry
Using process is implemented as follows.Overall flow such as Fig. 1,
It is specific as follows:
1) target system information is extracted:
The input extracted using above-mentioned code sample as target system information.Work is parsed using the source code that Eclipse is carried Tool JDT parsing above-mentioned example code obtains output of the program relationship graph of above-mentioned example code as this step, such as Fig. 5 institute Show:
The development platform that this example uses in this step is Eclpise, and source code analytical tool is EclpiseJDT, ontology Developing instrument is Jena, and ontology description language selects owl.This step obtains the exemplary program relationship graph.
2) the instance layer ontological construction of event-driven mode:
Instance layer ontological construction process is exactly big in the program dependency graph for being obtained step 1 using ontology development tool Jena The node of amount and side (band attribute) are converted to RDF triple.The instance layer ontology built is substantially also a figure, this For figure using ontology describing, ontological construction process is exactly the sheet according to the figure building characterization instance layer ontology extracted from source code Body RDF graph, ontology RDF graph characterize goal systems program Dependency Specification.
The ontology development tool that this example uses in this step is Jena, and ontology description language selects owl.This step Input is the program relationship graph that step 1 obtains, and exports the exemplary instance layer ontology.The exhibition in the form of RDF triple It is existing, as follows:
(MyListener,Implements,MouseListener)
(Notify, call, solve)
(solve, parameter,MyEvent)
(Notify,Belong, solve)
(Solve, belong, solve)
3) the conceptual level ontological construction of event-driven mode:
Event-driven mode is made of event, event source and monitor;According to the structure behavior of event-driven architecture mode Feature obtains the recognizable feature of event-driven mode:
A) relationship between monitor and event source is that monitor is registered on event source;
B) monitor is realized with the listening components in event monitoring mechanism framework;
C) relationship between monitor and event source is Observer Pattern, and event source is object observing, and monitor is observation Person;
D) event, listener process event are generated on event source;
Event-driven mode is described by ontology, i.e., is write the recognizable feature of above-mentioned event-driven mode as this Body rule, obtains conceptual level ontology Oeventdriven
According to the composing principle of the above event-driven mode, the conceptual level ontology that we obtain is as follows:
4) reasoning and inquiry:
The mode configuration behavioural characteristic of event-driven architecture mode according to Fig.3, on ontology development platform Jena The inference rule for meeting Jena rule language specification is write, and the rule write is saved into .rules rule file.By table Levy the instance layer ontology rdf triple of above-mentioned goal systems dependence, the conceptual level of the above-mentioned event-driven architecture mode of description The input of ontology .owl file, ontology inference rule .rules file three as inference machine on Jena platform, uses the reasoning The rule-based reasoning that machine provides obtains obtaining the ontology of the expansion of new knowledge.The SPARQL inquiry provided using Jena filters out this The schema instance of event-driven architecture mode in goal systems.
The ontology development tool that this example uses in this step is Jena, and ontology description language selects owl, Ontology Query Language selects SPARQL, the inference machine that inference machine selects Jena included, inference mode alternation rule reasoning.This step obtains the mesh The event-driven architecture mode of mark system.
The instance layer ontology of embodiment is obtained by step 2 and step 3 obtains the conceptual level ontology of embodiment as inference machine Input.
For the Observer Pattern example in embodiment, obtained after reasoning are as follows:
Observer gathers { MyListener }
Object observing set { MyEventSource }
Finally we obtain event-driven mode example it is as follows:
Monitor example collection { MyListener, MouseListener };
Event source instance set { MyEventSource };
Event instance set { MyEvent }.
It should be noted that above-described embodiment is only presently preferred embodiments of the present invention, there is no for the purpose of limiting the invention Protection scope, the equivalent substitution or substitution made based on the above technical solution all belong to the scope of protection of the present invention.

Claims (5)

1. a kind of event-driven architecture mode recognition methods based on ontology, which is characterized in that the described method comprises the following steps:
1) target system information is extracted;
Goal systems source code is parsed using source code analytical tool, obtains goal systems program relationship graph G;
2) the instance layer ontological construction of event-driven mode;
Using ontology construction tool, goal systems program relationship graph G obtained in step 1 is converted into ontology RDF ternary Group, form such as<E1, R, E2>, wherein E1, E2 indicate code entity, and such as class, method, R indicates the dependence between code entity Type, such as method call, Similar integral.
3) the conceptual level ontological construction of event-driven mode;
In ontology construction tool, mode configuration feature and the Mode behavior spy of event-driven mode are described using ontology description language Sign constructs the ontology O of event-driven modeeventdriven
4) reasoning and inquiry;
In ontology construction tool, according to the structure and behavior feature of event-driven mode, reasoning needed for writing ontology inference Regular Reventdriven;By Oinstance, Oeventdriven, ReventdrivenThree inputs inference machine, and reasoning obtains the expansion comprising new knowledge The ontology filled obtains the event-driven for including in goal systems to Ontology Query using the query function inquiry of ontology construction tool Architecture mode example.
2. the event-driven architecture mode recognition methods according to claim 1 based on ontology, which is characterized in that the step Rapid 1) target system information is extracted, the specific steps are as follows:
11) the AST tree of source program is obtained by source code analytical tool, traversal AST tree obtains program relationship graph G.The node of G It is the program entity of step 1 information extraction, the side of G is the coupled relation of step 1 information extraction.Entity has class and method, coupling Relationship have succession, realization, combination, association (exclude combination), call, instantiation, parameter type coupling, return Value Types coupling and The coupling of variable declarations type.
3. the event-driven architecture mode recognition methods according to claim 1 based on ontology, which is characterized in that the step The instance layer ontological construction of rapid 2) event-driven mode is specific as follows:
21) instance layer ontological construction process is the instance layer sheet that the program dependency graph G for obtaining information extraction is built into ontology Body Oinstance
22) node a large amount of in program dependency graph G and side (band attribute) are exactly converted to this by the building process of instance layer ontology Body RDF triple.Ontological construction process is exactly that the program relationship graph that will be extracted from source code is converted to ontology RDF ternary Group, ontology RDF triple characterize the program relational dependence information of goal systems.
4. the event-driven architecture mode recognition methods according to claim 1 based on ontology, which is characterized in that the step The conceptual level ontological construction of rapid 3) event-driven mode, specific as follows:
31) the mode configuration feature and Mode behavior feature of event-driven mode are described using ontology description language;Specifically make Event driven mode role is described with Ontological concept class, describes each mode role using Ontology attribute and ontology value attribute Between correlation;
32) building of event-driven mode conceptual level ontology of the invention is completed in ontology construction tool, the concept being built into Layer ontology OeventdrivenIt is saved in a manner of ontology file.
5. the event-driven architecture mode recognition methods according to claim 1 based on ontology, which is characterized in that it is described 4) Reasoning and inquiry, specific as follows:
41) the instance layer ontology O constructed in step 2 by goal systems program relationship graph GinstanceRDF triple, step The conceptual level ontology file that architecture mode is described in ontology construction tool using ontology description language in 3 Oeventdriven, in this step in ontology construction tool, according to the structure and behavior feature and event-driven of event-driven mode The multiplexing behavioural characteristic of mechanism framework component, inference rule R needed for writing ontology inferenceeventdriven, with ontology rule file Form saves, by instance layer ontology OinstanceRDF triple, conceptual level ontology OeventdrivenFile, ontology inference rule ReventdrivenInput of the file three as inference machine includes event-driven framework after obtaining reasoning with the rule-based reasoning of inference machine The ontology of the expansion of schema instance, the identification process of architecture mode are mainly architecture mode example and architecture mode abstract The process matched.OinstanceInstance layer ontology for the characterization target system information being transformed from target system information extraction, with The form of ontology file stores.OeventdrivenTo use ontology description language to describe event-driven architecture mode structure behavioural characteristic Event-driven mode conceptual level ontology, in the form of ontology file store.ReventdrivenFor the rule of reasoning needed for ontology inference Then, it is stored in the form of rule file.
42) ontology of the expansion obtained by reasoning in step 41) is made using the Ontology Query function of providing in ontology development tool The phase between the entity and entity of each event-driven mode role is served as in goal systems source code with Ontology query language inquiry Mutual relation, the result inquired are the event-driven architecture mode example in goal systems.
CN201910254649.9A 2019-03-31 2019-03-31 Event-driven architecture mode identification method based on ontology Active CN109976805B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910254649.9A CN109976805B (en) 2019-03-31 2019-03-31 Event-driven architecture mode identification method based on ontology

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910254649.9A CN109976805B (en) 2019-03-31 2019-03-31 Event-driven architecture mode identification method based on ontology

Publications (2)

Publication Number Publication Date
CN109976805A true CN109976805A (en) 2019-07-05
CN109976805B CN109976805B (en) 2022-09-09

Family

ID=67081965

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910254649.9A Active CN109976805B (en) 2019-03-31 2019-03-31 Event-driven architecture mode identification method based on ontology

Country Status (1)

Country Link
CN (1) CN109976805B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111597352A (en) * 2020-05-18 2020-08-28 中国人民解放军国防科技大学 Network space knowledge graph reasoning method and device combining ontology concept and example

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5555346A (en) * 1991-10-04 1996-09-10 Beyond Corporated Event-driven rule-based messaging system
CN103617265A (en) * 2013-12-03 2014-03-05 北京航空航天大学深圳研究院 Ontology query engine optimizing system based on ontology semantic information
CN107368302A (en) * 2017-06-28 2017-11-21 东南大学 A kind of design mode identification method based on body
CN107885528A (en) * 2017-11-17 2018-04-06 东南大学 A kind of architecture mode modeling method based on body

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5555346A (en) * 1991-10-04 1996-09-10 Beyond Corporated Event-driven rule-based messaging system
CN103617265A (en) * 2013-12-03 2014-03-05 北京航空航天大学深圳研究院 Ontology query engine optimizing system based on ontology semantic information
CN107368302A (en) * 2017-06-28 2017-11-21 东南大学 A kind of design mode identification method based on body
CN107885528A (en) * 2017-11-17 2018-04-06 东南大学 A kind of architecture mode modeling method based on body

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
钟林辉等: "《基于本体及模式驱动的构件化软件共同变化识别研究》", 《计算机应用研究》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111597352A (en) * 2020-05-18 2020-08-28 中国人民解放军国防科技大学 Network space knowledge graph reasoning method and device combining ontology concept and example
CN111597352B (en) * 2020-05-18 2023-05-09 中国人民解放军国防科技大学 Network space knowledge graph reasoning method and device combining ontology concepts and instances

Also Published As

Publication number Publication date
CN109976805B (en) 2022-09-09

Similar Documents

Publication Publication Date Title
US7962497B2 (en) Relationship modeling
CN110275894B (en) Knowledge graph updating method and device, electronic equipment and storage medium
CN103631596B (en) Business object data typing and the configuration device and collocation method for updating rule
Konstantinou et al. Ontology and database mapping: a survey of current implementations and future directions
CN106202207A (en) A kind of index based on HBase ORM and searching system
CN105975531B (en) Robot dialog control method and system based on dialogue knowledge base
CN106844693A (en) A kind of conversion methods of openEHR Template to relational database
US20130091184A1 (en) Correlating independent schema mappings
Crotti Junior et al. An evaluation of uplift mapping languages
De Raedt et al. Probabilistic programming concepts
Pomp et al. Eskape: Information platform for enabling semantic data processing
CN109033272A (en) A kind of knowledge automatic correlation method and device based on concept
CN109976805A (en) A kind of event-driven architecture mode recognition methods based on ontology
Xu et al. Semantic web services annotation and composition based on ER model
Sahoo et al. Provenance algebra and materialized view-based provenance management
Lano et al. Optimising model-transformations using design patterns
Gelfond et al. Towards a theory of elaboration tolerance: Logic programming approach
Gómez et al. Towards a framework for ontology-based data access: materialization of OWL ontologies from relational databases
CN115858348B (en) Test workload assessment method, device and medium based on byte codes
Meimaris Managing, querying and analyzing big data on the web
CN107341021A (en) The software network of large complicated software belt restraining logical attribute represents, storage and retrieval method
Pop et al. Semantic data factory: A framework for using domain knowledge in software application development
Xu Knowledge graph management and streaming in the context of edge computing
Durand et al. Spread the Good Around! Information Propagation in Schema Matching and Entity Resolution for Heterogeneous Data.
Thenmozhi et al. OntoMD: ontology based multidimensional schema design approach

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant