Method, device and electronic equipment for converting owl data into graph data

By parsing the type parameters of OWL node data, establishing the relationships between OWL instances and converting them into graph data, the incompatibility problem between OWL data and graph data is solved, realizing the conversion of OWL data to graph data, saving creation costs and quickly building a graph database.

CN116108112BActive Publication Date: 2025-11-21HARBIN ANTIY TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211610753.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-14
Publication Date
2025-11-21
Estimated Expiration
2042-12-14

AI Technical Summary

Technical Problem

In existing technologies, OWL data is incompatible with graph data, making it impossible to convert an existing OWL data knowledge base into graph data, resulting in a waste of resources.

Method used

By parsing the type parameters of OWL node data, the association between OWL instances is established, and the OWL instances are converted into vertex data and edge data in graph data to construct the rule schema statement of the graph database.

Benefits of technology

It enables the conversion of OWL data to graph data, saving the cost of creating graph data, avoiding resource waste, and enabling the rapid creation of graph databases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116108112B_ABST
    Figure CN116108112B_ABST
Patent Text Reader

Abstract

The application provides a conversion method, device and electronic equipment for converting OWL data into graph data, and the method comprises the following steps: based on a loaded OWL data knowledge base, type parameters of a corresponding type are parsed from each OWL node data; the type comprises at least one of an OWL attribute, an OWL class, an OWL relationship and an OWL instance; based on the parsed type parameters, an association relationship between OWL instances is established; each OWL instance is converted into vertex data, and the association relationship between two OWL instances is converted into edge data between the two OWL instances; and the vertex data and the edge data are combined to form graph data. According to the scheme, the OWL data in the created OWL data knowledge base can be converted into graph data, the creation cost of the graph data is saved, and resource waste is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of data processing, in particular to a conversion method, device and electronic equipment for converting OWL data into graph data. BACKGROUND

[0002] OWL data is developed from ontology language, and can be constructed by ontology modeling tool software. With the rapid development of graph database technology, it is inevitable to store ontology data in the form of graph data. However, the current OWL data and graph data are incompatible, and the OWL data knowledge base which has been constructed at a large cost cannot be converted into graph data, which causes waste of resource cost. Therefore, it is urgent to provide a method for converting OWL data into graph data. SUMMARY

[0003] Embodiments of the present application provide a method, device and electronic equipment for converting OWL data into graph data, which can realize the conversion of OWL data into graph data to reduce the waste of resource cost.

[0004] In a first aspect, embodiments of the present application provide a method for converting OWL data into graph data, comprising:

[0005] Based on the loaded OWL data knowledge base, a type parameter of a corresponding type is parsed from each OWL node data; the type includes at least one of OWL property, OWL class, OWL relationship and OWL instance;

[0006] Based on the parsed type parameter, an association relationship between OWL instances is established.

[0007] Each OWL instance is converted into vertex data, and the association relationship between two OWL instances is converted into edge data between the two OWL instances; wherein the vertex data and the edge data are combined to form graph data.

[0008] In a possible implementation, before the type parameter of the corresponding type is parsed from each OWL node data, the method further comprises:

[0009] The OWL node data is converted into triple data including subject, predicate and object; and the type of the corresponding OWL node data is determined based on the subject in the converted triple data.

[0010] In a possible implementation, the type parameter of the corresponding type is parsed from each OWL node data, comprising:

[0011] When the type of the OWL node data is an OWL property, the type parameters of the corresponding type include at least one of a property number, a property name, a property value, and a parent property;

[0012] When the type of the OWL node data is an OWL class, the type parameters of the corresponding type include at least one of a class number, a class name, a parent class, and a property number;

[0013] When the type of the OWL node data is an OWL relationship, the type parameters of the corresponding type include at least one of a relationship number, a relationship name, a parent relationship, a number of a starting point of a relationship arrow connection, and a number of a target point of the relationship arrow connection;

[0014] When the type of the OWL node data is an OWL instance, the type parameters of the corresponding type include at least one of an instance number, an instance name, and an association number.

[0015] In a possible implementation, the association number includes a property number, a class number, and a relationship number;

[0016] The establishing of the association relationship between the OWL instances based on the parsed type parameters includes:

[0017] For each OWL instance, the following is performed: based on an association number included in type parameters of the OWL instance, a relationship list associated with the OWL instance is determined; and based on type parameters of each target relationship in the relationship list, other OWL instances associated with the OWL instance and an association relationship between the OWL instance and the other OWL instances are determined.

[0018] In a possible implementation, the method further includes: for each OWL instance, based on an association number included in type parameters of the OWL instance, a parent class of the OWL instance and a property list associated with the OWL instance are determined;

[0019] The converting of each OWL instance into vertex data includes: corresponding vertex data is generated according to the parent class of the OWL instance and each property associated with the OWL instance.

[0020] In a possible implementation, the method further includes:

[0021] A rule Schema statement of a graph database is constructed based on the parsed type parameters;

[0022] A corresponding graph database is created according to the converted graph data and the rule Schema statement.

[0023] In a possible implementation, the constructing of the rule Schema statement of the graph database based on the parsed type parameters includes:

[0024] generating the attribute Schema statement based on the type parameter of the OWL attribute, generating the node Schema statement and the index Schema statement based on the type parameter of the OWL class, and generating the edge Schema statement based on the type parameter of the OWL relationship;

[0025] integrating the attribute Schema statement, the node Schema statement, the index Schema statement and the edge Schema statement into a rule Schema statement used for representing the graph database rule.

[0026] In a second aspect, an apparatus for converting OWL data into graph data is provided, and the apparatus comprises:

[0027] a parsing unit configured to parse a type parameter of a corresponding type from each OWL node data based on the loaded OWL data knowledge base, wherein the type comprises at least one of an OWL attribute, an OWL class, an OWL relationship and an OWL instance;

[0028] a relationship establishing unit configured to establish an association relationship between the OWL instances based on the parsed type parameter;

[0029] a converting unit configured to convert each OWL instance into vertex data and convert an association relationship between two OWL instances into edge data between the two OWL instances, wherein the vertex data and the edge data are combined to form the graph data.

[0030] In a third aspect, an electronic device is provided, which comprises a memory and a processor, and the memory stores a computer program, and the processor executes the computer program to implement the method described in any of the embodiments of the present specification.

[0031] In a fourth aspect, a computer readable storage medium is provided, which stores a computer program, and when the computer program is executed in a computer, the computer is caused to execute the method described in any of the embodiments of the present specification.

[0032] The embodiment of the present application provides a method, device and electronic equipment for converting OWL data into graph data, each OWL node in an OWL data knowledge base is parsed to parse type parameters of types such as OWL attributes, OWL classes, OWL relationships and OWL instances, then the relationship between OWL instances is established based on the parsed type parameters, and each OWL instance is converted into vertex data in graph data, and the association relationship between two OWL instances is converted into edge data between the two OWL instances in graph data. It can be seen that in the present scheme, the OWL data in the created OWL data knowledge base can be converted into graph data, which not only saves the creation cost of graph data, but also avoids resource waste. BRIEF DESCRIPTION OF DRAWINGS

[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0034] Figure 1 It is a method flow chart for converting OWL data into graph data provided by an embodiment of the present application;

[0035] Figure 2 It is a hardware architecture diagram of an electronic equipment provided by an embodiment of the present application;

[0036] Figure 3 It is a device structure diagram for converting OWL data into graph data provided by an embodiment of the present application;

[0037] Figure 4 It is another device structure diagram for converting OWL data into graph data provided by an embodiment of the present application. DETAILED DESCRIPTION

[0038] In order to make the purpose, technical scheme and advantages of the embodiments of the present application more clear, the technical scheme in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present application.

[0039] As mentioned above, the current OWL data is incompatible with the graph data, and the OWL data cannot be converted into the graph data. In order to avoid the waste of the OWL data knowledge base which has been constructed at a large cost, a method for converting the OWL data into the graph data is needed.

[0040] Through analysis, the OWL data contains instances, attributes, classes, relationships and the like, and the graph data is composed of vertex data and edge data, wherein the vertex data is an instance node in a graph, that is, corresponding to the instance in the OWL data, and the edge data is used to represent the relationship between two instance nodes. Therefore, the association relationship between the OWL instances needs to be sorted out from the OWL data, and then the conversion from the OWL data to the graph data can be realized.

[0041] The specific implementation of the above concept is described below.

[0042] Please refer to Figure 1 The embodiment of the present application provides a method for converting the OWL data into the graph data, which comprises the following steps.

[0043] In step 100, based on the loaded OWL data knowledge base, the type parameters of the corresponding types are parsed from each OWL node data; the types include at least one of the OWL attribute, the OWL class, the OWL relationship and the OWL instance;

[0044] In step 102, based on the parsed type parameters, the association relationship between the OWL instances is established.

[0045] In step 104, each OWL instance is converted into vertex data, and the association relationship between two OWL instances is converted into edge data between the two OWL instances; wherein the vertex data and the edge data are combined to form the graph data.

[0046] In the embodiment of the present application, each OWL node in the OWL data knowledge base is parsed to parse the type parameters of the types such as the OWL attribute, the OWL class, the OWL relationship and the OWL instance, and then the relationship between the OWL instances is established based on the parsed type parameters, and each OWL instance is converted into the vertex data in the graph data, and the association relationship between two OWL instances is converted into the edge data between the two OWL instances in the graph data. It can be seen that in the present scheme, the OWL data in the OWL data knowledge base which has been created can be converted into the graph data, which not only saves the creation cost of the graph data, but also avoids the waste of resources.

[0047] The execution mode of each step is described below. Figure 1

[0048] ​Firstly, for step 100, based on the loaded OWL data knowledge base, a type parameter of a corresponding type is parsed from each OWL node data.

[0049] The OWL data knowledge base has been constructed and contains a large amount of OWL node data, and the OWL data knowledge base can correspond to different fields, such as social networks, enterprise information queries, advertisement recommendations, anti-black reconnaissance, financial control, anti-virus, and big data security governance.

[0050] When loading the OWL data knowledge base, the OWL data knowledge base can be read into the memory by calling the OWL operation API. It can be understood that if the content of the OWL data knowledge base is huge, a batch reading method can also be used.

[0051] The types of different OWL node data can be different. In the embodiment of the application, the type can include at least one of an OWL attribute, an OWL class, an OWL relationship, and an OWL instance.

[0052] Since the contents represented by different types of OWL node data are different, the type of the OWL node data needs to be determined. In an embodiment of the application, since the most basic component unit of the knowledge graph is a triple, the OWL node data can be converted into triple data including a subject, a predicate, and an object before a type parameter of a corresponding type is parsed from each OWL node data; and the type of the corresponding OWL node data is determined based on the subject in the converted triple data.

[0053] Specifically, if the subject is "owl:DatatypeProperty", the type of the OWL node data is an OWL attribute; if the subject is "owl:Class", the type of the OWL node data is an OWL class; if the subject is "owl:ObjectProperty", the type of the OWL node data is an OWL relationship; and if the subject is "owl:NamedIndividual", the type of the OWL node data is an OWL instance.

[0054] By converting the OWL node data into triples, not only can the OWL node data be quickly determined based on the subject, but also the parsing of the type parameter can be further implemented based on the converted triple data, so that the parsing speed is faster and the parsing result is more accurate.

[0055] In the embodiment of the application, when the type parameter of the OWL node data is parsed, the type parameters parsed from different types of OWL node data are different, and the following describes the four types of OWL attributes, OWL classes, OWL relationships, and OWL instances.

[0056] 1. OWL property

[0057] When the type of the OWL node data is an OWL property, the type parameters of the corresponding type include at least one of a property number, a property name, a property value, and a parent property.

[0058] For example, when the OWL node data is converted into triple data, the following contents are included:

[0059] webprotege:R8PecQtpAfUbFJOXAkjgxfx rdf:type owl:DatatypeProperty;

[0060] rdfs:subPropertyof webprotege:R7HhgK4LKmVCmSITBATtfk;

[0061] rdfs:label“Microsoft number”.

[0062] Among them, “owl:DatatypeProperty” is used to represent that the type of the OWL node data is an OWL property, “webprotege:R8PecQtpAfUbFJOXAkjgxfx” is the property number, “rdfs:subPropertyof webprotege:R7HhgK4LKmVCmSITBATtfk” is used to represent the number of the parent property of the property, and “rdfs:label“Microsoft number”” represents that the property name is “Microsoft number”.

[0063] 2. OWL class

[0064] When the type of the OWL node data is an OWL class, the type parameters of the corresponding type include at least one of a class number, a class name, a parent class, and a property number.

[0065] For example, when the OWL node data is converted into triple data, the following contents are included:

[0066] webprotege:R7cn62Ud4WBZU1h35iofxUe rdf:type owl:Class;

[0067] rdfs:subClassOf webprotege:RCz96sb7bpGTdFgksiLvx9A;

[0068] rdfs:label“Local user account”.

[0069] Wherein, "rdf:type owl:Class" is used to represent the type of the OWL node data as OWL class, "webprotege:R7cn62Ud4WBZU1h35iofxUe" is the class number, "rdfs:subClassOf webprotege:RCz96sb7bpGTdFgksiLvx9A" is used to represent the parent class number of the class, and "rdfs:label "Local user account"" represents the class name as "Local user account".

[0070] 3. OWL relationship

[0071] When the type of the OWL node data is OWL relationship, the type parameters of the corresponding type include at least one of the following: relationship number, relationship name, parent relationship, number of starting point of relationship arrow connection, and number of target point of relationship arrow connection.

[0072] For example, when the OWL node data is converted into triple data, it includes the following contents:

[0073] webprotege:R7PqwcUrjrwNgwgBgaA7BzI rdf:type owl:ObjectProperty;

[0074] rdfs:subPropertyof webprotege:R85VwQHYSwSBbW9zEF5Cs91;

[0075] rdfs:label "Connection".

[0076] Wherein, "owl:ObjectProperty" is used to represent the type of the OWL node data as OWL relationship, "webprotege:R7PqwcUrjrwNgwgBgaA7BzI" is the relationship number, "rdfs:subPropertyof webprotege:R85VwQHYSwSBbW9zEF5Cs91" is used to represent the parent relationship number of the relationship, and "rdfs:label "Connection"" represents the relationship name as "Connection".

[0077] 4. OWL instance

[0078] When the type of the OWL node data is OWL instance, the type parameters of the corresponding type include at least one of the following: instance number, instance name, and association number.

[0079] For example, when the OWL node data is converted into triple data, it includes the following contents:

[0080] webprotege RZe1hhdnfgSDODmTozuP1g rdf:type owl:NamedIndividual

[0081] webprotege:Rt2yaDAB6mIW1qIRMLKfJL;

[0082] webprotege:R7PqwcUrjrWgwgBgaA7BzI

[0083] webprotege:RDQOF9GYoB3564P2jP79gMV,

[0084] webprotege:RDqd28N1p4iEf4s1J3FT4I9;

[0085] rdfs:1abe1 "Switch A".

[0086] Wherein, the "owl:NamedIndividual" is used to represent the type of the OWL node data as an OWL instance, the "webprotege RZe1hhdnfgSDODmTozuP1g" is an instance number, the "webprotege:Rt2yaDAB6mIW1qIRMLKfJL" "webprotege:R7PqwcUrjrWgwgBgaA7BzI" "webprotege:RDQOF9GYoB3564P2jP79gMV" and "webprotege:RDqd28N1p4iEf4s1J3FT4I9" are all associated numbers corresponding to the instance, which can be attribute numbers, class numbers and relationship numbers; the "rdfs:1abe1 "Switch A"" represents that the instance name is "Switch A".

[0087] It should be noted that the above examples are all examples in actual application, and other type parameters can be included in addition to the type parameters involved in the above examples.

