Indoor space rule knowledge graph construction method and system, terminal equipment and medium
By obtaining building code text data to build an ontology model and using large language models to extract information, the problem of lack of normative constraints in the interior space design of residential buildings is solved, the normativeness of building interior plane generation and compliance verification of design plans is achieved, and the scientific nature of architectural design is improved.
Patent Information
- Application Number
- CN202510750278.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-07-04
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing technology lacks special support for indoor space rules in the design of residential buildings. Traditional knowledge graph construction is inefficient and difficult to process large-scale data. Deep learning methods are insufficiently modeled in this field, resulting in lack of standard constraints on building interior plane generation and difficulty in verifying the compliance of design schemes.
By obtaining building code text data, building ontology models, and using large language models for information extraction, building a knowledge graph corresponding to indoor space rules, and using ontology models as an auxiliary to large language models to ensure the integrity and logic of the knowledge system.
It realizes comprehensive standardized constraints on the generation of indoor floor plans of the building, avoids design defects, can verify the compliance of the design plan, and improves the scientificity and standardization of architectural design.
Smart Images

Figure CN120258116A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of knowledge graph construction, and in particular to a method, system, terminal device and medium for constructing an indoor space rule knowledge graph. Background Art
[0002] In the field of architecture, the inference of residential indoor space is a complex multi-stage process that requires a large amount of professional knowledge and experience to ensure the rationality and accuracy of the inference results. At present, although there are expert systems and knowledge bases in the field of architecture to assist knowledge retrieval, there is a lack of specialized support for the rules of residential building indoor space. The traditional manual construction method of knowledge graph has limitations such as slow construction speed, poor ability to process large-scale data, and difficulty in adapting to the complexity and dynamic changes of indoor space. The development of deep learning technology has brought a breakthrough to the construction of knowledge graph. Its model, with powerful text processing capabilities, can efficiently identify entities, extract relationships, and improve the construction accuracy and efficiency. However, existing deep learning-based methods mostly focus on general fields and lack targeted modeling in the specific field of residential building indoor space rules. This field involves complex structural relationships and specific rules, and the construction of its knowledge graph requires in-depth integration of domain knowledge to ensure the accuracy and logic of knowledge representation.
[0003] In practical applications, the problems of the existing technology are prominent. For example, when generating building interior plans, due to the lack of sufficient specification constraints, the design plans often have defects. Constructing a knowledge graph of residential building indoor space rules is of great significance. It can transform scattered building specification texts into machine-understandable entity, relationship, and attribute triples. This knowledge graph has a wide range of applications. It can provide more specification constraints for the generation of building interior plans and optimize the design; combined with large language models, it can correct the hallucination problems of the models in the professional field; integrated into the BIM (Building Information Modeling) system, it can verify the compliance of design plans and improve the design quality and efficiency.
[0004] Therefore, there is an urgent need for an intelligent method for constructing a knowledge graph that focuses on the field of residential building indoor space rules to fill the gap in the existing technology. Summary of the Invention
[0005] The technical problem to be solved by the present invention is that in the field of interior space design of residential buildings, although existing expert systems and knowledge bases can retrieve building knowledge, they lack dedicated support for interior space rules and are difficult to meet design requirements. The traditional manual construction method of knowledge graphs is inefficient, difficult to process large-scale data, and unable to adapt to the complex changes in interior spaces. Deep learning technology has insufficient modeling for specific domains of interior space rules in the construction of knowledge graphs. This results in a lack of sufficient normative constraints in the generation of building interior plans, hallucinations in large language models in professional fields, and difficulties in verifying the compliance of design schemes, and there is an urgent need for effective solutions.
[0006] To solve the above technical problems, the technical solutions adopted by the present invention are as follows: In a first aspect, the present invention provides a method for constructing a knowledge graph of interior space rules, the method comprising: Obtaining interior space rules; Constructing an ontology model; Based on the ontology model, using a large language model to extract information from the interior space rules to obtain an information set; Based on the information set, constructing a knowledge graph corresponding to the interior space rules.
[0007] In one implementation, the obtaining of the interior space rules includes: Obtaining publicly available building code text data, and preprocessing the building code text data to obtain preprocessed building code text data; Using a large language model to screen the preprocessed building code text data to obtain interior space rules, where the interior space rules are text fragments of building codes used to describe interior spaces.
[0008] In one implementation, the constructing of the ontology model includes: Defining classes and the hierarchical structure of classes, where the classes are used to describe a set of objects with common characteristics in the interior space; Defining data attributes, where the data attributes are used to describe the data information of the objects; Defining object attributes, where the object attributes are used to describe the association information between the objects; Defining constraint attributes, where the constraint attributes are used to express the attribute restriction rules of the objects or between the objects; Integrating the classes and the hierarchical structure of classes, the data attributes, the object attributes, and the constraint attributes to obtain the ontology model.
[0009] In one implementation, the based on the ontology model, using a large language model to extract information from the interior space rules to obtain an information set includes: Set the ontology model as a limiting condition for the large language model recognition process; Use the large language model to recognize the indoor space rules, and obtain all entities and corresponding attributes in the indoor space rules, where the entities correspond to the objects in the ontology model; Integrate each entity and its corresponding attribute to obtain a number of entity tuples; Use the large language model to recognize the relationship between each entity in the indoor space rules and other entities, and obtain a number of entity pairs; Integrate the entity tuples and the entity pairs to obtain an information set.
[0010] In one implementation, setting the ontology model as a limiting condition for the large language model recognition process includes: During the recognition process, use the classes and class hierarchies in the ontology model to limit the types and abstract levels of the recognized entities; During the recognition process, use the object properties and data properties in the ontology model to limit the attribute dimensions and semantic relationships of the recognized entities; During the recognition process, use the constraint properties in the ontology model to make the recognized entities comply with the restriction rules of the constraint properties.
[0011] In one implementation, using the large language model to recognize the relationship between each entity in the indoor space rules and other entities, and obtaining a number of entity pairs includes: Use the large language model to recognize the relationship between each entity in the indoor space rules and other entities, and obtain a number of initial entity pairs; Evaluate the relationship strength of each initial entity pair to obtain the corresponding relationship strength score; Explain the reason for the association of each initial entity pair to obtain the corresponding relationship description; Integrate the initial entity pairs and the corresponding relationship strength scores and the relationship descriptions to obtain a number of entity pairs.
[0012] In one implementation, constructing the knowledge graph corresponding to the indoor space rules based on the information set includes: Store the entity tuples and entity pairs in the information set into a graph database, where the entity tuples are used as the nodes of the graph database and the entity pairs are used as the relationships of the graph database.
[0013] In a second aspect, an embodiment of the present invention further provides an indoor space rule knowledge graph construction system, and the system includes: An indoor space rule acquisition module, configured to acquire indoor space rules; An ontology model construction module for constructing an ontology model; An information set acquisition module for extracting information from the indoor space rules using a large language model based on the ontology model to obtain an information set; A knowledge graph acquisition module for constructing a knowledge graph corresponding to the indoor space rules based on the information set.
[0014] In a third aspect, an embodiment of the present invention further provides a terminal device, which includes a memory, a processor, and an indoor space rule knowledge graph construction program stored in the memory and executable on the processor. When the processor executes the indoor space rule knowledge graph construction program, the steps of the indoor space rule knowledge graph construction method described in any one of the above solutions are implemented.
[0015] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which an indoor space rule knowledge graph construction program is stored. When the indoor space rule knowledge graph construction program is executed by a processor, the steps of the indoor space rule knowledge graph construction method described in any one of the above solutions are implemented.
[0016] Beneficial effects: The present invention discloses a method, system, terminal device, and medium for constructing an indoor space rule knowledge graph. The method first obtains indoor space rules and then constructs an ontology model. Subsequently, based on the ontology model, a large language model is used to extract information from the indoor space rules to obtain an information set. Finally, based on the information set, a knowledge graph corresponding to the indoor space rules is constructed. The present invention constructs an ontology model and innovatively uses the ontology model to assist the large language model to accurately extract indoor space knowledge from building specification texts. When constructing the ontology model, the integrity and logic of the knowledge system are ensured by defining classes, attributes, and constraints in detail. The local model assists the large language model, improving the understanding and processing capabilities of professional texts, and more accurately identifying and extracting entities, relationships, and attributes. The constructed knowledge graph can not only provide comprehensive specification constraints during the indoor floor plan generation stage of the building to avoid design defects, but also perform compliance verification on the design scheme to ensure compliance with various specifications, effectively improving the scientificity and standardization of building design. Description of the Drawings
[0017] Figure 1 It is a flowchart of the specific implementation of the indoor space rule knowledge graph construction method provided by the embodiment of the present invention.
[0018] Figure 2 It is the overall flowchart of the indoor space rule knowledge graph construction provided by the embodiment of the present invention.
[0019] Figure 3It is a flow chart for constructing an ontology model provided by an embodiment of the present invention.
[0020] Figure 4 It is a schematic block diagram of the principle of a device for constructing an indoor space rule knowledge graph provided by an embodiment of the present invention.
[0021] Figure 5 It is a schematic block diagram of the internal structure principle of a terminal device provided by an embodiment of the present invention. Detailed implementation manners
[0022] To make the objectives, technical solutions and effects of the present invention clearer and more definite, the following further describes the present invention in detail with reference to the accompanying drawings and by way of examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0023] The flow chart shown in the accompanying drawings is only an example illustration, and does not necessarily include all the content and operations or steps, nor does it necessarily execute in the described order. For example, some operations or steps can also be decomposed, combined or partially merged, so the actual execution order may be changed according to the actual situation.
[0024] It should be understood that the terms used in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include the plural forms.
[0025] It should be understood that, in order to clearly describe the technical solutions of the embodiments of the present invention, in the embodiments of the present invention, terms such as "first" and "second" are used to distinguish the same items or similar items with basically the same functions and effects. For example, the first control information and the second control information are only used to distinguish different control information, and do not limit their order.
[0026] Those skilled in the art can understand that the terms "first", "second", etc. do not limit the quantity and execution order, and the terms "first", "second", etc. do not necessarily limit to be different.
[0027] It should also be understood that the term " / and" used in the specification of the present invention and the appended claims refers to any combination and all possible combinations of one or more of the related listed items, and includes these combinations.
[0028] In the field of architecture, the interior space design of residential buildings is particularly crucial. Its quality is related to the living experience and use safety, and it requires comprehensive consideration of various professional knowledge and experiences. Currently, although expert systems and knowledge bases in the architecture field can assist in retrieving knowledge, the dedicated support for the rules of the interior space of residential buildings is seriously insufficient, making it difficult to solve specific design problems such as space layout and functional area size planning. At the same time, the traditional method of manually constructing knowledge graphs is inefficient, difficult to process large-scale data, and unable to adapt to the complex and changeable interior space. With the development of the industry, new materials and design concepts are emerging continuously, and the traditional method is increasingly unable to meet the requirements. Although the development of deep learning technology has promoted the progress of knowledge graph construction, the existing construction methods based on deep learning mostly focus on general fields, and there is a serious shortage in modeling specific fields of the rules of the interior space of residential buildings, making it difficult to combine complex domain rules to ensure accurate knowledge representation and reasonable logic.
[0029] These technical problems have a significant impact in practical applications. The generation of building interior plans lacks sufficient normative constraints, and design schemes are often unreasonable; when the large language model is used for auxiliary design, due to insufficient professional knowledge, hallucinations are prone to occur, giving wrong suggestions; there are also defects in the compliance verification of design schemes, and the existing means cannot comprehensively and accurately check, resulting in designs with potential safety hazards or non-compliance entering the construction stage. In short, the problems in knowledge acquisition, graph construction, and practical application of the interior space design of residential buildings are prominent. There is an urgent need for an intelligent knowledge graph construction method focusing on this field to solve the existing technical dilemmas and promote the intelligent development of the construction industry.
[0030] Figure 2 The overall flowchart of a method for constructing a knowledge graph of interior space rules is shown. First, analyze the characteristics of the rules for the interior space design of residential buildings, combine the knowledge of domain experts, determine the method for constructing the ontology model, and construct specific ontology model instances according to this method. Then, based on the ontology model, clarify the entity, relationship, and attribute types within the domain. Next, collect and screen relevant data according to the ontology model, and combine the designed prompt words (Prompt), and use the large language model to extract entities, relationships, and attributes in the domain knowledge from the screened data. Finally, store the extracted entities, relationships, and attributes in the Neo4j graph database to achieve the visual construction of the knowledge graph. Among them, the Neo4j graph database is a database based on graph structure for storing and querying data, used to process complex relationship networks.
[0031] A method for constructing a knowledge graph of interior space rules provided in this embodiment, as Figure 1 shown, specifically includes the following steps: Step S100, obtain the interior space rules.
[0032] In this embodiment, the focus is mainly on residential buildings, and the interior space rules are specifically the interior space rules of residential buildings.
[0033] In one implementation manner, the obtaining of the indoor space rules specifically includes the following steps: Step S110: Obtain the publicly available building code text data, and preprocess the building code text data to obtain the preprocessed building code text data; Step S120: Use a large language model to screen the preprocessed building code text data to obtain the indoor space rules, where the indoor space rules are text segments of the building codes used to describe the indoor space.
[0034] In this embodiment, first, determine the source of the building code text data. Specifically, select various building design standards, code manuals, industry guides, etc. issued in the local area, such as the "Code for Residential Design" and the "Code for Fire Protection of Buildings". The above-mentioned code texts are the summary of the actual experience in the construction industry and the embodiment of regulatory requirements, and contain a large amount of rule information on indoor space design, layout, safety, etc. After determining the data source, use the BeautifulSoup library and the lxml library in the Python programming language to write a crawler script to automatically obtain the text data of these publicly available codes from the Internet. Among them, the BeautifulSoup library is a Python library for parsing HTML and XML documents and extracting data, and the lxml library is a high-performance XML and HTML parser for web crawling and data extraction.
[0035] After obtaining these original building code text data, due to problems such as diverse formats, complex content, and a large amount of noise information, it is necessary to preprocess it. Preferably, the preprocessing process may include steps such as format unification, noise removal, text cleaning, paragraph and sentence segmentation, etc. First, convert data files in different formats into a unified text format file. Then, use text processing functions or regular expressions to remove noise information such as extra spaces and special symbols. At the same time, clean the text, including removing duplicate paragraphs, correcting spelling mistakes, and unifying text case. Finally, divide the text after noise removal and cleaning into paragraphs and sentences to facilitate subsequent processing by the large language model, so that the large language model can more accurately understand the semantics and structure of the text.
[0036] The preprocessed building code text data still contains a large amount of information irrelevant to the indoor space rules, and it is necessary to use a large language model for screening. The large language model has powerful language understanding and semantic analysis capabilities and can accurately identify text segments related to the indoor space.
[0037] After obtaining the preprocessed building code text data, use a large language model to screen the above data. Among them, the large language model can choose to use a general large language model or a fine-tuned large language model. Fine-tuning can make it more adaptable to the professional terms and semantics in the construction field. Use a professional corpus in the construction field to conduct supervised training on the large language model, so that the model can learn the professional vocabulary, grammar structures, and semantic relationships in the building code text. Among them, if a general large language model is used, general large language models such as DeepSeek or Qwen can be used. Through the natural language processing ability of the large language model, deeply screen the preprocessed text knowledge, and accurately identify and retain the sentences and paragraphs related to the key concepts of "room layout", "area requirements", and "interior space". These sentences and paragraphs constitute the indoor space rules for subsequent knowledge graph construction.
[0038] Step S200: Construct an ontology model.
[0039] In this embodiment, as Figure 2 shown, before constructing the ontology model, it is necessary to first determine the construction method of the ontology model. In this embodiment, an ontology model construction method for residential building interior space design rules based on an improved seven-step method is used to construct the ontology model.
[0040] The specific process of constructing the ontology model by the improved seven-step method of the present invention is as Figure 3 shown, including the task framework and specific execution actions at each stage.
[0041] First, in the early data collection stage, the determination of the ontology professional field and scope and the screening of professional domain knowledge in the task framework correspond to the execution actions of domain knowledge acquisition, data analysis, and screening. During actual execution, the step of obtaining indoor space rules falls within the scope of this stage, and the domain knowledge acquisition is completed by clarifying the professional boundaries of residential building interior space design. For example, focus on the layout of house types and functional zoning specifications. Further, denoise and purify the collected miscellaneous information, and screen out the spatial function requirements that meet the design standards to achieve data analysis and screening, and prepare the data basis for subsequent ontology construction.
[0042] Secondly, the ontology definition stage includes the logical process steps of listing important terms in the ontology, defining classes and class hierarchies, defining class attributes, and defining attribute classifications, corresponding to specific definition execution actions. Specifically, the definition class and class hierarchy are refined into the definition class and class hierarchy, such as sorting out the subclass hierarchy of living room, bedroom, etc. in the residential space. And the attributes of the defined class are disassembled into the definition object attributes to describe the association between classes, such as the relationship between the living room and the furniture layout. Next, the data attributes are defined to clarify the characteristics of the class itself, such as the area and orientation of the living room. Further define the classification of attributes, extend it to define constraint attributes for supplementary rules, and build the ontology logic process framework through structured actions.
[0043] Finally, the ontology instantiation phase is guided by the task of creating an instance, which is specifically implemented as the execution action of creating an instance. Based on the classes, attributes and constraints defined in the previous order, specific scenario instances are generated to complete the transformation from abstract models to practical applications, realizing the full process of ontology construction.
[0044] In one implementation, the constructing of the ontology model specifically includes the following steps: Step S210: define a class and a class hierarchy, wherein the class is used to describe a set of objects having common characteristics in an indoor space; Step S220: define data attributes, where the data attributes are used to describe data information of the object; Step S230: define object attributes, where the object attributes are used to describe association information between the objects; Step S240: defining constraint attributes, where the constraint attributes are used to express attribute restriction rules of the object or between the objects; Step S250: Integrate the classes and class hierarchies, the data attributes, the object attributes, and the constraint attributes to obtain the ontology model.
[0045] In this embodiment, if Figure 3 As shown in the figure, in the ontology definition stage, classes and class hierarchies, data attributes, object attributes, and constraint attributes are specifically defined. The following is a detailed explanation of each concept defined above.
[0046] Regarding classes and class hierarchies, first, it is explained that a class is an abstract classification that defines a set of instances with common characteristics. If an entity is a "bedroom", the class it belongs to may be "the composition of the internal space of a residential building". In contrast, an object is a specific instance of a class, that is, the individualized manifestation of a class. If the class is "the composition of the internal space of a residential building", then a bedroom can be an object of this class. Based on the definition of a class, the classes described in the ontology model can include three top-level classes: residential layout objects, residential building units, and vertical transportation spaces. Based on these three top-level classes, subclasses can be further refined and constructed according to requirements.
[0047] Regarding object properties, in the field of residential building floor plans, the definition of object properties describes the constraint relationships and inclusion relationships, etc., among residential floor plan objects. Specifically, the object properties described in the ontology model can include composition, inclusion, constraint, and others.
[0048] Regarding data properties, after defining the class, specific data is also needed to describe the class. The numerical types of each data property can be the same or different, and are set based on specific requirements when defining data properties. Specifically, the data properties described in the ontology model are shown in Table 1: Table 1
[0049] Regarding constraint properties, in a knowledge graph, constraint properties refer to rules that restrict and regulate the attribute values of entities or relationships. The role of these constraint properties is to ensure that the data in the knowledge graph conforms to predefined logical and semantic rules. Among them, an entity is a specific thing or concept in the knowledge graph, which corresponds to an object in this embodiment. As an entity, a "bedroom" is an instance (object) of the class of the composition of the internal space of a residential building, and is represented as a node in the knowledge graph, containing attributes (such as area) and relationships (such as "belongs to", "adjacent to"). Specifically, the constraint properties described in the ontology model are shown in Table 2: Table 2
[0050] Among them, the constraint properties refer to specific restriction rules imposed on the attribute values of entities or relationships. For example, the entity attribute constraint: "The area of the bedroom ≥ 10 square meters". And the constraint types used in Table 2 are the classifications of constraint properties, representing the abstract categories of constraints. For example, the area range belongs to the numerical range constraint. That is to say, constraint properties are specific rules, and constraint types are their classifications. Further, the constraint relationships mentioned in object properties are the specific applications of constraint properties in entity associations.
[0051] After defining the classes and class hierarchies, the data properties, the object properties, and the constraint properties, the above concepts are integrated to form an ontology model. The method for constructing the ontology model systematically defines and strictly constrains the domain ontology knowledge, classes, and properties in view of the uniqueness of the indoor space design rules for residential buildings, thereby reasonably designing the ontology model. By clarifying the types of entities, the types of relationships, and the characteristics of properties within the domain, the ontology model can accurately depict the knowledge structure of the indoor space design field for residential buildings, providing a solid framework foundation for the subsequent construction of the knowledge graph.
[0052] Step S300: Based on the ontology model, use a large language model to extract information from the indoor space rules to obtain an information set.
[0053] In this embodiment, after constructing the ontology model, through the structured framework provided by the ontology model, the specific direction of information extraction by the large language model is guided.
[0054] In one implementation, the step of using a large language model to extract information from the indoor space rules based on the ontology model to obtain an information set specifically includes the following steps: Step S310: Set the ontology model as a limiting condition in the recognition process of the large language model; Step S320: Use the large language model to recognize the indoor space rules to obtain all entities and corresponding attributes in the indoor space rules, where the entities correspond to the objects in the ontology model; Step S330: Integrate each entity and its corresponding attribute to obtain a number of entity tuples; Step S340: Use the large language model to recognize the relationships between each entity and other entities in the indoor space rules to obtain a number of entity pairs; Step S350: Integrate the entity tuples and the entity pairs to obtain an information set.
[0055] In this embodiment, a large language model is used to recognize all entities in the text and extract detailed information for each entity. First, the name (entity_name) of each recognized entity needs to be extracted and expressed in Chinese; then its entity type (entity_type) is determined; next, a short description (entity_description) is written to outline what the entity is; finally, based on the attribute relationships defined by the ontology model, as a limiting condition in the recognition process of the large language model, all relevant attribute information (entity_info) of the entity is collected and presented in the form of key-value pairs. The information of each entity will be formatted into an entity tuple in the form of: ( "entity"{tuple_delimiter} <entity_name>{tuple_delimiter} <entity_type>{tuple_delimiter} <entity_description>{tuple_delimiter} <entity_info> ), Among them, {tuple_delimiter} is a delimiter used to distinguish different fields.
[0056] After integrating the entity tuples, the large language model is further used to identify the relationships between the entities determined in the previous step.
[0057] After obtaining the entity tuples and entity pairs, all the extracted entities and entity pairs are integrated into a list. First, an empty string variable is created to store the final output result; then all the extracted entity tuples and entity pairs are traversed, each tuple is converted into a string format and added to the output result string, and {record_delimiter} is inserted between each tuple string to ensure that different records can be clearly distinguished; finally, {completion_delimiter} is appended to the end of the output result string. In this way, this list will serve as an information set and participate in the subsequent construction of the knowledge graph.
[0058] In one implementation, setting the ontology model as a limiting condition in the large language model recognition process specifically includes the following steps: Step S311: During the recognition process, use the classes and class hierarchies in the ontology model to limit the types and abstraction levels of the recognized entities; Step S312: During the recognition process, use the object properties and data properties in the ontology model to limit the attribute dimensions and semantic relationships of the recognized entities; Step S313: During the recognition process, use the constraint properties in the ontology model to make the recognized entities conform to the restriction rules of the constraint properties.
[0059] In this embodiment, an ontology model is used as a constraint condition in the process of identifying by a large language model. For example, prompts can be used to restrict the operation process of the large language model. Specifically for the constraint conditions, the ontology model, through classes and the hierarchical structure of classes, clarifies the types of entities in the domain and their abstraction levels, ensuring that the large language model can identify specific entities as needed. And through data properties and object properties, it limits the attribute dimensions of entities, avoiding the introduction of irrelevant information during extraction by the large language model. Secondly, it can constrain semantic relationships and improve extraction accuracy. The ontology model also defines the types of logical relationships between entities through object properties (such as "composition", "constraint"), guiding the large language model to identify specific associations (such as "a bedroom and a bathroom cannot be directly connected"). The ontology model further restricts the value range of entity attributes through constraint attributes (such as "the area of a bedroom ≥ 10 square meters"), ensuring that the extracted data conforms to domain specifications and supporting the logical consistency and scalability of the knowledge graph. Finally, the ontology model avoids knowledge conflicts through constraint types (such as existence constraints, uniqueness constraints). For example, if the model defines that "each bedroom must belong to a residential unit", the large language model will verify whether this rule is satisfied during extraction. When domain rules are updated (such as adding "smart home wiring requirements"), the ontology model can quickly expand new classes and properties to guide the large language model to adjust the extraction scope.
[0060] In one implementation, the step of using the large language model to identify the relationship between each entity and other entities in the indoor space rules to obtain a number of entity pairs specifically includes the following steps: Step S341: Use the large language model to identify the relationship between each entity and other entities in the indoor space rules to obtain a number of initial entity pairs; Step S342: Evaluate the relationship strength of each of the initial entity pairs to obtain the corresponding relationship strength score; Step S343: Explain the reason for the association of each of the initial entity pairs to obtain the corresponding relationship description; Step S344: Integrate the initial entity pairs and the corresponding relationship strength scores and the relationship descriptions to obtain a number of entity pairs.
[0061] In this embodiment, to identify the relationships between the entities determined in the previous step using a large language model, it is first necessary to find all the initial entity pairs that are "obviously related". An initial entity pair includes two entities, a source entity and a target entity (source_entity and target_entity). Further, a relationship description (relationship_description) is extracted for each pair of initial entity pairs to explain the reason for their association. At the same time, the strength of this relationship (relationship_strength) is evaluated and represented by a numerical score from 1 to 10. Finally, each entity pair is formatted into a tuple in the form of: ( "relationship"{tuple_delimiter} <source_entity>{tuple_delimiter} <target_entity>{tuple_delimiter} <relationship_description>{tuple_delimiter} <relationship_strength> ), where, {tuple_delimiter} is also used to separate different fields.
[0062] Step S400: Based on the information set, construct a knowledge graph corresponding to the indoor space rules.
[0063] In this embodiment, the entities, relationships, and attributes extracted from the publicly available building code text knowledge are integrated and transformed into a graph structure form for storage and visualization.
[0064] In one implementation manner, the constructing the knowledge graph corresponding to the indoor space rules based on the information set specifically includes the following steps: Step S410: Store the entity tuples and entity pairs in the information set into a graph database, where the entity tuples serve as the nodes of the graph database and the entity pairs serve as the relationships of the graph database.
[0065] In this embodiment, according to the entity tuples and entity pairs in the information set extracted in the previous steps, corresponding data structures are prepared. First, an entity data list (entities) is created, where each entity is a tuple containing the following information: entity_name, entity_type, entity_description, entity_info; then a relationship data list relationships is created, where each pair of related entities is a tuple containing the following information: source_entity, target_entity, relationship_description, relationship_strength.
[0066] Next, in order to store the above entity data list into the graph database, corresponding statements need to be written using the Cypher query language. First, define the Cypher statement create_entity_query for creating entity nodes. This statement uses the CREATE keyword to create a node of type Entity and sets its properties such as name, type, description, and info. Then, define the Cypher statement create_relationship_query for creating relationships. This statement uses the MATCH keyword to match the source entity and target entity nodes, and then uses the CREATE keyword to create a relationship of type RELATED_TO and sets its properties such as description and strength.
[0067] Finally, through the defined Cypher statements and the prepared data, the entity data list is stored in the graph database. Preferably, the graph database uses the neo4j database. First, inside the function, a session is created through driver.session() to perform database operations. Subsequently, the entity data list is traversed, and the Cypher statement for creating entities is executed using the session.run method, and the properties of the entities are passed as parameters, so as to store all the data in the entity data list into the database. Among them, the entity tuples serve as the nodes of the graph database, and the entity pairs serve as the relationships of the graph database.
[0068] In summary, under the technical solutions of the above embodiments, by constructing an ontology model and innovatively using the ontology model to assist the large language model, accurate extraction of indoor space knowledge from building specification texts is achieved. When constructing the ontology model, an improved seven-step method is used to define classes, attributes, and constraints in detail to ensure the integrity and logic of the knowledge system. The local model assists the large language model, improving the understanding and processing capabilities of professional texts, and more accurately identifying and extracting entities, relationships, and attributes. The constructed knowledge graph can not only provide comprehensive specification constraints during the indoor building plan generation stage to avoid design defects, but also perform compliance verification on the design scheme to ensure compliance with various specifications, effectively improving the scientificity and standardization of building design.
[0069] As Figure 4 shown in , an indoor space rule knowledge graph construction system is provided in an embodiment of the present invention. The system includes: an indoor space rule acquisition module 10, an ontology model construction module 20, an information set acquisition module 30, and a knowledge graph acquisition module 40.
[0070] Specifically, the indoor space rule acquisition module 10 is used to acquire indoor space rules; the ontology model construction module 20 is used to construct an ontology model; the information set acquisition module 30 is used to extract information from the indoor space rules using a large language model based on the ontology model to obtain an information set; the knowledge graph acquisition module 40 is used to construct a knowledge graph corresponding to the indoor space rules based on the information set.
[0071] In one implementation, the indoor space rule acquisition module includes: A building specification text preprocessing unit, which is used to acquire public building specification text data and preprocess the building specification text data to obtain preprocessed building specification text data; An indoor space rule acquisition unit, which is used to screen the preprocessed building specification text data using a large language model to obtain indoor space rules, and the indoor space rules are text segments of building specifications used to describe indoor spaces.
[0072] In one implementation, the ontology model construction module includes: A class and class hierarchy definition unit, which is used to define classes and class hierarchies, and the classes are used to describe a set of objects with common characteristics in indoor spaces; A data attribute definition unit, which is used to define data attributes, and the data attributes are used to describe the data information of the objects; An object attribute definition unit, which is used to define object attributes, and the object attributes are used to describe the association information between the objects; A constraint attribute definition unit for defining constraint attributes, which are used to represent the attribute restriction rules between the object or objects; An ontology model construction unit for integrating the classes and class hierarchies, the data attributes, the object attributes, and the constraint attributes to obtain the ontology model.
[0073] In one implementation, the information set acquisition module includes: An ontology model setting unit for setting the ontology model as a limiting condition in the recognition process of the large language model; An entity acquisition unit for using the large language model to recognize the indoor space rules to obtain all entities and corresponding attributes in the indoor space rules, where the entities correspond to the objects in the ontology model; An entity tuple acquisition unit for integrating each entity and its corresponding attribute to obtain a number of entity tuples; An entity pair acquisition unit for using the large language model to recognize the relationships between each entity and other entities in the indoor space rules to obtain a number of entity pairs; An information set acquisition unit for integrating the entity tuples and the entity pairs to obtain an information set.
[0074] In one implementation, the ontology model setting unit includes: A class and class hierarchy limitation subunit for using the classes and class hierarchies in the ontology model to limit the types and abstraction levels of the recognized entities during the recognition process; An object attribute and data attribute limitation subunit for using the object attributes and data attributes in the ontology model to limit the attribute dimensions and semantic relationships of the recognized entities during the recognition process; A constraint attribute limitation subunit for using the constraint attributes in the ontology model to make the recognized entities comply with the restriction rules of the constraint attributes during the recognition process.
[0075] In one implementation, the entity pair acquisition unit includes: An initial entity pair acquisition subunit for using the large language model to recognize the relationships between each entity and other entities in the indoor space rules to obtain a number of initial entity pairs; A relationship strength score acquisition subunit for evaluating the relationship strength of each initial entity pair to obtain the corresponding relationship strength score; A relationship description acquisition subunit for explaining the associated reasons for each initial entity pair to obtain the corresponding relationship description; An entity pair acquisition subunit for integrating the initial entity pairs and the corresponding relationship strength scores and the relationship descriptions to obtain a number of entity pairs.
[0076] In one implementation, the knowledge graph acquisition module includes: A graph database storage unit for storing entity tuples and entity pairs in the information set into a graph database, where the entity tuples serve as nodes of the graph database and the entity pairs serve as relationships of the graph database.
[0077] Based on the above embodiments, the present invention also provides a terminal device, and its principle block diagram can be as Figure 5 shown. The terminal device includes a processor, a memory, a network interface, a display screen, and a temperature sensor connected through a system bus. Among them, the processor of the terminal device is used to provide computing and control capabilities. The memory of the terminal device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the terminal device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a method for constructing an indoor space rule knowledge graph. The display screen of the terminal device can be a liquid crystal display screen or an electronic ink display screen, and the temperature sensor of the terminal device is pre-set inside the terminal device to detect the operating temperature of the internal device.
[0078] Those skilled in the art can understand that Figure 5 the principle block diagram shown in
[0079] merely shows the block diagram of some structures related to the solution of the present invention, and does not constitute a limitation on the terminal device to which the solution of the present invention is applied. The specific terminal device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements. Obtain indoor space rules; Construct an ontology model; Based on the ontology model, use a large language model to extract information from the indoor space rules to obtain an information set; Based on the information set, construct a knowledge graph corresponding to the indoor space rules.
[0080] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided by the present invention can include non-volatile and / or volatile memories. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.
[0081] In summary, the present invention discloses a method, system, terminal device, and medium for constructing an indoor space rule knowledge graph, which relates to the technical field of knowledge graph construction. The method includes: obtaining indoor space rules; constructing an ontology model; based on the ontology model, using a large language model to extract information from the indoor space rules to obtain an information set; and based on the information set, constructing a knowledge graph corresponding to the indoor space rules. The present invention accurately extracts indoor space knowledge from building specification texts by constructing an ontology model and using a local model as an auxiliary to the large language model. The constructed knowledge graph can guide the generation of indoor building plans, verify the compliance of design schemes, and effectively improve the scientificity and standardization of building design.
[0082] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.
[0083] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims
1. A method for constructing an indoor space rule knowledge graph, characterized in that The method includes: Obtain the indoor space rules; Construct an ontology model; Based on the ontology model, use a large language model to extract information from the indoor space rules to obtain an information set; Based on the information set, construct a knowledge graph corresponding to the indoor space rules.
2. The method for constructing an indoor space rule knowledge graph according to claim 1, wherein The obtaining of the indoor space rules includes: Obtain publicly available building code text data, and preprocess the building code text data to obtain preprocessed building code text data; Use a large language model to screen the preprocessed building code text data to obtain indoor space rules, where the indoor space rules are text fragments of building codes used to describe indoor spaces.
3. The method for constructing an indoor space rule knowledge graph according to claim 1, wherein The constructing of the ontology model includes: Define classes and the hierarchical structure of classes, where the classes are used to describe a set of objects with common characteristics in the indoor space; Define data attributes, where the data attributes are used to describe the data information of the objects; Define object attributes, where the object attributes are used to describe the association information between the objects; Define constraint attributes, where the constraint attributes are used to express the attribute restriction rules of the objects or between the objects; Integrate the classes and the hierarchical structure of classes, the data attributes, the object attributes, and the constraint attributes to obtain the ontology model.
4. The method for constructing an indoor space rule knowledge graph according to claim 3, characterized in that The extracting of information from the indoor space rules based on the ontology model using a large language model to obtain an information set includes: Set the ontology model as a limiting condition in the large language model recognition process; Use a large language model to recognize the indoor space rules to obtain all entities and corresponding attributes in the indoor space rules, where the entities correspond to the objects in the ontology model; Integrate each entity and its corresponding attribute to obtain several entity tuples; Use a large language model to recognize the relationship between each entity and other entities in the indoor space rules to obtain several entity pairs; Integrate the entity tuples and the entity pairs to obtain an information set.
5. The method for constructing an indoor space rule knowledge graph according to claim 4, wherein The setting of the ontology model as a limiting condition in the large language model recognition process includes: During the recognition process, use the classes and the hierarchical structure of classes in the ontology model to limit the type and abstract level of the recognized entities; During the recognition process, use the object attributes and data attributes in the ontology model to limit the attribute dimension and semantic relationship of the recognized entities; During the recognition process, use the constraint attributes in the ontology model to make the recognized entities conform to the restriction rules of the constraint attributes.
6. The method for constructing an indoor space rule knowledge graph according to claim 4, wherein, The using of a large language model to recognize the relationship between each entity and other entities in the indoor space rules to obtain several entity pairs includes: Use a large language model to recognize the relationship between each entity and other entities in the indoor space rules to obtain several initial entity pairs; Evaluate the relationship strength of each initial entity pair to obtain the corresponding relationship strength score; Explain the reason for the association of each initial entity pair to obtain the corresponding relationship description; Integrate the initial entity pairs and the corresponding relationship strength scores and the relationship descriptions to obtain several entity pairs.
7. The method for constructing an indoor space rule knowledge graph according to claim 4, wherein The constructing of a knowledge graph corresponding to the indoor space rules based on the information set includes: Store the entity tuples and entity pairs in the information set into the graph database, where the entity tuples serve as the nodes of the graph database and the entity pairs serve as the relationships of the graph database.
8. An indoor space rule knowledge graph construction system, characterized in that The system includes: An indoor space rule acquisition module for acquiring indoor space rules; An ontology model construction module for constructing an ontology model; An information set acquisition module for extracting information from the indoor space rules using a large language model based on the ontology model to obtain an information set; A knowledge graph acquisition module for constructing a knowledge graph corresponding to the indoor space rules based on the information set.
9. A terminal device, characterized in that, The terminal device includes a memory, a processor, and an indoor space rule knowledge graph construction program stored in the memory and executable on the processor. When the processor executes the indoor space rule knowledge graph construction program, the steps of the indoor space rule knowledge graph construction method according to any one of claims 1-7 are implemented.
10. A computer-readable storage medium, characterized in that, An indoor space rule knowledge graph construction program is stored on the computer-readable storage medium. When the indoor space rule knowledge graph construction program is executed by the processor, the steps of the indoor space rule knowledge graph construction method according to any one of claims 1-7 are implemented.
Citation Information
Patent Citations
Knowledge graph construction method oriented to constructional engineering field
CN116304076A
Knowledge graph correction method, system and device and storage medium
CN117689021A
Knowledge graph correction method based on data correlation and causal mode
CN117709449A
Legal knowledge graph construction method and device, equipment and storage medium
CN118036736A
Elevator fault knowledge graph construction method based on large model prompt instruction
CN119917702A