Sewing process SPARQL query method based on large language model
Through the sewing process SPARQL query method based on the large language model, the ontology consistency rules of RDFS and OWL are used to check and correct the sewing process query, which solves the shortcomings of the traditional system in terms of accuracy and adaptability, and improves the query accuracy in the sewing and textile industry. performance and production efficiency.
Patent Information
- Application Number
- CN202411035205.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-08-30
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The query system of the traditional sewing and textile industry is poor in accuracy and adaptability, which affects the accuracy of the query, increases material waste and reduces production efficiency, and may lead to inappropriate material selection and production technology application, affecting the product quality and market performance.
The sewing process SPARQL query method based on the large language model is used to obtain sewing process data, build a knowledge graph, and use the ontology consistency rules of RDFS and OWL to perform query checks, automatically correct logic errors, and ensure that the query meets the preset standards.
It improves the accuracy and flexibility of queries, reduces the need for manual intervention, enhances processing speed and reliability of query results, supports data-driven decision-making, and improves the company's ability to respond to market changes.
Smart Images

Figure CN118568205A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of sewing technology, and in particular to a sewing technology SPARQL query method, system and device based on a large language model. Background Art
[0002] As the complexity and variety of data in the sewing and textile industry increases, traditional query systems tend to be poor in terms of accuracy and adaptability. Integrating semantic web technologies such as RDF, RDFS, OWL, and SPARQL provides a more rigorous logic-based query processing foundation; However, due to errors in logic establishment, the accuracy of queries is often affected, which not only reduces production efficiency but also may increase material waste. Incorrect data may also lead to inappropriate material selection or production technology application, thus affecting the quality and market performance of the final product. It may also cause operators in the sewing and textile industries to take extra time to verify and correct erroneous information, which needs to be improved urgently. Summary of the invention
[0003] The present application provides a sewing process SPARQL query method, system and device based on a large language model, so that the query accuracy is higher.
[0004] A first aspect of the present application provides a sewing craft SPARQL query method based on a large language model; A sewing craft SPARQL query method based on a large language model, comprising: Obtain sewing process data; According to the sewing process data, a knowledge graph based on SPARQL statements is constructed; The knowledge graph based on SPARQL statements is processed according to the large language model to generate SPARQL queries for the sewing process knowledge graph; Performing ontology-based query checking on SPARQL queries, wherein the ontology-based query checking includes: judging whether there are rule errors in the SPARQL query according to the ontology consistency rules based on RDFS and OWL; if so, outputting error feedback information corresponding to all rule errors; Input error feedback information into the large language model to correct the SPARQL query; Determine whether the modified SPARQL query meets the preset standard; If yes, then output the SPARQL query.
[0005] Preferably, determining whether the new SPARQL query meets the preset criteria includes: If not, continue to perform ontology-based query checking on the SPARQL query.
[0006] Preferably, the preset standard is that the number of error checks reaches a preset number or it is determined that there is no rule error in the SPARQL query.
[0007] Preferably, a knowledge graph based on SPARQL statements is constructed according to the sewing process data, including: According to the sewing process data, construct the sewing process knowledge ontology triple; According to the triples of sewing process knowledge ontology, a knowledge graph based on SPARQL statements is constructed.
[0008] Preferably, according to the sewing process data, a sewing process knowledge ontology triple is constructed, including: The sewing process knowledge ontology triples are constructed according to the entities, relations and attributes in the sewing process data.
[0009] Preferably, judging whether there is a rule error in the SPARQL query according to the ontology consistency rules based on RDFS and OWL includes: Extract triple-based graph patterns from SPARQL queries; The three-element basic graphic pattern and the three-element group of sewing process knowledge ontology are constructed as a joint graph; According to the ontology consistency rules based on RDFS and OWL, it is judged whether there are rule errors in the joint graph.
[0010] Preferably, the ontology consistency rules based on RDFS and OWL include: Domain rule: ensure that the entity of a certain attribute in the ternary basic graphic pattern conforms to the domain category of the attribute in the ternary structure of the sewing process knowledge ontology; Scope rule: ensure that the object of the attribute in the ternary basic graph pattern conforms to the scope category defined in the ternary structure of the sewing process knowledge ontology; Type matching rule: Check whether the data type of the attribute value in the ternary basic graphic pattern conforms to the data type definition of the attribute in the ternary structure of the sewing process knowledge ontology; Logical consistency rules: Check the attribute relationship to ensure that the attribute relationship in the ternary basic graphic pattern conforms to the logical specifications in the ternary structure of the sewing process knowledge ontology, where the attribute relationship includes symmetry, antisymmetry, and transitivity; Class membership rule: Check whether the entities in the ternary basic graphic pattern are correctly classified into the categories defined in the ternary structure of the sewing process knowledge ontology; Existence rule: Check whether all attributes and entities referenced in the query of the ternary basic graph pattern are defined in the ternary structure of the sewing process knowledge ontology.
[0011] Preferably, inputting the error feedback information into the large language model to correct the SPARQL query includes: Convert error feedback information into error explanation templates that can be used by large language models; The error explanation template and the SPARQL query with rule errors are input into the large language model to correct the SPARQL query.
[0012] The second aspect of the present application also provides a sewing process SPARQL query system with a large language model; A sewing craft SPARQL query system with a large language model, including: A data acquisition module, used for acquiring sewing process data; The knowledge graph construction module is used to construct a knowledge graph based on SPARQL statements according to sewing process data; A SPARQL query generation module is used to process the knowledge graph based on SPARQL statements according to the large language model and generate SPARQL queries for the sewing process knowledge graph; The ontology-based query checking module is used to perform ontology-based query checking on SPARQL queries, wherein the ontology-based query checking includes: judging whether there are rule errors in the SPARQL query according to the ontology consistency rules based on RDFS and OWL; if so, outputting error feedback information corresponding to all rule errors; An error correction module is used to input error feedback information into a large language model to correct the SPARQL query; A standard judgment module is used to judge whether the modified SPARQL query meets the preset standard; The SPARQL query output module is used to output the SPARQL query when the standard judgment module judges that it is yes.
[0013] In a third aspect of the present application, an electronic device is provided.
[0014] An electronic device includes a processor, a memory and a transceiver, wherein the memory is used to store instructions, the transceiver is used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes a sewing process SPARQL query method for a large language model.
[0015] In summary, this application includes the following beneficial technical effects: 1. Through ontology-based checking, the system can accurately identify logical errors in queries and their inconsistencies with the sewing ontology, ensuring that the query complies with the specific semantic rules of the sewing field. Based on the feedback provided by the ontology-based query check, combined with the set output template, and using the automatic repair function of the large language model, the present invention can quickly correct the identified errors or inconsistencies, reduce the need for manual intervention, and improve the processing speed. This automated process is particularly suitable for the sewing field, where the diversity of materials and technologies requires the query system to have a high degree of flexibility and accuracy.
[0016] 2. The iterative optimization method of the system further ensures the reliability of the query results, allowing sewing companies to rely on accurate data to support complex design decisions and production processes. In this way, the present invention effectively supports data-driven decision-making and strengthens the company's ability to respond to market changes. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is a flow chart of the overall architecture of a sewing process SPARQL query method based on a large language model according to an embodiment of the present application; Figure 2 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0018] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.
[0019] In the description of the embodiments of the present application, words such as "illustrative", "for example" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "illustrative", "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "illustrative", "for example" or "for example" is intended to present related concepts in a concrete way.
[0020] In the description of the embodiments of the present application, the term "and / or" is only a kind of association relationship describing the associated objects, indicating that there may be three kinds of relationships, for example, A and / or B, which can represent: A exists alone, B exists alone, and A and B exist at the same time. In addition, unless otherwise specified, the meaning of the term "multiple" refers to two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" can explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
[0021] Scenario: This application provides a sewing process SPARQL query method based on a large language model for massive multi-source heterogeneous knowledge information in the sewing field, and optimizes the SPARQL query statements generated by the large language model in the sewing process field; for the inaccuracy problem in the SPARQL query generated by the large language model, two key components are introduced: an ontology-based query checking mechanism and a large language model repair process; The ontology-based query checking component uses the semantic structure of the knowledge graph ontology to verify the logical consistency between the generated SPARQL query and the expected semantic meaning. This process can detect and mark incorrect queries, effectively preventing the generation of incorrect answers. When the ontology-based query checking identifies errors, the large language model repair process is executed, which uses the error explanation to dynamically repair the defective SPARQL query. By integrating this repair mechanism, the system can automatically correct the identified problems, thereby enhancing the overall reliability and performance of the question answering system.
[0022] Explanation of special terms: SPARQL: A language for querying and manipulating RDF (Resource Description Framework) data. RDF is a standardized model for describing web resources, which uses triples (resource-property-resource) to express information. SPARQL allows users to retrieve and update RDF data through a query language.
[0023] Ontology: An explicit formal specification that defines a set of concepts, entities, and their interrelationships within a specific domain, providing a consistent vocabulary and logical structure for shared understanding and information exchange.
[0024] Large Language Model: An existing deep learning-based AI model with a large number of parameters and extensive training data that can understand and generate high-quality natural language text and support a variety of language tasks such as translation, summarization, question answering, and creation.
[0025] Reference Figure 1 , a sewing craft SPARQL query method based on a large language model, comprising: S10: Acquiring sewing process data; Specifically, the method is applied to an intelligent device, which may be a system of an intelligent sewing device, specifically a computer; sewing process data may be obtained by uploading from other network devices, and the sewing process data includes fabric type, sewing technology, machines and tools used, etc.; wherein, the sewing process data includes unstructured, semi-structured and structured data; therefore, the sewing process data needs to be cleaned and standardized before being used to construct a knowledge graph and subsequent query processing.
[0026] S20: Based on the sewing process data, a knowledge graph based on SPARQL statements is constructed; Specifically: Classify and establish the sewing process knowledge ontology, and divide the sewing process knowledge into five knowledge systems: sewing equipment knowledge system, sewing electrical knowledge system, product design knowledge system, sewing equipment and needle knowledge system, and sewing equipment operation and maintenance knowledge system. Organize and classify the sewing industry knowledge system, select basic terms, category information, process technology, etc. as concepts or entity information, and define their relationships to form the concept hierarchy of the knowledge graph; taking sewing equipment as an example, define the categories and attributes of various sewing machines. For example, the H93S series sewing machines belong to the "sewing equipment" category, in which specific models such as H93S-7C are defined as an entity and associated with related attributes such as fault code E605.
[0027] These relationships and attributes are stored in the graph database through the RDF data model, thus forming a complete ontology model. The classification and establishment of the sewing process knowledge ontology can be carried out in response to personnel operations or based on a trained neural network model. The ontology model of this application combines the knowledge structure characteristics of the sewing industry and the service system requirements; Construct the sewing process knowledge ontology triples according to the entities, relations and attributes in the sewing process data; Specifically, the sewing process data in the ontology model includes entities, relationships, and attributes. The entities, relationships, and attributes in the ontology model are extracted to construct the sewing process knowledge ontology triples. The sewing process knowledge ontology triples are the steps for constructing knowledge triples in the existing knowledge graph construction process, which will not be described in detail here. According to the triples of sewing process knowledge ontology, a knowledge graph based on SPARQL statements is constructed; specifically, the triples of sewing process knowledge ontology are imported into the database to construct a knowledge graph based on SPARQL statements; SPARQL is a query language used to access and operate RDF data. It allows users to retrieve, modify and analyze data stored in the knowledge graph by writing query statements; S30: Processing the knowledge graph based on the SPARQL statement according to the large language model to generate a SPARQL query for the sewing process knowledge graph; Specifically, a large language model is used to identify the knowledge graph based on SPARQL statements, and a SPARQL query for the sewing process knowledge graph is generated; S40: performing an ontology-based query check on the SPARQL query, wherein the ontology-based query check includes: judging whether the SPARQL query has a rule error according to the ontology consistency rules based on RDFS and OWL; if so, outputting error feedback information corresponding to all rule errors; Specifically, the SPARQL query is judged whether there are rule errors according to the ontology consistency rules based on RDFS and OWL, including: S41: Extracting triple-based graph patterns from SPARQL queries; Specifically, in SPARQL queries, the basic graph pattern is composed of a set of triple patterns. These triple patterns are similar to RDF triples, which define the subject, predicate, and object in the query, such as the query "Query sewing techniques applicable to silk fabrics". The key steps to extract the basic graph pattern from the SPARQL query are as follows: Determine the triple pattern in the query: subject, predicate, and object. Use curly braces to separate these patterns to form a complete graph pattern. Make sure that all necessary information is included to ensure that the query can correctly match and return the required data. It should be noted that some parts of the original SPARQL query logic, including the SELECT clause, subquery structure, filters, UNION, OPTIONAL, and NOT clauses, are not considered because the focus is on checking the compatibility of the basic graph pattern with the ontology structure.
[0028] S42: constructing the ternary basic graphic patterns and the ternary groups of sewing process knowledge ontology into a joint graph; The joint graph consists of two parts. One part is the RDF form converted from the triple basic graph pattern of the SPARQL query. Its function is to structure the SPARQL query into RDF triples so that it can be directly compared and analyzed with the sewing process knowledge ontology triples. The other part is the sewing process knowledge ontology triples. The function of the sewing process knowledge ontology triples is to provide the domain knowledge and semantic rules required for query logic checking, that is, the ontology consistency rules based on RDFS and OWL, to ensure the correctness and consistency of the query, so as to conduct integrated analysis. S43: Determine whether there are rule errors in the joint graph according to the ontology consistency rules based on RDFS and OWL; Among them, the ontology consistency rules based on RDFS and OWL are provided by the triples of sewing process knowledge ontology; further, the ontology consistency rules based on RDFS and OWL include: Domain rule: ensure that the entity of a certain attribute in the ternary basic graphic pattern conforms to the domain category of the attribute in the ternary structure of the sewing process knowledge ontology; Scope rule: ensure that the object of the attribute in the ternary basic graph pattern conforms to the scope category defined in the ternary structure of the sewing process knowledge ontology; Type matching rule: Check whether the data type of the attribute value in the ternary basic graphic pattern conforms to the data type definition of the attribute in the ternary structure of the sewing process knowledge ontology; Logical consistency rules: Check the attribute relationship to ensure that the attribute relationship in the ternary basic graphic pattern conforms to the logical specifications in the ternary structure of the sewing process knowledge ontology, where the attribute relationship includes symmetry, antisymmetry, and transitivity; Class membership rule: Check whether the entities in the ternary basic graphic pattern are correctly classified into the categories defined in the ternary structure of the sewing process knowledge ontology; Existence rule: Check whether all attributes and entities referenced in the query of the ternary basic graph pattern are defined in the ternary structure of the sewing process knowledge ontology; According to the ontology consistency rules based on RDFS and OWL, the contents in the ternary basic graph pattern are checked from beginning to end; whether there is any content in the ternary basic graph pattern that does not meet the ontology consistency rules based on RDFS and OWL; S44: If yes, output error feedback information corresponding to all rule errors; Specifically, if there is content in the ternary basic graph pattern that does not satisfy the ontology consistency rules based on RDFS and OWL, all the content in the ternary basic graph pattern that does not satisfy the ontology consistency rules based on RDFS and OWL are filtered out, and corresponding error feedback information is generated; For example, in the domain rule check, since the applicable categories of relevant attributes are defined in the triple structure of the sewing technology knowledge ontology, such as how sewing techniques and fabrics should be used on clothing. By creating a joint graph that merges the SPARQL query graph and the triple structure of the sewing technology knowledge ontology, check whether the SPARQL query graph violates the domain rules defined in the triple structure of the sewing technology knowledge ontology, and finally confirm the accuracy and consistency of the query. If the check result shows that the query is inconsistent with the ontology, it means that some parts of the query need to be adjusted to comply with the provisions of the ontology. It should be noted that in the example, the ontology can be understood as the triple structure of the sewing technology knowledge ontology; In this sewing technology case study, we show how to use ontology-based query checking to identify and correct scope rule errors in SPARQL queries generated by a large language model. The triple structure definition of the sewing technology knowledge ontology specifies that the sewing technology sew is only applicable to fabrics marked as SuitableFabric, while Cotton and Leather meet this condition, but Synthetic does not. However, the SPARQL query generated by the large language model incorrectly applies the sew technology to Synthetic fabrics. By executing SPARQL queries, we check whether all garments using the sew technology use the appropriate fabric type. When it is detected that the sew technology is used for Synthetic fabrics, this violates the scope rule. This error is exposed through the FILTER NOT EXISTS clause in the SPARQL query, which is the error feedback information, which verifies whether the fabric belongs to the applicable fabric category. This process not only helps to confirm the query errors, but also guides how to correct these errors to ensure that all data and query behaviors strictly comply with the ontology specifications, thereby improving data consistency and application reliability; The ontology definition specifies that the sewing technique “usesTechnique” only applies to “Wool” or “Cotton”, both of which are subclasses of the class “Fabric”. However, the large language model incorrectly generated a query that attempted to apply the technique to the fabric “Synthetic”. By executing a specially crafted SPARQL query, we checked whether all garments using the technique were of the appropriate fabric type. When it was detected that the technique was used for the fabric “Synthetic”, this clearly violated the scope rule defined in the ontology. This error was revealed using the FILTER NOT EXISTS clause; Type matching rule errors in SPARQL queries For example, in the sewing technology domain, the fabric thickness attribute (fabricThickness) should be a floating point number (xsd:float). For example, if a SPARQL query attempts to assign a string value (such as "thick") to the fabricThickness attribute, this will violate the data type definition in the ontology.
[0029] Logical consistency rule errors in SPARQL queries, such as: the order attribute of sewing steps should be transitive, that is, if cutting comes before sewing and sewing comes before finishing in the ontology, then cutting should come before finishing; if the SPARQL query cuts after finishing, it violates the logical consistency rule; Class membership rule errors in SPARQL queries For example, in sewing craft, fabric types should be correctly classified as categories in the ontology. For example, suppose the ontology defines the Fabric category and its subcategories Cotton and Wool. If a SPARQL query classifies a fabric (such as Synthetic) as a type that does not belong to the Fabric category, this will violate the class membership rule.
[0030] Existence rule errors in SPARQL queries For example, in the domain of sewing crafts, queries may refer to specific sewing techniques and fabric types. These properties and entities should be pre-defined in the ontology. For example, if a SPARQL query refers to a sewing technique that does not exist in the ontology (such as ultrasonic Sewing), the existence rule is violated.
[0031] It should be noted that type matching rule errors in SPARQL queries, logical consistency rule errors in SPARQL queries, class membership rule errors in SPARQL queries, and existence rule errors in SPARQL queries will also be revealed through error feedback information similar to the FILTER NOT EXISTS clause.
[0032] S5: Large language model correction; Specifically, the error feedback information is converted into an error explanation template that can be used by the large language model; the error explanation template and the SPARQL query with the rule error are input into the large language model to correct the SPARQL query; It should be noted that: after obtaining the input SPARQL query and the corresponding error feedback through ontology-based query checking, since these error feedbacks are usually detailed descriptions of the inconsistency between the SPARQL query and the triple structure of the sewing process knowledge ontology; a large language model is required to understand them, so the error feedback needs to be converted into a text format that can be understood and used by the large language model, namely, an error explanation template; then the error explanation template and the corresponding SPARQL query statement with a rule error are used as input, so that the large language model modifies the SPARQL query with a rule error, and the large language model modifies the SPARQL query statement with a rule error into a correct statement that complies with the ontology consistency rules based on RDFS and OWL according to the error explanation content in the error explanation template, and generates a new SPARQL query; the method of modifying the content according to the explanation statement is a prior art and will not be elaborated here; S6: Determine whether the modified SPARQL query meets the preset standard; if so, output the SPARQL query; if not, continue to perform ontology-based query checking on the SPARQL query.
[0033] The preset standard is that the number of error checks reaches a preset number or it is determined that the SPARQL query does not have a rule error, and the preset number is the upper limit of the number of SPARQL query iterations set by the personnel; When a SPARQL query finally passes the ontology-based query check, its output will be precise and strictly in accordance with the ontology definition, thus ensuring the accuracy of the data and the credibility of the application. On the contrary, if a SPARQL query is repeatedly rejected due to non-compliance with the RDFS- and OWL-based ontology consistency rules, some information that should have been retrieved may not be obtained, which helps prevent decisions based on wrong information.
[0034] This application also provides a sewing craft SPARQL query system with a large language model; A sewing craft SPARQL query system with a large language model, including: A data acquisition module, used for acquiring sewing process data; The knowledge graph construction module is used to construct a knowledge graph based on SPARQL statements according to sewing process data; A SPARQL query generation module is used to process the knowledge graph based on SPARQL statements according to the large language model and generate SPARQL queries for the sewing process knowledge graph; The ontology-based query checking module is used to perform ontology-based query checking on SPARQL queries, wherein the ontology-based query checking includes: judging whether there are rule errors in the SPARQL query according to the ontology consistency rules based on RDFS and OWL; if so, outputting error feedback information corresponding to all rule errors; An error correction module is used to input error feedback information into a large language model to correct the SPARQL query; A standard judgment module is used to judge whether the modified SPARQL query meets the preset standard; The SPARQL query output module is used to output the SPARQL query when the standard judgment module judges that it is yes.
[0035] Reference Figure 2 , provides a schematic diagram of the structure of an electronic device for an embodiment of the present application. The electronic device may include: at least one processor, at least one network interface, a user interface, a memory, and at least one communication bus.
[0036] The communication bus is used to realize the connection and communication between these components.
[0037] The user interface may include a display screen (Display) and a camera (Camera), and the optional user interface may also include a standard wired interface and a wireless interface.
[0038] The network interface may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0039] Among them, the processor may include one or more processing cores. The processor uses various interfaces and lines to connect various parts of the entire server, and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory, and calling data stored in the memory. Optionally, the processor can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor, but may be implemented separately through a chip.
[0040] The memory may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory includes a non-transitory computer-readable storage medium. The memory may be used to store instructions, programs, codes, code sets or instruction sets. The memory may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory may also be at least one storage device located away from the aforementioned processor. The memory as a computer storage medium may include an operating system, a network communication module, a user interface module, and a sewing process SPARQL query method application based on a large language model.
[0041] It should be noted that: when the device provided in the above embodiment realizes its function, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0042] In the electronic device, the user interface is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor can be used to call an application stored in the memory that stores a sewing process SPARQL query method based on a large language model. When executed by one or more processors, the electronic device executes one or more of the methods described in the above embodiments.
[0043] The "unit" and "module" in this specification refer to software and / or hardware that can independently complete a specific function or cooperate with other components to complete a specific function, where the hardware may be, for example, a field programmable gate array (FPGA), an integrated circuit (IC), etc.
[0044] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0045] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0046] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0047] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0048] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0049] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, disk or optical disk and other media that can store program codes.
[0050] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable memory, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0051] The above is only an exemplary embodiment of the present disclosure, and the scope of the present disclosure cannot be limited thereto. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the specification and practicing the disclosure here, those skilled in the art will easily think of other embodiments of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field not recorded in the present disclosure. The description and examples are only regarded as exemplary, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. A sewing technology SPARQL query method based on a large language model, characterized in that: include: Obtain sewing process data; According to the sewing process data, a knowledge graph based on SPARQL statements is constructed; The knowledge graph based on SPARQL statements is processed according to the large language model to generate SPARQL queries for the sewing process knowledge graph; Performing ontology-based query checking on SPARQL queries, wherein the ontology-based query checking includes: judging whether there are rule errors in the SPARQL query according to the ontology consistency rules based on RDFS and OWL; if so, outputting error feedback information corresponding to all rule errors; Input error feedback information into the large language model to correct the SPARQL query; Determine whether the modified SPARQL query meets the preset standard; If yes, then output the SPARQL query.
2. The sewing process SPARQL query method based on a large language model according to claim 1 is characterized in that: After judging whether the modified SPARQL query meets the preset criteria, it includes: If not, continue to perform ontology-based query checking on the SPARQL query.
3. The sewing process SPARQL query method based on a large language model according to claim 2 is characterized in that: The preset standard is that the number of error checks reaches a preset number or it is determined that there is no rule error in the SPARQL query.
4. The sewing process SPARQL query method based on a large language model according to claim 1 is characterized in that: According to the sewing process data, a knowledge graph based on SPARQL statements is constructed, including: According to the sewing process data, construct the sewing process knowledge ontology triple; According to the triples of sewing process knowledge ontology, a knowledge graph based on SPARQL statements is constructed.
5. The sewing process SPARQL query method based on a large language model according to claim 4 is characterized in that: According to the sewing process data, a sewing process knowledge ontology triple is constructed, including: The sewing process knowledge ontology triples are constructed according to the entities, relations and attributes in the sewing process data.
6. The sewing process SPARQL query method based on a large language model according to claim 4 is characterized in that: Determine whether there are rule errors in SPARQL queries based on the ontology consistency rules based on RDFS and OWL, including: Extract triple-based graph patterns from SPARQL queries; The three-element basic graphic pattern and the three-element group of sewing process knowledge ontology are constructed into a joint graph; According to the ontology consistency rules based on RDFS and OWL, it is judged whether there are rule errors in the joint graph.
7. The sewing process SPARQL query method based on a large language model according to claim 6 is characterized in that: Ontology consistency rules based on RDFS and OWL, including: Domain rule: ensure that the entity of a certain attribute in the ternary basic graphic pattern conforms to the domain category of the attribute in the ternary structure of the sewing process knowledge ontology; Scope rule: ensure that the object of the attribute in the ternary basic graph pattern conforms to the scope category defined in the ternary structure of the sewing process knowledge ontology; Type matching rule: Check whether the data type of the attribute value in the ternary basic graphic pattern conforms to the data type definition of the attribute in the ternary structure of the sewing process knowledge ontology; Logical consistency rules: Check the attribute relationship to ensure that the attribute relationship in the ternary basic graphic pattern conforms to the logical specifications in the ternary structure of the sewing process knowledge ontology, where the attribute relationship includes symmetry, antisymmetry, and transitivity; Class membership rule: Check whether the entities in the ternary basic graphic pattern are correctly classified into the categories defined in the ternary structure of the sewing process knowledge ontology; Existence rule: Check whether all attributes and entities referenced in the query of the ternary basic graph pattern are defined in the ternary structure of the sewing process knowledge ontology.
8. The sewing process SPARQL query method based on a large language model according to claim 1 is characterized in that: Input error feedback information into the large language model to correct the SPARQL query, including: Convert error feedback information into error explanation templates that can be used by large language models; The error explanation template and the SPARQL query with rule errors are input into the large language model to correct the SPARQL query.
9. A sewing process SPARQL query system based on a large language model of the method described in any one of claims 1 to 8, characterized in that: include: A data acquisition module, used for acquiring sewing process data; The knowledge graph construction module is used to construct a knowledge graph based on SPARQL statements according to sewing process data; A SPARQL query generation module is used to process the knowledge graph based on SPARQL statements according to the large language model and generate SPARQL queries for the sewing process knowledge graph; The ontology-based query checking module is used to perform ontology-based query checking on SPARQL queries, wherein the ontology-based query checking includes: judging whether there are rule errors in the SPARQL query according to the ontology consistency rules based on RDFS and OWL; if so, outputting error feedback information corresponding to all rule errors; An error correction module is used to input error feedback information into a large language model to correct the SPARQL query; A standard judgment module is used to judge whether the modified SPARQL query meets the preset standard; The SPARQL query output module is used to output the SPARQL query when the standard judgment module judges that it is yes.
10. An electronic device, characterized in that It includes a processor, a memory and a transceiver, wherein the memory is used to store instructions, the transceiver is used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Ontology model-based data access method and system for terminal users
CN108959358A
A method of constructing enterprise knowledge map from a multi-source data integration perspective
CN109284394A
Techniques for automated generation of queries for querying ontologies
US20100185643A1
Query rewriting in a relational data harmonization framework
US20180011903A1
Cited By
Inference method and related device
WO2026113261A1
