CN115203491A - Method and device for dynamically expanding attribute data and storage medium - Google Patents

Method and device for dynamically expanding attribute data and storage medium Download PDF

Info

Publication number
CN115203491A
CN115203491A CN202110378964.XA CN202110378964A CN115203491A CN 115203491 A CN115203491 A CN 115203491A CN 202110378964 A CN202110378964 A CN 202110378964A CN 115203491 A CN115203491 A CN 115203491A
Authority
CN
China
Prior art keywords
attribute
attribute data
data
target
template
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.)
Pending
Application number
CN202110378964.XA
Other languages
Chinese (zh)
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202110378964.XA priority Critical patent/CN115203491A/en
Publication of CN115203491A publication Critical patent/CN115203491A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/84Mapping; Conversion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Security & Cryptography (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A method, a device and a storage medium for dynamically expanding attribute data are provided, which can realize the dynamic expansion of complex types of attribute data. The method comprises the following steps: and acquiring attribute data to be dynamically expanded and a target attribute data template which corresponds to the attribute data and is subjected to flattening mapping processing. Further, the target attribute data is subjected to flattening mapping processing to obtain a second mapping relationship, for example, the second mapping relationship may be in a primary key value format. And then according to the configuration information or the verification rule of each attribute defined by the target attribute data template subjected to the flattened mapping processing, performing dynamic attribute verification processing on the value of each attribute of the attribute data subjected to the flattened mapping processing to obtain a dynamic attribute verification processing result of the attribute data. And further performing dynamic expansion on the target attribute data according to the dynamic attribute verification processing result of the target attribute data.

Description

Method and device for dynamically expanding attribute data and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, and a storage medium for dynamic expansion of attribute data.
Background
In some scenarios, attribute data of a user may be stored in a database according to a user attribute data template, and when the user attribute needs to be dynamically extended, the user attribute can only be extended in a Key-Value (Key-Value) manner, and some complex data types, for example, attributes of a reference type or an array type, cannot be extended.
Disclosure of Invention
The application provides a method, a device and a storage medium for dynamic expansion of attribute data, which can realize dynamic expansion of attribute data of complex data types.
In a first aspect, a method for dynamically expanding attribute data is provided, including:
acquiring target attribute data to be subjected to attribute dynamic expansion;
acquiring a target attribute data template corresponding to the target attribute data, wherein the target attribute data template is used for defining configuration information of each attribute of the attribute data, and the configuration information of each attribute comprises a key field included by each attribute and a use rule of a data type of each attribute;
performing flattening mapping processing on the target attribute data to obtain a first mapping relation, wherein the first mapping relation is a mapping relation between each attribute of the target attribute data and a value of each attribute;
performing dynamic attribute verification processing on the value of each attribute in the first mapping relation according to the configuration information of each attribute defined by the target attribute data template to obtain a verification processing result of the target attribute data;
and dynamically expanding the target attribute data according to the verification processing result of the target attribute data.
In some implementation manners, the performing, according to the configuration information of each attribute defined by the target attribute data template, a dynamic attribute check process on the value of each attribute in the first mapping relationship may include:
according to the configuration information of each attribute defined by the target attribute data template, performing dynamic attribute verification on the target attribute data subjected to the flattening mapping processing to obtain a verification result of the target attribute data;
and according to the configuration information of each attribute defined by the target attribute data template, performing dynamic attribute processing on the target attribute data subjected to the flattening mapping processing to obtain a processing result of the target attribute data.
In some implementations, the verification processing result of the target attribute data may include a verification result of the target attribute data and a processing result of the target attribute data.
In some implementation manners, when the verification result of the target attribute data is that verification passes, the dynamic attribute processing may be performed on the target attribute data subjected to the flattened mapping processing according to the configuration information of each attribute defined by the target attribute data template, so as to obtain a processing result of the target attribute data.
In some implementation manners, under the condition that the verification result of the actually-entered attribute data of the target attribute data is that the verification passes, the dynamic attribute processing is performed on the attribute data that is not entered of the target attribute data, so as to obtain the processing result of the target attribute data.
In some implementations, performing dynamic attribute processing on the unregistered attribute data of the target attribute data may include performing at least one of default value processing, mandatory item check processing, and attribute value null check processing on the unregistered attribute data of the target attribute data.
In some implementations, before performing the dynamic attribute check processing on the target attribute data, the method further includes: and preprocessing the input first attribute data to obtain target attribute data.
In some implementations, the pre-processing is performed on the entered first attribute data, including:
at least one of a data type check process, a regular expression check process, and a data value check process is performed on the first attribute data.
In some implementations, the method further includes:
and verifying the input first attribute data template to obtain a target attribute data template.
In some implementations, the checking the entered first attribute data template may include: and performing at least one of data format check processing and data type check processing on the first attribute data template.
In some implementations, the key fields of the attribute include at least one of:
attribute name, data type, regular expression, default value, attribute value, whether to fill in, whether to encrypt, whether to serve as search condition.
In a second aspect, an apparatus for dynamically expanding attribute data is provided, including:
the first acquisition module is used for acquiring target attribute data to be subjected to attribute dynamic expansion;
a second obtaining module, configured to obtain a target attribute data template corresponding to the target attribute data, where the target attribute data template is used to define configuration information of each attribute of the attribute data, and the configuration information of each attribute includes a key field included in each attribute and a usage rule of a data type of each attribute;
the flattening processing module is used for flattening mapping processing on the target attribute data to obtain a first mapping relation, wherein the first mapping relation is a mapping relation between each attribute of the target attribute data and a value of each attribute;
a verification processing module, configured to perform dynamic attribute verification processing on the value of each attribute in the first mapping relationship according to the configuration information of each attribute defined by the target attribute data template, to obtain a verification processing result of the target attribute data;
and the dynamic expansion module is used for dynamically expanding the target attribute data according to the verification processing result of the target attribute data.
In a third aspect, an apparatus for dynamically expanding attribute data is provided, including:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the above described method of dynamic extension of attribute data via execution of executable instructions.
In a fourth aspect, a storage medium is provided, in which a computer program is stored, which, when being executed by a processor, carries out the steps of the above-mentioned method for dynamic extension of attribute data.
Therefore, the attribute data of the embodiment of the application may be attribute data with a hierarchical relationship, and the attribute data template may support configuration of the attribute data with the hierarchical relationship, so as to meet an expansion requirement of complex type attribute data in some scenarios, and by performing flattening mapping processing on the attribute data, further performing dynamic attribute verification processing on the flattened attribute data based on the flattened attribute data template, on one hand, algorithm complexity of the attribute data dynamic verification processing may be reduced, and system performance may be improved, on the other hand, through the dynamic attribute verification processing algorithm, verification processing on basic type attribute data may be realized, and simultaneously, verification processing on complex type attribute data may also be realized, that is, through a unified algorithm, verification processing on different types of attribute data may be realized, therefore, when an attribute needs to be newly added, only a corresponding attribute data template needs to be modified, verification processing on the newly added attribute may be realized without modifying the verification processing algorithm, and dynamic expansion on the newly added attribute may be realized.
Drawings
Fig. 1 is a schematic diagram of an application scenario according to an embodiment of the present application.
Fig. 2 is a schematic flowchart of a method for dynamically expanding attribute data according to an embodiment of the present application.
FIG. 3 is a schematic flow chart diagram of performing format conversion on an attribute data template.
FIG. 4 is a schematic flow chart diagram of dynamic attribute verification of attribute data according to an attribute data template.
FIG. 5 is a schematic flow diagram of dynamic attribute processing of attribute data according to an attribute data template.
FIG. 6 is a schematic block diagram of a dynamic property template model according to an embodiment of the present application.
Fig. 7 is a flowchart of the processing of the attribute data template.
FIG. 8 is a schematic block diagram of a dynamic attribute verification processing model according to an embodiment of the present application.
Fig. 9 is a flowchart of processing of attribute data.
FIG. 10 is a schematic block diagram of a dynamic property presentation model according to an embodiment of the present application.
Fig. 11 is a schematic block diagram of an apparatus for dynamically expanding attribute data according to an embodiment of the present application.
Fig. 12 is a schematic block diagram of another apparatus for dynamically expanding attribute data provided in accordance with an embodiment of the present application.
Detailed Description
Technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments obtained by a person of ordinary skill in the art without making any creative effort for the embodiments in the present application belong to the protection scope of the present application.
It should be understood that the drawings are schematic illustrations of the present application, in which the same reference numerals denote the same or similar parts, and thus, a repetitive description thereof will be omitted. Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more example embodiments. In the following description, numerous specific details are provided to give a thorough understanding of example embodiments of the application. One skilled in the relevant art will recognize, however, that the subject matter of the present application can be practiced without one or more of the specific details, or with other methods, components, steps, and so forth. In other instances, well-known structures, methods, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the application.
It should also be understood that some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks, processor devices, or micro-control devices.
Cloud technology refers to a hosting technology for unifying serial resources such as hardware, software, network and the like in a wide area network or a local area network to realize calculation, storage, processing and sharing of data.
Cloud technology (Cloud technology) is based on a general term of network technology, information technology, integration technology, management platform technology, application technology and the like applied in a Cloud computing business model, can form a resource pool, is used as required, and is flexible and convenient. Cloud computing technology will become an important support. Background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture-like websites and more web portals. With the high development and application of the internet industry, each article may have its own identification mark and needs to be transmitted to a background system for logic processing, data in different levels are processed separately, and various industrial data need strong system background support and can only be realized through cloud computing.
The blockchain system may be a distributed system formed by a client, a plurality of nodes (any form of computing device in an access network, such as a server, a user terminal) connected through a network communication form. A point-To-point (P2P) network is formed among nodes, a P2P Protocol is an application layer Protocol which runs on a Transmission Control Protocol (TCP), in a distributed system, any machine such as a server and a terminal can be added To form a node, and the node comprises a hardware layer, a middle layer, an operating system layer and an application layer.
The functions of each node in the blockchain system comprise:
1) Routing, a basic function that a node has, is used to support communication between nodes.
Besides the routing function, the node can also have the following functions:
2) The application is used for being deployed in a block chain, realizing specific services according to actual service requirements, recording data related to the realization functions to form recording data, carrying a digital signature in the recording data to represent a source of task data, and sending the recording data to other nodes in the block chain system, so that the other nodes add the recording data to a temporary block when the source and integrity of the recording data are verified successfully.
For example, the services implemented by the application include:
2.1 Wallet) for providing functions of conducting transactions of electronic money, including initiating transactions (i.e. sending transaction records of current transactions to other nodes in the blockchain system, and storing the record data of the transactions in temporary blocks of the blockchain as a response for acknowledging that the transactions are valid after the other nodes are successfully verified; of course, the wallet also supports the querying of the remaining electronic money in the electronic money address;
2.2 Shared account book, which is used for providing functions of operations such as storage, query and modification of account data, sending record data of the operations on the account data to other nodes in the block chain system, and after the other nodes verify that the record data is valid, storing the record data into a temporary block as a response for acknowledging that the account data is valid, and also sending confirmation to the node initiating the operations.
2.3 Intelligent contracts, computerized agreements, which can enforce the terms of a contract, implemented by code deployed on a shared ledger for execution when certain conditions are met, for completing automated transactions according to actual business requirement code, such as querying the logistics status of goods purchased by a buyer, transferring the buyer's electronic money to a merchant's address after the buyer has signed up for goods; of course, smart contracts are not limited to executing contracts for trading, but may also execute contracts that process received information.
3) And the Block chain comprises a series of blocks (blocks) which are mutually connected according to the generated chronological order, new blocks cannot be removed once being added into the Block chain, and recorded data submitted by nodes in the Block chain system are recorded in the blocks.
A block chain (Blockchain), which is essentially a decentralized database, is a string of data blocks associated by using cryptography, and each data block contains related information for verifying the validity (anti-counterfeiting) of the information and generating a next block.
In some scenarios, the interaction of attribute data may be performed between different application systems, for example, the name, sex, age, native place, interests, and the like of a user, each application system may define its own attribute data template, the entered attribute data needs to satisfy the defined attribute data template, and different application systems may define different attribute data templates.
In some embodiments, the application system may be a node in a blockchain system, and data interaction may be performed between nodes in the blockchain system to implement a corresponding service, such as the aforementioned wallet, shared ledger, intelligent contract service, and the like.
FIG. 1 is an exemplary scenario diagram according to an embodiment of the present application. As shown in fig. 1, a first attribute data template is stored in the application system 11, an algorithm for performing verification processing on attribute data based on the first attribute data template runs on the application system 11, a second attribute data template is stored in the application system 12, and an algorithm for performing verification processing on attribute data based on the second attribute data template runs on the application system 12.
Moreover, when a new attribute is required, the attribute can only be extended in a Key-Value (Key-Value) manner, and some complex data types, such as the extension of the attribute of a reference type or an array type, cannot be implemented.
The embodiment of the application provides a method and a device for dynamically expanding attribute data and a storage medium. In practical applications, each functional module in the dynamic expansion apparatus for attribute data may be cooperatively implemented by hardware resources of a device (such as a terminal device, a server, or a server cluster), such as computing resources like a processor, and communication resources (such as those used to support various ways of implementing communications like optical cables and cellular).
FIG. 2 shows a schematic flow diagram of a method 100 for dynamic extension of attribute data according to an embodiment of the application. As shown in fig. 2, the method 100 may include at least some of the following:
and S110, acquiring target attribute data to be subjected to attribute dynamic expansion.
In the embodiment of the present application, the target attribute data may be attribute data of the user, such as name, gender, age, native place, hobbies, child information, and the like of the user. Or, other types of data may also be used, for example, an entry or return value of an Application Protocol Interface (API), other data interacted between the front end and the back end of the Application system, or other data interacted between the Application systems. In the following, the description will be given taking the target attribute data as the attribute data of the user as an example, but the present application is not limited to this.
In the embodiment of the present application, the target attribute data may be acquired from another application system or may be entered by a user, and the method of acquiring the target attribute data is not limited in the present application.
In some embodiments of the present application, the target attribute data includes at least one attribute and values corresponding to the at least one attribute respectively.
It should be understood that, in the embodiment of the present application, the format of the target attribute data may embody (or enable) the hierarchical relationship between the attributes, but it indicates that the target attribute data entered by the user must have a hierarchical relationship of multiple layers.
For example, the target attribute data includes the age and gender attributes of the user, which are sibling, in which case there is no hierarchical relationship between the attributes of the target attribute data.
As another example, the target attribute data includes age (age) and name (name) attributes of the user, where the name attributes further include a last name attribute (i.e., firstName) and a first name attribute (lastName). In this case, the age attribute and the name attribute are sibling, and there is an attribute having a parent-child relationship between the name attribute and the last name attribute (i.e., firstName) and the first name attribute (lastName).
As an example, the target attribute data entered by the user may be in the format:
Figure BDA0003012072210000081
from the above, it can be seen that the hierarchical relationship between the attributes of the attribute data, that is, name and age are attributes of the same level, and firstName and lastName are attributes (or child node attributes) of the next level of the name, in other words, name is a parent attribute of the firstName and lastName.
In some embodiments of the present application, before performing subsequent dynamic attribute verification processing on attribute data, preprocessing may be performed on entered attribute data first, for example, at least one of data type verification, regular expression verification, and data value verification is performed on the attribute data, which is beneficial to reducing complexity of a subsequent dynamic attribute verification processing algorithm. .
In some embodiments, it may be checked whether the data type of each attribute in the entered attribute data is a predefined data type.
As an example, assume that the predefined data types are eight types: the data type check of the first attribute is determined to be passed if the data type of the first attribute in the attribute data is one of the eight types, otherwise, the data type check of the first attribute is determined to be failed.
In some embodiments, it may be checked whether the value of each attribute in the entered attribute data conforms to a regular expression. As an example, if the value of the first attribute conforms to the regular expression, it is determined that the regular expression of the first attribute passes verification, and if the value of the first attribute does not conform to the regular expression, it is determined that the regular expression of the first attribute fails verification.
In some embodiments, it may be verified whether the value of each attribute in the entered attribute data is within a reasonable range. As an example, if the value of the first attribute is not within the reasonable range, it is determined that the data value of the first attribute passes the check, and if the value of the first attribute is not within the reasonable range, it is determined that the data value of the first attribute fails the check.
In some embodiments of the present application, the target attribute data may refer to entered original attribute data, or may be attribute data obtained by preprocessing entered attribute data, for example, the data type in the entered attribute data passes verification, the regular expression passes verification, and the data value passes verification, for example, the data type in the entered attribute data passes verification, and the data value passes verification.
With continued reference to fig. 2, the method 100 further includes:
and S120, acquiring a target attribute data template corresponding to the target attribute data.
It should be understood that the present application does not limit the configuration granularity of the attribute data template, and may determine the configuration granularity according to the service logic corresponding to the attribute data, which is not limited in the present application.
In some implementations, the attribute data templates may be application system-granular, e.g., one application system corresponds to one attribute data template, i.e., the entire application system may use a uniform attribute data template.
In other implementations, the attribute data templates may be service-sized, for example, different services may correspond to independent attribute data templates, for example, a first service corresponds to a first attribute data template, a second service corresponds to a second attribute data template, and so on.
In some embodiments, the S120 may include:
and acquiring a corresponding target attribute data template according to the service logic corresponding to the target attribute data.
For example, if the target attribute data is of a service granularity, the target attribute data template corresponding to the service may be obtained according to the service corresponding to the target attribute data. As an example, if the target attribute data corresponds to the first service, an attribute data template corresponding to the first service may be obtained.
For another example, if the target attribute data is of an application system granularity, the target attribute data template corresponding to the application system may be obtained according to the application system corresponding to the target attribute data. In the embodiment of the present application, the target attribute data template is an attribute data template used for dynamic attribute verification processing of target attribute data, and the target attribute data attribute template is used for defining configuration information (or a verification rule) of each attribute of the attribute data, and dynamic attribute verification processing is performed on the attribute data according to the attribute data template corresponding to the target attribute data, so as to implement dynamic extension of the attribute data.
In an embodiment of the present application, the attribute data template is used to define the following:
1. key field included in each attribute of attribute data
By way of example and not limitation, the key field may include at least one of:
attribute name, data type, regular expression, default value, attribute value, whether encryption is required or not, whether null is allowed or not, whether padding is required or not, and whether search conditions are required or not.
Alternatively, the data type may include a basic type, data of the type having no child node, such as a number (including integer and floating point types), a date, a text array, a number array, a date array, etc., and may also include a complex type, data of the type having child node, such as an object type, an object array type, a reference type, etc., but the present application is not limited thereto.
By supporting the data types of complex types, scenes which cannot be met by basic data types during dynamic attribute extension can be solved.
2. Data format of attribute data template
I.e. which format the attribute data template adopts for data conversion or storage.
Optionally, the data format of the attribute data template may be json format, or may also be other data formats, for example, xml format or character string format. In the following, the json format is used as an example, but the present application is not limited thereto.
3. Rule definition for attribute data templates
Such as usage rules that define data types, which data types may reference other data types, which data types may serve as parent nodes, including other data types, and so forth, as examples.
Therefore, the attribute data template in the embodiment of the present application is a dynamic attribute template model, and the application system can define different attribute data templates according to service requirements, so that flexibility of data interaction between application systems is increased.
As can be seen from the above description, the attribute data in the embodiment of the present application may be data with a hierarchical structure, or may also be attribute data without a hierarchical result, and the attribute data template supports configuration of attribute data with a hierarchical structure, but the configured attribute data does not necessarily have a hierarchical structure, that is, the attribute data template in the embodiment of the present application may configure attribute data with a hierarchical structure, or may configure attribute data without a hierarchical structure, in this case, how to implement dynamic attribute verification processing on attribute data with different formats to implement dynamic extension of attribute data is a difficult point in the dynamic attribute verification processing.
In the embodiment of the application, the flattened attribute data and the flattened attribute data template (namely, the target attribute data template) are obtained by respectively performing the flattening mapping processing on the attribute data and the attribute data template, and further, the dynamic attribute verification processing is performed on the flattened attribute data based on the flattened attribute data template (namely, the target attribute data template), so that the complexity of the dynamic attribute verification processing is favorably reduced.
The generation of the target attribute data template will be described with reference to specific embodiments.
In some embodiments of the present application, the method 100 further comprises:
and receiving a first attribute data template input by a user, wherein the first attribute data template is an initial data template which can represent the hierarchical relation among the attributes of the attribute data.
Optionally, the first attribute data template may correspond to an application system, that is, the entire application system may use a uniform template, or may also correspond to a specific service, that is, different services may correspond to independent attribute data templates.
Alternatively, different application systems may use the same attribute data template, or different attribute data templates may be used.
As an example, the first attribute data template entered by the user is formatted as follows:
Figure BDA0003012072210000111
Figure BDA0003012072210000121
wherein, the definition of the key field is as follows:
FieldCode: a field representation;
FieldName: a field display name;
DataType: a data type;
IsEncrypted boolean (bool): whether to encrypt;
IsNullable pool: whether empty is allowed;
IsSearch cool: whether to search;
regex string (string): a regular expression;
DefaultValue string: a default value.
According to the recorded first attribute data template, the name and the age respectively correspond to respective configuration information, wherein the child node attributes of the name, namely the firstName and the lastName, respectively correspond to the respective configuration information.
Further, in some embodiments of the present application, the method 100 further comprises:
and carrying out flattening mapping processing on the first attribute data template to obtain a second mapping relation. The second mapping relation is used for representing the mapping relation between each attribute defined by the first attribute data template and the configuration information corresponding to each attribute.
Further, the second mapping relationship may be determined as a target attribute data template for performing a dynamic attribute check process on the attribute data.
In some embodiments of the present application, in the second mapping relationship, the attribute name of each attribute is configured as a primary key (key) of each attribute, and other configuration information (e.g., data type, default value, whether padding is necessary, etc.) of each attribute is configured as a value (value) corresponding to the primary key in the second mapping relationship. Therefore, when the subsequent attribute data is verified, the corresponding value is retrieved through the key, the configuration information of the attribute can be obtained, and the retrieval speed is improved.
Optionally, in some embodiments of the present application, after receiving the first attribute data template entered by the user, it may be determined first whether a corresponding attribute data template already exists.
For example, the first attribute data template corresponds to a first service, and if an attribute data template corresponding to the first service is already stored in the application system, the entry may be terminated, or if one attribute data template is used by the application system and an attribute data template is already stored in the application system, the entry may be terminated. Otherwise, the subsequent steps are executed.
Optionally, in some embodiments of the present application, after the first attribute data template is entered, a verification process may also be performed on the first attribute data template, for example, a data format verification process or a data type verification process may be performed on the first attribute data template.
As an example, the data format verification processing on the first attribute data template may include:
and judging whether the data format of the first attribute data template is a predefined data format or not.
Optionally, the predefined data format may be a data format supported by an application system corresponding to the first attribute data template, or a data format supported by a service corresponding to the first attribute data template.
For example, if the data format of the first attribute data template is the predefined data format, determining that the data format check of the first attribute data template passes, otherwise, determining that the data format check of the first attribute data template does not pass.
Optionally, the predefined data format may comprise, for example, the Json format.
As an example, the data type checking the first attribute data template may include:
and judging whether the data type corresponding to each attribute in the first attribute data template is a predefined data type or not.
For example, assume that the predefined data types are eight types: the data type check of the first attribute is determined to be passed if the data type corresponding to the first attribute in the first attribute data template is one of the eight types, otherwise, the data type check of the first attribute is determined to be failed.
Optionally, the predefined data type may be a data type supported by an application system corresponding to the first attribute data template, or a data type supported by a service corresponding to the first attribute data template.
Alternatively, subsequent attribute data template processing steps, such as a flattening mapping processing step, may be performed with the data format of the attribute data template verified and the data type of each attribute verified.
Alternatively, in the case that the data format of the attribute data template is checked to pass and there is an attribute that the data type is checked to pass, a subsequent attribute data template processing step, such as a flattening mapping processing step, may be performed on the attribute data that the data type is checked to pass.
In some embodiments of the present application, each attribute in the first attribute data template may be sequentially traversed according to a hierarchical relationship from high to low between the attributes in the first attribute data template, and a mapping relationship between each attribute and corresponding configuration information may be established.
In some embodiments, performing a flattening mapping process on the first attribute data template to obtain a second mapping relationship includes:
according to the hierarchical relationship among the attributes of the first attribute data template, traversing the father node attributes in the first attribute data template to obtain the mapping relationship between each father node attribute and the configuration information corresponding to each father node attribute;
and under the condition that the attributes of each father node are traversed, sequentially traversing the attributes of the child nodes of each father node in the first attribute data template to obtain the mapping relation between each attribute of the child nodes and the configuration information corresponding to each attribute of the child nodes.
That is to say, the attribute of the highest level is traversed first, the mapping relation between the attribute of the highest level and the corresponding configuration information is established, the attribute of the next level is further searched, the mapping relation between the attribute of the next level and the corresponding configuration information is established until the mapping relation between the attribute of the lowest level and the corresponding configuration information is established, and the target attribute data template is obtained.
Following the foregoing example, the name and the age in the first attribute data template may be traversed first, a mapping relationship between the name and the age and the corresponding configuration information is established, and as the name has child nodes, the mapping relationship between the firstName and the lastName and the corresponding configuration information is established by traversing all child nodes of the name.
It should be understood that, in the embodiment of the present application, the attribute data template (i.e., the target attribute number template) after being subjected to the flattening mapping may also embody a parent-child relationship between the attributes, for example, a child node attribute having a parent node may be configured with an identification information, where the identification information is used to identify the parent node attribute corresponding to the child node attribute.
Optionally, the attribute name of the attribute of the parent node may be used to identify the attribute of the parent node corresponding to the attribute of the child node.
The format of the target attribute data template after the flattening mapping process of the attribute data template in the above example may be:
Figure BDA0003012072210000151
in this example, by adding "name" before the firstName and lastName to identify the parent attribute of the firstName and lastName as name, in other embodiments, the parent-child relationship between the two may also be identified in other manners, for example, by name: name? And the like, which is not limited in this application.
Optionally, in some embodiments of the present application, the target attribute data template after the flattening mapping process may be saved for subsequent attribute data verification process, for example, the target attribute data template is saved in a memory.
In some embodiments of the present application, the S120 may specifically include:
and acquiring a target attribute data template corresponding to the target attribute data from a memory of the application system.
In some embodiments of the present application, the second mapping relationship may be further processed, converted into data in a target format, and stored in a database.
Optionally, the data in the target format may embody a hierarchical relationship between the attributes.
Optionally, the target format may be a json schema format.
For example, the data in the second mapping relationship may be circularly traversed and spliced into template data of a Json hierarchical structure, in the circulating process, the association relationship between parent and child attributes is stored through the parent node attribute, and the template data of the Json format is further converted into the template data of the Json schema.
In some embodiments, multiple key fields are defined in the object format, for example, for the JsonSchema format, fields of value (key), type (type), format (format), required (required), style (pattern), and properties (properties) are defined.
In a specific implementation, each attribute may be sequentially traversed according to the hierarchical relationship of each attribute in the second mapping relationship, and the information of each key field of each attribute is mapped to a corresponding key field in the target format one by one.
With reference to fig. 3, a conversion manner of the attribute data template from the second mapping relationship to the JsonSchema format is described by taking the example that the target format is the JsonSchema format.
For example, traversing the parent node attribute, obtaining information of each key field of each parent node attribute, mapping the information of each key field of each parent node attribute to a corresponding field in the json schema format one by one, for example, mapping the attribute value, the data type, the data format, whether padding is necessary and the attribute name field in the first mapping relation to the value, the type, the format, the required and the properties field in the json schema format respectively.
And after traversing each father node attribute, traversing the child node attribute of each father node attribute, acquiring the information of each key field of each child node attribute, mapping the information of each key field of each child node attribute to the corresponding field in the JsonSchema format one by one until each key field of the attribute at the lowest level is mapped, and obtaining the attribute data template in the JsonSchema format.
Following the above example, the attribute data template in the JsonSchema format may be:
Figure BDA0003012072210000171
therefore, in the embodiment of the present application, the target attribute data template having a flattened structure and the attribute data template having an object format having a hierarchical structure may be stored, and when performing attribute data verification according to the attribute data template, the target attribute data template having a flattened structure may be acquired, and verification processing may be performed on the flattened attribute data.
With continued reference to fig. 2, the method 100 further includes:
s130, performing flattening mapping processing on the target attribute data to obtain a first mapping relation.
The first mapping relation represents the mapping relation between each attribute of the target attribute data and the value of each attribute.
It should be understood that the execution order of S120 and S130 is not sequential, for example, the target attribute data template is obtained first, or the target attribute data to be subjected to the dynamic attribute verification processing may be subjected to preprocessing, flattening processing, and the like before the dynamic attribute verification processing, which is not limited in this application.
Optionally, in the first mapping relationship, the attribute name of each attribute is configured as a primary key of each attribute, the value of each attribute is configured as a value corresponding to the primary key, in the target attribute data template, the attribute name of each attribute is configured as the primary key, and the configuration information of each attribute is configured as a value corresponding to the primary key. Therefore, when the subsequent dynamic attribute data verification processing is executed, the key in the attribute data template can be retrieved through the key, the value corresponding to the key, namely the configuration information of the attribute, is obtained, the dynamic attribute verification processing is further carried out on the value of the key in the first mapping relation according to the configuration information, and the verification speed is improved.
It should be understood that, in the embodiment of the present application, the attribute data after being subjected to the flattened mapping process may also embody a parent-child relationship between the attributes, for example, a child node attribute having a parent node may be configured with identification information, where the identification information is used to identify the parent node attribute corresponding to the child node attribute.
Following the foregoing example, the flattened attribute data format is as follows:
name.firstName=ccc
name.lastName=xxx
age=20。
therefore, in the embodiment of the present application, the attribute names in the attribute data after the flattening mapping process are stored in the full path, the attribute names include the attribute name of the parent node attribute, and if there is a higher-level attribute, the attribute name of the higher-level attribute may also be included.
In the above example, by adding "name" before the firstName and lastName to identify the parent attribute of the firstName and lastName as name, in other embodiments, the parent-child relationship between the two may also be identified in other manners, for example, by name: name? The present application is not limited to these.
In some embodiments of the present application, each attribute in the target attribute data may be sequentially traversed according to an attribute hierarchical relationship between the attributes in the target attribute data, and a mapping relationship between each attribute and corresponding configuration information may be established.
In some embodiments of the present application, the performing a flattening mapping process on the target attribute data to obtain the first mapping relationship may include the following steps:
according to the hierarchical relationship among the attributes of the template attribute data, parent node attributes in the attribute data are traversed to obtain the mapping relationship between each parent node attribute in the target attribute data and the value of each parent node attribute;
and under the condition that the attributes of each father node are traversed, sequentially traversing the attributes of the child nodes corresponding to the attributes of each father node in the target attribute data to obtain the mapping relation between the attributes of each child node and the values of the attributes of each child node.
That is to say, the attributes of the highest layer are traversed first, the mapping relationship between the attributes of the highest level and the corresponding values is established, the attributes of the next level are further searched, and the mapping relationship between the attributes of the next level and the corresponding values is established until the mapping relationship between the attributes of the lowest level and the corresponding values is established, so that the first mapping relationship is obtained.
The attribute data template with the hierarchical relationship is converted into the mapping relationship between the attribute and the corresponding configuration information through the flat mapping processing, and the attribute data with the hierarchical relationship is converted into the mapping relationship between the attribute and the value through the flat mapping processing, so that when the attribute of the attribute data is subjected to the dynamic attribute verification processing according to the attribute data template, the configuration information corresponding to the attribute is only required to be searched according to the mapping relationship of the attribute data template, the value of the attribute in the mapping relationship of the attribute data by the configuration information is further subjected to the dynamic attribute verification processing, and the flexible verification processing of the dynamic attribute can be realized.
With continued reference to fig. 2, the method 100 further includes:
and S140, performing dynamic attribute verification processing on the value of each attribute in the first mapping relation according to the configuration information of each attribute defined by the target attribute data template.
Optionally, in some embodiments, S140 may include:
and performing dynamic attribute verification on the target attribute data (namely the first mapping relation) subjected to the flattening mapping processing according to the configuration information of each attribute defined by the target attribute data template.
Optionally, in some embodiments, S140 may include: and performing dynamic attribute processing on the target attribute data (namely the first mapping relation) subjected to the flattening mapping processing according to the configuration information of each attribute defined by the target attribute data template.
Alternatively, the verification processing result on the target attribute data may include at least one of a verification result of the attribute data and a processing result of the target attribute data.
As described above, the attribute data template may define key fields of the attribute, usage rules of the data type, and the like, and then the key fields of the attribute, the data type, and the like may be checked in S140.
For example, each attribute of the attribute data may be traversed in a loop, and the key field and the data type corresponding to each attribute may be checked in turn.
As shown in fig. 4, this S140 illustrates one implementation of performing dynamic attribute check on attribute data:
s141, whether the attribute is the last attribute is confirmed.
If so, the verification is ended, otherwise, S142 is executed.
S142, judging whether the primary key of the attribute data exists in the target attribute data template.
As described above, after the attribute data flattening mapping process, the first mapping relationship with the attribute name as the key and the attribute value as the value can be obtained, so that it can be sequentially checked whether each key in the first mapping relationship exists in the mapping relationship of the target attribute data template, if so, it indicates that the attribute name is a legal attribute name, otherwise, the processing is performed according to a specific service logic, for example, the processing is not performed, or an error is prompted.
As an example, if the primary key exists in the attribute data template, S143 is executed, otherwise, the verification is ended, or the verification is confirmed to be failed.
And S143, performing data type verification on the attribute data.
Specifically, the data type of the value of each attribute of the attribute data may be checked according to the data type of each attribute defined in the attribute data template.
For example, according to the key of each attribute in the first mapping relationship, sequentially retrieving the configuration information corresponding to the key in the target attribute data template, obtaining the data type information of the key in the configuration information, and then checking the data type of the value of the attribute according to the data type information of the key defined in the attribute data template. For example, if the two match, it is determined that the data type check of the attribute passes, otherwise, it is determined that the data type check of the attribute fails.
In some embodiments, checking the data type of the value of the attribute according to the data type information of the key defined in the target attribute data template may further include:
and checking the value of the attribute according to the use rule of the data type in the target attribute data template.
For example, if the data type of the attribute defined in the target attribute data template is an object array, the data type allows the attribute to have child nodes, or if the data type of the attribute defined in the target attribute data template is a basic type, the data type does not allow child nodes, that is, the attribute value only can be a basic type, but cannot be a compound data type.
For example, if the data type of the first attribute is a basic type and the first attribute has a child node, it is determined that the data type of the first attribute fails to check.
For another example, if the data type of the first attribute is a complex type and the first attribute has child nodes, it is determined that the data type of the first attribute passes the check.
Optionally, in some embodiments, in S140, a check process of other key fields may also be performed on each attribute in the target attribute data, for example, a default check process or a regular expression check process is performed.
For example, if the value of the first attribute does not conform to the regular expression defined by the target attribute data template, it is determined that the check of the regular expression of the first attribute fails, otherwise, it is determined that the check of the regular expression of the first attribute passes.
For another example, if the value of the first attribute is the default value defined by the target attribute data template, it is determined that the default value of the first attribute passes verification, otherwise, it is determined that the default value of the first attribute fails verification.
And S144, confirming whether the check is passed or not.
Optionally, if a key of an attribute exists in the target attribute data template, and the data type of the attribute is consistent with the data type defined by the attribute in the attribute data template, it may be determined that the verification result of the attribute is a verification pass.
Optionally, if a key of an attribute does not exist in the attribute data template, or the data type of the attribute is not consistent with the data type of the attribute defined in the attribute data template, it may be determined that the result of the dynamic verification of the attribute is a verification failure.
If the verification result of the attribute is that the verification is passed, S141 is executed, otherwise, the verification may be ended, or the above-mentioned verification process may be continuously executed on the next attribute.
It should be understood that, in the embodiment of the present application, performing a dynamic attribute check on target attribute data may refer to performing a dynamic attribute check on actually entered attribute data, for example, a check result of the target attribute data may be determined according to a check result of each attribute of the actually entered target attribute data, and the check result of the target attribute data may be used to determine whether to perform a subsequent attribute data processing step or whether to save the target attribute data.
In some implementation manners, it may be determined that the verification result of the target attribute data is a verification pass when all the attributes in the actually entered target attribute data are verified to pass, or it is determined that the verification result of the target attribute data is a verification pass when there is a verification result of at least one attribute that is a verification pass, or it is determined that the verification result of the target attribute data is a verification fail when there is an attribute that is a verification fail that is a verification result of at least one attribute.
Optionally, the target attribute data may be dynamically expanded according to the verification result of the target attribute data, for example, to determine whether to store the actually-entered attribute data, or the target attribute data may also be dynamically expanded according to the respective verification result of each attribute, for example, to determine whether to store each actually-entered attribute data.
For example, when the result of checking the target attribute data is that the check is passed, the target attribute data is dynamically expanded, for example, all the attribute data that has passed the check are stored, or when the result of checking the target attribute data is that the check is not passed, the target attribute data is not dynamically expanded, for example, any attribute data is not stored.
For another example, if the result of the dynamic attribute check of the first attribute is that the check is passed, the first attribute is dynamically expanded, for example, attribute data corresponding to the first attribute is stored, or if the result of the check of the first attribute is that the check is not passed, the first attribute is not dynamically expanded, for example, the attribute data of the first attribute is not stored.
Optionally, when the result of the dynamic attribute verification of the target attribute data is that the verification fails, the target attribute is not dynamically extended, and further prompt information for prompting that the entry format of the user attribute data does not conform to the rule defined by the target attribute data template may be sent to the user.
Optionally, when the verification result of the first attribute is that the verification fails, the first attribute is not dynamically expanded, and further prompt information for prompting that the entry format of the first attribute does not conform to the entry rule of the first attribute defined by the target attribute data template may be sent to the user.
In some scenarios, if all attribute data of the target attribute data is not entered, for example, only information of a part of attributes is entered, or for a certain attribute, only a part of key fields of the attribute are entered, and the like, in this case, a dynamic attribute processing procedure may also be performed, for example, dynamic attribute processing is performed on the attribute data that is not entered of the target attribute data, for example, mandatory item checking processing is performed, whether null checking processing is allowed or not, default value processing is allowed, and the like, so as to perfect the target attribute data to be entered.
Fig. 5 illustrates a specific implementation of a dynamic attribute processing flow of target attribute data, and as shown in fig. 5, processing the target attribute data may include:
s145, executing necessary item checking processing on the attribute data which is not recorded in the target attribute data, and judging whether at least one of null checking processing and default value processing is allowed.
Alternatively, in some embodiments, S145 may be performed in a case that the verification result of the target attribute data is verification pass. If the verification result of the target attribute data is that the verification fails, S145 is not performed. For example, it is directly determined not to save the entered target attribute data.
For example, in the case where the key check of each attribute of the target attribute data actually entered passes and the data type check of the key passes, at least one of the mandatory item check processing, whether or not to allow the null check processing, the default value processing, is further performed on the attribute data of the target attribute data not entered.
In some embodiments of the present application, the processing result of each attribute in the target attribute data may also be determined according to whether the mandatory item check processing is executed, as a result of the null check processing and the default value processing.
In some embodiments, if the first key field of the first attribute is not entered, but the value of the first key field of the first attribute defined by the target attribute data template is not allowed to be null, and the target attribute data template defines a default value of the first key field of the first attribute, in this case, the default value is used as the value of the first key field of the first attribute, and the mapping relationship between the default value and the first key field of the first attribute is added to the target attribute data after the flattening mapping process. In this case, the processing result of the first attribute is considered to be successful.
In other embodiments, if the first key field of the first attribute is not entered, but the target attribute data template defines that the value of the first key field of the first attribute is a mandatory item, and the target attribute data template defines a default value of the first key field of the first attribute, the default value is used as the value of the first key field of the first attribute, and the mapping relationship between the default value and the first key field of the first attribute is added to the target attribute data after the flattening mapping process. In this case, the processing result of the first attribute is considered to be successful.
In still other embodiments, if the first key field of the first attribute is not entered, but the value of the first key field of the first attribute defined by the target attribute data template is not allowed to be null or a mandatory item, but the target attribute data template does not define the default value of the first key field of the first attribute, in this case, subsequent processing may be performed according to specific business logic, for example, the first key field is not processed, or a prompt message may be output to the user to prompt that the target attribute data input by the user does not conform to the rule of the target attribute data template. In this case, the processing result of the first attribute is considered to be a failure.
In still other embodiments, if the first key field of the first attribute is not entered, but the value of the first key field of the first attribute defined by the target attribute data template is allowed to be null or unnecessary, and the target attribute data template defines a default value of the first key field of the first attribute, as an implementation, the first key field of the first attribute may not be processed, and in this case, the processing result of the first attribute is considered to be a failure. Alternatively, a default value may be assigned to the first key field of the first attribute, in which case the processing result of the first attribute is considered to be successful. That is, the stored target attribute data may or may not include the value of the first key field.
As an implementation manner, if the first key field of the first attribute is not entered, the value of the first key field of the first attribute defined by the target attribute data template is allowed to be null or an unnecessary entry, and the target attribute data template does not define a default value of the first key field of the first attribute, in this case, the first key field of the first attribute may not be processed, that is, the stored target attribute data does not include the value of the first key field. In this case, the processing result of the first attribute is considered to be a failure.
Optionally, the first key field may be an attribute value field, or may also be another key field, which is not limited in this application.
In some embodiments of the present application, a processing result of the target attribute data may be determined according to a processing result of each attribute data that is not entered.
For example, when all the attribute data that is not entered is successfully processed, that is, each attribute that is not entered obtains a corresponding value, the processing result of the target attribute data may be determined to be successful.
For another example, in a case where a processing result in which at least one attribute exists is a failure, that is, there exists an attribute that must be filled or is not allowed to be empty but is not assigned, the processing result of the target attribute data is determined to be a failure.
For another example, in a case where the processing result in which there is at least one attribute is successful, that is, there is an attribute that must be filled or is not allowed to be empty and is assigned, the processing result of the target attribute data is determined to be successful.
Continuing with FIG. 2, in some embodiments of the present application, the method 100 further comprises:
and S150, dynamically expanding the target attribute data according to the verification processing result of the target attribute data.
Optionally, the dynamically expanding the target attribute data according to the verification processing result of the target attribute data may include:
and dynamically expanding the target attribute data according to at least one of the verification result of the target attribute data and the processing result of the target attribute data.
The verification result of the target attribute data refers to the verification result of the attribute data actually recorded in the target attribute data, and the processing result of the target attribute data refers to the processing result of the non-recorded attribute data in the target attribute data.
In some implementations, if the verification result of the target attribute data is that the verification is passed and the processing result of the target attribute data is that the processing is successful, the target attribute data is dynamically extended, for example, the target attribute data is saved.
In other implementations, if the verification result of the target attribute data is that the verification fails, the target attribute data is not dynamically expanded, for example, the target attribute data is not saved.
In still other implementations, if the check result of the target attribute data is a check pass but the processing result of the target attribute data is a failure, the target attribute data is not dynamically extended, e.g., the target attribute data is not saved, or only the attribute data that has passed the check pass is dynamically extended, e.g., only the attribute data that has passed the check pass is saved, or only the attribute data that has passed the check pass or has successfully been processed is dynamically extended, e.g., only the attribute data that has passed the check pass and the attribute data whose processing result is a success are saved.
It should be understood that the above dynamic attribute checking manner of the target attribute data and the dynamic attribute processing manner of the target attribute data are merely examples, which may be designed according to a specific service logic, and the present application does not limit this.
It should be understood that, in the embodiment of the present application, the saved target attribute data may include attribute data that the dynamic attribute check passes, or may also include attribute data that the processing result of the dynamic attribute processing in S145 is successful, for example, attribute data that is processed by a default value, and the like.
In some embodiments of the present application, the method 100 further comprises:
converting the target attribute data into a target format;
and storing the attribute data of the target format to a database.
Alternatively, the target attribute data may be converted into a target format in a case where it is determined that the target attribute data is dynamically extended.
For example, in the case that the dynamic attribute check of the target attribute data passes and the dynamic data processing of the target attribute data succeeds, it may be determined to dynamically extend the target attribute data, and further convert the target attribute data into a target format for storage.
For another example, when the dynamic attribute check of the target attribute data passes, it may be determined to dynamically expand the target attribute data, and the target attribute data may be further converted into a target format for storage.
Optionally, the target format is a data format supported by the database, such as a Json format.
Following the foregoing example, the storage format of the target attribute data in the database is as follows:
Figure BDA0003012072210000251
Figure BDA0003012072210000261
Figure BDA0003012072210000271
through the steps, the target attribute data and the target attribute data template are obtained, and further, in some embodiments, the attribute data can be displayed according to the requirements of the user.
Optionally, in some embodiments of the present application, the method 100 further includes:
receiving a query condition for attribute data input by a user;
taking the query condition as a main key of attribute data to be queried;
acquiring attribute data meeting the query conditions from a database according to a main key of the attribute data to be queried;
converting the data type of each attribute of the attribute data into the data type of each attribute defined by a target attribute data template;
converting the attribute data into a data format defined by the target attribute data template;
and outputting the attribute data according to a data format defined by the target attribute data template.
As described above, the attribute data is stored in the database in a flattened data format, and the target attribute data template is also stored in a flattened data format, so after the query condition of the user is obtained, the query condition can be used as a key, and the value corresponding to the key is quickly searched.
By integrating the above embodiments, the embodiments of the present application provide a dynamic attribute template model, a dynamic attribute verification processing model, and a dynamic attribute display model, which can support complex data types, and when an attribute needs to be added, only the attribute data template needs to be updated, and the dynamic attribute verification processing model and the dynamic attribute display model do not need to be modified, that is, the verification processing algorithm of the attribute data and the display algorithm of the attribute data do not need to be modified, and the application system does not need to be restarted, so that the dynamic verification processing on the changed attribute data template and the dynamic verification processing on the attribute data of the added attribute can be implemented.
In addition, the dynamic attribute verification processing model of the embodiment of the application performs dynamic attribute verification processing after performing flattening mapping processing on the attribute data and the target attribute data template, so that dynamic verification on both basic type attribute data and complex type attribute data can be realized, that is, dynamic verification on different types of attribute data is realized through a unified algorithm.
And before the attribute data template and the attribute data are stored, the dynamic attribute verification processing is carried out on the attribute data template and the attribute data through a dynamic attribute verification processing algorithm, so that the accuracy of data transmitted to an application system background is ensured, and the transparent transmission of error data is avoided.
FIG. 6 illustrates a model structure diagram of a dynamic property template model according to an embodiment of the present application.
As shown in FIG. 6, the dynamic data template model may be used to perform the following operations:
and recording the attribute data template, verifying the attribute data template, processing the attribute data template and storing the attribute data template.
The generation process of the attribute data template is explained in detail with reference to fig. 7.
As shown in fig. 7, the following steps may be included:
s310, receiving an input first attribute data template;
optionally, the first attribute data template may correspond to one or more application systems, or may also correspond to a specific service, that is, the same attribute data template may be used by one or more application systems, or different attribute data templates may be used by different services.
It should be appreciated that the format of the first attribute data template may embody a hierarchical relationship between the attributes.
The first attribute data template can support data of complex types, wherein the data of complex types can mean that one attribute can have child node attributes, and the requirements of different application scenes can be met by designing the attribute data template to support the data of complex types.
S310, determining whether the attribute data template exists, that is, whether the application system or the database stores the corresponding attribute data template.
For example, the first attribute data template corresponds to a first service, and if the attribute data template corresponding to the first service already exists, the entry is ended, or if the attribute data template corresponds to an application system and the attribute data template already exists in the application system, the entry is ended. Otherwise, the subsequent steps are executed.
And S330, performing dynamic attribute verification processing on the attribute data template. In some embodiments of the present application, performing the dynamic attribute verification process on the attribute data template may include at least one of:
carrying out data format verification processing on the first attribute data template;
and carrying out data type verification processing on the first attribute data template.
Optionally, whether the data format or the data type of the first attribute data template is reasonable may be determined by a specific service logic, where the service logic may be determined according to a service to which the attribute data template is applicable.
In some embodiments, the data format checking process on the first attribute data template may include:
and judging whether the data format of the first attribute data template is a predefined data format.
For example, if the data format of the first attribute data template is the predefined data format, it is determined that the data format check of the first attribute data template is passed, otherwise, it is determined that the data format check of the first attribute data template is failed.
Optionally, the predefined data format may comprise, for example, the Json format.
In some embodiments, performing the data type check process on the first attribute data template may include:
and judging whether the data type corresponding to each attribute in the first attribute data template is a predefined data type.
For example, if the data type corresponding to the first attribute in the first attribute data template is the predefined data type, it is determined that the data type check of the first attribute passes, otherwise, it is determined that the data type check of the first attribute fails.
Optionally, if the data format check of the first attribute data template passes and the data type check of each attribute in the first attribute data template passes, performing the subsequent attribute data template processing step.
Optionally, if the data format check of the first attribute data template fails, or an attribute with a data type check failed exists in the first attribute data template, ending the entry.
Optionally, if the data type check of the partial attribute in the first attribute data template fails, the subsequent processing may also be performed on the attribute that passes the data type check.
S340, performing flattening mapping processing on the attribute data template.
For example, the first attribute data template is subjected to flattening mapping processing to obtain a second mapping relationship.
The second mapping relation is used for representing the mapping relation between each attribute defined by the first attribute data template and the configuration information corresponding to each attribute. That is, the second mapping relationship is formatted as flattened data without a hierarchical structure.
In order to avoid losing the association relationship between the attributes, the attribute of the child node having the parent node may be configured with identification information, where the identification information is used to identify the attribute of the parent node corresponding to the attribute of the child node.
Alternatively, the identification information may be an attribute name of the parent node attribute.
Therefore, in the embodiment of the present application, the attribute names in the template data after the flattening mapping process are stored in the full path, the attribute names include the attribute name of the parent node attribute, and if there is a higher-level attribute, the attribute name of the higher-level attribute may also be included.
It should be understood that, for the specific implementation process of performing the flattening mapping processing on the attribute data template, reference is made to the relevant description in the foregoing embodiments, and details are not described here for brevity.
And S350, converting the format of the attribute data template.
In some embodiments, the second mapping relationship may be stored in the memory for subsequent dynamic attribute verification processing of the attribute data.
In other embodiments, the attribute data template in the target format may be further generated according to the second mapping relationship to be stored in the database.
For example, the information of each key field of each attribute may be mapped to a target key field in the target format one by one according to the hierarchical relationship of the attributes in the second mapping relationship to implement format conversion of the attribute data template.
For specific implementation of generating the attribute data template in the target format according to the second mapping relationship, reference is made to related implementation of the embodiment shown in fig. 3, and details are not described here for brevity.
And S360, performing persistence processing on the attribute data template in the target format.
And at the present, the entry of the attribute data template is completed, and the entered attribute data template can be used for performing dynamic attribute verification processing on the attribute data in a subsequent attribute data verification stage.
FIG. 8 illustrates a model structure diagram of a dynamic attribute verification process model according to an embodiment of the present application.
As shown in FIG. 8, the dynamic attribute verification process model may be used to perform the following operations:
the method comprises the steps of recording attribute data, preprocessing the attribute data before verification, obtaining an attribute data template for verification, performing flattening mapping processing on the attribute data, performing dynamic attribute verification on the attribute data according to the attribute data template, performing dynamic attribute processing after verification on the attribute data, performing format conversion on the attribute data template, and storing the attribute data.
The generation process of the attribute data is explained in detail with reference to fig. 9.
As shown in fig. 9, the following steps may be included:
and S410, receiving the entered attribute data.
In some embodiments of the present application, pre-processing may first be performed on the entered attribute data before subsequent dynamic attribute checks are performed on the attribute data. For example, at least one of a data type check, a regular expression check, and a data value check is performed on the attribute data.
Optionally, whether the data type of the attribute data is reasonable may be determined by a specific service logic, where the service logic may be determined according to the service type of the attribute data.
In some embodiments, performing the data type check process on the attribute data may include:
and judging whether the data type corresponding to the attribute in the attribute data is a predefined data type or not.
For example, if the data type corresponding to the first attribute in the attribute data is the predefined data type, it is determined that the data type check of the first attribute passes, otherwise, it is determined that the data type check of the first attribute fails.
In some embodiments, performing regular expression check processing on the attribute data may include:
and judging whether the value of the attribute in the attribute data meets the regular expression or not.
For example, if the value of the first attribute in the attribute data satisfies the regular expression, it is determined that the regular expression of the first attribute passes verification, otherwise, it is determined that the regular expression of the first attribute fails verification.
In some embodiments, it may be verified whether the value of the attribute in the entered attribute data is within a reasonable range. And if the value of the first attribute is not in the reasonable range, determining that the data value of the first attribute passes the verification, and if the value of the first attribute is not in the reasonable range, determining that the data value of the first attribute fails the verification.
Optionally, if the data type check, the regular expression check and the data value check of each attribute in the attribute data pass, executing the subsequent process, otherwise, ending the entry.
Optionally, if the result of the dynamic attribute verification of the data type verification, the regular expression verification and the data value verification of the partial attributes in the attribute data is verification passing, the subsequent process is executed on the attribute passing the verification, and the attribute data failing the verification is not saved.
In the embodiment of the application, the recorded attribute data is preprocessed before the dynamic attribute verification processing is executed, so that the realization complexity of the subsequent dynamic attribute verification processing of the attribute data based on the attribute data template is reduced.
And S420, acquiring an attribute data template corresponding to the attribute data.
For example, different services correspond to independent attribute data templates, and if the attribute data corresponds to the first service, the attribute data template corresponding to the first service may be obtained.
The attribute data template of the embodiment of the application can support complex data types, that is, the attribute data template can be a data template with a hierarchical relationship, and the attribute data can also be a complex data type, that is, the attribute data can be attribute data with a hierarchical relationship.
It should be understood that the attribute data template obtained in S420 may be the attribute data template that has undergone the flattening mapping process and is saved, for example, the second mapping relationship.
And the attribute data template after the flattening mapping processing is adopted to carry out dynamic attribute verification on the attribute data, so that the complexity of verification processing is reduced.
S430, performing flattening mapping processing on the attribute data to obtain a first mapping relation.
It should be understood that the execution attributes of S430 and S420 are not sequential, and S420 may be executed first, or S430 may also be executed first, or S420 may also be executed simultaneously, which is not limited in this application.
It should be understood that, for the specific implementation process of performing the flattening mapping process on the attribute data, reference is made to the foregoing description of S130, and for brevity, the description is not repeated here.
As an example, the attribute of the highest level node in the attribute data is traversed, the mapping relationship between the attribute of the highest level node and the corresponding value is established, the attribute of the next level node is further searched, the mapping relationship between the attribute of the next level node and the corresponding value is established until the establishment of the mapping relationship between the attribute of the lowest level node and the corresponding value is completed, and the first mapping relationship is obtained.
And S440, performing dynamic attribute verification on the attribute data subjected to the flattening mapping according to the flattened attribute data template.
For a specific implementation process, reference is made to the description of S140 in fig. 2 and S140 in fig. 4, and details are not repeated here for brevity.
Optionally, the S440 may be a dynamic attribute check of the actually entered attribute data for the attribute data.
As an example, if a key corresponding to an attribute in the attribute data exists in the attribute data template, and the data type of the value of the key matches with the data type defined by the attribute data template, it is determined that the dynamic attribute check of the attribute passes, otherwise, it is determined that the dynamic attribute check of the attribute fails.
S450, judging whether the verification is passed.
If the verification is passed, executing S460, otherwise ending the logging.
Optionally, the determination method of the verification result of the attribute data refers to the related description above, and is not described herein again for brevity.
And S460, performing dynamic attribute processing on the attribute data subjected to the flattening mapping according to the flattened attribute data template.
Optionally, the 460 may be a dynamic property process for unentered property data for the property data.
For example, at least one of a mandatory check process, a null check process, and a default process may be performed on the attribute data that is not entered of the attribute data.
It should be understood that the specific implementation of S460 may refer to the related implementation of S145 in fig. 5, and for brevity, will not be described herein.
After the above processing, the attribute data conforming to the rule defined by the attribute data template can be obtained. The attribute data may include the entered data conforming to the template definition rule, and may also include the data processed in S460.
And S470, performing format conversion on the attribute data to be stored.
For example, converted to Json format for storage.
And S480, performing persistence processing on the attribute data.
Through the steps, the attribute data entry is completed, and the attribute data can be displayed in the subsequent attribute data display stage.
As shown in FIG. 10, the dynamic property exposure model may perform the following operations:
acquiring query conditions, matching the query conditions to obtain attribute data meeting the query conditions, performing data type conversion on the attribute data meeting the query conditions, performing format conversion on the attribute data meeting the query conditions, and outputting the attribute data.
As described above, the attribute data is stored in the database in a flattened data format, and the attribute data template is also stored in a flattened data format, so after the query condition of the user is obtained, the query condition can be used as a key, and the value corresponding to the key is quickly searched.
In summary, the attribute data template according to the embodiment of the present application can support not only basic data types but also complex data types, and can solve the problem that the data types defined by the attribute data template do not support when the attribute is dynamically extended, thereby meeting the requirements of various service scenarios.
Moreover, based on the verification processing scheme of the dynamic attribute data and the display scheme of the dynamic attribute data in the embodiment of the application, when the new attribute data is required, the dynamic verification processing of the changed attribute data template and the dynamic verification processing of the attribute data of the new attribute can be realized only by updating the attribute data template without modifying the verification processing algorithm of the attribute data and the display algorithm of the attribute data or restarting an application system, so that the verification processing scheme of the attribute data and the display scheme of the attribute data in the embodiment of the application have universality, and can be applied to various scenes for performing verification processing on the attribute data based on the attribute data template in a cross-application scene.
According to the attribute data verification processing scheme, the attribute data and the attribute data template are subjected to the flattening mapping processing and then the dynamic attribute verification processing is executed, so that the dynamic verification of basic type attribute data and the dynamic verification of complex type attribute data can be realized, namely the dynamic verification of different types of attribute data is realized through a uniform verification processing algorithm, and therefore the flexibility of the data format of the attribute data template is improved, for example, a user can customize the data format of the attribute data template, the participation of technical personnel is not needed, and the flexibility of data interaction between application systems is improved.
And before the attribute data template and the attribute data are stored, the attribute data template and the attribute data are subjected to dynamic attribute verification processing through a verification processing algorithm, so that the accuracy of data transmitted to an application system background is guaranteed, and the transparent transmission of error data is avoided.
Method embodiments of the present application are described in detail above with reference to fig. 1-10, and apparatus embodiments of the present application are described in detail below with reference to fig. 11-12, it being understood that apparatus embodiments correspond to method embodiments and that similar descriptions may be had with reference to method embodiments.
Fig. 11 is a schematic structural diagram of an apparatus 1000 for dynamically expanding attribute data according to an embodiment of the present application, and as shown in fig. 11, the apparatus 1000 for dynamically expanding attribute data may include:
a first obtaining module 1001, configured to obtain target attribute data to be subjected to attribute dynamic expansion;
a second obtaining module 1002, configured to obtain a target attribute data template corresponding to the target attribute data, where the target attribute data template is used to define configuration information of each attribute of the attribute data, where the configuration information of each attribute includes a key field included in each attribute and a usage rule of a data type of each attribute;
a flattening processing module 1003, configured to perform flattening mapping processing on the target attribute data to obtain a first mapping relationship, where the first mapping relationship is a mapping relationship between each attribute of the target attribute data and a value of each attribute;
a verification processing module 1004, configured to perform verification processing on the value of each attribute in the first mapping relationship according to the configuration information of each attribute defined by the target attribute data template, so as to obtain a verification processing result of the target attribute data;
a dynamic extension module 1005, configured to dynamically extend the target attribute data according to the verification processing result of the target attribute data.
In some embodiments of the present application, the flattening processing module 1003 is further configured to:
according to the hierarchical relationship among the attributes of the target attribute data, parent node attributes in the target attribute data are traversed to obtain the mapping relationship between each parent node attribute in the target attribute data and the value of each parent node attribute;
and sequentially traversing child node attributes corresponding to each parent node attribute in the target attribute data under the condition that each parent node attribute is traversed to obtain the mapping relation between each child node attribute and the value corresponding to each child node attribute.
In some embodiments of the present application, the apparatus 1000 further comprises:
the input module is used for receiving a first attribute data template input by a user, wherein the first attribute data template is an initial data template capable of representing the hierarchical relationship among the attributes of the attribute data;
in some embodiments of the present application, the flattening processing module 1003 is further configured to:
performing flattening mapping processing on the first attribute data template to obtain a second mapping relation, wherein the second mapping relation is a mapping relation between each attribute defined by the first attribute data template and configuration information of each attribute;
and determining the second mapping relation as the target attribute data template.
In some embodiments of the present application, the flattening processing module 1003 is further configured to:
according to the hierarchical relationship among the attributes in the first attribute data template, traversing the father node attributes in the first attribute data template to obtain the mapping relationship between each father node attribute and the configuration information of each father node attribute;
and sequentially traversing the child node attributes of each parent node attribute in the first attribute data template under the condition that each parent node attribute is traversed to obtain the mapping relation between each child node attribute and the configuration information of each child node attribute.
In some embodiments of the present application, in the second mapping relationship, a child node attribute having a parent node corresponds to identification information, where the identification information is used to identify a parent node attribute corresponding to the child node attribute, and the apparatus 1000 further includes:
the format conversion module is used for determining the hierarchical relationship among the attributes in the second mapping relationship according to the identification information of the attributes in the second mapping relationship;
according to the hierarchical relationship among the attributes in the second mapping relationship, parent node attributes in the second mapping relationship are traversed first, information of each key field of each parent node attribute is obtained, and the information of each key field of each parent node attribute is mapped to corresponding fields in a target format one by one; and
and after traversing each father node attribute, traversing the child node attribute of each father node attribute, acquiring the information of each key field of each child node attribute, mapping the information of each key field of each child node attribute to the corresponding field in the target format one by one, and acquiring the attribute data template of the target format.
In some embodiments of the present application, in the target attribute data template, an attribute name of each attribute is configured as a primary key, and other configuration information of each attribute is used as a value corresponding to the primary key;
in the first mapping relationship, the attribute name of each attribute is configured to be used as a main key, and the value of each attribute is used as the value corresponding to the main key.
In some embodiments of the present application, the verification processing module 1004 is further configured to:
sequentially acquiring each primary key in the first mapping relation, and determining whether the primary key exists in the target attribute data template;
and under the condition that the main key exists, obtaining a value corresponding to the main key in the first mapping relation, and performing data type verification processing or regular expression verification processing on the value of the main key.
In some embodiments of the present application, the verification processing module 1004 is further configured to:
and executing default value processing, mandatory item checking processing and at least one item of checking processing whether the attribute value is null or not on the attribute data which is not recorded in the target attribute data according to the configuration information of each attribute defined by the target attribute data template.
In some embodiments of the present application, the verification processing module 1004 is further configured to:
if a first key field of a first attribute is not recorded, but the value of the first key field of the first attribute defined by the target attribute data template is not allowed to be empty, and the target attribute data template defines a default value of the first key field of the first attribute, the default value is used as the value of the first key field of the first attribute, and target attribute data are updated; or
If the first key field of the first attribute is not recorded, but the value of the first key field of the first attribute is defined as a mandatory item by the target attribute data template, and the default value of the first key field of the first attribute is defined by the target attribute data template, the default value is used as the value of the first key field of the first attribute, and the target attribute data is updated.
In some embodiments of the present application, the storage module 1005 is further configured to:
under the condition that the attribute data are confirmed to be saved, converting the target attribute data into a target format;
and storing the target attribute data in the target format to a database.
In some embodiments of the present application, the apparatus 1000 further comprises:
the input module is used for receiving query conditions for the attribute data input by a user;
the query module is used for taking the query condition as a primary key of the attribute data to be queried and acquiring the attribute data meeting the query condition from the database according to the primary key of the attribute data to be queried;
a data type conversion module, configured to convert a data type of each attribute of the attribute data into a data type of each attribute defined by the target attribute data template;
the data format conversion module is used for converting the data format of the attribute data into the data format defined by the target attribute data template;
and the output module is used for outputting the target attribute data according to the data format defined by the target attribute data template.
In some embodiments of the present application, in the first mapping relationship, a child node attribute having a parent node corresponds to identification information, where the identification information is used to identify a parent node attribute corresponding to the child node attribute.
In some embodiments of the present application, the verification processing module 1003 is further configured to:
according to the configuration information of each attribute defined by the target attribute data template, performing dynamic attribute verification on the target attribute data subjected to the flattening mapping processing to obtain a verification result of the target attribute data;
and carrying out dynamic attribute processing on the target attribute data subjected to the flattening mapping processing according to the configuration information of each attribute defined by the target attribute data template to obtain a processing result of the target attribute data.
In some embodiments of the present application, the verification processing result of the target attribute data may include a verification result of the target attribute data and a processing result of the target attribute data.
In some embodiments of the present application, the verification processing module 1003 is further configured to:
and under the condition that the verification result of the target attribute data is verified to be passed, performing dynamic attribute processing on the target attribute data subjected to the flattening mapping processing according to the configuration information of each attribute defined by the target attribute data template to obtain a processing result of the target attribute data.
In some embodiments of the present application, the verification processing module 1003 is further configured to:
and under the condition that the verification result of the actually recorded attribute data of the target attribute data is that the verification is passed, performing dynamic attribute processing on the attribute data which is not recorded of the target attribute data to obtain a processing result of the target attribute data.
In some embodiments of the present application, the verification processing module 1003 is further configured to:
the dynamic attribute processing of the attribute data of the target attribute data that is not recorded may include at least one of a default value processing, a mandatory item check processing, and an attribute value null check processing of the attribute data that is not recorded.
In some embodiments of the present application, the apparatus 1000 further comprises:
and the attribute data preprocessing module is used for preprocessing the input first attribute data to obtain target attribute data.
In some embodiments of the present application, the attribute data preprocessing module is specifically configured to:
at least one of a data type check process, a regular expression check process, and a data value check process is performed on the first attribute data.
In some embodiments of the present application, the apparatus 1000 further comprises:
and the template data preprocessing module is used for verifying the input first attribute data template to obtain a target attribute data template.
In some embodiments of the present application, the template data preprocessing module is further configured to:
and performing at least one of data format check processing and data type check processing on the first attribute data template. It should be noted that, the functions of each module in the dynamic attribute data expansion apparatus 1000 in this embodiment of the application may refer to the specific implementation manner of any embodiment in fig. 2 to fig. 10 in each method embodiment described above, and are not described herein again.
The modules in the above dynamic expansion device for attribute data may be implemented wholly or partially by software, hardware, and a combination thereof. The modules may be embedded in hardware or independent of a processor in the computer device, or may be stored in a memory in the computer device in software, so that the processor calls and executes operations corresponding to the modules.
The dynamic expansion apparatus 1000 of attribute data may be integrated into a terminal or a server having a storage, a processor, and a computing capability, such as a tablet computer, a slave computer, or a notebook computer, or the dynamic expansion apparatus 1000 of attribute data may be the terminal or the server.
Fig. 12 is a further schematic structural diagram of an apparatus for dynamically expanding attribute data according to an embodiment of the present application, and as shown in fig. 12, an apparatus 1100 for dynamically expanding attribute data may include: a communication interface 1101, a memory 1102, a processor 1103, and a communication bus 1104. The communication interface 1101, the memory 1102, and the processor 1103 communicate with each other via a communication bus 1104. The communication interface 1101 is used for the apparatus 1100 to communicate data with an external device. The memory 1102 may be used for storing software programs and modules, and the processor 1103 may execute the software programs and modules stored in the memory 1102, such as the software programs of the corresponding operations in the foregoing method embodiments.
In some embodiments, the processor 1103 may invoke software programs and modules stored in the memory 1102 to perform the following operations:
acquiring target attribute data to be subjected to attribute dynamic expansion, wherein the format of the target attribute data can reflect the hierarchical relationship among the attributes of the target attribute data;
acquiring a target attribute data template corresponding to the target attribute data, wherein the target attribute data template is used for defining configuration information of each attribute of the attribute data, and the configuration information of each attribute comprises a key field included in each attribute and a use rule of a data type of each attribute;
performing flattening mapping processing on the target attribute data to obtain a first mapping relation, wherein the first mapping relation is a mapping relation between each attribute of the target attribute data and a value of each attribute;
performing dynamic attribute verification processing on the value of each attribute in the first mapping relation according to the configuration information of each attribute defined by the target attribute data template to obtain a verification processing result of the target attribute data;
and dynamically expanding the target attribute data according to the verification processing result of the target attribute data.
In some embodiments, the dynamic expansion apparatus 1100 for attribute data may be integrated into a terminal or a server having a storage and a processor and having an operation capability, such as a tablet computer, a sub-computer, a notebook computer, or the like, or the dynamic expansion apparatus 1100 for attribute data may be the terminal or the server.
In some embodiments, the present application further provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the steps in the method embodiments when executing the computer program.
The embodiment of the application also provides a computer readable storage medium for storing the computer program. The computer-readable storage medium can be applied to a computer device, and the computer program enables the computer device to execute a corresponding process in the method for dynamically extending attribute data in the embodiment of the present application, which is not described herein again for brevity.
Embodiments of the present application further provide a computer program product, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and executes the computer instruction, so that the computer device executes a corresponding process in the dynamic expansion method for attribute data in this embodiment.
Embodiments of the present application also provide a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and executes the computer instruction, so that the computer device executes the corresponding process in the dynamic expansion method of attribute data in the embodiment of the present application, which is not described herein again for brevity.
It should be understood that the processor of the embodiments of the present application may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method embodiments may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, or discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and combines hardware thereof to complete the steps of the method.
It will be appreciated that the memory in the embodiments of the subject application can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. The volatile Memory may be a Random Access Memory (RAM) which serves as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static random access memory (Static RAM, SRAM), dynamic Random Access Memory (DRAM), synchronous Dynamic random access memory (Synchronous DRAM, SDRAM), double Data Rate Synchronous Dynamic random access memory (DDR SDRAM), enhanced Synchronous SDRAM (ESDRAM), synchronous link SDRAM (SLDRAM), and Direct Rambus RAM (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
It should be understood that the above memories are exemplary but not limiting illustrations, for example, the memories in the embodiments of the present application may also be Static Random Access Memory (SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous Dynamic Random Access Memory (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (enhanced SDRAM, ESDRAM), synchronous Link DRAM (SLDRAM), direct Rambus RAM (DR RAM), and the like. That is, the memory in the embodiments of the present application is intended to comprise, without being limited to, these and any other suitable types of memory.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the technical solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer or a server) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (15)

1. A method for dynamically expanding attribute data is characterized by comprising the following steps:
acquiring target attribute data to be subjected to attribute dynamic expansion;
acquiring a target attribute data template corresponding to the target attribute data, wherein the target attribute data template is used for defining configuration information of each attribute of the attribute data, and the configuration information of each attribute comprises a key field included in each attribute and a use rule of a data type of each attribute;
performing flattening mapping processing on the target attribute data to obtain a first mapping relation, wherein the first mapping relation is a mapping relation between each attribute of the target attribute data and a value of each attribute;
performing dynamic attribute verification processing on the value of each attribute in the first mapping relation according to the configuration information of each attribute defined by the target attribute data template to obtain a verification processing result of the target attribute data;
and dynamically expanding the target attribute data according to the verification processing result of the target attribute data.
2. The method according to claim 1, wherein the performing the flattening mapping process on the target attribute data to obtain a first mapping relationship includes:
traversing parent node attributes in the target attribute data according to the hierarchical relationship among the attributes of the target attribute data to obtain the mapping relationship between each parent node attribute in the target attribute data and the value of each parent node attribute;
sequentially traversing child node attributes corresponding to each parent node attribute in the target attribute data under the condition that each parent node attribute is traversed, and obtaining a mapping relation between each child node attribute and a value corresponding to each child node attribute;
in the first mapping relationship, a child node attribute having a parent node corresponds to identification information, and the identification information is used for identifying the parent node attribute corresponding to the child node attribute.
3. The method of claim 1, wherein prior to said flattening mapping process on said target property data, said method further comprises:
and preprocessing the input attribute data to obtain the target attribute data, wherein the preprocessing comprises at least one of data type checking processing, regular expression checking processing and data value checking processing.
4. The method of claim 1, further comprising:
receiving a first attribute data template input by a user, wherein the first attribute data template is an initial data template capable of representing the hierarchical relationship among attributes of attribute data;
performing flattening mapping processing on the first attribute data template to obtain a second mapping relation, wherein the second mapping relation is a mapping relation between each attribute defined by the first attribute data template and configuration information of each attribute;
and determining the second mapping relation as the target attribute data template.
5. The method according to claim 4, wherein the performing the flattening mapping process on the first attribute data template to obtain the second mapping relationship includes:
according to the hierarchical relationship among the attributes in the first attribute data template, traversing the father node attributes in the first attribute data template to obtain the mapping relationship between each father node attribute and the configuration information of each father node attribute;
and sequentially traversing the child node attributes of each parent node attribute in the first attribute data template under the condition that each parent node attribute is traversed to obtain the mapping relation between each child node attribute and the configuration information of each child node attribute.
6. The method of claim 4, wherein prior to performing the flattening mapping process on the first attribute data template, the method further comprises:
and preprocessing the input first attribute data template, wherein the preprocessing comprises at least one of data type checking processing and data type checking processing.
7. The method of claim 4, wherein in the second mapping relationship, a child node attribute having a parent node corresponds to an identification information, and the identification information is used to identify a parent node attribute corresponding to the child node attribute, and the method further comprises:
determining a hierarchical relationship between attributes in the second mapping relationship according to the identification information of the attributes in the second mapping relationship;
according to the hierarchical relationship among the attributes in the second mapping relationship, traversing the father node attributes in the second mapping relationship, acquiring the information of each key field of each father node attribute, and mapping the information of each key field of each father node attribute to the corresponding field in the target format one by one;
and after traversing each father node attribute, traversing the child node attributes of each father node attribute, acquiring the information of each key field of each child node attribute, and mapping the information of each key field of each child node attribute to the corresponding field in the target format one by one to obtain the attribute data template of the target format.
8. The method according to any one of claims 1 to 7, wherein in the target attribute data template, an attribute name of each attribute is configured as a primary key, and other configuration information of each attribute is configured as a value corresponding to the primary key;
in the first mapping relation, the attribute name of each attribute is configured to be used as a main key, and the value of each attribute is used as the value corresponding to the main key; wherein, the performing, according to the configuration information of each attribute defined by the target attribute data template, a dynamic attribute verification process on the value of each attribute in the first mapping relationship includes:
sequentially acquiring each primary key in the first mapping relation, and determining whether the primary key exists in the target attribute data template;
and under the condition that the main key exists, obtaining a value corresponding to the main key in the first mapping relation, and performing data type verification processing or regular expression verification processing on the value of the main key.
9. The method according to claim 8, wherein the performing a dynamic attribute check process on the value of each attribute in the first mapping relationship according to the configuration information of each attribute defined by the target attribute data template includes:
and executing default value processing, mandatory item checking processing and at least one item of checking whether the attribute value is null or not on the attribute data which is not recorded in the target attribute data according to the configuration information of each attribute defined by the target attribute data template.
10. The method according to claim 9, wherein the performing at least one of a default value process, a mandatory item check process, and an attribute value null check process on the unregistered attribute data of the target attribute data according to the configuration information of each attribute defined by the target attribute data template includes:
if a first key field of a first attribute is not recorded, but the value of the first key field of the first attribute defined by the target attribute data template is not allowed to be empty, and the target attribute data template defines a default value of the first key field of the first attribute, the default value is used as the value of the first key field of the first attribute, and the target attribute data is updated; or
If the first key field of the first attribute is not recorded, but the value of the first key field of the first attribute is defined as a mandatory item by the target attribute data template, and the default value of the first key field of the first attribute is defined by the target attribute data template, the default value is used as the value of the first key field of the first attribute, and the target attribute data is updated.
11. The method according to claim 1, wherein the dynamically expanding the target attribute data according to the result of the verification processing of the target attribute data comprises:
and if the verification processing result of the target attribute is that the verification is passed, determining to dynamically expand the target attribute data, converting the target attribute data into a target format, and storing the target attribute data of the target format in a database.
12. The method of claim 11, further comprising:
receiving a query condition for attribute data input by a user;
taking the query condition as a main key of attribute data to be queried;
acquiring attribute data meeting the query condition from the database according to the primary key of the attribute data to be queried;
converting the data type of each attribute of the attribute data into the data type of each attribute defined by the target attribute data template;
converting the data format of the attribute data into the data format defined by the target attribute data template;
and outputting the attribute data according to the data format defined by the target attribute data template.
13. An apparatus for dynamically expanding attribute data, comprising:
the first acquisition module is used for acquiring target attribute data to be subjected to attribute dynamic expansion;
a second obtaining module, configured to obtain a target attribute data template corresponding to the target attribute data, where the target attribute data template is used to define configuration information of each attribute of the attribute data, and the configuration information of each attribute includes a key field included in each attribute and a usage rule of a data type of each attribute;
the flattening processing module is used for carrying out flattening mapping processing on the target attribute data to obtain a first mapping relation, wherein the first mapping relation is a mapping relation between each attribute of the target attribute data and a value of each attribute;
a verification processing module, configured to perform dynamic attribute verification processing on the value of each attribute in the first mapping relationship according to the configuration information of each attribute defined by the target attribute data template, to obtain a verification processing result of the target attribute data;
and the dynamic expansion module is used for dynamically expanding the target attribute data according to the verification processing result of the target attribute data.
14. An apparatus for dynamically expanding attribute data, comprising: a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any of claims 1-12 via execution of the executable instructions.
15. A computer-readable storage medium for storing a computer program which causes a computer to perform the method of any one of claims 1 to 12.
CN202110378964.XA 2021-04-08 2021-04-08 Method and device for dynamically expanding attribute data and storage medium Pending CN115203491A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110378964.XA CN115203491A (en) 2021-04-08 2021-04-08 Method and device for dynamically expanding attribute data and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110378964.XA CN115203491A (en) 2021-04-08 2021-04-08 Method and device for dynamically expanding attribute data and storage medium

Publications (1)

Publication Number Publication Date
CN115203491A true CN115203491A (en) 2022-10-18

Family

ID=83570693

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110378964.XA Pending CN115203491A (en) 2021-04-08 2021-04-08 Method and device for dynamically expanding attribute data and storage medium

Country Status (1)

Country Link
CN (1) CN115203491A (en)

Similar Documents

Publication Publication Date Title
US11876910B2 (en) Systems, methods, and apparatuses for implementing a multi tenant blockchain platform for managing Einstein platform decisions using distributed ledger technology (DLT)
US11875400B2 (en) Systems, methods, and apparatuses for dynamically assigning nodes to a group within blockchains based on transaction type and node intelligence using distributed ledger technology (DLT)
Zhang et al. Towards Dependable, Scalable, and Pervasive Distributed Ledgers with Blockchains.
CN108846659B (en) Block chain-based transfer method and device and storage medium
CN107577427B (en) data migration method, device and storage medium for blockchain system
TWI726573B (en) Block chain-based data compression and query method and device and electronic equipment
CN108572986B (en) Data updating method and node equipment
CN109684607B (en) JSON data analysis method and device, computer equipment and storage medium
US10795882B2 (en) Blockchain-based data compression and searching
CN111066047A (en) Implementing a blockchain based workflow
US11775507B2 (en) Methods and apparatuses for reading and updating data structures, and electronic devices
WO2023020242A1 (en) Blockchain-based data processing method and apparatus, computer device, computer-readable storage medium, and computer program product
CN111010282B (en) Block chain-based information processing method, related device and storage medium
US7664779B1 (en) Processing of a generalized directed object graph for storage in a relational database
Garcia Bringas et al. BlockChain platforms in financial services: current perspective
EP3974960B1 (en) Method and system for automated testing of web service apis
JP2023554417A (en) Blockchain transaction generation and validation
CN112395339B (en) Intersystem data admission verification method, device, computer equipment and storage medium
WO2023092986A1 (en) Cross-chain data transfer method and system based on decentralized identity identifier
US20230306128A1 (en) Systems and methods for using secure, encrypted communications across distributed computer networks to provide variable resiliency when indexing blockchain states for performing blockchain operations in decentralized applications using cryptography-based digital repositories
US20230269086A1 (en) Systems and methods for using secure, encrypted communications across distributed computer networks to efficiently index blockchain states for performing blockchain operations in decentralized applications using cryptography-based digital repositories
CN115203491A (en) Method and device for dynamically expanding attribute data and storage medium
US20230269085A1 (en) Systems and methods for using secure, encrypted communications across distributed computer networks to efficiently update cryptography-based digital repositories for performing blockchain operations in decentralized applications
CN112269915B (en) Service processing method, device, equipment and storage medium
CN114844904A (en) System and method for cross-block chain interaction

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40075611

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination