SPARQL statement reordering, bim model checking method and device based on sparql reordering

By reordering the SPARQL check statements and establishing a component relationship constraint diagram, the problem of low query efficiency of BIM model inspection tools under large data volumes was solved, achieving more efficient model inspection.

CN114064708BActive Publication Date: 2025-10-21TSINGHUA UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111412372.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-25
Publication Date
2025-10-21
Estimated Expiration
2041-11-25

AI Technical Summary

Technical Problem

Existing BIM model inspection tools have low query efficiency when dealing with simple RDF data structures and large data volumes, and existing optimization methods are not effective.

Method used

By reordering the SPARQL check statements and establishing a component relationship constraint graph, the SPARQL check statements are reordered based on the component relationship constraint graph, reducing duplicate queries.

Benefits of technology

It improves the efficiency of BIM model inspection, especially when the RDF data structure is simple and the data volume is large, reducing the number of repeated queries and improving the query speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114064708B_ABST
    Figure CN114064708B_ABST
Patent Text Reader

Abstract

The application discloses a SPARQL statement reordering, a BIM model checking method and device based on SPARQL reordering, and can improve the checking efficiency of a BIM model. The method comprises the following steps: determining a target component according to the predicate of a SPARQL checking statement generated based on a building rule description language SNL rule; grouping a plurality of SPARQL checking statements, dividing the SPARQL checking statements related to the same target component into the same group, and obtaining SPARQL checking statement segments of different target components; traversing the SPARQL checking statement segments of each target component, if the subject and the object in the currently traversed SPARQL checking statement are both components, connecting a directed edge from the SPARQL checking statement segment with the subject as the target component to the SPARQL checking statement segment with the object as the target component, and generating a component relationship constraint graph after the traversal ends; and reordering the SPARQL checking statement segments of different target components according to the component relationship constraint graph, and obtaining the SPARQL checking statement corresponding to the SNL rule after reordering.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of building technology, and in particular to a SPARQL statement reordering method and a BIM model checking method and device based on SPARQL reordering. Background Art

[0002] BIM (Building Information Model) is a technology for building information applications based on three-dimensional models. It can be effectively applied to the planning, design, construction, and management of buildings and infrastructure, and is one of the most promising technologies in the architecture, engineering, and construction stages. In the process of promoting and implementing BIM technology, implementing building code reviews based on BIM models plays a vital role in promoting the progress and development of the BIM industry.

[0003] In related technologies, the building code review tool BIMChecker can be used to review the BIM model to determine whether the building corresponding to the BIM model complies with the code. The basic flow chart of the BIMChecker tool for model checking is as follows: Figure 1 As shown, the overall process can be briefly divided into the following three steps: (1) converting the Revit model (or AutoCad model, IFC model, etc.) into a TTL (the Terse RDF Triple Language) model for checking; (2) converting the SNL (Structural Natural Language, building specification description language) rules written by the user according to the building specification provisions into SPARQL check statements used for model checking; (3) using SPARQL queries to check the TTL model and output the query results as the check results. TTL is a simplified expression of the Resource Description Framework (RDF).

[0004] Inspection efficiency is a key criterion for evaluating the performance of BIMChecker tools. To improve this efficiency, current research focuses on optimizing the query scale of RDF data. For example, approaches such as storing RDF data in a graph structure, implementing multiple indexes based on RDF data context, and using new engines to process large amounts of RDF data can improve inspection efficiency. However, when the RDF data involved is simple in structure and large in volume, optimization efforts at the RDF data end are less effective. Summary of the Invention

[0005] The present invention provides a SPARQL statement reordering method and a BIM model checking method and device based on SPARQL reordering, which can improve the query efficiency of building information models by reordering SPARQL statements. The specific technical solution is as follows:

[0006] In a first aspect, an embodiment of the present invention provides a SPARQL statement reordering method, the method comprising:

[0007] Determining a target component based on a predicate of a SPARQL check statement generated based on a building code description language (SNL) rule; wherein the SNL rule is a building code clause written based on SNL;

[0008] Grouping multiple SPARQL check statements, dividing SPARQL check statements related to the same target component into the same group, and obtaining SPARQL check statement fragments of different target components; the SPARQL check statements related to the same target component include SPARQL check statements with the same target component as a subject and SPARQL check statements associated with non-component objects in the SPARQL check statements with the same target component as a subject;

[0009] Traversing the SPARQL check statement fragments of each target component, if both the subject and the object in the currently traversed SPARQL check statement are components, connecting a directed edge from the SPARQL check statement fragment with the subject as the target component to the SPARQL check statement fragment with the object as the target component, and generating a component relationship constraint graph after the traversal is completed;

[0010] According to the component relationship constraint graph, the SPARQL check statement fragments of different target components are reordered to obtain the reordered SPARQL check statements corresponding to the SNL rules.

[0011] Optionally, determining the target component according to a predicate of a SPARQL check statement generated based on a building rule description language SNL rule includes:

[0012] The subject of the SPARQL check statement whose predicate is rdf:type is determined to be the target component.

[0013] Optionally, reordering the SPARQL check statement fragments of different target components according to the component relationship constraint graph includes:

[0014] If the component relationship constraint graph includes at least two relationship trees, reordering the at least two relationship trees according to the order of depth of the relationship trees from deep to shallow;

[0015] For a relationship tree, the pre-order traversal algorithm is used to reorder the SPARQL check statement fragments of different target components.

[0016] Optionally, if the target component is a special component, before traversing the SPARQL check statement fragments of each target component, if both the subject and the object in the currently traversed SPARQL check statement are components, before connecting a directed edge from the SPARQL check statement fragment with the subject as the target component to the SPARQL check statement fragment with the object as the target component, the method further includes:

[0017] Traversing a SPARQL check statement fragment of a target component that is a special component, and if the object of the SPARQL check statement of the currently traversed special component is a component, inserting the object of the SPARQL check statement of the currently traversed special component as the SPARQL check statement fragment of the target component after the SPARQL check statement of the currently traversed special component; the special component includes a building and / or a floor;

[0018] Traversing the SPARQL check statement fragments of each target component, if the subject and the object in the currently traversed SPARQL check statement are both components, connecting a directed edge from the SPARQL check statement fragment with the subject as the target component to the SPARQL check statement fragment with the object as the target component, including:

[0019] Traversing each SPARQL check statement fragment without a special component inserted therein, and if both the subject and the object in the currently traversed SPARQL check statement are components, connecting a directed edge from the SPARQL check statement fragment with the subject in the currently traversed SPARQL check statement as a target component to the SPARQL check statement fragment with the object in the currently traversed SPARQL check statement as a target component.

[0020] Optionally, the SPARQL check statement associated with the non-component object in the SPARQL check statement with the same target component as the subject includes: a SPARQL check statement with the non-component object as the subject, and a SPARQL check statement with the object of the SPARQL check statement with the non-component object as the subject.

[0021] In a second aspect, an embodiment of the present invention provides a BIM model checking method based on SPARQL reordering, the method comprising:

[0022] Obtaining a SPARQL check statement generated based on a building rule description language SNL rule; the SNL rule is a building code clause written based on SNL;

[0023] Reorder the SPARQL check statements; the reordering method includes the method described in the first aspect;

[0024] The architectural semantic model is queried according to the reordered SPARQL check statements; the architectural semantic model is a model obtained by semantic extraction based on a Building Information Model (BIM) model.

[0025] In a third aspect, an embodiment of the present invention provides a SPARQL statement reordering device, the device comprising:

[0026] A determination unit, configured to determine a target component based on a predicate of a SPARQL check statement generated based on a building rule description language (SNL) rule; the SNL rule is a building code clause written based on SNL;

[0027] a grouping unit, configured to group multiple SPARQL check statements, grouping SPARQL check statements related to the same target component into the same group, and obtaining SPARQL check statement fragments of different target components; the SPARQL check statements related to the same target component include SPARQL check statements with the same target component as a subject, and SPARQL check statements associated with non-component objects in the SPARQL check statements with the same target component as a subject;

[0028] a generating unit configured to traverse the SPARQL check statement fragments of each target component, and if both the subject and the object in the currently traversed SPARQL check statement are components, connect a directed edge from the SPARQL check statement fragment with the subject as the target component to the SPARQL check statement fragment with the object as the target component, and generate a component relationship constraint graph after the traversal is completed;

[0029] The sorting unit is used to reorder the SPARQL check statement fragments of different target components according to the component relationship constraint graph to obtain the reordered SPARQL check statements corresponding to the SNL rules.

[0030] Optionally, the determining unit is configured to determine the subject of a SPARQL check statement whose predicate is rdf:type as the target component.

[0031] Optionally, the sorting unit includes:

[0032] A first sorting module is configured to re-sort the at least two relationship trees according to the depth of the relationship trees from deep to shallow if the component relationship constraint graph includes at least two relationship trees;

[0033] The second sorting module is used to reorder the SPARQL check statement fragments of different target components using a pre-order traversal algorithm for a relationship tree.

[0034] Optionally, the sorting unit is configured to, if the target component is a special component, traverse the SPARQL check statement fragments of each target component, and before connecting a directed edge from the SPARQL check statement fragment with the subject as the target component to the SPARQL check statement fragment with the object as the target component, traverse the SPARQL check statement fragments in which the target component is the special component, and if the object of the SPARQL check statement of the special component currently traversed is a component, use the object of the SPARQL check statement of the special component currently traversed as the SPARQL check statement fragment of the target component and insert it after the SPARQL check statement of the special component currently traversed; the special component includes a building and / or a floor;

[0035] The generating unit is configured to traverse each SPARQL check statement fragment of a non-special component in which no special component is inserted, and if both the subject and the object in the currently traversed SPARQL check statement are components, connect a directed edge from the SPARQL check statement fragment with the subject in the currently traversed SPARQL check statement as a target component to the SPARQL check statement fragment with the object in the currently traversed SPARQL check statement as a target component.

[0036] Optionally, the SPARQL check statement associated with the non-component object in the SPARQL check statement with the same target component as the subject includes: a SPARQL check statement with the non-component object as the subject, and a SPARQL check statement with the object of the SPARQL check statement with the non-component object as the subject.

[0037] In a fourth aspect, an embodiment of the present invention provides a BIM model checking device based on SPARQL reordering, the device comprising:

[0038] An acquisition unit is used to acquire a SPARQL check statement generated based on a building rule description language SNL rule; the SNL rule is a building code clause written based on SNL;

[0039] A reordering unit, configured to reorder the SPARQL check statements; the reordering method includes the method described in the first aspect;

[0040] A query unit is used to query a building semantic model according to the reordered SPARQL check statements; the building semantic model is a model obtained by semantic extraction based on a Building Information Model (BIM) model.

[0041] In a fifth aspect, an embodiment of the present invention provides a storage medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement the method described in the first aspect or the second aspect.

[0042] In a sixth aspect, an embodiment of the present invention provides an electronic device, including:

[0043] one or more processors;

[0044] a storage device for storing one or more programs,

[0045] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in the first aspect or the second aspect.

[0046] As can be seen from the above content, the embodiments of the present invention provide a SPARQL statement reordering method and apparatus for BIM model checking based on SPARQL reordering. After obtaining a SPARQL check statement generated based on an SNL rule, the method and apparatus can first establish a component relationship constraint graph based on the association relationship between the components involved in the SPARQL check statement, and then reorder the original SPARQL check statements based on the component relationship constraint graph. The BIM model is then checked based on the sorted SPARQL check statements. Therefore, when the RDF data structure is simple and the data volume is large, the number of repeated queries can be reduced by modifying the order of the SPARQL check statements, further improving the efficiency of BIM model checking. Of course, any product or method implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time.

[0047] The innovative features of the embodiments of the present invention include:

[0048] 1. By analyzing the subject, predicate, and object in SPARQL check statements, we determine the relationships between components and build a component relationship constraint graph based on these relationships. Finally, we reorder the original SPARQL check statements based on the component relationship constraint graph. This reordering method not only automates the process but also reduces the number of repeated queries, further improving BIM model checking efficiency.

[0049] 2. After obtaining the component relationship constraint graph, the SPARQL check statements can be sorted in order from deep to shallow according to the depth of the relationship tree in the component relationship constraint graph, so that the component information of the deeper tree can be output first, and then the component information of the shallower tree can be output. Then, when resources such as memory are sufficient, the query of the deeper tree can be realized, thereby further improving the inspection efficiency.

[0050] 3. When constructing a component relationship constraint diagram involving special components (including buildings and floors), in order to avoid a large number of queries and query ranges due to the full arrangement of special components, thereby affecting the inspection efficiency, before establishing the component relationship constraint diagram, the object of the SPARQL check statement of the special component can be used as the SPARQL check statement fragment of the target component, and inserted after the SPARQL check statement of the currently traversed special component. Then, the component relationship constraint diagram is established and reordered according to the component relationship constraint diagram. This can narrow the query range of the statements after the SPARQL check statement of the currently traversed special component, reduce the number of queries, and further improve the BIM model inspection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely some embodiments of the present invention. Those skilled in the art can derive other drawings based on these drawings without inventive effort.

[0052] Figure 1 A schematic diagram of the structure of a building code review tool provided for the prior art;

[0053] Figure 2 A schematic diagram of a flow chart of a SPARQL statement reordering method provided by an embodiment of the present invention;

[0054] Figure 3 An example diagram of a grouping of SPARQL check statements provided by an embodiment of the present invention;

[0055] Figure 4 An example diagram of a component relationship constraint diagram provided by an embodiment of the present invention;

[0056] Figure 5 An example diagram of reordering of SPARQL check statements provided by an embodiment of the present invention;

[0057] Figure 6 A schematic diagram of the system structure of a BIMChecker tool provided by an embodiment of the present invention;

[0058] Figure 7A schematic diagram of a class diagram of a SPARQL reordering module provided by an embodiment of the present invention;

[0059] Figure 8 A block diagram of a SPARQL statement reordering device provided by an embodiment of the present invention;

[0060] Figure 9 A block diagram of a BIM model checking device based on SPARQL reordering provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0061] The following will provide a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0062] It should be noted that the terms "including" and "having" and any variations thereof in the embodiments of the present invention and the accompanying drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to the process, method, product, or apparatus.

[0063] The present invention provides a SPARQL statement reordering method and apparatus for BIM model checking based on SPARQL reordering. These methods can improve the query efficiency of building information models by reordering SPARQL statements. The methods provided in embodiments of the present invention can be applied to any electronic device with computing capabilities, such as a terminal or a server. In one implementation, the functional software implementing the method can exist as standalone client software or as a plug-in for currently available client software.

[0064] The embodiments of the present invention are described in detail below.

[0065] Figure 2 A schematic diagram of a process for reordering SPARQL statements provided in an embodiment of the present invention. The method may include the following steps:

[0066] S100: Determine a target component according to a predicate of a SPARQL check statement generated based on a building rule description language SNL rule.

[0067] The SNL rules are building code clauses written based on SNL. SNL can be mainly divided into simple sentences, complex sentences and conditional sentences in terms of structure.

[0068] Simple sentence = (prefix noun phrase (suffix noun phrase ((<and>|<or>) suffix noun phrase)*) | (prefix noun verb phrase ((<and>|<or>) verb phrase)*))

[0069] Complex sentence = simple sentence (<and> simple sentence)*

[0070] Conditional sentence <if>(compound conditional | there is a conditional)

[0071] <then>(compound conditional | there is a conditional)

[0072] For example, if the original text of the clause is "For civil buildings with a building height greater than 100m, the fire resistance limit of the floor slab shall not be less than 2.00h", then the SNL expression can be found in text 1:

[0073] Text 1

[0074]

[0075] The above examples are general rule samples based on SNL. The conditional part (i.e., the if part) of the following text 2 involves a computational rule ("the wall between area A-area B"), and the result part of text 3 involves a computational rule ("the minimum orthogonal horizontal distance of the outer window C-outer window D is >= 1000"). From the examples, it can be observed that SNL is easy to understand and can basically be read smoothly according to the word order of Chinese.

[0076] Text 2

[0077]

[0078] Text Three

[0079]

[0080] SNL can clearly and intuitively describe building regulations, but it cannot be used directly to query building clauses. Instead, it must be converted into a SPARQL query in the BIMChecker tool. Then, the TTL model of the building to be inspected must be queried using SPARQL to obtain inspection results. In SNL, a clause is the smallest independent logical unit and is divided into a subject, a predicate, and an object. For example, in the sentence "The building has room A," "building" is the subject, "has" is the predicate, and "room A" is the object. After analyzing the sentence components, the tool generates SPARQL for the entire clause based on whether the clause is an attribute clause or a verb clause. The corresponding SPARQL for all clauses is output sequentially to obtain the target SPARQL. Accordingly, the SPARQL check statement generated based on SNL also consists of a subject, predicate, and object. When the predicate is "rdf:type," the subject of the SPARQL check statement is always a component. Therefore, the predicate of the SPARQL check statement can be used to determine all target components, allowing for sorting based on the target components.

[0081] S110: Grouping multiple SPARQL check statements, dividing SPARQL check statements related to the same target component into the same group, and obtaining SPARQL check statement fragments of different target components.

[0082] The SPARQL check statements related to the same target component include a SPARQL check statement with the same target component as a subject and a SPARQL check statement associated with a non-component object in the SPARQL check statement with the same target component as a subject. The SPARQL check statements associated with a non-component object in the SPARQL check statement with the same target component as a subject include a SPARQL check statement with the non-component object as a subject and a SPARQL check statement with the object of the SPARQL check statement with the non-component object as a subject.

[0083] For example, if the SPARQL check statement automatically generated based on SNL is as shown in the following text 4, there are six query predicates "rdf:type" (marked in bold), and it can be determined that the target components include A, B, X0, BS1, BS2 and Y106. After grouping the target components, the various SPARQL check statement fragments obtained are as follows: Figure 3 As shown. For example, the fragment of component A contains the statements "?A rdf:type ifc2x3:ifcspace.", "?Aifc2x3:LongName?v3", "?A ifc2x3:isContaining?Y106." and "?Aifc2x3:hasPropertySet?ps5." with subject A, and the SPARQL check statements "?ps5 ifc2x3:hasProperty?p5.", "?p5 ifc2x3:PropName'Calculate elevation'." and "?p5 ifc2x3:PropValue?v5." associated with the non-component object "ps5" in the SPARQL check statement with subject A, where "?ps5 "ifc2x3:hasProperty? p5." is a SPARQL check statement with "ps5" as the subject, "? p5ifc2x3:PropName'Calculate elevation'." and "? p5ifc2x3:PropValue? v5." are SPARQL check statements with "ps5" as the subject and "p5" as the object of the SPARQL check statement.

[0084] Text 4

[0085]

[0086]

[0087] S120: traverse the SPARQL check statement fragments of each target component. If both the subject and the object in the currently traversed SPARQL check statement are components, connect a directed edge from the SPARQL check statement fragment with the subject as the target component to the SPARQL check statement fragment with the object as the target component, and generate a component relationship constraint graph after the traversal is completed.

[0088] For each target component, the SPARQL triples (subject, predicate, and object) are enumerated. If the subject and object of a SPARQL triple are both components, then there is a component constraint relationship between the subject and the object. A directed edge is connected from the node corresponding to the component of the subject to the node corresponding to the object. After enumerating each component, a component constraint graph is generated. For example, for Figure 3 The component relationship constraint diagram obtained after traversing the statements shown can be shown as Figure 4 shown.

[0089] S130: reordering the SPARQL check statement fragments of different target components according to the component relationship constraint graph to obtain the reordered SPARQL check statements corresponding to the SNL rules.

