CN109976805B - Event-driven architecture mode identification method based on ontology - Google Patents

Event-driven architecture mode identification method based on ontology Download PDF

Info

Publication number
CN109976805B
CN109976805B CN201910254649.9A CN201910254649A CN109976805B CN 109976805 B CN109976805 B CN 109976805B CN 201910254649 A CN201910254649 A CN 201910254649A CN 109976805 B CN109976805 B CN 109976805B
Authority
CN
China
Prior art keywords
ontology
event
driven
mode
target system
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.)
Active
Application number
CN201910254649.9A
Other languages
Chinese (zh)
Other versions
CN109976805A (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

Images

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 invention discloses an event-driven architecture mode recognition method based on an ontology, which is characterized in that a source code analysis tool is utilized to analyze source codes of a target system to obtain dependency information among the source codes required by recognizing an event-driven architecture mode and construct a program relation dependency graph, an instance layer ontology of the ontology is constructed according to the program relation dependency graph, and an ontology description language is used for describing the event-driven architecture mode as a concept layer ontology. And taking the concept layer ontology, the instance layer ontology and the inference rule compiled by the concept layer ontology as the input of the ontology inference engine. And the inference engine obtains an extended ontology containing new knowledge through inference, and obtains the event-driven architecture mode example of the target system by using the query statement of the ontology. The method for identifying the event-driven architecture mode by using the ontology can improve the automation degree of the identification process, and limits the identification of the event-driven architecture mode to a specific application scene, thereby improving the identification accuracy.

Description

Event-driven architecture mode identification method based on ontology
Technical Field
The invention relates to an event-driven architecture pattern recognition method based on an ontology, and belongs to the field of architecture pattern recognition in software engineering reverse engineering.
Background
The software architecture pattern recognition is one of the most important steps in software engineering reverse engineering, and under the condition of document loss, the architecture pattern recognition is carried out on a target system based on system static source codes in the software evolution process to obtain an architecture pattern example of the target system, so that the overall understanding of the whole system and the maintenance of the system in the later period are facilitated.
The architectural model is a solution to solve a new similar problem according to a known problem. At the concept level, the architecture mode is an abstraction for solving the problem idea, and the problem idea is embodied by some principles and methods. At the technology level, an architectural schema is an abstraction of the basic constituent elements and interrelationships of the system.
Event Driven Architecture (Event Driven Architecture) is a very popular Architecture mode at present, and is a way to achieve the maximum loose coupling between components or services by taking events as the medium. In an event-driven architecture, because of the high degree of decoupling between components, the components can be deployed, extended, and tested independently, and because of the decoupling between event and event processors and the independent maintenance, the agility of the event-driven architecture mode is high. Event-driven architectures are typically used in systems where agility and response speed requirements are relatively high.
The identification of the event-driven architecture mode based on the ontology describes the event-driven architecture mode in a formalization mode by using the ontology, and then an inference engine is used for deducing whether codes meeting the internal relation of the event-driven architecture mode exist in source codes of a target system. The use of ontologies for event-driven architectural pattern recognition can reduce the encoding workload of programmers in the event-driven architectural pattern description and matching of event-driven patterns with target system source code. Because common event-driven mode systems are developed on the basis of a specific event-driven framework, the method limits the identification of the event-driven mode in the object-oriented field, and limits the identified event-driven architecture mode in the specific event-driven development mechanism framework by identifying the multiplexing behavior characteristics of a target system to the event-driven mechanism framework component. The recognition of the event-driven architecture mode is limited under a specific development framework in the object-oriented field, so that the accuracy of the recognition result can be improved. The method of using an ontology may improve the degree of automation of the pattern recognition process.
Disclosure of Invention
The invention provides an event-driven architecture mode identification method based on an ontology aiming at the technical problems in the prior art. The method uses the ontology to formally describe the event-driven architecture mode to well solve the problem of mode abstract representation in the event-driven architecture mode recognition process, and uses the strong reasoning capability of the ontology to well solve the problem of matching of event-driven mode concept abstraction in the event-driven mode recognition process and the event-driven mode instance in the target system. The method of using the ontology can improve the automation degree of the pattern recognition process. Meanwhile, the method limits the recognition of the event-driven architecture mode to a specific development framework in the object-oriented field, and can improve the accuracy of the recognition result.
In order to achieve the purpose, the technical scheme of the invention is as follows: an ontology-based event-driven architecture pattern recognition method, the method comprising the steps of:
1) extracting target system information;
analyzing a source code of a target system by using a source code analyzing tool to obtain a target system program relation dependency graph G;
2) instance layer ontology building of event-driven patterns;
converting the target system program relation dependency graph G obtained in the step 1 into RDF triples by using an ontology construction tool, wherein the RDF triples are used as instance layer ontologies O for representing target system source code dependency information instance
3) Constructing a concept layer ontology of the event-driven mode;
on an ontology construction tool, an ontology O of the event-driven mode is constructed by using an ontology description language to describe mode structure characteristics and mode behavior characteristics of the event-driven mode eventdriven
4) Reasoning and inquiring;
on an ontology construction tool, compiling an inference rule R required by ontology inference according to the structural and behavioral characteristics of an event-driven mode eventdriven (ii) a Mixing O with instance ,O eventdriven ,R eventdriven The three are input into an inference engine to infer and obtain an extended ontology containing new knowledge, and the ontology is queried by using a query function of an ontology construction tool to obtain an event-driven architecture mode example contained in a target system.
As an improvement of the present invention, the step 1) of extracting the target system information specifically includes the following steps:
11) an AST tree of a source program is obtained through a source code analysis tool, and a program relation dependency graph G is obtained by traversing the AST tree;
12) the main extracted entities for information extraction have classes and methods, and the extracted coupling relations include inheritance, implementation, combination, association (excluding combination), call, instantiation, parameter type coupling, return value type coupling and variable declaration type coupling.
The purpose of extracting the target system information is as follows: the method is used for extracting program dependence information required by pattern recognition from system source codes, and specifically comprises the following steps: the entity has classes and methods, and the extracted coupling relation has inheritance, implementation, combination, association (excluding combination), calling, instantiation, parameter type coupling, return value type coupling and variable statement type coupling. And finally obtaining a program relation dependency graph G for representing the dependency relation between the programs of the target system. The method comprises the following specific steps: the original input of the identification process only has the project source code corresponding to the target system, and in order to attempt to identify the architecture mode of the target system, the source code of the target system needs to be analyzed by using a source code analysis tool to obtain an AST tree, the AST tree is traversed, the interdependence relation between program entities is extracted in the process of traversing the AST tree, a program relation dependency graph G is constructed, and the program relation dependency graph G is stored in a correlation container. The source code analysis can be realized by performing lexical syntax analysis on the source code through an existing source code analysis tool, converting the source code into an AST (abstract syntax tree) tree, extracting basic information and mutual dependency information of system entities based on traversal of the AST tree, and finally constructing a program relation dependency graph G to be placed in a relevance container.
Considering that the AST that stores all source codes of the whole target system in the memory at the same time consumes a large amount of memory, the information extraction speed of the target system is also affected. In the implementation of the specific scheme, required information is extracted while AST trees are generated for each source code file, and the extracted information is stored in a database or a disk file, so that the subsequent processes can be conveniently reused.
As an improvement of the present invention, the step 2) is specifically configured as follows:
21) the example layer ontology construction process is to construct the program dependency graph G obtained by information extraction into an example layer ontology (RDF triple) O in the ontology instance
22) The building process of the instance layer is to convert a large number of nodes and edges (with attributes) in the program dependency graph G into RDF triples, and the built instance layer ontology is also a graph essentially, but the graph is described by using an ontology, and the building process of the ontology is to convert a graph extracted from source codes into an RDF graph in the ontology, wherein the RDF graph in the ontology characterizes program relationship dependency information of a target system.
The purpose of the example layer ontology construction is to construct a program relation dependency graph obtained by extracting target system information into an example layer ontology O of the ontology instance (RDF triplets) and will be input into the inference engine in a subsequent step as an initial set of facts for the inference engine.
As an improvement of the present invention, the concept layer ontology in step 3) is constructed as follows:
31) describing mode structure characteristics and mode behavior characteristics of the event-driven mode by using an ontology description language; specifically, an ontology concept class is used for describing event-driven mode roles, an ontology object attribute and an ontology value attribute are used for describing the interrelation among the mode roles, the construction of a concept layer ontology is completed on an ontology construction tool, and a constructed concept layer ontology O eventdriven Storing in a body file mode;
32) the event-driven architecture mode to be identified by the method is a common software architecture mode in software engineering, and obvious interaction exists among three mode component events, an event monitor and an event source of the event-driven architecture mode; because common event-driven mode systems are developed on the basis of a specific event-driven framework, the method limits the identification of the event-driven mode in the object-oriented field, and limits the identified event-driven architecture mode in the specific framework with the event-driven development mechanism by identifying the multiplexing behavior characteristics of a target system to the frame component of the event-driven mechanism; therefore, the concept layer ontology O of the event-driven architecture model eventdriven The method is characterized in that an ontology description language is used on an ontology construction platform to describe mode structure features and mode behavior features of an event-driven architecture mode and multiplexing behavior features of an event-driven mechanism framework component. Wherein, the object of concept layer ontology construction: and describing the structure and behavior characteristics of the event-driven mode by using an ontology description language to obtain a concept layer ontology for representing the structure and behavior characteristics of the event-driven architecture mode, and inputting the concept layer ontology into an inference engine as a rule set of the inference engine in the subsequent steps. The method comprises the following specific steps: the instance level ontology building process is to use an ontology description language to describe the structure and theAnd obtaining a concept layer ontology of the structural and behavior characteristics of the characteristic event-driven architecture mode according to the behavior characteristics. Specifically, on an ontology development platform, the concept class of the ontology is used for describing event-driven mode roles, and the object attribute and the value attribute of the ontology are used for describing the interrelation among the mode roles. And obtaining a concept layer ontology which represents the structural and behavioral characteristics of the event-driven architecture mode, and storing the concept layer ontology in a database or a disk file in the form of an ontology file after the concept layer ontology is constructed on an ontology development platform. And will be used as input to the inference engine in subsequent steps. The inference engine internally converts the related concepts and attributes of the event-driven architecture mode described by the concept layer ontology into a plurality of rules, and the rules are used as a rule set of the inference engine.
As an improvement of the present invention, said 4) reasoning and querying specifically includes the following steps: 41) instance layer ontology O constructed by target system program relation dependency graph G in step 2 instance rdf triple, concept layer ontology file O described by step 3 using ontology language on the ontology building tool for architecture schema eventdriven In the step, on an ontology construction tool, an inference rule R required by ontology inference is compiled according to the structure and behavior characteristics of the event-driven mode and the multiplexing behavior characteristics of the frame assembly of the event-driven mechanism eventdriven Saving in the form of ontology rule file, and storing instance layer ontology O instance rdf triple, concept layer ontology O eventdriven Document and ontology inference rule R eventdriven The three files are used as the input of the inference engine, the rule inference of the inference engine is used to obtain the extended ontology containing the event-driven architecture pattern example after the inference, the identification process of the architecture pattern mainly lies in the abstract matching process of the architecture pattern example and the architecture pattern,
42) and 41), using an ontology query function provided in an ontology development tool to query the entity serving as each event-driven mode role in the source code of the target system and the correlation between the entities by using an ontology query language, wherein the result obtained by the query is the event-driven architecture mode example in the target system. Target of inference and query: and on the ontology construction tool, compiling inference rules required by ontology inference according to the structural and behavior characteristics of the event-driven mode, and storing the inference rules in an ontology rule file form. And taking the instance layer ontology rdf triple, the concept layer ontology file and the ontology reasoning rule file as the input of the reasoning machine, and using the rule reasoning of the reasoning machine to obtain an extended ontology containing the event-driven architecture mode instance after reasoning. Ontology query functionality provided using an ontology development tool queries entities and interrelationships between entities in the target system source code that serve as the roles of the individual schemas in the event-driven schema using an ontology query language. And the result obtained by the query is the event-driven architecture mode example in the target system.
Compared with the prior art, the method has the advantages that the method identifies the event-driven architecture mode of the software system by using an ontology-based method,
(1) the accuracy of the event-driven architecture pattern recognition is improved. Compared with the conventional method, the identification method of the event-driven architecture mode based on the ontology more pertinently and deeply considers the structure and behavior characteristics and the application scene of the event-driven mode, creatively limits the identification of the event-driven mode under a specific event-driven development framework of the object-oriented field, and has variable implementation modes of the event-driven architecture mode under different scenes. And limiting the recognition of the event-driven mode under a specific event-driven development framework of the object-oriented field, and intensively recognizing the event-driven architecture software system designed and developed according to the object-oriented field specification. The method limits the field of event-driven architecture mode recognition, simultaneously eliminates the complicated realization of the event-driven architecture mode in different fields, eliminates interference and simultaneously improves the recognition accuracy.
(2) The automation degree of the event-driven architecture mode recognition is improved. The method provided by the invention innovatively uses an ontology description language to describe the structural behavior characteristics of the architectural mode. The event-driven architecture pattern recognition process is a matching process of pattern instances of the source code implementation layer of the event-driven architecture pattern abstraction and the target system. A developer writes an inference rule according to the structural behavior characteristics of the event-driven architecture mode, and a specific matching process is completed by inference steps of an inference engine. The reasoning is realized by the reasoning machine without the need of a programmer to decode, thereby improving the automation degree of the event-driven architecture mode recognition.
Drawings
FIG. 1 is a general flow diagram of the present invention.
Fig. 2 is a diagram of a target system information extraction process of the present invention.
FIG. 3 is a diagram of the ontology inference process of the present invention.
FIG. 4 is a conceptual diagram of the event driven mode of the present invention.
FIG. 5 is a program relationship dependency diagram of an embodiment of the invention.
Detailed Description
The technical scheme of the invention is explained in detail in the following with the accompanying drawings:
example 1: referring to fig. 1-5, a method for ontology-based event-driven architecture pattern recognition includes the following steps:
1) extracting target system information;
analyzing a source code of a target system by using a source code analyzing tool to obtain a target system program relation dependency graph G;
2) instance layer ontology building of event-driven patterns;
converting the target system program relation dependency graph G obtained in the step 1 into RDF triple by using an ontology construction tool, wherein the RDF triple is used as an example layer ontology O for representing target system source code dependency information instance
3) Constructing a concept layer ontology of the event-driven mode;
on an ontology construction tool, an ontology O of the event-driven mode is constructed by using an ontology description language to describe mode structure characteristics and mode behavior characteristics of the event-driven mode eventdriven
4) Reasoning and inquiring;
on an ontology construction tool, compiling an inference rule R required by ontology inference according to the structural and behavioral characteristics of an event-driven mode eventdriven (ii) a Mixing O with instance ,O eventdriven ,R eventdriven The three input inference machines infer to obtain an extended ontology containing new knowledge, and query the ontology by using a query function of an ontology construction tool to obtain an event-driven architecture mode example contained in a target system.
The step 1) of extracting the target system information comprises the following specific steps:
11) an AST tree of a source program is obtained through a source code analysis tool, and a program relation dependency graph G is obtained by traversing the AST tree;
12) the main extracted entities for information extraction have classes and methods, and the extracted coupling relations include inheritance, implementation, combination, association (excluding combination), call, instantiation, parameter type coupling, return value type coupling and variable declaration type coupling.
The purpose of extracting the target system information is as follows: the method is used for extracting program dependence information required by pattern recognition from system source codes, and specifically comprises the following steps: the entity has classes and methods, and the extracted coupling relations include inheritance, implementation, combination, association (excluding combination), calling, instantiation, parameter type coupling, return value type coupling and variable declaration type coupling. And finally obtaining a program relation dependency graph G for representing the dependency relation between the programs of the target system. The method comprises the following specific steps: in order to attempt to identify the architecture mode of the target system, the source code of the target system needs to be analyzed by using a source code analysis tool to obtain an AST tree, the AST tree is traversed, the interdependence between program entities is extracted in the process of traversing the AST tree, a program relation dependency graph G is constructed, and the program relation dependency graph G is stored in a correlation container. The source code analysis can be realized by performing lexical syntax analysis on the source code through an existing source code analysis tool, converting the source code into an AST (abstract syntax tree) tree, extracting basic information and mutual dependency information of system entities based on traversal of the AST tree, and finally constructing a program relation dependency graph G to be placed in a relevance container.
Considering that the AST that stores all source codes of the whole target system in the memory at the same time consumes a large amount of memory, the information extraction speed of the target system is also affected. In the implementation of the specific scheme, the needed information is extracted while the AST tree is generated for each source code file, and the extracted information is stored in a database or a disk file, so that the later process can be conveniently reused.
The step 2) is specifically as follows:
21) the example layer ontology construction process is to construct the program dependency graph G obtained by information extraction into an example layer ontology (RDF triple) O in the ontology instance
22) The building process of the instance layer is to convert a large number of nodes and edges (with attributes) in the program dependency graph G into RDF triples, and the built instance layer ontology is also a graph essentially, but the graph is described by using an ontology, and the building process of the ontology is to convert a graph extracted from source codes into an RDF graph in the ontology, wherein the RDF graph in the ontology characterizes program relationship dependency information of a target system.
The purpose of the example layer ontology construction is to construct a program relation dependency graph obtained by extracting target system information into an example layer ontology O of the ontology instance (RDF triplets) and will be input into the inference engine in a subsequent step as an initial set of facts for the inference engine.
The step 3) of constructing a concept layer ontology specifically comprises the following steps:
31) describing mode structure characteristics and mode behavior characteristics of the event-driven mode by using an ontology description language; specifically, an ontology concept class is used for describing event-driven mode roles, an ontology object attribute and an ontology value attribute are used for describing the interrelation among the mode roles, the construction of a concept layer ontology is completed on an ontology construction tool, and a constructed concept layer ontology O eventdriven Storing in a body file mode;
32) the event-driven architecture mode to be identified by the method is a common software architecture mode in software engineering, and three mode component events, an event monitor and an event source of the event-driven architecture mode have obvious interaction; since common event-driven mode systems are developed based on a specific event-driven framework, the method limits the identification of event-driven modes in the object-oriented field byIdentifying the multiplexing behavior characteristics of the target system to the event-driven mechanism frame assembly, and limiting the identified event-driven framework mode under a specific frame with an event-driven development mechanism; therefore, the concept layer ontology O of the event-driven architectural model eventdriven The method is characterized in that an ontology description language is used on an ontology construction platform to describe mode structure features and mode behavior features of an event-driven architecture mode and multiplexing behavior features of an event-driven mechanism framework component. Wherein, the object of concept layer ontology construction is as follows: and describing the structure and behavior characteristics of the event-driven mode by using an ontology description language to obtain a concept layer ontology for representing the structure and behavior characteristics of the event-driven architecture mode, and inputting the concept layer ontology into an inference engine as a rule set of the inference engine in the subsequent steps. The method comprises the following specific steps: the example layer ontology construction process is to describe the structure and behavior characteristics of the event-driven schema by using an ontology description language to obtain a concept layer ontology representing the structure and behavior characteristics of the event-driven architecture schema. Specifically, on an ontology development platform, the concept class of the ontology is used for describing event-driven mode roles, and the object attribute and the value attribute of the ontology are used for describing the interrelation among the mode roles. And obtaining a concept layer ontology representing the structural and behavioral characteristics of the event-driven architecture mode, and storing the concept layer ontology into a database or a disk file in the form of an ontology file after the concept layer ontology is constructed on an ontology development platform. And will be used as input to the inference engine in subsequent steps. The inference engine internally converts the related concepts and attributes of the event-driven architecture schema described by the concept layer ontology into a plurality of rules as a rule set of the inference engine.
And 4) reasoning and inquiring, which specifically comprises the following steps: 41) instance layer ontology O constructed by target system program relation dependency graph G in step 2 instance rdf triple, concept layer ontology document O described by ontology language on the ontology building tool in step 3 eventdriven In the step, on an ontology construction tool, an inference rule R required by ontology inference is compiled according to the structure and behavior characteristics of the event-driven mode and the multiplexing behavior characteristics of the frame assembly of the event-driven mechanism eventdriven Stored in the form of ontology rule file, and storing the ontology rule fileExample layer body O instance rdf triple, concept layer ontology O eventdriven Document and ontology inference rule R eventdriven The three files are used as the input of the inference engine, the rule inference of the inference engine is used to obtain the extended ontology containing the event-driven architecture pattern example after inference, the identification process of the architecture pattern mainly lies in the process of abstract matching of the architecture pattern example and the architecture pattern,
42) and 41), using an ontology query function provided in an ontology development tool to query the entity serving as each event-driven mode role in the source code of the target system and the correlation between the entities by using an ontology query language, wherein the result obtained by the query is the event-driven architecture mode example in the target system. Target of inference and query: and on the ontology construction tool, compiling inference rules required by ontology inference according to the structural and behavior characteristics of the event-driven mode, and storing the inference rules in an ontology rule file form. And the instance layer ontology rdf triple, the concept layer ontology file and the ontology inference rule file are used as input of an inference engine, and the rule inference of the inference engine is used for obtaining an extended ontology containing the event-driven architecture mode instance after inference. Ontology query functionality provided using ontology development tools queries entities and interrelationships between entities in the target system source code that serve the role of each schema in the event-driven schema using an ontology query language. And obtaining a result of the query, namely the event-driven architecture mode instance in the target system.
The specific application embodiment is as follows:
the present invention assumes that what is to be identified is an object-oriented system with an event-driven architectural schema developed under the javassing framework using the Java language. For convenience of description, we assume the following simplified application example: the target program source code has three classes, 27 lines of code, as shown below.
Figure BDA0002013336400000091
Referring to fig. 1 to 4, an ontology-based event-driven architecture pattern recognition method in the implementation process of the embodiment has the following steps:
1) extracting target system information;
2) instance layer ontology building of event-driven patterns;
3) constructing a concept layer ontology of the event-driven mode;
4) reasoning and query
The procedure was carried out as follows. The whole flow is shown in figure 1,
the method comprises the following specific steps:
1) extracting target system information:
the above example code is used as input for target system information extraction. And analyzing the example code by using an Eclipse-owned source code analysis tool JDT to obtain a program relation dependency graph of the example code as an output of the step, as shown in FIG. 5:
the development platform used in this step is Eclpise, the source code analysis tool is Eclpise jdt, the ontology development tool is Jena, and the ontology description language is owl. This step results in the program relationship dependency graph of this example.
2) Instance layer ontology building of event-driven schema:
the instance layer ontology building process is to convert a large number of nodes and edges (with attributes) in the program dependency graph obtained in the step 1 into RDF triples by using an ontology development tool Jena. The constructed instance layer ontology is also a graph essentially, the graph is described by using an ontology, and the ontology construction process is to construct an ontology RDF graph representing the instance layer ontology according to the graph extracted from the source code, wherein the ontology RDF graph represents the target system program dependency information.
The ontology development tool used in this step is Jena, and the ontology description language is owl. The input of this step is the program relation dependency graph obtained in step 1, and the example layer ontology of this example is output. And is represented in the form of RDF triples as follows:
(MyListener,ImplementsMouseListener)
(Notify,call,solve)
(solve,parameter,MyEvent)
(Notify,belong,solve)
(solve,belong,solve)
3) concept layer ontology construction of event-driven schema:
the event-driven mode consists of an event, an event source and a monitor; according to the structural behavior characteristics of the event-driven architecture mode, obtaining the recognizable characteristics of the event-driven mode:
a) the relationship between the listener and the event source is that the listener is registered on the event source;
b) the monitor realizes a monitoring component in a framework with an event monitoring mechanism;
c) the relationship between the listener and the event source is an observer mode, the event source is an observation target, and the listener is an observer;
d) generating an event on an event source, and processing the event by a monitor;
describing the event-driven mode through the ontology, namely writing the recognizable features of the event-driven mode into an ontology rule to obtain a concept layer ontology O eventdriven
Based on the above composition principles of event-driven patterns, we get the following concept layer ontology:
Figure BDA0002013336400000101
Figure BDA0002013336400000111
4) reasoning and inquiring:
according to the mode structure behavior characteristics of the event-driven architecture mode shown in FIG. 3, an inference rule meeting the Jena rule language specification is written on the ontology development platform Jena, and the written rule is stored into a rule file of rules. And taking an example layer ontology rdf triple representing the dependency relationship of the target system and a concept layer ontology describing the event-driven architecture mode, wherein an own file, an ontology inference rule and a rules file are used as input of an inference engine on a Jena platform, and the rule provided by the inference engine is used for inferring to obtain an extended ontology with new knowledge. The SPARQL query provided by Jena is used to screen out pattern instances of event-driven architectural patterns in the target system.
The ontology development tool used in this step is Jena, the ontology description language is owl, the ontology query language is SPARQL, the inference engine is a Jena-owned inference engine, and the inference mode is rule inference. This step obtains the event-driven architecture mode of the target system.
The example layer ontology of the embodiment is obtained from step 2 and the concept layer ontology of the embodiment is obtained from step 3 as the input of the inference engine.
For the embodiment, the example of the observer pattern obtained after reasoning is:
set of observers { MyListener }
Observation target set { MyEventSource }
An example of the resulting event-driven mode is as follows:
set of listener instances { MyListener, MouseListener };
a set of event source instances { MyEventSource };
set of event instances { MyEvent }.
It should be noted that the above-mentioned embodiments are only preferred embodiments of the present invention, and are not intended to limit the scope of the present invention, and all equivalent substitutions or substitutions made on the above-mentioned technical solutions belong to the scope of the present invention.