[0088] Then, for step 102, based on the parsed type parameters, the association relationship between the OWL instances is established.

[0089] In order to realize the conversion of the OWL data into the graph data, the commonness between the two needs to be found out. Firstly, the relations of each type in the OWL data are as follows: the OWL property belongs to the OWL class, the OWL instance is derived from the OWL class, the OWL relationship exists between the OWL instances, and the attribute value of the OWL property fills the OWL instance. Then, the graph data includes vertex data and edge data, wherein the vertex data is used to form an instance node in the graph, that is, corresponds to the OWL instance in the OWL data, and the OWL property and the OWL class can be used as the description information of the OWL instance, in addition, the edge data is used to represent the association relationship between the instance nodes, therefore, the association relationship between the OWL instances needs to be sorted out.

[0090] In an embodiment of the present application, the association relationship between the OWL instances can be established in the following manner:

[0091] For each OWL instance, the following is performed: based on the association number included in the type parameter of the OWL instance, the relationship list associated with the OWL instance is determined; and according to the type parameter of each target relationship in the relationship list, the other OWL instance associated with the OWL instance and the association relationship between the OWL instance and the other OWL instance are determined.

[0092] When the analysis of all the OWL node data in the OWL data knowledge base is completed, the instance set can be formed based on the instance number of the OWL instance, the property set can be formed based on the OWL property, the class set can be formed based on the OWL class, and the relationship set can be formed based on the relationship number of the OWL relationship. Therefore, in the embodiment of the present application, the association relationship of each OWL instance can be confirmed by traversing the instance set.

[0093] In the confirmation of the association relationship of the current OWL instance, since the association number in the type parameter of the OWL instance includes one or more relationship numbers, the one or more relationship numbers can be stored in the list, thereby forming the relationship list associated with the OWL instance. Further, since the type parameter of the OWL relationship includes the number of the starting point of the relationship arrow connection and the number of the target point of the relationship arrow connection, the other OWL instance associated with the OWL instance can be determined based on the type parameter of each target relationship in the relationship list, and the type parameter of the OWL relationship further includes the relationship name, therefore, the association relationship between the OWL instance and the other OWL instance can be determined.

[0094] In addition, since the association number in the type parameter of the OWL instance further includes the attribute number and the class number, the parent class of the OWL instance and the attribute list associated with the OWL instance can be determined based on the association number included in the type parameter of the OWL instance for each OWL instance; specifically, the parent class to which the OWL instance belongs can be determined based on the class number, and the attribute list of the OWL instance can be determined based on the attribute number, and the parent class to which the OWL instance belongs and the attributes in the attribute list of the OWL instance can be used as the description information of the OWL instance, so as to facilitate the conversion of subsequent vertex data.

[0095] Further, all OWL instances belonging to the same parent class can be determined according to the parent class to which the OWL instance belongs, and then the OWL instances belonging to the same parent class can be determined as the same class instance.

[0096] Finally, for step 104, each OWL instance is converted into vertex data, and the association relationship between two OWL instances is converted into edge data between the two OWL instances; wherein the vertex data and the edge data are combined to form graph data.

[0097] According to the foregoing analysis, the OWL instance can be used as an instance node in the graph data, and therefore, the corresponding vertex data can be generated according to the parent class of the OWL instance and the attributes associated with the OWL instance. Specifically, when generating the vertex data, the corresponding vertex data statements can be created based on these information, so as to facilitate the subsequent creation of the graph database.

[0098] Since the OWL instance can be used as an instance node in the graph data, and the edge data of the graph data is used to represent the association relationship between two instance nodes, for the association relationship between the OWL instances established in step 102, the edge data between any two OWL instances having an association relationship can be formed. Similarly, when generating the edge data, the corresponding edge data statements can be created based on these information, so as to facilitate the subsequent creation of the graph database.

[0099] Further, the vertex data statements and the edge data statements are combined to form graph data creation statements.

[0100] The conversion of the OWL data into the graph data is completed.

