Ship piping system design assisting method based on knowledge graph

Through the knowledge graph-based ship piping design assistance method, the joint extraction and rapid retrieval of entity relationships are realized by utilizing data models and pre-trained language models, which solves the problem of low reuse rate of design knowledge and improves the intelligence and accuracy of the design process.

CN120764652APending Publication Date: 2025-10-10WUHAN UNIV OF TECH
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510898958.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-01
Publication Date
2025-10-10

AI Technical Summary

Technical Problem

The reuse rate of design knowledge in ship design is low, designers have difficulty in utilizing design resources, traditional knowledge management is inefficient and error-prone, and it is difficult to meet the needs of intelligent development.

Method used

The knowledge graph-based auxiliary method for ship piping design realizes the joint extraction of entity relationships and the cleaning and merging of triple data by constructing a data model, an entity relationship framework, a pre-trained language model and a structured convolutional self-attention model, and combines graph embedding technology for rapid retrieval and inference generation.

Benefits of technology

It improves the reuse rate and utilization efficiency of design knowledge, ensures design compliance and accuracy, enhances the intelligence level of the design process, and reduces human errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120764652A_ABST
    Figure CN120764652A_ABST
Patent Text Reader

Abstract

The invention provides a ship management system design assisting method based on a knowledge graph, which comprises the following steps of: processing scattered design documents and design criteria of enterprises by utilizing a natural language processing technology, extracting knowledge triple information in the design documents and design criteria, and on the basis of the constructed knowledge graph, further utilizing a retrieval enhancement generation (RAG) technology to generate a knowledge triple; according to the method, subjective query of design information of a graph database is achieved, analysis and proofreading of design information graph-text and document data corresponding to design drawings and models are achieved, and finally design requirement query and automatic check of the design drawings and models in the design process of aided designers are achieved. Integration and sharing of design knowledge are completed, and the design knowledge utilization rate is increased.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of ship piping system design, and particularly relates to a ship piping system design auxiliary method based on a knowledge graph. BACKGROUND

[0002] The vigorous rise of digital technology has injected strong reform power into the shipbuilding industry, covering the whole life cycle from design, manufacturing, to operation, maintenance, and management, and has become a research field focused by the shipbuilding industry. In the field of ship design, about 60% of the work relies on existing experience. Design personnel must have a comprehensive understanding of relevant design knowledge and past experience to ensure design compliance. However, in the traditional ship design process, there are many significant shortcomings in the use of design knowledge resources. On the one hand, knowledge storage is scattered and disordered, and retrieval efficiency is low, and a large amount of experience knowledge lacks structured organization, which is easy to cause knowledge loss due to personnel flow. On the other hand, shipowners, classification societies, construction units and other multi-agency institutions have different design requirements, which further aggravates the complexity of knowledge management. Therefore, it is urgent to solve a series of key problems such as analysis, organization, expression, storage, and efficient application of design knowledge to break through the current knowledge management predicament, and the knowledge graph provides a new idea and direction for solving these problems with its unique advantages.

[0003] In the field of ship design, the application of structured design information combined with the knowledge graph and the reasoning ability of large language models in design information query and design compliance discrimination has strong application potential. In the early field of intelligent manufacturing, the construction of knowledge ontology or knowledge graph mainly relies on manual operation or direct conversion through specific data models. This construction mode has significant drawbacks, not only low efficiency and easy to make mistakes, but also faces many difficulties in updating and maintenance, and is difficult to effectively meet the actual needs of future industry development. Benefiting from the progress of information technologies such as deep learning and optical character recognition (OCR), as well as the continuous enrichment of engineering documents and data resources, it has become a reality to automatically learn and extract knowledge graphs from massive data. At the same time, design review still highly depends on manual checking, with low intelligence level, and problems such as inconsistent review standards, easy to make mistakes, human manipulation, and high cost. Combined with the storage and retrieval advantages of the knowledge graph and the generation and reasoning ability of large models, serving ship design personnel for design compliance discrimination and design knowledge query has important value and significance in the intelligent development of the shipbuilding industry. SUMMARY

[0004] The technical problem to be solved by the present application is to provide a ship piping system design auxiliary method based on a knowledge graph to solve the problems of low reuse rate of ship piping system design knowledge and difficulty for design personnel to utilize design resources.

[0005] Embodiments of the present application are implemented as follows: The present application provides a knowledge graph-based auxiliary method for ship piping design, which includes the following steps: Step a, knowledge graph construction: Step a1: Collect relevant information on ship piping system design and build a data model, i.e., an entity and relationship framework; Step a2: Clean the data, annotate the data using the entity and relationship framework, divide the data into triples of head entity-relationship-tail entity, and divide the training set and test set into proportional sets to train and evaluate the model; Step a3: Based on the pre-trained language model BERT and structured convolutional self-attention (SCSA), the entity relationship joint extraction model incorporates absolute position information into the feature representation in the form of a rotation matrix through the rotation position encoding (ROPE) mechanism, thereby achieving joint extraction of entities and relationships from the input design information. In step a4, the learning rate is set to 1e-5, the number of training cycles is set to 50, the model is trained and the model effect is evaluated using evaluation indicators; Step a5: Use the trained model to extract triple data information and perform verification and cleaning, and import the cleaned entities, relationships, and attributes into the graph database; Step a6: Identify and merge entities that represent the same real-world object from different data sources, different extraction batches, or different locations in the same data source through similarity calculation to build a unified knowledge view; Step b: retrieval filtering and reasoning generation: Step b1: extract semantic features from the input query information through word segmentation, padding, truncation preprocessing, average pooling, and L2 normalization; Step b2: Introduce graph embedding technology to map entities and relationships in the knowledge graph into a low-dimensional vector space for storage; Step b3: Implement fast retrieval of knowledge graph data based on vector similarity. The query text is converted into a high-dimensional semantic vector using the GTE Embedding model. L2 distance calculation is performed using the vector index data built using the FAISS library, achieving millisecond-level retrieval. Step b4: The key information extraction module automatically parses the key design information in the query input, constructs structured search conditions, and realizes direct query matching on the graph database; Step b5: For the data information jointly stored in the Neo4j graph structure and FAISS vector space, two-way recall of vectors and keywords is achieved through vector search and graph search, and the recalled information is comprehensively sorted by semantic similarity; Step b6: Dynamically construct prompt words to combine user questions with search context, guiding the model to generate accurate answers.

[0006] In some optional implementation schemes, step a3 includes the following specific contents: First, the input text is encoded using the pre-trained BERT model. BERT uses a multi-layer Transformer structure to capture deep semantic information and contextual dependencies in the text and generate high-quality text representations. Subsequently, the structured convolutional self-attention (SCSA module) is introduced on the output of BERT. Combining the local feature extraction capability of the convolution operation and the global modeling capability of self-attention, four convolution kernels of different scales [3, 5, 7, 9] are used to capture multi-level contextual information, and the attention-enhanced feature matrix X that integrates multi-scale local features is obtained. atnn , as follows:

[0007] Among them, ⊙ is element-wise multiplication, X i is the feature grouping, k i ∈{3, 5, 7, 9} is the convolution kernel size; The input features are extracted through multi-scale convolution to extract local and global features. After feature splicing, the spatial attention weights are generated by the activation function and fused with the original features to obtain the feature enhancement matrix.

[0008] The self-attention and cluster weighted calculation process of the SCSA module is calculated through the cluster weight Ω c Introducing prior grouping knowledge improves the ability to capture structural features such as entity relationships. The specific formula is as follows:

[0009] Among them, Q, K, and V are generated by linear transformation of input sequence features to achieve weighted aggregation of semantic association information in the input sequence, and Ω c is the cluster attention weight matrix, d k is the head dimension; cluster weighting can enhance the model's ability to group different semantic features; In addition, the rotational position encoding ROPE mechanism mentioned in the step is expressed as follows:

[0010] Among them, x represents the encoding sequence information, m represents the sequence position information, and the absolute position information is integrated into the feature representation through complex rotation to retain the relative position relationship, where θ m is the rotation angle of position m and dimension i.

[0011] In some optional implementation schemes, the evaluation indicators in step a4 include: precision, recall, and F1-score, and the three evaluation indicators are calculated by the following formula:

[0012]

[0013]

[0014] Among them, correct_num is the number of correctly classified entity relationship triplets of the model, predict_num is the total number of triplets extracted by model recognition, and gold_num is the total number of triplets labeled in the dataset.

[0015] In some optional implementation schemes, the triple data information verification and cleaning described in step a5 includes: deleting erroneously extracted information content and supplementing unidentified extracted triple information.

[0016] In some optional implementation schemes, step a6 includes the following specific contents: Index the key identifying attributes of the entity, and use Jaccard similarity and Cosine similarity to calculate the probability scores of the generated candidate entity pairs representing the same object. The calculation formula is as follows:

[0017]

[0018] Among them S j is the Jaccard similarity, S c is the Cosine similarity, (e1, e2) is the candidate entity pair, A(e) represents the set of key attribute values ​​of entity e, v(e) represents the vector of key attribute values ​​of entity e, and the above similarity scores are all in the range of [0, 1]. The larger the value, the more similar it is. The calculated multiple similarity scores are weighted and combined into a comprehensive similarity score S composite :

[0019] We further set a similarity threshold and judge whether the candidate pairs represent the same entity based on the comprehensive similarity score. We merge multiple representations of the same entity into a unified entity node, and then verify the alignment results through manual sampling review, correct errors, and optimize the alignment model.

[0020] In some optional implementation schemes, step b1 includes the following specific contents: The input query information is preprocessed through word segmentation, padding, truncation, and other methods, and semantic features are extracted through average pooling and L2 normalization. The specific formula is as follows:

[0021]

[0022] Where e represents the sentence embedding after average pooling, H represents the embedding matrix of the input token, M is the attention mask, where M[i]=1 represents a valid token, ε is the minimum value to avoid division by zero, and V norm Represents the normalized vector value, v represents a vector input, and L2 normalization is used to scale the vector to unit length to eliminate the impact of length differences; Further, based on the large model API, the query input realizes the identification of entities and relationships in the field of ship piping system design. This includes: dynamically obtaining entity types and relationship types by loading piping system design diagram pattern files to build domain-specific extraction scopes; using prompt engineering technology combined with customized JSON format instructions to guide the model to return structured results to ensure output standardization; and controlling the determinism of model output through the low temperature parameter temperature=0.0 to improve the stability of extraction results.

[0023] In some optional implementation schemes, step b2 includes the following specific contents: using a pre-trained language model to vectorize entities and triples in the graph database, using the FAISS library to build vector indexes, and realizing batch processing and index persistent storage; realizing model replaceability through dependency injection and adapting to different embedding models; automatically adapting to CPU / GPU devices, improving the deployment capabilities of different devices, and combining the batch processing mechanism to improve the efficiency of large-scale data processing, and finally providing efficient semantic vector representation and retrieval capabilities for design information query tasks.

[0024] In some optional implementation schemes, step b3 includes the following specific contents: Fast retrieval of knowledge graph data is achieved based on vector similarity. The query text is converted into a high-dimensional semantic vector through the GTEEmbedding model. The vector index data built by the FAISS library is used to calculate the L2 distance, achieving millisecond-level retrieval. The L2 distance calculation expression and conversion formula are as follows:

[0025] Where d is the straight-line distance between two vectors in Euclidean space, x and y are two n-dimensional vectors. The smaller the distance, the higher the similarity between the vectors. In vector retrieval, similarity is the similarity score converted from the L2 distance to the interval [0,1]. This conversion makes the similarity 1 when the distance d=0, and the larger the distance, the closer the similarity is to 0, which is convenient for result sorting. A dynamic mapping mechanism is used to convert search results into structured text containing type, name, and description to improve the readability of the results. The top_k number parameter controls the number of returned results, and the Euclidean distance is converted into a similarity score in the [0,1] range to facilitate result sorting.

[0026] In some optional implementation schemes, step b4 includes the following specific contents: through a multi-dimensional retrieval strategy, using the Cypher query language to implement graph traversal, including direct entity matching, relationship pattern matching and graph pattern association retrieval; supporting node attribute fuzzy matching and relationship type constraints, automatically associating and displaying adjacent nodes and relationships of the entity; finally, sorting the retrieval results through a relevance scoring mechanism, giving higher weight to direct matching results.

[0027] In some optional implementation schemes, step b5 includes the following specific contents: first, the candidate set is filtered through rules, and then the BERT-based Global Ranking model is used to refine the sorting according to semantic similarity and knowledge graph association to ensure a balance between result relevance and efficiency; in addition, the output scale is dynamically controlled through the top_k number parameter, automatic device detection is supported, and an error fallback mechanism is provided. When the model loading fails, a simple rearrangement model is used to enhance the robustness of the module.

[0028] The beneficial effects of this application are as follows: 1. The ship piping system design auxiliary method based on the knowledge graph provided by this application explicitly models the multiple relationships between entity pairs through the triple joint annotation strategy to avoid overlapping and missed detection of relationships; considers enhancing the model's ability to capture long-distance dependencies at the encoding layer to solve the boundary fuzziness problem caused by the attenuation of long entities due to position information; introduces an attention mechanism to guide the model to focus on the structured context area and improve the accuracy of knowledge association; 2. By introducing a retrieval technology based on graph embedding, the entities and relationships in the knowledge graph are mapped to a low-dimensional vector space, and the relevant context information is quickly and comprehensively recalled by calculating the vector similarity. At the same time, it is also possible to consider methods such as expansion, multi-way recall, and comprehensive sorting of the retrieved information to continuously optimize the retrieval strategy and improve the accuracy and comprehensiveness of the recall; 3. Combining the reasoning ability of the large language model and the structural information of the knowledge graph, the design prompt word engineering and thinking chain technology are used to ensure that the model can fully utilize the logical relationships and constraints in the knowledge graph, guide and constrain the generation process, and ensure that the generated answers meet the professional specifications and logical requirements of ship design. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.

[0030] Figure 1 A flowchart for constructing the graph in the embodiments of this application; Figure 2 This is a diagram of the model structure in the embodiment of this application; Figure 3 This is a flowchart of the question-answering implementation process in the embodiment of this application; Figure 4 This is a visualization diagram of the piping system design knowledge graph data in the embodiment of this application; Figure 5 This is a diagram showing the effect of implementing the piping system design knowledge quiz in the embodiment of this application. DETAILED DESCRIPTION

[0031] To make the objectives, technical solutions, and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Generally, the components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations.

[0032] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for protection, but merely represents selected embodiments of the present application. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments in the present application without creative work are within the scope of protection of the present application.

[0033] It should be understood that the size of the serial numbers of the steps in the embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.

[0034] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings.

[0035] The features and performance of the present application are further described in detail below with reference to the embodiments.

[0036] The knowledge graph-based ship piping system design auxiliary method provided in this application includes knowledge graph construction, design knowledge retrieval and filtering module, and reasoning generation module.

[0037] like Figure 1 As shown in the figure, the knowledge graph construction includes the following processes: (1) Design of the ontology model layer: Data related to ship piping system design is collected and a data model, namely, an entity and relationship framework, is constructed. The design of the ontology model layer serves as the structural foundation of the ship piping system design knowledge graph. The entity relationship definitions of ship design knowledge in the data model include: Entity definitions include Attribute, Component, Requirements, Context, Measure, Content, Labeling, File, Department\People. Relationship definitions include: Traitof, Applyto, Conditionof, Include, Participatein. The specific meanings of the entity and relationship definitions are shown in Table 1.

[0038] Table 1 Entity and relationship definitions

[0039] (2) Data labeling: Clean the collected design data, delete irrelevant information, label the data using a predefined entity and relationship framework, divide the data into a triple format of head entity-relationship-tail entity, and finally divide the prepared data set into a training set and a test set in an 8:2 ratio to train and evaluate the model.

[0040] (3) Model design: In this paper, a joint entity relationship extraction model based on the pre-trained language model BERT and structured convolutional self-attention is proposed. The overall structure of the model is shown in Figure 2 . The model aims to leverage the powerful semantic representation capabilities of the pre-trained language model and the multi-scale feature extraction capabilities of the structured convolutional self-attention mechanism to improve the extraction performance of entity-relationship triples. Specifically, the model first encodes the input text through the pre-trained BERT model. Through its multi-layer Transformer structure, BERT is able to capture deep semantic information and contextual dependencies in the text, thereby generating high-quality text representations. Subsequently, the structured convolutional self-attention SCSA module is introduced on the output of BERT, combining the local feature extraction capabilities of the convolution operation and the global modeling capabilities of self-attention. Four different scales of convolution kernels [3, 5, 7, 9] are used to capture multi-level contextual information, and the global perception capabilities of self-attention are integrated to enhance the model's capture of entity boundaries and relationship features.

[0041] The working process of the structured convolutional self-attention module is as follows: Attention-enhanced feature matrix that fuses multi-scale local features: (1) Where: X atnn is the feature after multi-scale fusion, ⊙ is the element-level multiplication, where X i is the feature grouping, k i ∈{3, 5, 7, 9} is the convolution kernel size.

[0042] The input features are processed through multi-scale convolution to extract local and global features. After feature concatenation, an activation function is applied to generate spatial attention weights, which are then fused with the original features through dot multiplication. The feature values ​​at each position are re-weighted by the attention weights to highlight key semantic areas.

[0043] Module self-attention and cluster weighted calculation: (2) Among them, Q, K, and V are generated by linear transformation of input sequence features to achieve weighted aggregation of semantic association information in the input sequence, and Ω c is the cluster attention weight matrix, d k is the head dimension; cluster weighting can enhance the model's ability to group different semantic features; To further mine the structured information in the text and improve the accuracy and robustness of entity relationship extraction, the Rotation Position Encoding (ROPE) mechanism incorporates absolute position information into the feature representation in the form of a rotation matrix, addressing the performance degradation problem of traditional position encoding in long sequence tasks. The model's sensitivity to entity positions and relationships is enhanced, and the encoding mechanism expression is shown in Equation (3). Subsequently, the model explicitly constructs all possible entity pair representations, concatenates the head entity representation and the tail entity representation, and obtains the joint feature representation of the entity pair through a nonlinear projection transformation. Finally, relationship classification is performed based on the entity pair features to generate a three-dimensional score matrix for the relationship-entity pair. Through end-to-end training, the joint extraction of the input design information entities and relationships is achieved.

[0044] (3) where θ m is the rotation angle of position m and dimension i, x represents the encoding sequence information, m represents the sequence position information, and the absolute position information is integrated into the feature representation through complex rotation to retain the relative position relationship.

[0045] (4) Model training and evaluation: The learning rate is set to 1e-5, and the number of training cycles is set to 50. After training, the model effect is evaluated using precision, recall, and F1-score to test the model's effectiveness in extracting ship design knowledge. The above three evaluation indicators are calculated using the following formula: (4) (5) (6) Among them, correct_num is the number of correctly classified entity relationship triplets of the model, predict_num is the total number of triplets extracted by model recognition, and gold_num is the total number of triplets labeled in the dataset.

[0046] (5) Graph Verification: Verify the extracted triple data information, delete the incorrectly extracted information content, supplement the unidentified extracted triple information, and improve the quality of the graph. Import the cleaned entities, relationships, and attributes into the graph database.

[0047] (6) Entity alignment: Identify and merge entities that come from different data sources, different extraction batches, or different locations in the same data source but represent the same real-world object through similarity calculation, eliminate redundancy, and build a unified knowledge view.

[0048] The specific process is: index the key identifying attributes of the entity, and use Jaccard similarity and Cosine similarity to calculate the probability scores of the generated candidate entity pairs that they represent the same object. The calculation formula is as follows: (7) (8) Among them S j is the Jaccard similarity, S c is the Cosine similarity, (e1, e2) is the candidate entity pair, A(e) represents the set of key attribute values ​​of entity e, v(e) represents the vector of key attribute values ​​of entity e, and the above similarity scores are all in the range of [0, 1]. The larger the value, the more similar it is.

[0049] The calculated multiple similarity scores are weighted and combined into a comprehensive similarity score S composite : (9) We then set a similarity threshold and use the combined similarity score to determine whether candidate pairs represent the same entity. We merge multiple representations of the same entity into a single entity node. We then conduct manual sampling and review to verify the alignment results, correct errors, and optimize the alignment model.

[0050] like Figure 3As shown in the figure, by using the constructed knowledge graph related to ship piping system design, the Neo4j database can be directly queried through simple graph database query statements. For complex requirements, the design rules can be queried by matching the triple-grouped chain design rules, and the design information related to the drawing model can be reviewed, thereby providing design assistance to designers. The design knowledge retrieval and filtering module and the reasoning generation module process are as follows: (1) Query input key information extraction module: The input query information is preprocessed through word segmentation, padding, truncation, etc., and semantic features are extracted by average pooling and L2 normalization. The specific formula is as follows: (10) (11) Where e represents the sentence embedding after average pooling, H represents the embedding matrix of the input token, M is the attention mask, where M[i]=1 represents a valid token, and ε is the minimum value to avoid division by zero. norm represents the normalized vector value, and v represents a vector input. L2 normalization is used to scale the vector to unit length, eliminating the effects of length differences.

[0051] Further, based on the large model API, we implement entity and relationship recognition for query input in the field of ship piping system design. Key technical points include: dynamically acquiring entity and relationship types by loading piping system design schema files to establish domain-specific extraction scopes; employing prompt engineering techniques combined with customized JSON format instructions to guide the model in returning structured results, ensuring output standardization; and controlling the determinism of model output through a low temperature parameter (temperature=0.0) to improve the stability of extraction results.

[0052] (2) Graph vectorization module: Introducing graph embedding technology, the entities and relationships in the knowledge graph are mapped to a low-dimensional vector space for storage, providing a data foundation for the vector retrieval module. The specific implementation method is as follows: using a pre-trained language model to vectorize entities and triples in the graph database, using the FAISS library to build vector indexes, and realizing batch processing and index persistence storage; achieving model replaceability through dependency injection and adapting to different embedding models; automatically adapting to CPU / GPU devices, improving the deployment capabilities of different devices, and combining the batch processing mechanism to improve the efficiency of large-scale data processing, ultimately providing efficient semantic vector representation and retrieval capabilities for design information query tasks.

[0053] (3) Vector retrieval module: It realizes fast retrieval of knowledge graph data based on vector similarity. It converts query text into high-dimensional semantic vectors through the GTEEmbedding model. It uses the vector index data built by the FAISS library to perform L2 distance calculation to achieve millisecond-level retrieval. The L2 distance calculation expression and conversion formula are as follows: (12) Where d is the straight-line distance between two vectors in Euclidean space, and x and y are two n-dimensional vectors. A smaller distance indicates a higher similarity between the vectors. In vector search, similarity is the L2 distance converted to a similarity score in the range [0, 1]. This conversion sets the similarity to 1 when the distance d = 0, and the similarity approaches 0 as the distance increases, facilitating result sorting.

[0054] A dynamic mapping mechanism is used to convert search results into structured text containing type, name, and description to improve the readability of the results. The top_k number parameter controls the number of returned results, and the Euclidean distance is converted into a similarity score in the [0,1] range to facilitate result sorting.

[0055] (4) Neo4j graph retrieval module: The key information extraction module automatically parses the key design information in the query through the query input, constructs structured retrieval conditions, and realizes direct query matching of the graph database; the specific implementation method is: through multi-dimensional retrieval strategy, the Cypher query language is used to realize graph traversal, including direct entity matching, relationship pattern matching and graph pattern association retrieval; it supports fuzzy matching of node attributes and relationship type constraints, and automatically associates and displays the adjacent nodes and relationships of the entity; finally, the retrieval results are sorted through the relevance scoring mechanism, and higher weights are given to direct matching results.

[0056] (5) Information sorting module: For data information jointly stored in the Neo4j graph structure and FAISS vector space, the vector retrieval module and the graph retrieval module are used to implement dual-path recall of vectors and keywords, improving the information matching capability and further performing comprehensive sorting of the recalled information based on semantic similarity. The specific implementation method is as follows: first, the candidate set is filtered by rules, and then the BERT-based Global Ranking model is used to refine the sorting based on semantic similarity and knowledge graph relevance, ensuring a balance between result relevance and efficiency. In addition, the output scale is dynamically controlled through the top_k number parameter, supporting automatic device detection and providing an error fallback mechanism. When the model loading fails, a simple re-ranking model is used to enhance the robustness of the module.

[0057] (6) Generation module: By dynamically constructing prompt words (Prompt Engineering), the user question is combined with the search context to guide the model to generate accurate answers; the formatting function is used to convert the results of vector search and graph search into structured knowledge base text, and the key conclusions are accompanied by knowledge traceability functions to retain source information and enhance traceability; by strictly limiting the model to answer only based on the knowledge base content, it avoids generating unfounded information and ensures the professionalism and reliability of the answers.

[0058] This method realizes intelligent question answering based on the ship piping system design knowledge graph, provides designers with an efficient query and retrieval method for design knowledge and reasoning based on design rules, and provides strong support for the design process.

[0059] Example 1 To address the problems of long entity names and multiple nested levels in ship design texts, an entity relationship fitting extraction model based on a pre-trained language model and a structured attention mechanism was proposed. The evaluation indicators used for the established ship design triple dataset were precision, recall, and F1-score, and the specific data are shown in Table 2 below.

[0060] Table 2 Evaluation index calculation results

[0061] 1514 data were annotated based on the collected design data (see Figure 4 ), and the data is divided into training and test sets with an 8:2 ratio. The number of entity types in the dataset is: Attribute: 764, Component: 1447, Requirements: 586, Context: 631, Measure: 1410, Content: 45, Labeling: 121, File: 258, Department\People: 44. The number of relationship types in the dataset is: Traitof: 385, Applyto: 1441, Conditionof: 631, Include: 152, Participatein: 44.

[0062] Experimental results show that the model achieved an accuracy of 0.7183 and an F1 score of 0.6758 on a relatively limited dataset, achieving relatively accurate and usable information extraction. By comparing with other entity relationship joint extraction models and taking into account the complexity of text features and the limited nature of the dataset, the experimental results reflect the advantages and usability of the proposed model in the construction of end-to-end design knowledge graphs in the field of ship piping system design.

[0063] For the technical support process of the design process of this solution, by inputting question statements or design information graphic documents related to ship piping system design, it will match the functional part of the system's back-end rag workflow, extract and vectorize the entity relationship of the input question statement, and the design information graphic document must first be parsed through a rule template before the entity is extracted and vectorized. Further multi-way matching is performed on the triple information, and the matched design information is sorted and passed to the big model as context. The big model's information organization ability and the background information of the ship design atlas are used to give professional responses to guide the designer's design process. The specific piping system design knowledge question and answer implementation effect diagram is as follows Figure 5 shown.

Claims