Claims (3)

1. An ontology-based event-driven architecture pattern recognition method, characterized in that the method comprises the following steps:
1) extracting target system information;
analyzing a source code of a target system by using a source code analyzing tool to obtain a target system program relation dependency graph G;
2) instance layer ontology building of event-driven patterns;
converting the target system program relation dependency graph G obtained in the step 1) into an ontology RDF triple by using an ontology construction tool, wherein the form is < E1, R, E2>, E1 and E2 represent code entities and are classes or methods, and R represents a dependency type among the code entities and is method calling or class inheritance;
3) constructing a concept layer ontology of the event-driven mode;
on an ontology construction tool, an ontology O of the event-driven mode is constructed by using an ontology description language to describe mode structure characteristics and mode behavior characteristics of the event-driven mode eventdriven
4) Reasoning and inquiring;
on an ontology construction tool, compiling an inference rule R required by ontology inference according to the structural and behavioral characteristics of an event-driven mode eventdriven (ii) a Mixing O with instance ,O eventdriven ,R eventdriven Inputting the three into an inference engine, inferring to obtain an extended ontology containing new knowledge, and querying the ontology by using a query function of an ontology construction tool to obtain an event-driven architecture mode example contained in a target system;
the example layer ontology of the event-driven mode in the step 2) is specifically constructed as follows:
21) the example layer ontology construction process is to construct the program relation dependency graph G obtained by information extraction into an example layer ontology O in the ontology instance
22) The construction process of the instance layer body is to convert a large number of nodes and edges with attributes in the program relation dependency graph G into an RDF triple of the body; the program relation dependency graph G is extracted from source codes, and the RDF (remote data format) triple of the body represents the program relation dependency information of the target system;
the 4) reasoning and query specifically comprise the following steps:
41) step 2) constructing an example layer ontology RDF triple by the target system program relation dependency graph G, and step 3) describing the architecture mode on an ontology construction tool by using an ontology description language to obtain a concept layer ontology O eventdriven Files, structure and of event-driven patterns on the ontology building tool in this stepThe behavior characteristics and the multiplexing behavior characteristics of the frame component of the event-driven mechanism, and an inference rule R required by ontology inference are compiled eventdriven Storing the RDF triple of the instance layer ontology and the concept layer ontology O in an ontology rule file form eventdriven Document and ontology inference rule R eventdriven The three files are used as the input of an inference engine, an extended ontology containing an event-driven architecture mode example after inference is obtained by using the rule inference of the inference engine, and the identification process of the architecture mode is the process of abstract matching of the architecture mode example and the architecture mode; o is instance The instance layer ontology which is converted from the target system information and used for representing the target system information is extracted and stored in the form of an ontology file; o is eventdriven Storing an event-driven model concept layer ontology, which is used for describing the structural behavior characteristics of the event-driven architecture model by using an ontology description language, in the form of an ontology file; r is eventdriven Reasoning rules required by ontology reasoning are stored in the form of rule files;
42) the extended ontology obtained by reasoning in step 41) uses an ontology query function provided in an ontology development tool to query the entity serving as each event-driven mode role in the source code of the target system and the correlation between the entities by using an ontology query language, and the result obtained by the query is the event-driven architecture mode example in the target system.
2. The ontology-based event-driven architecture pattern recognition method according to claim 1, wherein the step 1) of target system information extraction specifically comprises the following steps:
11) an AST tree of a source program is obtained through a source code analysis tool, and a program relation dependency graph G is obtained by traversing the AST tree; the node of G is a program entity for information extraction in the step 1), and the edge of G is a coupling relation for information extraction in the step 1); the entity has classes and methods, and the coupling relationship comprises inheritance, implementation, combination, association for excluding combination, calling, instantiation, parameter type coupling, return value type coupling and variable declaration type coupling.
3. The ontology-based event-driven architecture pattern recognition method of claim 1, wherein the step 3) is a concept-level ontology construction of the event-driven pattern, specifically as follows:
31) describing mode structure characteristics and mode behavior characteristics of the event-driven mode by using an ontology description language; particularly, an ontology concept class is used for describing event-driven mode roles, and an ontology object attribute and an ontology value attribute are used for describing the interrelation among the mode roles;
32) the construction of the concept layer ontology of the event-driven mode is completed on an ontology construction tool, and the constructed concept layer ontology O eventdriven And saving in a body file mode.
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 CN109976805A (en) 2019-07-05
CN109976805B true 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)

