[go: up one dir, main page]

CN118331936B - IFC file compression method, device, electronic equipment and storage medium - Google Patents

IFC file compression method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN118331936B
CN118331936B CN202410556056.9A CN202410556056A CN118331936B CN 118331936 B CN118331936 B CN 118331936B CN 202410556056 A CN202410556056 A CN 202410556056A CN 118331936 B CN118331936 B CN 118331936B
Authority
CN
China
Prior art keywords
instance
ifc
file
reference network
network diagram
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410556056.9A
Other languages
Chinese (zh)
Other versions
CN118331936A (en
Inventor
高嵩
张萱
周中梁
狄孟毅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan University of Technology WUT
Original Assignee
Wuhan University of Technology WUT
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan University of Technology WUT filed Critical Wuhan University of Technology WUT
Priority to CN202410556056.9A priority Critical patent/CN118331936B/en
Publication of CN118331936A publication Critical patent/CN118331936A/en
Application granted granted Critical
Publication of CN118331936B publication Critical patent/CN118331936B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1744Redundancy elimination performed by the file system using compression, e.g. sparse files
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/116Details of conversion of file system types or formats
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to an IFC file compression method, an IFC file compression device, electronic equipment and a storage medium, and belongs to the technical field of electronic information, wherein the method comprises the following steps: constructing an IFC instance reference network diagram based on an original IFC-SPF file; performing iterative simplification on the instance reference network diagram to obtain a simplified instance reference network diagram; identifying the instance type in the simplified instance reference network diagram, and converting the original IFC-SPF file into an IFC-HDF file. According to the method for compressing the IFC file, the IFC instance reference network diagram is constructed according to the original IFC-SPF file, the instance reference network diagram is iterated and simplified to achieve primary compression of the file, the instance types in the simplified instance reference network diagram are identified, the original IFC-SPF file is converted into the IFC-HDF file, secondary compression of the file is achieved, the occupancy rate of the IFC file is reduced, and data access efficiency is improved.

Description

IFC file compression method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of electronic information technologies, and in particular, to an IFC file compression method, an IFC file compression device, an electronic device, and a storage medium.
Background
The IFC data exchange standard is a fully published, unlimited data exchange format. The standard is widely applied to the fields of energy, traffic, water conservancy, construction, pipelines, fire protection and the like. In particular to the traffic field, the method provides a unified data exchange standard, provides convenience for efficient and accurate exchange of data in a plurality of traffic engineering projects involving a large amount of building information model (Building Information Modeling, BIM) data, and provides a technical basis for realizing informatization and intellectualization in the traffic field.
The data volume of the IFC file is huge, and in order to facilitate management and reading, the current scheme mainly comprises two types, namely file-based management and database-based management. Based on a management scheme of a file system, the size of a single model file is basically more than 1GB, the data reading efficiency is low, and the three-dimensional visualization speed is slower. The management scheme based on the database is to create corresponding table structures in various types of databases through pattern mapping to store IFC data, but the access performance of a data model provided by the existing pattern mapping method still cannot meet the requirements.
Currently, there are four methods for compressing IFC files as follows: (1) The use of a plain text compression tool to compress the IFC file directly, buildingSMART authorities provide the file format IFC-ZIP with an extension of. ifcZIP to reduce the size of the IFC file. The size of the IFC-ZIP file is about 20% of the original IFC file. The method does not consider the content of the IFC, and the redundant examples are still reserved and are only applicable to the scenes of storage or network transmission; (2) Partial models or information is extracted from the original complete IFC file, and model information is added by different participants at different stages during each lifecycle of the building project, which may result in an oversized IFC file. For this case, the problem can be alleviated by sub-model extraction. However, the partial model extracted by the method is incomplete, so that the method is not suitable for applications requiring complete building model information or other necessary information; (3) XML compression is performed after the IFC-SPF file is converted into an extensible markup language (Extensible Markup Language, XML) format, and the IFC file can be compressed by using an XML compression method after the IFC-SPF file is converted into the XML format. The method has poor applicability, and the construction model content is still not considered, so that redundant examples cannot be removed; (4) The structure according to the IFC instance compresses it and the commercial IFC optimization software Solibri IFC Optimizer can delete redundant primitives from the IFC file by updating the references, essentially deleting some specific types of redundant information to reduce the file size. However, the actual effect thereof cannot be expected.
The compression rate of the existing IFC file compression algorithm is low, so that the IFC file is high in occupancy rate and low in data access efficiency, and information loss exists after the partial compression algorithm is executed.
Disclosure of Invention
In view of the foregoing, it is desirable to provide an IFC file compression method, apparatus, electronic device and storage medium, which are used for solving the problems of high occupancy rate and low data access efficiency of the existing IFC file.
In order to solve the above problems, the present invention provides an IFC file compression method, including:
constructing an IFC instance reference network diagram based on an original IFC-SPF file;
Performing iterative simplification on the instance reference network diagram to obtain a simplified instance reference network diagram;
identifying the instance type in the simplified instance reference network diagram, and converting the original IFC-SPF file into an IFC-HDF file.
In one possible implementation manner, the constructing an IFC instance reference network map based on the original IFC-SPF file includes:
Based on the version of the original IFC-SPF file, obtaining an IFC_schema definition of a corresponding version;
Positioning instance data based on an instance identifier, and acquiring a type identifier of an IFC entity corresponding to the instance data;
Acquiring a corresponding type definition from the IFC_schema definition based on the type identifier;
Constructing an instance object based on the type definition;
based on the instance object, constructing the IFC instance reference network graph.
In one possible implementation manner, the constructing the IFC instance reference network graph based on the instance object includes:
Locating an attribute offset of the instance object based on a type definition of the instance object;
Determining an instance attribute of the instance object based on the attribute offset;
based on the instance attributes, establishing a forward reference relationship or a backward reference relationship between two instance objects;
And constructing the IFC instance reference network graph based on the forward reference relationship or the backward reference relationship.
In one possible implementation manner, the iteratively simplifying the instance reference network diagram to obtain a simplified instance reference network diagram includes:
Traversing the instance reference network graph to construct a non-redundant instance object set;
And obtaining the simplified instance reference network graph based on the non-redundant instance object set.
In one possible implementation, the traversing the instance reference network graph builds a set of non-redundant instance objects, including:
Determining a first redundant instance object with the same instance attribute and instance type based on the hash value corresponding to each instance object;
Starting iteration from the end of the instance reference network graph, determining a second redundant instance object with equal logic;
the set of non-redundant instance objects is determined based on the first redundant instance object and the second redundant instance object.
In one possible implementation, the identifying the instance type in the simplified instance reference network graph, converting the original IFC-SPF file to an IFC-HDF file, includes:
Determining an instance type of the instance object based on the simplified instance reference network graph;
creating a corresponding HDF composite type based on the instance type;
Creating a corresponding group and dataset based on the HDF composite type;
Traversing the data set to obtain the IFC-HDF file.
In one possible implementation, the traversing the dataset to obtain the IFC-HDF file includes:
Acquiring an instance type, an HDF5 composite type and an instance object list corresponding to the data set;
Acquiring an unaccessed instance object in the instance object list;
based on the attribute definition and the HDF5 compound type definition of the non-accessed instance object, writing the instance attribute of the non-accessed instance object into a buffer;
And writing the data of the buffer area into the created HDF5 file to obtain the IFC-HDF file.
The invention also provides an IFC file compression device, which comprises:
the construction module is used for constructing an IFC instance reference network diagram based on the original IFC-SPF file;
the simplifying module is used for carrying out iterative simplification on the instance reference network diagram to obtain a simplified instance reference network diagram;
and the conversion module is used for identifying the instance type in the simplified instance reference network diagram and converting the original IFC-SPF file into an IFC-HDF file.
In another aspect, the present invention also provides an electronic device comprising a memory and a processor, wherein,
The memory is used for storing programs;
The processor is coupled to the memory, and is configured to execute the program stored in the memory, so as to implement the IFC file compression method described in any of the foregoing implementations.
In another aspect, the present invention also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the IFC file compression method described in any of the above implementations.
The beneficial effects of the invention are as follows: according to the method for compressing the IFC file, the IFC instance reference network diagram is constructed according to the original IFC-SPF file, the instance reference network diagram is subjected to iterative simplification to achieve primary compression of the original IFC-SPF file, the instance types in the simplified instance reference network diagram are identified, a corresponding HDF composite type can be created, a data set is traversed and written in, the original IFC-SPF file is converted into the IFC-HDF file, secondary compression of the file is achieved, the size of the file is greatly reduced, the compression rate is improved, the occupancy rate of the IFC file is reduced, and the data access efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an embodiment of a method for compressing an IFC file according to the present invention;
FIG. 2 is a flow chart of an embodiment of a method for constructing an IFC instance reference network map provided by the present invention;
FIG. 3 is a flowchart of an embodiment of a method for converting an IFC instance reference network map to an HDF file;
FIG. 4 is a schematic diagram illustrating an embodiment of an IFC file compressing apparatus according to the present invention;
Fig. 5 is a schematic structural diagram of an embodiment of an electronic device according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It will be apparent that the described embodiments are only some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In the description of the embodiments of the present invention, unless otherwise indicated, the meaning of "a plurality" is two or more. "and/or", describes an association relationship of an associated object, meaning that there may be three relationships, for example: a and/or B may represent: a exists alone, A and B exist together, and B exists alone.
References to "first," "second," etc. in the embodiments of the present invention are for descriptive purposes only and are not to be construed as indicating or implying a relative importance or the number of technical features indicated. Thus, a technical feature defining "first", "second" may include at least one such feature, either explicitly or implicitly.
FIG. 1 is a flowchart illustrating a method of an embodiment of an IFC file compression method according to the present invention, where the IFC file compression method includes:
S101, constructing an IFC instance reference network diagram based on an original IFC-SPF file;
s102, carrying out iterative simplification on the instance reference network diagram to obtain a simplified instance reference network diagram;
S103, identifying the instance type in the simplified instance reference network diagram, and converting the original IFC-SPF file into an IFC-HDF file.
The execution main body of the IFC file compression method provided by the invention can be electronic equipment, and the electronic equipment can be a server or terminal equipment. Embodiments of the present invention are implemented using Visual Studio 2017 under Windows 10.
Compared with the prior art, the method for compressing the IFC file, provided by the embodiment of the invention, has the advantages that the IFC instance reference network diagram is constructed according to the original IFC-SPF file, the initial compression of the original IFC-SPF file is realized by carrying out iteration simplification on the instance reference network diagram, the instance type in the simplified instance reference network diagram is identified, the corresponding HDF composite type can be created, the data set is traversed and written in, the original IFC-SPF file is converted into the IFC-HDF file, the secondary compression of the file is realized, the size of the file is greatly reduced, the compression rate is improved, and therefore the occupancy rate of the IFC file is reduced, and the data access efficiency is improved.
In some embodiments of the present invention, the constructing an IFC instance reference network map based on the original IFC-SPF file includes:
Based on the version of the original IFC-SPF file, obtaining an IFC_schema definition of a corresponding version;
Positioning instance data based on an instance identifier, and acquiring a type identifier of an IFC entity corresponding to the instance data;
Acquiring a corresponding type definition from the IFC_schema definition based on the type identifier;
Constructing an instance object based on the type definition;
based on the instance object, constructing the IFC instance reference network graph.
In some embodiments of the invention, the constructing the IFC instance reference network map based on the instance object includes:
Locating an attribute offset of the instance object based on a type definition of the instance object;
Determining an instance attribute of the instance object based on the attribute offset;
based on the instance attributes, establishing a forward reference relationship or a backward reference relationship between two instance objects;
And constructing the IFC instance reference network graph based on the forward reference relationship or the backward reference relationship.
Optionally, redundant information exists in the original IFC-SPF file, and the redundant information can be briefly classified according to the following specific classification principle:
the first type of redundant information is character redundancy of the data instance part in the SPF file. Such redundant information is invalid characters, typically space or carriage return characters, due to software side beautification of the document, increasing readability.
The second type of redundant information is the same data instance with different instance numbers. Such redundant information refers to data instances that are only inconsistent with instance numbers beginning with' #, and instance types are completely consistent with instance attributes.
The third type of redundant information is redundant information of an equivalent replacement type. Such redundant information refers to redundancy, such as placeholders '$' and default attribute values, that may be generated due to, in some cases, multiple synonymous expressions for the same data information IFC standard.
The fourth type of redundant information is implicit redundant information, and can be specifically divided into three subclasses: (1) Instances with different global identifiers (Globally Unique Identifier, GUID) or change histories and the remaining properties being the same; (2) Examples with list attributes, which have different element arrangement sequences, consistent overall elements and the same rest attributes; (3) Logically identical data instances occur during the bottom iteration of the algorithm reference network graph from the instance.
For the original IFC-SPF file, the initial compression of the original file can be realized by constructing an IFC instance reference network diagram, carrying out iterative simplification on the instance reference network diagram, and reallocating the IFC instance number.
Illustratively, objects mapped from the IFC entity definition schema into c++ are defined by objects in the open source item IfcOpenShell, and fig. 2 is a flowchart of a method for implementing an IFC instance reference network graph construction method according to an embodiment of the present invention, as shown in fig. 2, where the IFC instance reference network graph construction method includes:
s201, loading and analyzing an original IFC-SPF file, and creating a file stream object and an access object.
S202, analyzing the file header, determining the IFC version corresponding to the file, and acquiring a C++ object definition mapped by the IFC standard mode of the version, namely an IFC_schema definition by means of the object definition in the open source item IfcOpenShell.
S203, analyzing the data and moving an access pointer.
In the embodiment of the invention, the instance identifier is used for positioning the instance data, namely, the scanning of the data stream is positioned to the position where' #, then the IFC entity type identifier corresponding to the instance data is acquired to the right, and the corresponding C++ type definition is acquired from the IFC_schema definition of the S202 through the type identifier.
C++ objects of the instance are built through the type definition by means of the open source item IfcOpenShell, and classified mapping storage is carried out until all instance data are traversed.
And after each instance object is constructed, the instance identifier, the GUID and the type are used as keys, the instance object is used as a value, and the value is stored in a corresponding hash table. Note that the object properties are not filled in the whole construction process, and only the offset of the instance properties in the file is saved.
Note that in the scan positioning process, the additional blank and carriage return character redundancy in the instance data is skipped, and similarly, the same operation is performed in the process of loading the attribute of the instance object in the subsequent step S204, which removes the first redundant information.
S204, traversing the instance object constructed in the S203, analyzing the attribute of the instance object, and constructing an instance reference network graph.
Description in a single instance object:
Firstly, acquiring the instance object and the type definition, and then directly positioning the position of the instance attribute in the file according to the offset of the attribute in the file stored in the instance object, so as to load the instance attribute; in the loading process, the basic attribute of the instance object is directly read, and for the attribute of the reference type, a forward and reverse reference relationship is established between the two objects through a pointer.
Meanwhile, the redundancy of the (2) subclass of the fourth class of redundancy information is identified in the process, namely, an algorithm judges whether the instance has a list attribute, if so, elements in the list are rearranged according to the numerical value or the identifier number of the elements, and then a forward and reverse reference relationship is continuously established according to the steps until the instance object is traversed;
and similarly, constructing a complete instance reference network diagram until the algorithm traverses all the instance objects.
Note that in the above example attribute loading process, for the special attribute of the equivalent replacement class, loading is performed uniformly according to the default value, and this operation will remove the third class redundancy.
According to the method for compressing the IFC file, the IFC instance reference network diagram is constructed on the original IFC-SPF file, each instance object can be regarded as a node in the diagram, the reference relation is regarded as an edge in the diagram, and the instance reference network diagram reflects the references and the connections between the instance objects, so that the relation between the instance objects in the IFC file can be better understood and analyzed.
In some embodiments of the present invention, the iteratively simplifying the instance reference network graph to obtain a simplified instance reference network graph includes:
Traversing the instance reference network graph to construct a non-redundant instance object set;
And obtaining the simplified instance reference network graph based on the non-redundant instance object set.
In some embodiments of the present invention, the traversing the instance reference network graph builds a set of non-redundant instance objects, comprising:
Determining a first redundant instance object with the same instance attribute and instance type based on the hash value corresponding to each instance object;
Starting iteration from the end of the instance reference network graph, determining a second redundant instance object with equal logic;
the set of non-redundant instance objects is determined based on the first redundant instance object and the second redundant instance object.
The above example reference network output in S204 is simplified, and specific steps are as follows:
first, traversing an instance reference network graph builds a set of non-redundant instance objects.
By using unordered _set in C++ as an aid and a hash algorithm of a custom hash container, comparing IFC instance objects; note that the GUID and change history of the instance object do not participate in the hash operation, which removes the (1) subclass redundancy of the fourth class redundancy information described above.
Firstly, taking the example reference network diagram of the above S204 as input, then calculating the hash value corresponding to the example object according to the hash table of the above S203, if the mapping position of the hash value in the container is empty, storing the hash value in the corresponding position according to a certain mapping rule, otherwise, comparing the hash value with the example object in the position, and when the attributes and types of the two example objects are the same, the current object is regarded as redundancy, and the current object is the first redundant example object. This process will remove the second type of redundancy described above.
Similarly, the above operations are repeated until the complete instance reference network graph is traversed and all remaining non-redundant objects are filled into the hash set, at which point the set is referred to as a set of non-redundant instance objects.
Second, iterating from the end of the reference network graph, removing the (3) subclass redundancy of the fourth class redundancy information, and outputting the simplified example reference network graph.
Scanning from the tail end of the reference network graph one by one, and if the fact that the instance object with equal logic exists in the container, namely a second redundant instance object, determining that the instance object is redundant to execute deleting operation and marking a father node, and changing the attribute of the instance object referencing the redundant object; for instance objects with changed object elements in the set, the instance objects are deleted from the set, and then the instance objects are rewritten and added into the set.
Repeating the steps until the whole instance reference network graph is traversed.
And finally, allocating smaller numbers to the data instances with more quotation times to obtain the simplified instance quotation network graph.
According to the IFC file compression method provided by the invention, different redundant information can be processed in a targeted manner through the iterative processing of the reference relation between the instance data, so that the primary compression of the file is realized.
In some embodiments of the present invention, the identifying the instance type in the simplified instance reference network graph, converting the original IFC-SPF file to an IFC-HDF file, includes:
Determining an instance type of the instance object based on the simplified instance reference network graph;
creating a corresponding HDF composite type based on the instance type;
Creating a corresponding group and dataset based on the HDF composite type;
Traversing the data set to obtain the IFC-HDF file.
In some embodiments of the invention, said traversing said dataset to obtain said IFC-HDF file comprises:
Acquiring an instance type, an HDF5 composite type and an instance object list corresponding to the data set;
Acquiring an unaccessed instance object in the instance object list;
based on the attribute definition and the HDF5 compound type definition of the non-accessed instance object, writing the instance attribute of the non-accessed instance object into a buffer;
And writing the data of the buffer area into the created HDF5 file to obtain the IFC-HDF file.
And taking the simplified example reference network diagram as input, sequentially identifying the type of the IFC example in the network diagram, creating a corresponding HDF composite type, traversing the data set, writing data, and converting the IFC-SPF file into an IFC-HDF file.
The schema mapping from IFCs to HDFs is in accordance with part 26 of ISO 10303, on the basis of which provision is made for the base types of different attribute types in the IFC instance data stored in the HDF file, as follows:
for basic data, it can be defined directly; for the enumeration type, firstly creating a corresponding enumeration item definition at a designated position, and then providing < string > < integer > to respectively designate the position of the definition and enumeration item subscripts to be taken; for array types, the instance data elements are classified according to their number, and for small aggregate instances they are embedded in the composite type data of the parent EXPRESS entity instance, which for large aggregate instances are represented as separate HDF5 data sets.
In addition, in terms of layout strategies in the HDF after the IFC data conversion, the data is usually stored in an aligned form, and for the variable-length data in the examples, the variable-length data is stored together with other attribute data, when space is allocated for the composite type of the IFC example object corresponding to the HDF, the space is directly allocated according to the maximum length of the variable attribute, and unused space after storage is filled with zero values. Then, the space occupation of the converted HDF data is optimized through block storage, when the HDF file is created, the data set is stored in blocks through the size of the attribute designated block, and then the data set after the blocks is compressed by using a compression algorithm such as gzip or sizp in units of blocks, so that the space occupation of the IFC-HDF file is greatly reduced.
Illustratively, fig. 3 is a flowchart of a method for converting an IFC instance reference network map to an HDF file according to an embodiment of the present invention, as shown in fig. 3, including:
s301, traversing an instance reference network diagram, and creating a path;
First, with the simplified example reference network diagram as input, a corresponding HDF5 file is created, and its file attributes are configured.
Next, based on the IFC object definition provided by IfcOpenshell mentioned above, an instance object definition corresponding to the version IFC is obtained, and then the traversing of instance objects is started, and for different IFC instance types, the schema map provided according to the present application creates a corresponding HDF composite type that is stored under a separate group of HDF5 files, named "IFC version" + "_encoding".
Then, corresponding groups and Dataset are created according to the method, and Dataset names and paths are saved for subsequent storage of converted data; finally, the whole instance reference network graph is traversed until all corresponding HDF composite types are created.
S302, traversing Dataset, and writing data.
This process starts the traversal in data sets, taking a single data set as an example.
Firstly, an IFC instance type corresponding to the data set and an HDF5 compound type thereof are acquired, then an instance object list in the data set is acquired, groups and Dataset are opened according to the path, and then a cache space is opened for writing, wherein the size of the space is the number of IFC instances of the type multiplied by the size of the compound type corresponding to the type instance.
Next, starting to convert the instance object into a corresponding HDF5 type, taking the data conversion of a single IFC instance object of a certain type as an example, firstly acquiring an IFC attribute definition and an HDF5 composite type definition corresponding to the instance object, then traversing the instance attribute, and taking out the attribute values one by one and judging the type of the instance attribute:
if the attribute is cited, find the position where its quoted object is located, fill the data in this position;
If the attribute is non-reference, the corresponding write accessor is called to write according to the type of the attribute, wherein the write accessor writes the buffer area according to the byte size occupied by the data.
Repeating the steps until all the attributes are written into the buffer area and the conversion of the instance object data is completed. After all the IFC instance objects in the instance object list are converted, the buffer data is uniformly written into the currently opened Dataset.
Finally, after traversing all Dataset and writing data, outputting the IFC-HDF file.
According to the IFC file compression method provided by the invention, iterative processing of the reference relation among the instance data is carried out, different redundant information is processed in a targeted manner, and the simplified entity object network diagram is taken as input, so that secondary compression is carried out, and the IFC file is converted into an HDF file in a lossless manner.
In addition, the method for compressing the IFC file solves the problem of losing the model data in the file compression process, improves the compression rate of the IFC file, and can realize format conversion from the full-version IFC file to the HDF file. The random access characteristic and flexible type definition of the converted HDF file are very suitable for the storage and access of IFC data, so that the management of the data of the converted HDF file is facilitated, and the problems that the data of an IFC file model is difficult to modify and the access efficiency is low are properly solved.
In summary, the method for compressing the IFC file can support compression and conversion of the full-version IFC file, and simultaneously greatly improves the file compression rate through secondary compression of the original IFC-SPF file, the file compression rate is generally between 80% and 90%, and lossless compression of all example objects is realized; in addition, the IFC-HDF file obtained after the IFC-SPF file conversion has the characteristic of supporting random access, so that the data reading efficiency is greatly improved, the query time is usually in the millisecond level, and the query time is increased in a few cases due to the huge number of instances. The file compression effect achieved by the method provides convenience conditions for a follow-up user to use the method to conduct three-dimensional visual modeling.
In order to better implement the IFC file compression method in the embodiment of the present invention, on the basis of the IFC file compression method, the embodiment of the present invention further provides an IFC file compression device, and fig. 4 is a schematic structural diagram of an embodiment of the IFC file compression device provided by the present invention, as shown in fig. 4, an IFC file compression device 400 includes:
a building module 410, configured to build an IFC instance reference network map based on the original IFC-SPF file;
a simplifying module 420, configured to iteratively simplify the instance reference network diagram to obtain a simplified instance reference network diagram;
and a conversion module 430, configured to identify an instance type in the simplified instance reference network graph, and convert the original IFC-SPF file into an IFC-HDF file.
The technical solution described in the foregoing IFC file compression method embodiment may be implemented by the IFC file compression device 400 provided in the foregoing embodiment, and the specific implementation principle of each module or unit may be referred to the corresponding content in the IFC file compression method embodiment, which is not described herein again.
As shown in fig. 5, the present invention further provides an electronic device 500 accordingly. The electronic device 500 comprises a processor 501, a memory 502 and a display 503. Fig. 5 shows only some of the components of the electronic device 500, but it should be understood that not all of the illustrated components are required to be implemented and that more or fewer components may be implemented instead.
Processor 501 may in some embodiments be a central processing unit (Central Processing Unit, CPU), microprocessor or other data processing chip for executing program code or processing data stored in memory 502, such as the IFC file compression method of the present invention.
In some embodiments, processor 501 may be a single server or a group of servers. The server farm may be centralized or distributed. In some embodiments, the processor 501 may be local or remote. In some embodiments, the processor 501 may be implemented on a cloud platform. In some embodiments, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an internal cloud, a multiple cloud, or the like, or any combination thereof.
The memory 502 may be an internal storage unit of the electronic device 500 in some embodiments, such as a hard disk or memory of the electronic device 500. The memory 502 may also be an external storage device of the electronic device 500 in other embodiments, such as a plug-in hard disk provided on the electronic device 500, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD), or the like.
Further, the memory 502 may also include both internal storage units and external storage devices of the electronic device 500. The memory 502 is used for storing application software and various types of data for installing the electronic device 500.
The display 503 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an Organic Light-Emitting Diode (OLED) touch, or the like in some embodiments. The display 503 is for displaying information at the electronic device 500 and for displaying a visual user interface. The components 501-503 of the electronic device 500 communicate with each other via a system bus.
In one embodiment, when the processor 501 executes the IFC file compression program in the memory 502, the following steps may be implemented:
constructing an IFC instance reference network diagram based on an original IFC-SPF file;
Performing iterative simplification on the instance reference network diagram to obtain a simplified instance reference network diagram;
identifying the instance type in the simplified instance reference network diagram, and converting the original IFC-SPF file into an IFC-HDF file.
It should be understood that: processor 501, when executing the IFC file compression program in memory 502, may perform other functions in addition to the above functions, as described above with respect to the corresponding method embodiments.
Further, the type of the electronic device 500 is not particularly limited, and the electronic device 500 may be a portable electronic device such as a mobile phone, a tablet computer, a Personal digital assistant (Personal DIGITAL ASSISTANT, PDA), a wearable device, a laptop (laptop), and the like. Exemplary embodiments of portable electronic devices include, but are not limited to, portable electronic devices that carry IOS, android, microsoft or other operating systems. The portable electronic device described above may also be other portable electronic devices, such as a laptop computer (laptop) or the like having a touch-sensitive surface, e.g. a touch panel. It should also be appreciated that in other embodiments of the invention, electronic device 500 may not be a portable electronic device, but rather a desktop computer having a touch-sensitive surface (e.g., a touch panel).
Correspondingly, the embodiment of the application also provides a computer readable storage medium, which is used for storing a computer readable program or instruction, and when the program or instruction is executed by a processor, the steps or functions in the IFC file compression method provided by the above method embodiments can be realized.
Those skilled in the art will appreciate that all or part of the flow of the methods of the embodiments described above may be accomplished by way of a computer program stored in a computer readable storage medium to instruct related hardware (e.g., a processor, a controller, etc.). The computer readable storage medium is a magnetic disk, an optical disk, a read-only memory or a random access memory.
The method, the device, the electronic equipment and the storage medium for compressing the IFC file provided by the invention are described in detail, and specific examples are applied to the principle and the implementation mode of the invention, and the description of the above examples is only used for helping to understand the method and the core idea of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present invention, the present description should not be construed as limiting the present invention.

Claims (6)

1.一种IFC文件压缩方法,其特征在于,包括:1. An IFC file compression method, comprising: 基于原始IFC-SPF文件,构建IFC实例引用网络图;Based on the original IFC-SPF file, build the IFC instance reference network diagram; 对所述实例引用网络图进行迭代简化,得到简化后的实例引用网络图;Iteratively simplify the instance reference network diagram to obtain a simplified instance reference network diagram; 对所述简化的实例引用网络图中的实例类型进行识别,将所述原始IFC-SPF文件转换为IFC-HDF文件;Identifying the instance type in the simplified instance reference network diagram, and converting the original IFC-SPF file into an IFC-HDF file; 所述基于原始IFC-SPF文件,构建IFC实例引用网络图,包括:The construction of the IFC instance reference network diagram based on the original IFC-SPF file includes: 基于所述原始IFC-SPF文件的版本,获取对应版本的IFC_schema定义;Based on the version of the original IFC-SPF file, obtaining an IFC_schema definition of a corresponding version; 基于实例标识符定位实例数据,获取所述实例数据对应的IFC实体的类型标识;Locate the instance data based on the instance identifier, and obtain the type identifier of the IFC entity corresponding to the instance data; 基于所述类型标识在所述IFC_schema定义中获取对应的类型定义;Obtaining a corresponding type definition in the IFC_schema definition based on the type identifier; 基于所述类型定义,构建实例对象;Based on the type definition, construct an instance object; 基于所述实例对象,构建所述IFC实例引用网络图;Based on the instance object, construct the IFC instance reference network diagram; 所述基于所述实例对象,构建所述IFC实例引用网络图,包括:The constructing the IFC instance reference network diagram based on the instance object includes: 基于所述实例对象的类型定义,定位所述实例对象的属性偏移量;Locating the attribute offset of the instance object based on the type definition of the instance object; 基于所述属性偏移量,确定所述实例对象的实例属性;Determining an instance attribute of the instance object based on the attribute offset; 基于所述实例属性,在两个实例对象之间建立正向引用关系或反向引用关系;Based on the instance attributes, a forward reference relationship or a reverse reference relationship is established between two instance objects; 基于所述正向引用关系或反向引用关系,构建所述IFC实例引用网络图;Based on the forward reference relationship or the reverse reference relationship, construct the IFC instance reference network diagram; 所述对所述实例引用网络图进行迭代简化,得到简化后的实例引用网络图,包括:The iterative simplification of the instance reference network diagram to obtain a simplified instance reference network diagram includes: 遍历所述实例引用网络图,构建非冗余实例对象集合;Traversing the instance reference network graph to construct a non-redundant instance object set; 基于所述非冗余实例对象集合,得到所述简化后的实例引用网络图;Based on the non-redundant instance object set, obtaining the simplified instance reference network graph; 所述遍历所述实例引用网络图,构建非冗余实例对象集合,包括:The traversing the instance reference network graph to construct a non-redundant instance object set includes: 基于每个实例对象对应的哈希值,确定实例属性和实例类型相同的第一冗余实例对象;Determine, based on the hash value corresponding to each instance object, a first redundant instance object having the same instance attribute and instance type; 从所述实例引用网络图的末端开始迭代,确定逻辑相等的第二冗余实例对象;Iterating from the end of the instance reference network graph to determine a logically equivalent second redundant instance object; 基于所述第一冗余实例对象和所述第二冗余实例对象,确定所述非冗余实例对象集合。The non-redundant instance object set is determined based on the first redundant instance object and the second redundant instance object. 2.根据权利要求1所述的IFC文件压缩方法,其特征在于,所述对所述简化的实例引用网络图中的实例类型进行识别,将所述原始IFC-SPF文件转换为IFC-HDF文件,包括:2. The IFC file compression method according to claim 1, wherein the step of identifying the instance type in the simplified instance reference network diagram and converting the original IFC-SPF file into an IFC-HDF file comprises: 基于所述简化的实例引用网络图,确定实例对象的实例类型;Determining an instance type of an instance object based on the simplified instance reference network diagram; 基于所述实例类型,创建对应的HDF复合类型;Based on the instance type, create a corresponding HDF composite type; 基于所述HDF复合类型,创建对应的组和数据集;Based on the HDF composite type, create corresponding groups and data sets; 遍历所述数据集,得到所述IFC-HDF文件。The data set is traversed to obtain the IFC-HDF file. 3.根据权利要求2所述的IFC文件压缩方法,其特征在于,所述遍历所述数据集,得到所述IFC-HDF文件,包括:3. The IFC file compression method according to claim 2, wherein traversing the data set to obtain the IFC-HDF file comprises: 获取所述数据集对应的实例类型、HDF5复合类型和实例对象列表;Get the instance type, HDF5 composite type and instance object list corresponding to the data set; 获取所述实例对象列表中未访问的实例对象;Obtaining an unvisited instance object in the instance object list; 基于所述未访问的实例对象的属性定义和HDF5复合类型定义,将所述未访问的实例对象的实例属性写入缓冲区;Based on the attribute definition of the unaccessed instance object and the HDF5 composite type definition, writing the instance attribute of the unaccessed instance object into a buffer; 将所述缓冲区的数据写入创建的HDF5文件中,得到所述IFC-HDF文件。The data in the buffer is written into the created HDF5 file to obtain the IFC-HDF file. 4.一种IFC文件压缩装置,其特征在于,包括:4. An IFC file compression device, comprising: 构建模块,用于基于原始IFC-SPF文件,构建IFC实例引用网络图;A construction module is used to construct an IFC instance reference network diagram based on the original IFC-SPF file; 简化模块,用于对所述实例引用网络图进行迭代简化,得到简化后的实例引用网络图;A simplification module, used for iteratively simplifying the instance reference network diagram to obtain a simplified instance reference network diagram; 转换模块,用于对所述简化的实例引用网络图中的实例类型进行识别,将所述原始IFC-SPF文件转换为IFC-HDF文件;A conversion module, used for identifying the instance type in the simplified instance reference network diagram, and converting the original IFC-SPF file into an IFC-HDF file; 所述基于原始IFC-SPF文件,构建IFC实例引用网络图,包括:The construction of the IFC instance reference network diagram based on the original IFC-SPF file includes: 基于所述原始IFC-SPF文件的版本,获取对应版本的IFC_schema定义;Based on the version of the original IFC-SPF file, obtaining an IFC_schema definition of a corresponding version; 基于实例标识符定位实例数据,获取所述实例数据对应的IFC实体的类型标识;Locate the instance data based on the instance identifier, and obtain the type identifier of the IFC entity corresponding to the instance data; 基于所述类型标识在所述IFC_schema定义中获取对应的类型定义;Obtaining a corresponding type definition in the IFC_schema definition based on the type identifier; 基于所述类型定义,构建实例对象;Based on the type definition, construct an instance object; 基于所述实例对象,构建所述IFC实例引用网络图;Based on the instance object, construct the IFC instance reference network diagram; 所述基于所述实例对象,构建所述IFC实例引用网络图,包括:The constructing the IFC instance reference network diagram based on the instance object includes: 基于所述实例对象的类型定义,定位所述实例对象的属性偏移量;Locating the attribute offset of the instance object based on the type definition of the instance object; 基于所述属性偏移量,确定所述实例对象的实例属性;Determining an instance attribute of the instance object based on the attribute offset; 基于所述实例属性,在两个实例对象之间建立正向引用关系或反向引用关系;Based on the instance attributes, a forward reference relationship or a reverse reference relationship is established between two instance objects; 基于所述正向引用关系或反向引用关系,构建所述IFC实例引用网络图;Based on the forward reference relationship or the reverse reference relationship, construct the IFC instance reference network diagram; 所述对所述实例引用网络图进行迭代简化,得到简化后的实例引用网络图,包括:The iterative simplification of the instance reference network diagram to obtain a simplified instance reference network diagram includes: 遍历所述实例引用网络图,构建非冗余实例对象集合;Traversing the instance reference network graph to construct a non-redundant instance object set; 基于所述非冗余实例对象集合,得到所述简化后的实例引用网络图;Based on the non-redundant instance object set, obtaining the simplified instance reference network graph; 所述遍历所述实例引用网络图,构建非冗余实例对象集合,包括:The traversing the instance reference network graph to construct a non-redundant instance object set includes: 基于每个实例对象对应的哈希值,确定实例属性和实例类型相同的第一冗余实例对象;Determine, based on the hash value corresponding to each instance object, a first redundant instance object having the same instance attribute and instance type; 从所述实例引用网络图的末端开始迭代,确定逻辑相等的第二冗余实例对象;Iterating from the end of the instance reference network graph to determine a logically equivalent second redundant instance object; 基于所述第一冗余实例对象和所述第二冗余实例对象,确定所述非冗余实例对象集合。The non-redundant instance object set is determined based on the first redundant instance object and the second redundant instance object. 5.一种电子设备,其特征在于,包括存储器和处理器,其中,5. An electronic device, comprising a memory and a processor, wherein: 所述存储器,用于存储程序;The memory is used to store programs; 所述处理器,与所述存储器耦合,用于执行所述存储器中存储的所述程序,以实现如权利要求1至3中任意一项所述的IFC文件压缩方法。The processor is coupled to the memory, and is used to execute the program stored in the memory to implement the IFC file compression method according to any one of claims 1 to 3. 6.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至3中任意一项所述的IFC文件压缩方法。6. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the IFC file compression method according to any one of claims 1 to 3 is implemented.
CN202410556056.9A 2024-05-07 2024-05-07 IFC file compression method, device, electronic equipment and storage medium Active CN118331936B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410556056.9A CN118331936B (en) 2024-05-07 2024-05-07 IFC file compression method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410556056.9A CN118331936B (en) 2024-05-07 2024-05-07 IFC file compression method, device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN118331936A CN118331936A (en) 2024-07-12
CN118331936B true CN118331936B (en) 2024-11-22

Family

ID=91774443

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410556056.9A Active CN118331936B (en) 2024-05-07 2024-05-07 IFC file compression method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN118331936B (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110706345A (en) * 2019-08-28 2020-01-17 中国铁道科学研究院集团有限公司电子计算技术研究所 A lightweight method and system for railway BIM model based on component instance merging
KR20220151573A (en) * 2021-05-06 2022-11-15 주식회사 밍스피엠 System for web-based 3D map display and method for file conversion using the same
CN113609084B (en) * 2021-07-24 2024-05-14 全图通位置网络有限公司 BIM custom format-based data compression method, device, equipment and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
An efficient binary storage format for IFC building models using HDF5 hierarchical data format;Thomas Krijnen, Jakob Beetz;《Automation in Construction》;20200309;第1-23页 *

Also Published As

Publication number Publication date
CN118331936A (en) 2024-07-12

Similar Documents

Publication Publication Date Title
CN109254733B (en) Method, apparatus and system for storing data
CN111462327A (en) Three-dimensional modeling software three-dimensional inspection model unstructured data analysis method
CN111984745B (en) Database field dynamic expansion method, device, equipment and storage medium
CN112506486B (en) Search system establishment method, device, electronic device and readable storage medium
CN102799679B (en) Hadoop-based massive spatial data indexing updating system and method
CN112765712B (en) Structured management method, device, computer equipment and storage medium for BIM data
CN118331936B (en) IFC file compression method, device, electronic equipment and storage medium
CN115658694A (en) System, method and device for generating a database table
CN117392331B (en) Visualization method of CAD file in three-dimensional scene based on vector tile serialization
CN114490651A (en) Data storage method and device
CN117435558B (en) Metadata management method, computing device and storage medium
CN114926596B (en) Oblique photography terrain file loading method, device, equipment and storage medium
CN117194372B (en) Data migration methods, apparatus, electronic devices and storage media
CN116756115A (en) Power grid multi-temporal modeling method, device and electronic equipment based on graph database
CN116932540A (en) Substation engineering data management method, device, computer equipment and storage medium
CN111159218B (en) Data processing method, device and readable storage medium
CN115114297A (en) Data lightweight storage and search method, device, electronic device and storage medium
CN115934669A (en) Three-dimensional tile storage and distribution method and device
CN114647630A (en) File synchronization method, information generation method, file synchronization device, information generation device, computer equipment and storage medium
CN114442940A (en) Data processing method, device, medium and electronic equipment
CN113849548A (en) A data extraction method, apparatus, device and medium
Wyszomirski Analysis of the possibility of using key-value store NoSQL databases for IFC data processing in the BIM-GIS integration process
CN114356945A (en) Data processing method, data processing device, computer equipment and storage medium
CN118364033B (en) Data processing method and device among database clusters and related equipment
CN116882408B (en) Construction method and device of transformer graph model, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant