CN111797090B - Description information storage method, description information access method and device - Google Patents

Description information storage method, description information access method and device Download PDF

Info

Publication number
CN111797090B
CN111797090B CN201910872487.5A CN201910872487A CN111797090B CN 111797090 B CN111797090 B CN 111797090B CN 201910872487 A CN201910872487 A CN 201910872487A CN 111797090 B CN111797090 B CN 111797090B
Authority
CN
China
Prior art keywords
description
class
index
container
target class
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
CN201910872487.5A
Other languages
Chinese (zh)
Other versions
CN111797090A (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.)
Xiamen Yaji Software Co Ltd
Original Assignee
Xiamen Yaji Software Co Ltd
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 Xiamen Yaji Software Co Ltd filed Critical Xiamen Yaji Software Co Ltd
Priority to CN201910872487.5A priority Critical patent/CN111797090B/en
Publication of CN111797090A publication Critical patent/CN111797090A/en
Application granted granted Critical
Publication of CN111797090B publication Critical patent/CN111797090B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2272Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/256Integrating or interfacing systems involving database management systems in federated or virtual databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation

Abstract

The embodiment of the application provides a storage method of description information, an access method of description information and a device, and relates to the technical field of information processing. The storage method of the description information comprises the following steps: receiving description information of a target class, and querying a first index of the target class; the first index is used for associating the target class and a first description container for storing the description information; if the first index is not inquired, acquiring a second description container of a parent class of the target class; creating the first description container according to the second description container and creating the first index; storing the description information in the first description container such that the description information is accessed through the first index. The embodiment of the application can effectively improve the access efficiency of the description information.

Description

Description information storage method, description information access method and device
Technical Field
The present application relates to the field of information processing technologies, and in particular, to a method for storing description information, a method for accessing description information, and an apparatus for accessing description information.
Background
During the development of a program or a program framework, some description information needs to be added to a class, for example, a property list of the class, a function, a feature of each property, or additional debugging information, an interface description related to an execution environment, and the like, which are in a large amount and generally need to be bound with classes of different levels. Because there is an inheritance relationship between classes, the description information itself also needs to be able to be searched according to the corresponding inheritance relationship.
Generally, when information description is performed on a class, description information is directly added to attribute information of the class, when the description information is accessed, the attribute information of the class with an inheritance relationship needs to be traversed, and when the data volume of the attribute information of the class is large or the inheritance relationship is complex, the attribute information of the class with the inheritance relationship is traversed to obtain the description information, so that low access efficiency is caused.
Content of application
The object of the present application is to solve at least one of the technical drawbacks mentioned above, in particular the inefficient access to the descriptive information.
In a first aspect, a method for storing description information is provided, where the method includes:
receiving description information of a target class, and querying a first index of the target class; the first index is used for associating the target class and a first description container for storing description information;
if the first index is not inquired, acquiring a second description container of a parent class of the target class;
creating a first description container according to the second description container, and creating a first index;
the description information is stored in a first description container such that the description information is accessed through a first index.
In an optional embodiment of the first aspect, the method of storing description information further comprises:
and if the first index is obtained through query, acquiring a first description container according to the first index, and executing a step of storing the description information in the first description container so as to enable the description information to be accessed through the first index.
In an optional embodiment of the first aspect, the step of obtaining a second description container of a parent class of the target class comprises:
acquiring a parent class of the target class, and inquiring a second index of the parent class of the target class; the second index is used for associating a parent class of the target class and the second description container;
and if the second index is obtained through query, obtaining a second description container according to the second index.
In an optional embodiment of the first aspect, the step of obtaining a second description container of a parent class of the target class comprises:
acquiring a parent class of the target class, and inquiring a second index of the parent class of the target class; the second index is used for associating a parent class of the target class and the second description container;
if the second index is not inquired, inquiring the parent class of the target class;
if the parent class of the target class is not inquired, a second description container is created, and a second index is established; the second description container of the parent class of the target class is used for storing description information of the parent class of the target class.
In an optional embodiment of the first aspect, the step of obtaining a second description container of a parent class of the target class comprises:
acquiring a parent class of the target class, and inquiring a second index of the parent class of the target class; the second index is used for associating a parent class of the target class and the second description container;
if the second index is not inquired, inquiring the parent class of the target class;
if the query obtains the parent class of the target class, taking the parent class of the target class as the current parent class of the target class, and executing the step of obtaining the second description container of the parent class of the target class until the current second description container of the parent class of the current target class is established or obtained;
and acquiring a second description container of the parent class of the target class according to the current second description container.
In an alternative embodiment of the first aspect, the step of creating the first description container from the second description container comprises:
creating a first description container, and setting a prototype chain of the first description container by adopting an object of JavaScript based on a second description container, so that the first description container inherits the second description container.
In an optional embodiment of the first aspect, the step of creating the first index comprises:
and acquiring the attribute name of the first description container, and creating a first index according to the name of the target class, the name of the first description container and the attribute name of the first description container.
In a second aspect, there is provided a method for accessing description information stored according to a method for storing description information, comprising:
receiving an access instruction of the description information of the target class, and inquiring a first index of the target class; the first index is used for associating the target class and a first description container for storing description information;
and acquiring a first description container according to the first index, and accessing the description information of the target class from the first description container.
In a third aspect, there is provided an apparatus for storing description information, the apparatus comprising:
the query module is used for receiving the description information of the target class and querying a first index of the target class; the first index is used for associating the target class and a first description container for storing description information;
the creating module is used for acquiring a second description container of a parent class of the target class if the first index is not inquired; creating a first description container according to the second description container, and creating a first index;
and the storage module is used for storing the description information in the first description container so that the description information is accessed through the first index.
In an alternative embodiment of the third aspect, the means for storing the description information further comprises:
and the obtaining module is used for obtaining the first description container according to the first index if the first index is obtained through query, and executing the step of storing the description information in the first description container so as to enable the description information to be accessed through the first index.
In an optional embodiment of the third aspect, when obtaining the second description container of the parent class of the target class, the creating module is specifically configured to:
acquiring a parent class of the target class, and inquiring a second index of the parent class of the target class; the second index is used for associating the parent class of the target class and the second description container;
and if the second index is obtained through query, obtaining a second description container according to the second index.
In an optional embodiment of the third aspect, when obtaining the second description container of the parent class of the target class, the creating module is specifically configured to:
acquiring a parent class of the target class, and inquiring a second index of the parent class of the target class; the second index is used for associating the parent class of the target class and the second description container;
if the second index is not inquired, inquiring the parent class of the target class;
if the parent class of the target class is not inquired, a second description container is created, and a second index is established; the second description container of the parent class of the target class is used for storing description information of the parent class of the target class.
In an optional embodiment of the third aspect, when obtaining the second description container of the parent class of the target class, the creating module is specifically configured to:
acquiring a parent class of the target class, and inquiring a second index of the parent class of the target class; the second index is used for associating a parent class of the target class and the second description container;
if the second index is not inquired, inquiring the parent class of the target class;
if the query obtains the parent class of the target class, taking the parent class of the target class as the parent class of the current target class, and executing the step of obtaining the second description container of the parent class of the target class until the current second description container of the parent class of the current target class is established or obtained;
and acquiring the second description container of the parent class of the target class according to the current second description container.
In an optional embodiment of the third aspect, the creating module, when creating the first description container according to the second description container, is specifically configured to:
and creating a first description container, and setting a prototype chain of the first description container by adopting object objects of JavaScript based on a second description container, so that the first description container inherits the second description container.
In an optional embodiment of the third aspect, the creating module, when creating the first index, is specifically configured to:
and acquiring the attribute name of the first description container, and creating a first index according to the name of the target class, the name of the first description container and the attribute name of the first description container.
In a fourth aspect, there is provided a description information accessing apparatus for accessing description information stored according to the above description information storing method, including:
the receiving module is used for receiving an access instruction of the description information of the target class and inquiring a first index of the target class; the first index is used for associating the target class and a first description container for storing description information;
and the access module is used for acquiring the first description container according to the first index and accessing the description information of the target class from the first description container.
In a fifth aspect, an electronic device is provided, which includes:
one or more processors;
a memory;
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: the storage method for realizing the description information shown in the first aspect of the present application is executed.
In a sixth aspect, a computer-readable storage medium is provided, on which a computer program is stored, wherein the program is executed by a processor to implement the method for storing description information shown in the first aspect of the present application.
The technical scheme provided by the application brings the beneficial effects that:
in the scheme of the embodiment of the disclosure, the description information of the target class is stored in the first description container of the target class, the first description container is obtained from the second description container of the parent class of the target class based on the logical inheritance relationship of the class, the first description container is associated with the target class by using the first index, and the description information can be searched according to the corresponding inheritance relationship only by using the first index of the target class, so that the access efficiency can be effectively improved.
Further, the description information of the target class is stored in the first description container, the first description container and the target class are associated by using the first index, and when the description information of the target class is changed, the description information of the subclass having an inheritance relationship with the target class is changed, so that the description information can be changed along with the inheritance relationship.
Additional aspects and advantages of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments of the present application will be briefly described below.
Fig. 1 is a schematic flowchart illustrating a method for storing description information according to an embodiment of the present application;
fig. 2 is a schematic flowchart illustrating a method for storing description information according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a method for storing description information according to an embodiment of the present application;
fig. 4 is a flowchart illustrating a method for storing description information in an example provided by an embodiment of the present application;
fig. 5 is a schematic flowchart illustrating a method for accessing description information according to an embodiment of the present application;
FIG. 6 is a schematic structural diagram of an apparatus for storing description information according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of an apparatus for accessing description information according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device for describing storage of information according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to the embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
To make the objects, technical solutions and advantages of the present application more clear, the following detailed description of the embodiments of the present application will be made with reference to the accompanying drawings.
The description information storage method, device, electronic device and computer-readable storage medium provided by the present application aim to solve the above technical problems in the prior art.
The following describes the technical solution of the present application and how to solve the above technical problems in detail by specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
The embodiment of the application provides a method for storing description information, and as shown in fig. 1, the method includes:
step S101, receiving description information of a target class, and inquiring a first index of the target class; the first index is used to associate the target class with a first description container for storing description information.
In this step, the first description container is an individual description information object set separately from the attribute of the target class itself, and is associated with the target class by the first index.
In a specific implementation process, when the description information of the target class is received, it is queried whether a first index is established in the target class, where the first index is generated when the first description container is created, for example, the first index may be generated by directly adding an attribute to the class, or may be generated in other manners, and a manner of specifically generating the first index is not limited herein.
Step S102, if the first index is not inquired, a second description container of a parent class of the target class is obtained; a first description container is created from the second description container, and a first index is created.
In this step, the second description container of the parent class of the target class is an independent description information object set separately from the attribute of the parent class itself of the target class, and is associated with the parent class of the target class through the second index.
If the parent class of the target class is provided with a second description container, namely the parent class of the target class is provided with a second index, the second description container can be directly obtained according to the second index; if the second index is not set in the parent class of the target class, that is, the description information of the parent class of the target class is not stored in the second description container, it is required to query whether the parent class of the target class has the third description container, and then generate the second description container of the parent class of the target class according to the third description container of the parent class of the target class, where a specific process of acquiring the second description container will be described in detail below.
In a specific implementation process, an inheritance relationship exists between the target class and a parent class of the target class, so that a corresponding inheritance relationship exists between the first description container and the second description container, the first description container is created according to the second description container, the second description container is used for storing description information of the parent class of the target class, the first description container is used for storing the description information of the target class, and when the description information of the parent class of the target class is changed, the description information of the corresponding target class can be correspondingly changed along with the inheritance relationship.
In step S103, the description information is stored in the first description container so that the description information is accessed through the first index.
Specifically, when the description information is accessed, the first description container is accessed through the first index, and then the description information in the first description container is acquired.
In a specific implementation process, a specific way of storing the description information in the first description container may be to directly assign a value to a JavaScript attribute.
For example, if the description information is named "field1" and has a value "true" and the description container is oa, the code "oa, field1 true" or "oa [" field1 "]true" is assigned.
It should be noted that, in the above possible embodiment, the description information is received, and the description information is stored in the first description container; in other possible embodiments, before receiving the new description information, the target class may already store the initial description information in other manners, and when receiving the new description information, the initial description information may be stored in the first description container in a replacement manner, and then the new description information is added to the first description container, or the initial description container is changed according to the new description information; in another possible embodiment, a change instruction of the storage method of the description information may be received, and when the change instruction of the storage method is received, the initial description information may be stored in the first description container in a manner of replacing the storage method.
In the above possible embodiment, the description is made for the case that the target class has a parent class, and if the target class does not have a parent class, the first description container is directly created, and the first index is created; the description information is stored in a first description container such that the description information is accessed through a first index.
In the above embodiment, the description information of the target class is stored in the first description container of the target class, the first description container is obtained from the second description container of the parent class of the target class based on the logical inheritance relationship of the class, and then the first description container is associated with the target class by using the first index, so that the description information can be searched according to the corresponding inheritance relationship only by using the first index of the target class, and the access efficiency can be effectively improved.
In the embodiment of the present application, a possible implementation manner is provided, and as shown in fig. 2, the method for storing the description information may further include:
step S104, if the first index is obtained through query, a first description container is obtained according to the first index, and the step of storing the description information in the first description container is executed so that the description information is accessed through the first index.
Specifically, the first index is generated when the first description container is created, if the first index is obtained by querying, the first description container is already created, the description information is stored in the first description container, and when the description information is accessed, the first description container is obtained through the first index, and then the description information is read from the first description container.
The parent class of the target class may or may not have a parent class, and the parent class of the target class may or may not have created the second description container, and the following will describe in detail the process of obtaining the second description container of the parent class of the target class in the above different cases with reference to the drawings.
In the embodiment of the present application, a possible implementation manner is provided, and the step of obtaining the second description container of the parent class of the target class in step S102 may include:
(1) acquiring a parent class of the target class, and inquiring a second index of the parent class of the target class; the second index is used for associating the parent class of the target class and the second description container;
(2) and if the second index is obtained through query, obtaining a second description container according to the second index.
Specifically, whether the second description container and the second index have been created by the parent class of the target class is judged, if the second description container and the second index have been created by the parent class of the target class, that is, the description information of the parent class of the target class is stored in the second description container and can be accessed through the second index, and the first description container can be created based on the second description container according to the inheritance relationship.
A possible implementation manner is provided in this embodiment of the application, and the step of obtaining the second description container of the parent class of the target class in step S102 may further include:
(3) if the second index is not inquired, inquiring the parent class of the target class;
(4) if the parent class of the target class is not inquired, a second description container is created, and a second index is established; the second description container of the parent class of the target class is used for storing description information of the parent class of the target class.
Specifically, if the second index does not exist in the parent class of the target class, whether the parent class exists in the parent class of the target class is judged; if the parent class of the target class does not have the parent class, directly creating a second description container and creating a second index, wherein the parent class of the target class may have description information stored in other forms, and the description information of the parent class of the target class may be stored in the second description container when the second description container is created.
In the embodiment of the present application, a possible implementation manner is provided, and the step of obtaining the second description container of the parent class of the target class in step S102 may further include:
(5) if the query obtains the parent class of the target class, taking the parent class of the target class as the parent class of the current target class, and executing the step of obtaining the second description container of the parent class of the target class until the second description container of the parent class of the current target class is established or obtained;
(6) and acquiring a second description container of the parent class of the target class according to the current second description container.
Specifically, if the parent of the target class is obtained through query, the parent of the target class is used as the current parent of the target class, and a step of obtaining a second description container of the parent of the target class is executed, namely, the parent of the target class is circularly operated until the current second description container of the parent of the current target class is obtained; the parent class of the current target class refers to a class having an inheritance relationship with the parent class of the target class.
In a specific implementation process, a specific process of obtaining the second description container of the parent class of the target class according to the current second description container is as follows: and sequentially obtaining the description containers of all subclasses of the parent class of the current target class according to the inheritance relationship until obtaining a second description container of the parent class of the target class.
Taking the example shown in fig. 3, the target class is a, and the corresponding first description container is a; the parent class of the target class is B, and the corresponding second description container is B; the parent class of the target class is C, and the corresponding third description container is C; the parent of C is D, and the corresponding fourth description container is D.
When the description information of the target class A is received, whether a first index is established in the A is inquired, and if the first index is not established in the target class A, whether a second index is established in a parent class B of the A is inquired; if the second index is not established in the parent class B, inquiring whether the parent class B has a parent class C, if the parent class C is inquired, taking the parent class C as the current parent class B, namely, repeating the operation on the parent class B on the parent class C: querying whether the current parent class B has the current second index, wherein the current parent class B is a parent class C, the current second index is a third index, and querying whether the current second index of the current parent class B is the third index; until a current second index of a parent class of a certain current target class having an inheritance relationship with a parent class B is inquired, obtaining a current second description container, or until the parent class of the certain current target class having the inheritance relationship with the parent class B is inquired without the parent class, directly creating the current second description container of the parent class of the current target class; that is, the fourth index of class D in fig. 3 is queried or the fourth description container D of class D is directly created, and the description containers of the respective subclasses of the parent class of the current object class are sequentially obtained according to the inheritance relationship, as shown in fig. 3, if class D is the parent class of the current object class, the respective subclasses of the parent class of the current object class are class C, class B, and class a, and the description containers of the respective subclasses of the parent class of the current object class are respectively corresponding to the third description container C, the second description container B, and the first description container a, and the description containers of the respective subclasses are sequentially obtained until the second description container of the parent class of the object class is obtained, that is, the third description container C is obtained according to the fourth description container D until the second description container B of the parent class B of the object class a is obtained according to the third description container C.
If the first index of the target class A needs to be obtained, a corresponding second index and a second description container B need to be established by a parent class B of the target class, so that the first description container a can inherit the second description container B; and the second description container B of the parent class B of the target class is established, and the third description container C needs to be established by the node C, so that the second description container B can inherit the third description container C, and by analogy, the first index and the first description container are established, and all the parent classes of the target class need to establish the corresponding description containers and the corresponding indexes.
If the first index is established, it indicates that all parent classes of the target class have already established corresponding indexes and corresponding description containers, that is, if a has already established the first index and the first description container a, B, C and D have already established corresponding description containers and corresponding indexes.
The above embodiment illustrates a specific process of obtaining the second description container of the parent class of the target class in different situations, and a specific process of creating the first description container and the first index will be described below.
In the embodiment of the present application, a possible implementation manner is provided, and the creating the first description container according to the second description container in step S102 may include:
and creating a first description container, and setting a prototype chain of the first description container by adopting object objects of JavaScript based on a second description container, so that the first description container inherits the second description container.
In a specific implementation process, the description container may be implemented by an Object of ordinary JavaScript, and assuming that the parent description container is b, a method of creating the description container a is generally as follows: create (b) "is object. The method sets the prototype chain of a while creating a, achieves the effect that a inherits b, and can realize information synchronization. In addition, JavaScript also has a variety of object creation methods, and also has a variety of inheritance ways, which are not limited herein.
A possible implementation manner is provided in this embodiment of the application, and the creating of the first index in step S102 may include:
and acquiring the attribute name of the first description container, and creating a first index according to the name of the target class, the name of the first description container and the attribute name of the first description container.
Specifically, the first index may be created by directly adding an attribute to the target class; for example, there is class a, describing container oa, and the attribute name is "__ attr __", and then the corresponding JavaScript code is "a. __ attr __ ═ oa", and in addition, the creation of the first index may also be implemented by other ways, such as a global module and a global container, and is not limited herein.
According to the storage method of the description information, the description information of the target class is stored in the first description container of the target class, the first description container is obtained from the second description container of the parent class of the target class based on the logical inheritance relationship of the classes, the first description container is associated with the target class by adopting the first index, the description information can be searched according to the corresponding inheritance relationship only through the first index of the target class, and the access efficiency can be effectively improved.
Further, the description information of the target class is stored in a first description container, the first description container is associated with the target class by using a first index, and when the description information of the target class is changed, the description information of a subclass having an inheritance relationship with the target class is changed accordingly, so that the description information can be changed along with the inheritance relationship.
In order to better understand the above description information storage method, as shown in fig. 4, an example of the description information storage method of the present application is set forth in detail below:
step S401, receiving description information of a target class;
step S402, inquiring whether a first index exists in the target class; if yes, go to step S403, otherwise go to step S404;
step S403, acquiring a first description container according to the first index; and executing step S410;
step S404, inquiring whether a second index exists in the parent class of the target class; if yes, go to step S405; if not, go to step S406;
step S405, acquiring a second description container according to a second index; executing the step S409;
step S406, inquiring whether the parent class of the target class exists; if yes, go to step S407; if not, go to step S408;
step 407, taking the parent class of the target class as the parent class of the current target class, and executing step 404; until establishing or acquiring a current second description container of the parent class of the current target class; acquiring a second description container according to the current second description container;
step S408, a second description container is created, and a second index is established;
step S409, creating a first description container according to the second description container and creating a first index;
in step S410, the description information is stored in the first description container.
In the above example, when the description information of the target class is received, whether the first index exists in the target class is determined, if yes, the first description container is obtained according to the first index, and the description information is stored in the first description container; if not, judging whether a second index exists in the parent class of the target class, if so, acquiring a second description container according to the second index, creating a first description container according to the second description container, creating a first index, and storing description information in the first description container; if the first description container does not exist, the parent class of the target class is used as the parent class of the current target class, the step of inquiring whether the parent class of the target class has the second index is executed until the second description container of the parent class of the current target class is established or obtained, then the second description container of the parent class of the target class is obtained according to the current second description container, the description information can be searched according to the corresponding inheritance relationship only through the first index of the target class, the access efficiency can be effectively improved, in addition, when the description information of the target class is changed, the description information of the subclass having the inheritance relationship with the target class is changed along with the change of the description information, and the description information can be changed along with the inheritance relationship.
An embodiment of the present application provides a method for accessing description information, which is used for accessing the description information stored by the method for storing description information according to the foregoing embodiment, and as shown in fig. 5, the method includes:
step S501, receiving an access instruction of description information of a target class, and querying a first index of the target class; the first index is used to associate the target class with a first description container for storing description information.
In this step, the first description container is an individual description information object set separately from the attribute of the target class itself, and is associated with the target class by the first index.
In a specific implementation process, when an access instruction to description information of a target class is received, whether a first index is established in the target class is queried, where the first index is generated when a first description container is created, for example, the first index may be generated in a manner of directly adding an attribute to the class, or may be generated in other manners, and a manner of specifically generating the first index is not limited herein.
Step S502, acquiring a first description container according to the first index, and accessing description information of the target class from the first description container.
And if the first index is obtained by inquiry, the first description container is already established, and when the description information is accessed, the first description container is obtained through the first index, and then the description information is read from the first description container.
According to the method for accessing the description information, when an access instruction for the description information of the target class is received, the first description container for storing the description information of the target class can be obtained directly through the first index of the target class, so that the description information in the first description container is accessed, and the access efficiency can be effectively improved.
The embodiment of the present application provides a storage device for description information, and as shown in fig. 6, the storage device 60 for description information may include: a query module 601, a creation module 602, and a storage module 603, wherein,
the query module 601 is configured to receive description information of a target class and query a first index of the target class; the first index is used for associating the target class and a first description container for storing description information;
a creating module 602, configured to obtain a second description container of a parent class of the target class if the first index is not queried; creating a first description container according to the second description container, and creating a first index;
a storage module 603, configured to store the description information in the first description container, so that the description information is accessed through the first index.
In the embodiment of the present application, a possible implementation manner is provided, and the storage device 60 for description information further includes:
and the obtaining module is used for obtaining the first description container according to the first index if the first index is obtained through query, and executing the step of storing the description information in the first description container so as to enable the description information to be accessed through the first index.
In an embodiment of the present application, a possible implementation manner is provided, and when obtaining the second description container of the parent class of the target class, the creating module 602 is specifically configured to:
acquiring a parent class of the target class, and inquiring a second index of the parent class of the target class; the second index is used for associating a parent class of the target class and the second description container;
and if the second index is obtained through query, obtaining a second description container according to the second index.
In the embodiment of the present application, a possible implementation manner is provided, and when the creating module 602 acquires the second description container of the parent class of the target class, the creating module is specifically configured to:
acquiring a parent class of the target class, and inquiring a second index of the parent class of the target class; the second index is used for associating a parent class of the target class and the second description container;
if the second index is not inquired, inquiring the parent class of the target class;
if the parent class of the target class is not inquired, a second description container is created, and a second index is established; the second description container of the parent class of the target class is used for storing description information of the parent class of the target class.
In an embodiment of the present application, a possible implementation manner is provided, and when obtaining the second description container of the parent class of the target class, the creating module 602 is specifically configured to:
acquiring a parent class of the target class, and inquiring a second index of the parent class of the target class; the second index is used for associating a parent class of the target class and the second description container;
if the second index is not inquired, inquiring the parent class of the target class;
and if the query obtains the parent class of the target class, taking the parent class of the target class as the current parent class of the target class, and executing the step of obtaining the second description container of the parent class of the target class.
In the embodiment of the present application, a possible implementation manner is provided, and when creating the first description container according to the second description container, the creating module 602 is specifically configured to:
creating a first description container, and setting a prototype chain of the first description container by adopting an object of JavaScript based on a second description container, so that the first description container inherits the second description container.
A possible implementation manner is provided in this embodiment of the present application, and when creating the first index, the creating module 602 is specifically configured to:
and acquiring the attribute name of the first description container, and creating a first index according to the name of the target class, the name of the first description container and the attribute name of the first description container.
According to the storage device for the description information, the description information of the target class is stored in the first description container of the target class, the first description container is obtained from the second description container of the parent class of the target class based on the logical inheritance relationship of the class, the first description container is associated with the target class by adopting the first index, the description information can be searched according to the corresponding inheritance relationship only through the first index of the target class, and the access efficiency can be effectively improved.
The embodiment of the present application provides a device for storing description information, which is used for accessing the description information stored in the method for storing description information of the above embodiment, as shown in fig. 7, and includes a receiving module 701 and an accessing module 702, where:
a receiving module 701, configured to receive an access instruction for describing information of a target class, and query a first index of the target class; the first index is used for associating the target class and a first description container for storing the description information;
an accessing module 702, configured to obtain the first description container according to the first index, and access the description information of the target class from the first description container.
When receiving an access instruction for the description information of the target class, the above description information access device may obtain the first description container for storing the description information of the target class directly through the first index of the target class, so as to access the description information in the first description container, thereby effectively improving access efficiency.
The storage device for picture description information in the embodiments of the present disclosure may execute the storage method for picture description information provided in the embodiments of the present disclosure, and the implementation principle is similar, the actions performed by each module in the storage device for picture description information in the embodiments of the present disclosure correspond to the steps in the storage method for picture description information in the embodiments of the present disclosure, and for the detailed function description of each module in the storage device for picture description information, reference may be specifically made to the description in the storage method for corresponding picture description information shown in the foregoing, and details are not repeated here.
Based on the same principle as the method shown in the embodiments of the present disclosure, embodiments of the present disclosure also provide an electronic device, which may include but is not limited to: a processor and a memory; a memory for storing computer operating instructions; and the processor is used for executing the method shown in the embodiment by calling the computer operation instruction. Compared with the prior art, the electronic equipment can effectively improve the access efficiency of the description information.
In an alternative embodiment, an electronic device is provided, as shown in fig. 8, an electronic device 4000 shown in fig. 8 comprising: a processor 4001 and a memory 4003. Processor 4001 is coupled to memory 4003, such as via bus 4002. Optionally, the electronic device 4000 may further comprise a transceiver 4004. It should be noted that the transceiver 4004 is not limited to one in practical applications, and the structure of the electronic device 4000 is not limited to the embodiment of the present application.
The Processor 4001 may be a CPU (Central Processing Unit), a general-purpose Processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other Programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or execute the various illustrative logical blocks, modules, and circuits described in connection with the disclosure herein. The processor 4001 may also be a combination that performs a computational function, including, for example, a combination of one or more microprocessors, a combination of a DSP and a microprocessor, or the like.
Bus 4002 may include a path that carries information between the aforementioned components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus 4002 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 8, but that does not indicate only one bus or one type of bus.
The Memory 4003 may be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical Disc storage, optical Disc storage (including Compact Disc, laser Disc, optical Disc, digital versatile Disc, blu-ray Disc, etc.), a magnetic Disc storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto.
The memory 4003 is used for storing application codes for implementing the present scheme, and execution is controlled by the processor 4001. Processor 4001 is configured to execute application code stored in memory 4003 to implement what is shown in the foregoing method embodiments.
Wherein, the electronic device includes but is not limited to: mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
The present application provides a computer-readable storage medium, on which a computer program is stored, which, when running on a computer, enables the computer to execute the corresponding content in the foregoing method embodiments. Compared with the prior art, the computer-readable storage medium provided by the application can effectively improve the access efficiency of the description information.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of execution is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may be separate and not incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above embodiments.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a definition of the unit itself, for example, the query module may also be described as a "module that queries the first index of the target class".
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other combinations of features described above or equivalents thereof without departing from the spirit of the disclosure. For example, the above features and the technical features disclosed in the present disclosure (but not limited to) having similar functions are replaced with each other to form the technical solution.

Claims (12)

1. A method for storing description information, comprising:
receiving description information of a target class, and querying a first index of the target class; the first index is used for associating the target class and a first description container for storing the description information;
if the first index is not inquired, acquiring a second description container of a parent class of the target class;
creating the first description container, setting a prototype chain of the first description container based on the second description container, enabling the first description container to inherit the second description container, and creating the first index;
storing the description information in the first description container such that the description information is accessed through the first index.
2. The method for storing the description information according to claim 1, further comprising:
if the first index is obtained through query, the first description container is obtained according to the first index, and the step of storing the description information in the first description container is executed so that the description information is accessed through the first index.
3. The method according to claim 1, wherein the step of obtaining the second description container of the parent class of the target class includes:
acquiring a parent class of the target class, and inquiring a second index of the parent class of the target class; the second index is used for associating a parent class of the target class and the second description container;
and if the second index is obtained through query, obtaining the second description container according to the second index.
4. The method according to claim 1, wherein the step of obtaining the second description container of the parent class of the target class includes:
acquiring a parent class of the target class, and inquiring a second index of the parent class of the target class; the second index is used for associating a parent class of the target class and the second description container;
if the second index is not inquired, inquiring the parent class of the target class;
if the parent class of the target class is not inquired, creating the second description container and establishing the second index; the second description container of the parent class of the target class is used for storing description information of the parent class of the target class.
5. The method for storing description information according to claim 1, wherein the step of obtaining the second description container of the parent class of the target class includes:
acquiring a parent class of the target class, and inquiring a second index of the parent class of the target class; the second index is used for associating a parent class of the target class and the second description container;
if the second index is not inquired, inquiring the parent class of the target class;
if the query obtains the parent class of the target class, taking the parent class of the target class as the parent class of the current target class, and executing the step of obtaining the second description container of the parent class of the target class until the current second description container of the parent class of the current target class is established or obtained;
and acquiring the second description container of the parent class of the target class according to the current second description container.
6. The method for storing description information according to claim 1, wherein the setting a prototype chain of the first description container based on the second description container includes:
and setting a prototype chain of the first description container by adopting object objects of JavaScript based on the second description container.
7. The method for storing description information according to claim 1, wherein the step of creating the first index includes:
and acquiring the attribute name of the first description container, and creating the first index according to the name of the target class, the name of the first description container and the attribute name of the first description container.
8. A method for accessing description information, comprising:
receiving an access instruction of description information of a target class, and inquiring a first index of the target class; the first index is used for associating the target class and a first description container for storing the description information;
acquiring the first description container according to the first index, and accessing the description information of the target class from the first description container; wherein the first index and the first description container are created based on:
acquiring a second description container of a parent class of the target class;
creating the first description container, setting a prototype chain of the first description container based on the second description container, enabling the first description container to inherit the second description container, and creating the first index.
9. An apparatus for storing description information, comprising:
the query module is used for receiving description information of a target class and querying a first index of the target class based on the description information; the first index is used for associating the target class and a first description container for storing the description information;
the creating module is used for acquiring a second description container of the parent class of the target class if the first index is not inquired; creating the first description container, setting a prototype chain of the first description container based on the second description container, enabling the first description container to inherit the second description container, and creating the first index;
a storage module to store the description information in the first description container such that the description information is accessed through the first index.
10. An apparatus for accessing description information, comprising:
the receiving module is used for receiving an access instruction of the description information of the target class and inquiring a first index of the target class; the first index is used for associating the target class and a first description container for storing the description information;
the access module is used for acquiring the first description container according to the first index and accessing the description information of the target class from the first description container; wherein the first index and the first description container are created based on:
acquiring a second description container of a parent class of the target class;
creating the first description container, setting a prototype chain of the first description container based on the second description container, enabling the first description container to inherit the second description container, and creating the first index.
11. An electronic device, comprising:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: executing the method of storing description information according to any one of claims 1 to 7 or the method of accessing description information according to claim 8.
12. A computer-readable storage medium on which a computer program is stored, characterized in that the program, when executed by a processor, implements the method of storing description information according to any one of claims 1 to 7 or the method of accessing description information according to claim 8.
CN201910872487.5A 2019-09-16 2019-09-16 Description information storage method, description information access method and device Active CN111797090B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910872487.5A CN111797090B (en) 2019-09-16 2019-09-16 Description information storage method, description information access method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910872487.5A CN111797090B (en) 2019-09-16 2019-09-16 Description information storage method, description information access method and device