[0090] The architectural semantic model is a model obtained by semantic extraction based on the Building Information Model (BIM) model, such as a TTL model. The relationship of the architectural model is unidirectional. For example, a floor can contain rooms, but a room cannot contain floors. Therefore, the data structure of the component relationship constraint graph is a tree structure, and there may be more than one root. Now, to output SPARQL in a suitable order, it is necessary to enumerate each tree in the forest. An optional solution is to sort according to the depth of the tree. The time complexity required for deeper trees may be relatively high, so the component information of the deeper tree is output first, and then the component information of the shallower tree is output. For each tree, each component information is output in sequence according to the pre-order traversal algorithm. In this way, except for the root of the tree, each component is output to ensure that "a component related to the component has been queried", making full use of the component relationship. That is to say, if the component relationship constraint graph includes at least two relationship trees, the at least two relationship trees are reordered according to the depth of the relationship tree from deep to shallow; for one relationship tree, the pre-order traversal algorithm is used to reorder the SPARQL check statement fragments of different target components. Figure 4 Taking the component relationship constraints shown in the figure as an example, after sorting them according to the above priority order, the result is as follows Figure 5 shown.

[0091] A SPARQL statement reordering method provided by an embodiment of the present invention can, after obtaining a SPARQL check statement generated based on an SNL rule, first establish a component relationship constraint graph through the association relationship between components involved in the SPARQL check statement, and reorder the original SPARQL check statement according to the component relationship constraint graph, so as to check the BIM model according to the sorted SPARQL check statement. Therefore, when the RDF data structure is simple and the data volume is large, the number of repeated queries can be reduced by modifying the order of the SPARQL check statement, thereby further improving the efficiency of BIM model checking.

[0092] In the above embodiment, an algorithm idea for reordering SPARQL based on component constraint graph is proposed. During actual use, it is found that new problems will arise when the entire SPARQL about a component is directly output. Taking the clause shown in Text Five as an example, its SPARQL part about the floor is shown in Text Six. It is worth noting that here, the floors are queried separately for safety exits, evacuation doors, and open stairwells. However, in this part, the floor only enumerates the "components of unknown type" owned by the floor. In the above embodiment, the components related to the component are first enumerated from the component, and then the query is made to confirm whether this component is "a component of the required type" and other conditions. However, using this method in this section of SPARQL will result in the need to continuously enumerate the three different components owned by the floor, and the query is completely independent, requiring the calculation of count(Y20 contains ) 3 The problem here is that it is generally assumed that the number of components related to a single component is small, even if it takes O(n 3 ) is also unaffected, but this is not the case for the "floor" and "building" components. A single floor has many components, resulting in this clause taking a long time to obtain the calculation result when directly using the SPARQL test that directly uses the depth-first sequence sorting of the components in the above embodiment.

[0093] Text Five

[0094]

[0095] Text 6

[0096]

[0097] In order to further improve the query efficiency, the SPARQL check statement fragments of each target component can be traversed. If the subject and object in the currently traversed SPARQL check statement are both components, before connecting a directed edge from the SPARQL check statement fragment with the subject as the target component to the SPARQL check statement fragment with the object as the target component, it is first determined whether the target component is a special component (the special components include buildings and / or floors). If it is a special component, the SPARQL check statement fragments in which the target component is a special component are first traversed. If the object of the SPARQL check statement of the currently traversed special component is a component, the currently traversed special component is connected to the SPARQL check statement fragment. The method further comprises: inserting the object of the SPARQL check statement of the component as the SPARQL check statement fragment of the target component after the SPARQL check statement of the currently traversed special component; then traversing each SPARQL check statement fragment of the non-special component into which the SPARQL check statement fragment of the special component is not inserted; and if both the subject and the object in the currently traversed SPARQL check statement are components, connecting a directed edge from the SPARQL check statement fragment with the subject in the currently traversed SPARQL check statement as the target component to the SPARQL check statement fragment with the object in the currently traversed SPARQL check statement as the target component.

[0098] The poor computational efficiency of Document 6 stems from the fact that when querying the objects owned by the Y20 variable, the conditions of variables A, B, and Y60 were not fully utilized for pruning. Instead, all three variables were fully sorted before subsequent queries. Therefore, if the conditions of the three variables were fully utilized and subsequent queries were performed after relevant information was retrieved, query efficiency would be significantly improved. As shown in Document 7, after a variable is mentioned, all components related to this variable and its related SPARQL are immediately inserted after this SPARQL. When the SPARQL query reaches "?Y20 ifc2x3:isContaining?A.", the SPARQL query related to the variable "?A" is immediately executed. Based on the previous analysis, as long as the SPARQL related to "?A" is correctly reordered according to the previous embodiment, the time required for the SPARQL related to "?A" will be within constant levels. Therefore, when executing the subsequent SPARQL query "?Y20 ifc2x3:hasSubType?Y60.", the variable "?A" obtained already satisfies the relevant constraints, rather than just any "?A" variable. The modified SPARQL query, run on a 124MB startup building, returned results in one second, while the unmodified SPARQL query took less than a minute to complete, demonstrating that this approach effectively improves operational efficiency.

[0099] Text Seven

[0100]

[0101] According to the above method embodiment, another embodiment of the present invention provides a BIM model checking method based on SPARQL reordering, which may include:

[0102] Obtain SPARQL check statements generated based on building rule description language (SNL) rules; the SNL rules are building code clauses written based on SNL; reorder the SPARQL check statements; the reordering method includes the sorting method described in the previous embodiment; query a building semantic model based on the reordered SPARQL check statements; the building semantic model is a model obtained by semantic extraction based on a building information model (BIM) model.

[0103] Based on the above method embodiment, another embodiment of the present invention provides a BIMChecker tool system, such as Figure 6 As shown, the system includes a Revit model parsing module, an SNL file parsing module, a TTL model generation module, a SPARQL query generation module, a computational rule framework module, a SPARQL reordering module, a geometric calculation unit module and a SPARQL query engine module.

[0104] The Revit model parsing module is a separately developed Revit plug-in that parses the Revit model based on the .NET API provided by Revit and stores the entire model information as a Json file for subsequent inspection work.

[0105] The SNL file parsing module stores the query SNL statements and related rule texts in an independent SNL file in the form of XML. The module parses the relevant information from the SNL file and stores it in the memory for subsequent use.

[0106] The TTL model generation module extracts information from the Json file obtained by parsing the Revit model and converts it into a TTL semantic model.

[0107] The SPARQL query generation module converts the SNL language provided by the SNL file into the SPARQL language for model checking.

[0108] The computational rule framework module is responsible for processing the SNL related to the computational rules, converting the SNL into a logical form, obtaining the intersection and / or union between the various parts of the SNL, and inputting the intersection and / or union between the various parts of the SNL into the geometric calculation unit module for calculation, thereby obtaining the computational rule query results.

[0109] The SPARQL reordering module is responsible for reordering SPARQL query statements before SPARQL query to make the query more efficient.

[0110] The geometric calculation unit module has prepared a variety of independent geometric calculation functions to calculate related geometric problems in response to different computational rule requirements.

[0111] After the TTL model and the SPARQL query are prepared, the SPARQL query engine module performs the final SPARQL query in the module. The embodiment of the present invention uses the ARQ engine provided by Jena to perform the SPARQL query.

[0112] The following introduces the system architecture and implementation details of the computational rule reordering module. Figure 7 The class diagram for the SPARQL reordering module is shown. The Forest class is used to store the entire SPARQL forest of SPARQL components. The ForestMapUnit class stores information about each component's child nodes and the component itself within the forest. The MultiTreeNode class stores all SPARQL data for a single component variable. During an actual SPARQL query, the QuerySPARQL function inputs the original SPARQL text into the Forest constructor, generating a list of unreordered ForestMapUnits to store the corresponding SPARQL information. Subsequently, the traverse() function reorders the components, reconstructing a new component tree based on the unreordered ForestMapUnits and associating related components. The reordered components are then output by repeatedly calling the viewData() function. Before each viewData() call, the unreordered components are moved to the head of the list through sorting, thus outputting all component information.

[0113] The following example illustrates the efficiency of the reordering inspection:

[0114] (1) Case Model

[0115] Table 1 lists the model-related information used for testing in this embodiment of the present invention. Because model volume can be measured based on both model volume and the number of entities and relationships within the model, both are listed here. The information in the table is based on TTL information extracted during actual inspections.

[0116] Table 1 TTL information of each model

[0117] Model Name Model size Entity Attributes Relationship A villa model 9.2MB 254 3121 595 Model of a startup building 124MB 7292 58182 25279 A middle school project building 42.8MB 6461 39978 21266

[0118] (2) SPARQL reordering method test

[0119] Based on the SPARQL reranking method, an efficiency experiment was conducted on the unoptimized SPARQL and the reranking method of the embodiment of the present invention. The compiled rule base "Code for Fire Protection Design of Buildings" was used for testing. The total number of clauses that obtained results within 1 second, 10 seconds, and 1 minute was compared. The results are shown in Tables 2 and 3.

[0120] Table 2 Model checking efficiency of unoptimized SPARQL

[0121] Model Name within 1 second within 10 seconds Within 1 minute time out A villa model 1251 0 1 0 Model of a startup building 1197 19 17 19 A middle school project building 1205 29 11 7

[0122] Table 3 Model checking efficiency after SPARQL re-ranking

[0123] Model Name within 1 second within 10 seconds Within 1 minute time out A villa model 1252 0 0 0 Model of a startup building 1246 5 1 0 A middle school project building 1250 2 0 0

[0124] Analyzing the above data, the check results for a villa model show that, because the data for this villa model is much smaller than for the other models, no optimization has any impact on efficiency. However, for the other two larger models, the model size significantly affects the check efficiency. This comparison shows that the SPARQL reranking method proposed in this embodiment of the present invention effectively improves query efficiency, enabling complex terms that previously failed to successfully obtain query results to now obtain results after the algorithm update.

[0125] Based on the above-mentioned sorting method embodiment, the present invention provides a SPARQL statement reordering device, such as Figure 8 As shown, the device may include:

[0126] A determination unit 80 is configured to determine a target component based on a predicate of a SPARQL check statement generated based on a building code description language (SNL) rule; the SNL rule is a building code clause written based on SNL;

[0127] A grouping unit 82 is configured to group multiple SPARQL check statements, grouping SPARQL check statements related to the same target component into the same group, and obtaining SPARQL check statement fragments of different target components; the SPARQL check statements related to the same target component include SPARQL check statements with the same target component as a subject, and SPARQL check statements associated with non-component objects in the SPARQL check statements with the same target component as a subject;

[0128] A generating unit 84 is configured to traverse the SPARQL check statement fragments of each target component, and if both the subject and the object in the currently traversed SPARQL check statement are components, connect a directed edge from the SPARQL check statement fragment with the subject as the target component to the SPARQL check statement fragment with the object as the target component, and generate a component relationship constraint graph after the traversal is completed;

[0129] The sorting unit 86 is configured to reorder the SPARQL check statement fragments of different target components according to the component relationship constraint graph to obtain the reordered SPARQL check statements corresponding to the SNL rules.

[0130] Optionally, the determining unit 80 is configured to determine the subject of a SPARQL check statement whose predicate is rdf:type as the target component.

[0131] Optionally, the sorting unit 86 includes:

[0132] A first sorting module is configured to re-sort the at least two relationship trees according to the depth of the relationship trees from deep to shallow if the component relationship constraint graph includes at least two relationship trees;

[0133] The second sorting module is used to reorder the SPARQL check statement fragments of different target components using a pre-order traversal algorithm for a relationship tree.

[0134] Optionally, the sorting unit 86 is configured to, if the target component is a special component, traverse the SPARQL check statement fragments of each target component, and before connecting a directed edge from the SPARQL check statement fragment with the subject as the target component to the SPARQL check statement fragment with the object as the target component, traverse the SPARQL check statement fragments of the target component if the target component is a special component, and if the object of the SPARQL check statement of the special component currently traversed is a component, use the object of the SPARQL check statement of the special component currently traversed as the SPARQL check statement fragment of the target component and insert it after the SPARQL check statement of the special component currently traversed; the special component includes a building and / or a floor;

[0135] The generating unit 84 is configured to traverse each SPARQL check statement fragment that is not a special component and that has no special component inserted therein, and if both the subject and the object in the currently traversed SPARQL check statement are components, connect a directed edge from the SPARQL check statement fragment that uses the subject in the currently traversed SPARQL check statement as a target component to the SPARQL check statement fragment that uses the object in the currently traversed SPARQL check statement as a target component.

[0136] Optionally, the SPARQL check statement associated with the non-component object in the SPARQL check statement with the same target component as the subject includes: a SPARQL check statement with the non-component object as the subject, and a SPARQL check statement with the object of the SPARQL check statement with the non-component object as the subject.

[0137] A SPARQL statement reordering device provided by an embodiment of the present invention can, after obtaining a SPARQL check statement generated based on an SNL rule, first establish a component relationship constraint graph through the association relationship between components involved in the SPARQL check statement, and reorder the original SPARQL check statement according to the component relationship constraint graph, so as to check the BIM model according to the sorted SPARQL check statement. Therefore, when the RDF data structure is simple and the data volume is large, the number of repeated queries can be reduced by modifying the order of the SPARQL check statement, thereby further improving the efficiency of BIM model checking.

[0138] Based on the above inspection method embodiment, the embodiment of the present invention provides a BIM model inspection device based on SPARQL reordering, such as Figure 9 As shown, the device may include:

[0139] An acquisition unit 90 is configured to acquire a SPARQL check statement generated based on a building rule description language SNL rule; the SNL rule is a building code clause written based on SNL;

[0140] A reordering unit 92 is configured to reorder the SPARQL check statements; the reordering method includes the method described in the first aspect;

[0141] The query unit 94 is configured to query a building semantic model according to the reordered SPARQL check statements; the building semantic model is a model obtained by semantic extraction based on a Building Information Model (BIM) model.

[0142] Based on the above method embodiment, another embodiment of the present invention further provides a storage medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement the above method.

[0143] Based on the above method embodiment, another embodiment of the present invention further provides an electronic device, including:

[0144] one or more processors;

[0145] a storage device for storing one or more programs,

[0146] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.

[0147] The above-mentioned system and device embodiments correspond to the method embodiments and have the same technical effects as the method embodiments. For detailed descriptions, please refer to the method embodiments. The device embodiments are obtained based on the method embodiments. For detailed descriptions, please refer to the method embodiments section and will not be repeated here. It should be understood by those skilled in the art that the accompanying drawings are only schematic diagrams of one embodiment, and the modules or processes in the accompanying drawings are not necessarily required to implement the present invention.

[0148] Those skilled in the art will appreciate that the modules in the apparatuses of the embodiments may be distributed in the apparatuses of the embodiments as described in the embodiments, or may be located in one or more apparatuses different from the embodiments with corresponding changes. The modules in the above embodiments may be combined into one module or further divided into multiple sub-modules.

[0149] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.< / then> < / if>

Claims

1. A SPARQL statement reordering method, characterized in that: The method comprises: Determining a target component based on a predicate of a SPARQL check statement generated based on a building code description language (SNL) rule; wherein the SNL rule is a building code clause written based on SNL; Grouping multiple SPARQL check statements, dividing SPARQL check statements related to the same target component into the same group, and obtaining SPARQL check statement fragments of different target components; the SPARQL check statements related to the same target component include SPARQL check statements with the same target component as a subject and SPARQL check statements associated with non-component objects in the SPARQL check statements with the same target component as a subject; Traversing the SPARQL check statement fragments of each target component, if both the subject and the object in the currently traversed SPARQL check statement are components, connecting a directed edge from the SPARQL check statement fragment with the subject as the target component to the SPARQL check statement fragment with the object as the target component, and generating a component relationship constraint graph after the traversal is completed; According to the component relationship constraint graph, the SPARQL check statement fragments of different target components are reordered to obtain the reordered SPARQL check statements corresponding to the SNL rules.

2. The method according to claim 1, wherein The target component is determined according to the predicate of the SPARQL check statement generated based on the building rule description language SNL rule, including: The subject of the SPARQL check statement whose predicate is rdf:type is determined to be the target component.

3. The method according to claim 1, wherein According to the component relationship constraint graph, the SPARQL check statement fragments of different target components are reordered, including: If the component relationship constraint graph includes at least two relationship trees, reordering the at least two relationship trees according to the order of depth of the relationship trees from deep to shallow; For a relationship tree, the pre-order traversal algorithm is used to reorder the SPARQL check statement fragments of different target components.

4. The method according to claim 1, wherein If the target component is a special component, before traversing the SPARQL check statement fragments of each target component, if both the subject and the object in the currently traversed SPARQL check statement are components, before connecting a directed edge from the SPARQL check statement fragment with the subject as the target component to the SPARQL check statement fragment with the object as the target component, the method further includes: Traversing a SPARQL check statement fragment of a target component that is a special component, and if the object of the SPARQL check statement of the currently traversed special component is a component, inserting the object of the SPARQL check statement of the currently traversed special component as the SPARQL check statement fragment of the target component after the SPARQL check statement of the currently traversed special component; the special component includes a building and / or a floor; Traversing the SPARQL check statement fragments of each target component, if the subject and the object in the currently traversed SPARQL check statement are both components, connecting a directed edge from the SPARQL check statement fragment with the subject as the target component to the SPARQL check statement fragment with the object as the target component, including: Traversing each SPARQL check statement fragment without a special component inserted therein, and if both the subject and the object in the currently traversed SPARQL check statement are components, connecting a directed edge from the SPARQL check statement fragment with the subject in the currently traversed SPARQL check statement as a target component to the SPARQL check statement fragment with the object in the currently traversed SPARQL check statement as a target component.

5. The method according to claim 1, wherein The SPARQL check statements associated with the non-component objects in the SPARQL check statements with the same target component as subject include: a SPARQL check statement with the non-component object as subject, and a SPARQL check statement with the object of the SPARQL check statement with the non-component object as subject as subject.

6. A BIM model checking method based on SPARQL reordering, characterized in that: The method comprises: Obtaining a SPARQL check statement generated based on a building rule description language SNL rule; the SNL rule is a building code clause written based on SNL; Reordering the SPARQL check statements; the reordering method includes the method according to any one of claims 1 to 5; The architectural semantic model is queried according to the reordered SPARQL check statements; the architectural semantic model is a model obtained by semantic extraction based on a Building Information Model (BIM) model.

7. A SPARQL statement reordering device, characterized in that: The device comprises: A determination unit, configured to determine a target component based on a predicate of a SPARQL check statement generated based on a building rule description language (SNL) rule; the SNL rule is a building code clause written based on SNL; a grouping unit, configured to group multiple SPARQL check statements, grouping SPARQL check statements related to the same target component into the same group, and obtaining SPARQL check statement fragments of different target components; the SPARQL check statements related to the same target component include SPARQL check statements with the same target component as a subject, and SPARQL check statements associated with non-component objects in the SPARQL check statements with the same target component as a subject; a generating unit configured to traverse the SPARQL check statement fragments of each target component, and if both the subject and the object in the currently traversed SPARQL check statement are components, connect a directed edge from the SPARQL check statement fragment with the subject as the target component to the SPARQL check statement fragment with the object as the target component, and generate a component relationship constraint graph after the traversal is completed; The sorting unit is used to reorder the SPARQL check statement fragments of different target components according to the component relationship constraint graph to obtain the reordered SPARQL check statements corresponding to the SNL rules.

8. A BIM model checking device based on SPARQL reordering, characterized in that: The device comprises: An acquisition unit is used to acquire a SPARQL check statement generated based on a building rule description language SNL rule; the SNL rule is a building code clause written based on SNL; a reordering unit, configured to reorder the SPARQL check statements; the reordering method comprising the method according to any one of claims 1 to 5; A query unit is used to query a building semantic model according to the reordered SPARQL check statements; the building semantic model is a model obtained by semantic extraction based on a Building Information Model (BIM) model.

9. A storage medium, characterized in that: Executable instructions are stored thereon, and when the instructions are executed by a processor, the processor implements the method according to any one of claims 1 to 6.

10. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • SPARQL semantic data query optimization method based on connection cost

    CN104834754A

  • SPARQL query optimization method and system based on a predicate combination, storage medium and equipment

    CN111241127A