Families Citing this family (1)

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

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
《基于本体及模式驱动的构件化软件共同变化识别研究》;钟林辉等;《计算机应用研究》;20160421;第33卷(第3期);第773-778页 *

Also Published As

Publication number Publication date
CN109976805A (en) 2019-07-05

Similar Documents

Publication Publication Date Title
Alur et al. Search-based program synthesis
Shi et al. PathPair2Vec: An AST path pair-based code representation method for defect prediction
Kogalovsky Ontology-based data access systems
Jarke et al. A software process data model for knowledge engineering in information systems
CN108228158B (en) Ontology-based framework behavior pattern recognition method
Lano et al. A framework for model transformation verification
US7640238B2 (en) Query planning for execution using conditional operators
CN109992271B (en) Layered architecture recognition method based on code vocabulary and structure dependence
CN112860263A (en) Contract defect detection method based on intelligent contract knowledge graph
Hinkel Implicit incremental model analyses and transformations
CN109976805B (en) Event-driven architecture mode identification method based on ontology
Steffen et al. Active automata learning: from DFAs to interface programs and beyond
Deutch et al. A structural/temporal query language for business processes
Lochmann et al. An integrated view on modeling with multiple domain-specific languages
Lezoche et al. Conceptualisation approach for cooperative information systems interoperability
CN115237469A (en) Multi-mode architecture reverse analysis method based on cloud service source code
US20200394529A1 (en) Knowledge engineering and reasoning on a knowledge graph
Hainaut et al. The nature of data reverse engineering
Agt et al. Metamodeling foundation for software and data integration
Haav A comparative study of approaches of ontology driven software development
Agt et al. Semantic Annotation and Conflict Analysis for Information System Integration
Rashid et al. Relational database support for aspect-oriented programming
Ivkovic et al. Using formal concept analysis to establish model dependencies
Pop et al. Semantic data factory: A framework for using domain knowledge in software application development
Zhang et al. Process Discovery for Structured Program Synthesis

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