[0101] After obtaining the graph data, in order to uniformly manage the graph data, it can be exported to the graph database. Therefore, the method can further include: constructing a rule Schema statement of the graph database based on the parsed type parameter; and creating a corresponding graph database based on the graph data formed after the conversion and the rule Schema statement.

[0102] The rule Schema statement is used to represent the generation rule of the graph database, and the generation rule is based on the obtained OWL data knowledge base. Specifically, the rule Schema statement for constructing the graph database based on the parsed type parameters can include:

[0103] The attribute Schema statement is generated based on the type parameters of the parsed OWL attribute, the node Schema statement and the index Schema statement are generated based on the type parameters of the parsed OWL class, and the edge Schema statement is generated based on the type parameters of the parsed OWL relationship.

[0104] The attribute Schema statement, the node Schema statement, the index Schema statement and the edge Schema statement are integrated into the rule Schema statement for representing the rule of the graph database.

[0105] The attribute Schema statement is generated based on the type parameters of the parsed OWL attribute, such as attribute number, attribute name, attribute value, data type, length, whether it is mandatory, etc. The node Schema statement and the index Schema statement are generated based on the type parameters of the parsed OWL class, such as class number, class name, attribute list, whether the attribute is null, etc., and the index Schema statement is used for data retrieval. The edge Schema statement is generated based on the type parameters of the parsed OWL relationship, such as relationship number, relationship name, starting point number, target point number, connection direction, whether it can be repeated, etc. After the above Schema statements are generated, the Schema statements are integrated together to form the rule Schema statement of the graph database.

[0106] When the graph database is created, the converted graph data and the rule Schema statement can be exported into a corresponding graph database file, and the graph database can be created by using the file. The method for creating the graph database by using the graph data and the rule Schema statement is prior art, and will not be described in detail here.

[0107] As shown in Figure 2 , Figure 3 The embodiment of the present application provides a device for converting OWL data into graph data. The device embodiment can be realized by software, or by hardware or a combination of software and hardware. From the hardware layer, as shown in Figure 2 is a hardware architecture diagram of an electronic device provided by the device for converting OWL data into graph data, and in addition to Figure 2In addition to the processor, the memory, the network interface, and the non-volatile memory shown, the electronic device in which the apparatus in the embodiment is located can also generally include other hardware, such as a forwarding chip responsible for processing packets, and the like. For example, in the case of software implementation, as shown in the figure, as a logically meaningful apparatus, it is formed by the CPU of the electronic device in which it is located reading the corresponding computer program in the non-volatile memory into the memory and running. The apparatus for converting OWL data into graph data provided in the embodiment comprises: Figure 3

[0108] The parsing unit 301 is configured to parse type parameters of a corresponding type from each OWL node data based on the loaded OWL data knowledge base; the type comprises at least one of an OWL attribute, an OWL class, an OWL relationship, and an OWL instance.

[0109] The relationship establishing unit 302 is configured to establish an association relationship between OWL instances based on the parsed type parameters.

[0110] The converting unit 303 is configured to convert each OWL instance into vertex data and convert an association relationship between two OWL instances into edge data between the two OWL instances; and the vertex data and the edge data are combined to form graph data.

[0111] In an embodiment of the present application, the parsing unit is further configured to convert the OWL node data into triple data comprising a subject, a predicate, and an object; and determine the type of the corresponding OWL node data based on the subject in the converted triple data.

[0112] In an embodiment of the present application, when the parsing unit parses type parameters of a corresponding type from each OWL node data, the parsing unit is specifically configured to:

[0113] When the type of the OWL node data is an OWL attribute, the type parameters of the corresponding type comprise at least one of an attribute number, an attribute name, an attribute value, and a parent attribute.

[0114] When the type of the OWL node data is an OWL class, the type parameters of the corresponding type comprise at least one of a class number, a class name, a parent class, and an attribute number.

[0115] When the type of the OWL node data is an OWL relationship, the type parameters of the corresponding type comprise at least one of a relationship number, a relationship name, a parent relationship, a number of a starting point of a relationship arrow connection, and a number of a target point of the relationship arrow connection.

[0116] When the type of the OWL node data is an OWL instance, the type parameters of the corresponding type comprise at least one of an instance number, an instance name, and an association number. ​

[0117] In one embodiment of the present application, the association number comprises an attribute number, a class number and a relationship number.

[0118] The relationship establishing unit is specifically configured to: for each OWL instance, determine a relationship list associated with the OWL instance based on the association number included in the type parameter of the OWL instance; and determine other OWL instances associated with the OWL instance and the association relationship between the OWL instance and the other OWL instances according to the type parameter of each target relationship in the relationship list.

[0119] In one embodiment of the present application, the parsing unit is further configured to: for each OWL instance, determine the parent class of the OWL instance and the attribute list associated with the OWL instance based on the association number included in the type parameter of the OWL instance.

[0120] The conversion unit is specifically configured to generate corresponding vertex data according to the parent class of the OWL instance and the attributes associated with the OWL instance when converting each OWL instance into vertex data.

[0121] In one embodiment of the present application, please refer to Figure 4 The device can further comprise:

[0122] The schema constructing unit 304 is configured to construct a rule Schema statement of the graph database based on the parsed type parameter;

[0123] The graph database creating unit 305 is configured to create a corresponding graph database according to the graph data formed after the conversion and the rule Schema statement.

[0124] In one embodiment of the present application, the schema constructing unit is specifically configured to: generate an attribute Schema statement based on the type parameter of the OWL attribute, generate a node Schema statement and an index Schema statement based on the type parameter of the OWL class, and generate an edge Schema statement based on the type parameter of the OWL relationship; and integrate the attribute Schema statement, the node Schema statement, the index Schema statement and the edge Schema statement into a rule Schema statement used to represent the rule of the graph database.

[0125] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the device for converting OWL data into graph data. In other embodiments of the present application, the device for converting OWL data into graph data can comprise more or fewer components than shown, or combine certain components, or split certain components, or different arrangement of components. The components shown can be realized by hardware, software or a combination of software and hardware.

[0126] The information interaction, execution process and the like between the modules in the device are based on the same concept as the method embodiments of the present application, and the specific content can be referred to the description in the method embodiments of the present application, which will not be repeated here.

[0127] The embodiment of the present application further provides an electronic device, including a memory and a processor, the memory stores a computer program, and the processor executes the computer program to realize the method for converting the OWL data into the graph data in any embodiment of the present application.

[0128] The embodiment of the present application further provides a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is executed by a processor to make the processor execute the method for converting the OWL data into the graph data in any embodiment of the present application.

[0129] Specifically, a system or device provided with a storage medium can be provided, the storage medium stores the software program code for realizing the functions of any embodiment of the above-mentioned embodiments, and the computer (or CPU or MPU) of the system or device reads and executes the program code stored in the storage medium.

[0130] In this case, the program code read from the storage medium can realize the functions of any one of the above-mentioned embodiments, and therefore the program code and the storage medium storing the program code constitute a part of the present application.

[0131] The storage medium for providing the program code includes a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card and a ROM. Alternatively, the program code can be downloaded from a server computer through a communication network.

[0132] In addition, it should be clear that not only the program code read by the computer can be executed, but also part or all of the actual operations can be completed by the operating system and the like operating on the computer based on the instructions of the program code, so as to realize the functions of any one of the above-mentioned embodiments.

[0133] In addition, it can be understood that the program code read from the storage medium is written into the memory provided in the expansion board inserted into the computer or the memory provided in the expansion module connected with the computer, and then part and all of the actual operations are executed by the CPU and the like installed on the expansion board or the expansion module based on the instructions of the program code, so as to realize the functions of any one of the above-mentioned embodiments.

[0134] It should be noted that, in the present document, relational terms such as first and second and the like can be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0135] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware, and the foregoing program can be stored in a computer readable storage medium, and the program performs the steps of the above-mentioned method embodiments when executed; and the foregoing storage medium includes various storage media that can store program codes, such as ROM, RAM, magnetic disk or optical disk.

[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method of converting OWL data into graph data, characterized by, The method comprises the following steps: Based on the loaded OWL data knowledge base, the type parameters of each OWL node data are parsed according to the corresponding type; the type includes at least one of the following: OWL attribute, OWL class, OWL relationship and OWL instance; Based on the parsed type parameters, the association relationship between the OWL instances is established; Each OWL instance is converted into vertex data, and the association relationship between two OWL instances is converted into edge data between the two OWL instances; wherein the vertex data and the edge data are combined to form graph data; Before the step of parsing the type parameters of each OWL node data according to the corresponding type, the method further comprises the following steps: Converting the OWL node data into triple data comprising subject, predicate and object; judging the type of the corresponding OWL node data based on the subject in the converted triple data; The step of parsing the type parameters of each OWL node data according to the corresponding type comprises the following steps: When the type of the OWL node data is an OWL attribute, the type parameters of the corresponding type include at least one of the following: attribute number, attribute name, attribute value and parent attribute; When the type of the OWL node data is an OWL class, the type parameters of the corresponding type include at least one of the following: class number, class name, parent class and attribute number; When the type of the OWL node data is an OWL relationship, the type parameters of the corresponding type include at least one of the following: relationship number, relationship name, parent relationship, the number of the starting point of the relationship arrow connection and the number of the target point of the relationship arrow connection; 2. The method of claim 1, wherein, When the type of the OWL node data is an OWL instance, the type parameters of the corresponding type include at least one of the following: instance number, instance name and association number. The association number includes attribute number, class number and relationship number; The step of establishing the association relationship between the OWL instances based on the parsed type parameters comprises the following steps:

3. The method of claim 1, wherein, For each OWL instance, the following steps are performed: based on the association number included in the type parameters of the OWL instance, a relationship list associated with the OWL instance is determined; according to the type parameters of each target relationship in the relationship list, other OWL instances associated with the OWL instance and the association relationship between the OWL instance and the other OWL instances are determined. The method further comprises the following steps: For each OWL instance, based on the association number included in the type parameters of the OWL instance, the parent class of the OWL instance and the attribute list associated with the OWL instance are determined; 4. The method according to any one of claims 1 to 3, characterized in that, The step of converting each OWL instance into vertex data comprises the following steps: according to the parent class of the OWL instance and the attributes associated with the OWL instance, corresponding vertex data is generated. The method further comprises the following steps: Based on the parsed type parameters, a rule Schema statement of the graph database is constructed; 5. The method of claim 4, wherein, According to the converted graph data and the rule Schema statement, a corresponding graph database is created. The step of constructing the rule Schema statement of the graph database based on the parsed type parameters comprises the following steps: generating an attribute Schema statement based on a type parameter of an OWL attribute, generating a node Schema statement and an index Schema statement based on a type parameter of an OWL class, and generating an edge Schema statement based on a type parameter of an OWL relationship; integrating the attribute Schema statement, the node Schema statement, the index Schema statement and the edge Schema statement into a rule Schema statement used for representing a graph database rule.

6. An apparatus for converting OWL data into graph data, the apparatus comprising: The apparatus is used for implementing the method in any of claims 1-5, and the apparatus comprises: a parsing unit, configured to parse a type parameter of a corresponding type from each OWL node data based on a loaded OWL data knowledge base, wherein the type comprises at least one of an OWL attribute, an OWL class, an OWL relationship and an OWL instance; a relationship establishing unit, configured to establish an association relationship between the OWL instances based on the parsed type parameter; a converting unit, configured to convert each OWL instance into vertex data and convert an association relationship between two OWL instances into edge data between the two OWL instances, wherein the vertex data and the edge data are combined to form graph data.

7. An electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method in any of claims 1-5.

8. A computer readable storage medium, having a computer program stored thereon, wherein the computer program, when executed in a computer, causes the computer to perform the method in any of claims 1-5.

Citation Information

Patent Citations

  • Graph data synthesis method and device, computer equipment and storage medium

    CN112231422A

  • Tool to build and store a data model and queries for a graph database

    US20220342932A1