Publications (2)

Publication Number Publication Date
CN111797090A CN111797090A (en) 2020-10-20
CN111797090B true CN111797090B (en) 2022-07-22

Family

ID=72805443

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910872487.5A Active CN111797090B (en) 2019-09-16 2019-09-16 Description information storage method, description information access method and device

Country Status (1)

Country Link
CN (1) CN111797090B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5511199A (en) * 1991-01-18 1996-04-23 International Business Machines Corporation Object oriented programming system for cooperative processing between objects in different languages by means of object descriptions and message format mappings between the different languages based on the object descriptions
CN1518702A (en) * 2001-05-04 2004-08-04 �Ҵ���˾ Web page annotation systems
CN102693174A (en) * 2012-06-06 2012-09-26 武汉大学 Object broker database constraint-oriented backup method
CN104991707A (en) * 2015-07-20 2015-10-21 青岛海信移动通信技术股份有限公司 User interface displaying method and device
CN109739526A (en) * 2017-10-30 2019-05-10 北京京东尚科信息技术有限公司 Code update method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5511199A (en) * 1991-01-18 1996-04-23 International Business Machines Corporation Object oriented programming system for cooperative processing between objects in different languages by means of object descriptions and message format mappings between the different languages based on the object descriptions
CN1518702A (en) * 2001-05-04 2004-08-04 �Ҵ���˾ Web page annotation systems
CN102693174A (en) * 2012-06-06 2012-09-26 武汉大学 Object broker database constraint-oriented backup method
CN104991707A (en) * 2015-07-20 2015-10-21 青岛海信移动通信技术股份有限公司 User interface displaying method and device
CN109739526A (en) * 2017-10-30 2019-05-10 北京京东尚科信息技术有限公司 Code update method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
面向对象XML数据索引技术;张晓琳等;《东北大学学报(自然科学版)》;20050915(第09期);全文 *

Also Published As

Publication number Publication date
CN111797090A (en) 2020-10-20

Similar Documents

Publication Publication Date Title
CN108345511B (en) Application data checking method and device and electronic equipment
CN112115153A (en) Data processing method, device, equipment and storage medium
CN113641873B (en) Data processing method and device, electronic equipment and readable storage medium
US9069807B2 (en) Method and system for implementing an array using different data structures
CN110020333A (en) Data analysing method and device, electronic equipment, storage medium
CN112506681B (en) Parameter calling method and device, electronic equipment and storage medium
CN106156050B (en) Data processing method and device
CN109614089B (en) Automatic generation method, device, equipment and storage medium of data access code
CN111324258B (en) Method, device, equipment and medium for generating contents of configuration items of multilevel pull-down menu
CN111797090B (en) Description information storage method, description information access method and device
CN110704099A (en) Alliance chain construction method and device and electronic equipment
CN110765238A (en) Data encryption query method and device
CN111241137A (en) Data processing method and device, electronic equipment and storage medium
CN116069725A (en) File migration method, device, apparatus, medium and program product
CN113849524B (en) Data processing method and device
CN111414152B (en) Method, system, readable medium and electronic device for realizing business logic
CN111796865B (en) Byte code file modification method, device, terminal equipment and medium
CN114629951A (en) Address service switching method and device, computer equipment and storage medium
CN111813407B (en) Game development method, game running device and electronic equipment
CN113760237A (en) Compiling address updating method and device, terminal equipment and readable storage medium
CN111753238A (en) Data mapping method and device and electronic equipment
CN112907198A (en) Service state circulation maintenance method and device and electronic equipment
CN117041980B (en) Network element management method and device, storage medium and electronic equipment
CN113448550B (en) Method and device for realizing collection management of classes, electronic equipment and computer medium
CN116541421B (en) Address query information generation method and device, electronic equipment and computer medium

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