1. The ship piping system design auxiliary method based on knowledge graph is characterized by: The steps include: Step a, knowledge graph construction: Step a1: Collect relevant information on ship piping system design and build a data model, i.e., an entity and relationship framework; Step a2: Clean the data, annotate the data using the entity and relationship framework, divide the data into triples of head entity-relationship-tail entity, and divide the training set and test set into proportional sets to train and evaluate the model; Step a3: Based on the pre-trained language model BERT and structured convolutional self-attention (SCSA), the entity relationship joint extraction model incorporates absolute position information into the feature representation in the form of a rotation matrix through the rotation position encoding (ROPE) mechanism, thereby achieving joint extraction of entities and relationships from the input design information. In step a4, the learning rate is set to 1e-5, the number of training cycles is set to 50, the model is trained and the model effect is evaluated using evaluation indicators; Step a5: Use the trained model to extract triple data information and perform verification and cleaning, and import the cleaned entities, relationships, and attributes into the graph database; Step a6: Identify and merge entities that represent the same real-world object from different data sources, different extraction batches, or different locations in the same data source through similarity calculation to build a unified knowledge view; Step b: retrieval filtering and reasoning generation: Step b1: extract semantic features from the input query information through word segmentation, padding, truncation preprocessing, average pooling, and L2 normalization; Step b2: Introduce graph embedding technology to map entities and relationships in the knowledge graph into a low-dimensional vector space for storage; Step b3: Implement fast retrieval of knowledge graph data based on vector similarity. The query text is converted into a high-dimensional semantic vector using the GTE Embedding model. L2 distance calculation is performed using the vector index data built using the FAISS library, achieving millisecond-level retrieval. Step b4: The key information extraction module automatically parses the key design information in the query input, constructs structured search conditions, and realizes direct query matching on the graph database; Step b5: For the data information jointly stored in the Neo4j graph structure and FAISS vector space, two-way recall of vectors and keywords is achieved through vector search and graph search, and the recalled information is comprehensively sorted by semantic similarity; Step b6: Dynamically construct prompt words to combine user questions with search context, guiding the model to generate accurate answers.

2. The ship piping system design auxiliary method based on knowledge graph according to claim 1 is characterized in that: Step a3 includes the following specific contents: First, the input text is encoded using the pre-trained BERT model. BERT captures deep semantic information and contextual dependencies in the text through a multi-layer Transformer structure, generating high-quality text representations. Subsequently, the structured convolutional self-attention (SCSA) module is introduced on the output of BERT. Combining the local feature extraction capability of the convolution operation and the global modeling capability of self-attention, four convolution kernels of different scales [3, 5, 7, 9] are used to capture multi-level contextual information, resulting in an attention-enhanced feature matrix X that integrates multi-scale local features. atnn , as follows: Among them, ⊙ is element-wise multiplication, X i is the feature grouping, k i ∈{3, 5, 7, 9} is the convolution kernel size; The input features are extracted through multi-scale convolution to extract local and global features. After feature splicing, the activation function is used to generate spatial attention weights, which are then fused with the original features by dot multiplication to obtain a feature enhancement matrix. The calculation process of self-attention and cluster weighting of SCSA module is as follows: c Introducing prior grouping knowledge improves the ability to capture structural features such as entity relationships, as shown in the following formula: Among them, Q, K, and V are generated by linear transformation of input sequence features to achieve weighted aggregation of semantic association information in the input sequence, and Ω c is the cluster attention weight matrix, d k is the head dimension; cluster weighting can enhance the model's ability to group different semantic features; In addition, the rotational position encoding ROPE mechanism mentioned in the step is expressed as follows: Among them, x represents the encoding sequence information, m represents the sequence position information, and the absolute position information is integrated into the feature representation through complex rotation to retain the relative position relationship, where θ m is the rotation angle of position m and dimension i.

3. The ship piping system design auxiliary method based on knowledge graph according to claim 1 or 2 is characterized in that: The evaluation indicators described in step a4 include: precision, recall, and F1-score. The three evaluation indicators are calculated using the following formula: Among them, correct_num is the number of correctly classified entity relationship triplets of the model, predict_num is the total number of triplets extracted by model recognition, and gold_num is the total number of triplets labeled in the dataset.

4. The ship piping system design auxiliary method based on knowledge graph according to claim 1 is characterized in that: The triplet data information verification and cleaning described in step a5 includes: deleting the erroneously extracted information content and supplementing the unidentified extracted triplet information.

5. The ship piping system design auxiliary method based on knowledge graph according to claim 3 is characterized in that: Step a6 includes the following specific contents: Index the key identifying attributes of the entity, and use Jaccard similarity and Cosine similarity to calculate the probability scores of the generated candidate entity pairs representing the same object. The calculation formula is as follows: Among them S j is the Jaccard similarity, S c is the Cosine similarity, (e1, e2) is the candidate entity pair, A(e) represents the set of key attribute values ​​of entity e, v(e) represents the vector of key attribute values ​​of entity e, and the above similarity scores are all in the range of [0,1]. The larger the value, the more similar it is. The calculated multiple similarity scores are weighted and combined into a comprehensive similarity score S composite : We further set a similarity threshold and judge whether the candidate pairs represent the same entity based on the comprehensive similarity score. We merge multiple representations of the same entity into a unified entity node, and then verify the alignment results through manual sampling review, correct errors, and optimize the alignment model.

6. The ship piping system design auxiliary method based on knowledge graph according to claim 5 is characterized in that: Step b1 includes the following specific contents: The input query information is preprocessed through word segmentation, padding, truncation, and other methods, and semantic features are extracted through average pooling and L2 normalization. The specific formula is as follows: Where e represents the sentence embedding after average pooling, H represents the embedding matrix of the input token, M is the attention mask, where M[i]=1 represents a valid token, ε is the minimum value to avoid division by zero, and V norm Represents the normalized vector value, v represents a vector input, and L2 normalization is used to scale the vector to unit length to eliminate the impact of length differences; Further, based on the large model API, the query input realizes the identification of entities and relationships in the field of ship piping system design. This includes: dynamically obtaining entity types and relationship types by loading piping system design diagram pattern files to build domain-specific extraction scopes; using prompt engineering technology combined with customized JSON format instructions to guide the model to return structured results to ensure output standardization; and controlling the determinism of model output through the low temperature parameter temperature=0.0 to improve the stability of extraction results.

7. The ship piping system design auxiliary method based on knowledge graph according to claim 6 is characterized in that: Step b2 includes the following specific contents: using a pre-trained language model to vectorize entities and triples in the graph database, using the FAISS library to build vector indexes, and realizing batch processing and index persistent storage; making the model replaceable through dependency injection and adapting to different embedding models; automatically adapting to CPU / GPU devices, improving the deployment capabilities of different devices, and combining the batch processing mechanism to improve the efficiency of large-scale data processing, ultimately providing efficient semantic vector representation and retrieval capabilities for design information query tasks.

8. The ship piping system design auxiliary method based on knowledge graph according to claim 7 is characterized in that: Step b3 includes the following specific contents: Fast retrieval of knowledge graph data is achieved based on vector similarity. The query text is converted into a high-dimensional semantic vector through the GTEEmbedding model. The vector index data built by the FAISS library is used to calculate the L2 distance, achieving millisecond-level retrieval. The L2 distance calculation expression and conversion formula are as follows: Where d is the straight-line distance between two vectors in Euclidean space, x and y are two n-dimensional vectors. The smaller the distance, the higher the similarity between the vectors. In vector retrieval, similarity is the similarity score converted from the L2 distance to the interval [0,1]. This conversion makes the similarity 1 when the distance d=0, and the larger the distance, the closer the similarity is to 0, which is convenient for result sorting. A dynamic mapping mechanism is used to convert search results into structured text containing type, name, and description to improve the readability of the results. The top_k number parameter controls the number of returned results, and the Euclidean distance is converted into a similarity score in the [0,1] range to facilitate result sorting.

9. The ship piping system design auxiliary method based on knowledge graph according to claim 8 is characterized in that: Step b4 includes the following specific contents: through multi-dimensional retrieval strategies, graph traversal is implemented using the Cypher query language, including direct entity matching, relationship pattern matching, and graph pattern association retrieval; fuzzy matching of node attributes and relationship type constraints are supported, and adjacent nodes and relationships of entities are automatically associated and displayed; finally, the retrieval results are sorted through a relevance scoring mechanism, giving higher weight to direct matching results.

10. The ship piping system design auxiliary method based on knowledge graph according to claim 8 is characterized in that: Step b5 includes the following specific content: first, the candidate set is filtered through rules, and then the BERT-based Global Ranking model is used to refine the sorting based on semantic similarity and knowledge graph relevance to ensure a balance between result relevance and efficiency. In addition, the output scale is dynamically controlled through the top_k number parameter, automatic device detection is supported, and an error fallback mechanism is provided. When the model loading fails, a simple re-arrangement model is used to enhance the robustness of the module.

Citation Information

Cited By

  • Intelligent planning and aided design method for ship equipment maintenance support task

    CN121504419A

  • Method for generating high-quality instruction data in ship manufacturing field based on knowledge graph

    CN121579706A