A body modeling method, system, device and medium for rail transit
By classifying and validating the candidate ontology elements of rail transit generated by LLM, a five-element semantic ontology covering entities, attributes, relationships, actions, and constraints is formed. This solves the semantic distortion problem of LLM extraction results in the rail transit field, improves the executability and consistency of rule templates, and ensures the reliability and usability of ontology assets.
Patent Information
- Application Number
- CN202611394369.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-09
- Publication Date
- 2026-11-20
AI Technical Summary
In the field of rail transit, existing technologies lack unified type constraints for LLM extraction results, leading to semantic distortion, difficulty in accurately distinguishing object states, process states, and event facts, lack of executable rule expressions that coordinate actions and constraints, and existing verification mechanisms have failed to effectively improve the executability of rule templates and cross-layer reference consistency.
Candidate ontology elements are generated from rail transit documents using a Large Language Model (LLM), and then classified, normalized, and verified using rail transit domain modeling rules to form a five-element semantic ontology covering entities, attributes, relationships, actions, and constraints. A mapping relationship with the underlying graph database is established to generate queryable and verifiable structured semantic assets.
It reduces semantic distortion in LLM candidate extraction, accurately distinguishes between object state and process state, forms a five-element semantic ontology that coordinates actions and constraints, improves the executability of rule templates and cross-layer reference consistency, and ensures the reliability and usability of the output ontology assets.
Smart Images

Figure CN123139998A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of rail transit, and in particular to a method, system, device and medium for ontology modeling of rail transit. Background Technology
[0002] Rail transit business systems are characterized by a wide variety of object types, rapid state changes, strong system collaboration, and complex operational rules. Business documents for rail transit scenarios such as train operation, inter-station evacuation, equipment maintenance, and anomaly handling typically include object concepts, operational states, system relationships, operational actions, action entry conditions, anomaly triggering logic, and prohibition conditions. For example, a single scenario text may describe objects such as trains, doors, ATS (Automatic Train Protection System), and ZC (Zero-Card Control), as well as attributes such as train speed, operating mode, and door status, actions such as sending commands, applying brakes, and unlocking doors, and business rules such as "execution only if conditions are met" and "anomalies should trigger a response."
[0003] As the application of Large Language Models (LLMs) in rail transit business question answering, rule interpretation, handling suggestions, and decision support gradually increases, a key issue has become how to provide an understandable, constrained, and reasonable semantic foundation for the rail transit domain for subsequent artificial intelligence applications. Traditional text retrieval enhancement generation methods mainly rely on document fragment recall, which can provide textual evidence, but it is difficult to guarantee that the output is strictly within the scope of rail transit objects, attributes, relationships, and business rules. Although ordinary knowledge graph or ontology construction methods can express entities, attributes, and related facts, they usually do not establish a unified and executable modeling mechanism for the direct state or relationship changes of actions, the type and timing of constraint checks, and the referencing rules between entities, attributes, relationships, actions, and constraints, making them difficult to directly use for action admission and state verification.
[0004] Extracting ontology elements from rail transit documents using LLM has significant value. LLM can quickly identify candidate entities, candidate attributes, candidate relationships, candidate actions, and candidate rules, reducing the cost of manual sorting. However, the open generation mechanism of LLM can also easily lead to domain semantic distortion. For example, the model might classify systems and equipment together based on text adjacency, incorrectly write a stage of a single process as a long-term object attribute, or mistakenly construct short-term actions such as "send command" or "unlock door" as stable relationships. If these results are directly entered into the ontology or knowledge graph, it will affect the reliability of subsequent rule verification and controlled generation.
[0005] After searching, several methods and systems related to rail transit knowledge graph construction, semantic extraction from large language models, ontology modeling, and knowledge verification have been proposed in the existing technology, as follows: 1) Chinese Patent Publication No. CN121189452B discloses a method, system, terminal, and storage medium for constructing a knowledge graph of subway operation accidents. Specifically, it proposes constructing an ontology knowledge base and example pool containing entity, relation, and attribute specifications based on subway operation accident dispatch logs; using similar examples to guide extraction by a large language model; and breaking down tasks such as entity recognition and relation determination through a thought chain; then performing post-event self-verification based on the ontology base and the large language model to generate an accident knowledge graph. The modeling objects of this scheme are mainly entities, relations, and attributes, without treating actions and constraints as independent semantic layers for unified modeling; its verification focus is on the correctness of the extraction results, without addressing cross-layer reference verification of action effects, constraint expressions, and graph query templates, or feedback on modeling gaps. 2) Chinese Patent Publication No. CN121257671A discloses a method, terminal equipment, and medium for constructing a knowledge graph for rail transit maintenance. Specifically, it proposes processing structured and unstructured maintenance data, using a large language model to perform context-based information distillation to obtain summaries and keywords with confidence scores; then, it uses a dynamic ontology-aware large language model to extract entity-relation triples, dynamically expands the initial ontology layer, and stores it in a graph database. The core of this scheme is the extraction of entity-relation triples with confidence scores and the dynamic expansion of the ontology layer. However, it does not form a five-element semantic boundary of entity, attribute, relation, action, and constraint; it does not compile natural language rules into executable constraints such as action admissions, state invariants, and triggering rules; and it does not verify the objects referenced by rules, attribute attribution, or relational paths. 3) Chinese Patent Publication No. CN121681842A discloses a method for constructing a knowledge graph of urban rail transit operation faults based on few-sample prompts. Specifically, it proposes constructing an ontology of urban rail transit fault knowledge graphs, defining entity types and relation types by combining text features and expert knowledge; designing knowledge extraction prompts based on few-sample examples, obtaining triple knowledge through a large language model, and completing knowledge fusion through clustering and large model verification. This scheme focuses on fault knowledge extraction and entity fusion guided by prompts, with semantic units still primarily consisting of entities and relations; it does not separate short-term operations from stable relations and model them as actions, nor does it independently model business conditions as constraints that can be bound to inspection timing; and it lacks a process context organization method with scenario operation records as root nodes.
[0006] The aforementioned existing technologies can, to a certain extent, achieve entity, relation, and attribute identification, knowledge fusion, or ontology expansion, but still have at least the following problems: 1) The LLM extraction results lack a unified type constraint and semantic correction mechanism for the rail transit domain, which easily leads to concept drift, erroneous inheritance, synonym duplication and hierarchical confusion; 2) The current state of long-term objects, the process state of a business process, and the facts of events that have occurred are easily mixed together, making it difficult to accurately define the process context and the scope of its objects in different scenarios; 3) Existing knowledge graphs typically organize knowledge around entities, attributes, and relationships, lacking executable rule expressions that coordinate actions and constraints; 4) Existing verification mechanisms focus on the consistency of entity recognition, relation extraction, or knowledge fusion, but do not uniformly verify the entity references, attribute attribution, relation paths, action-constraint mappings, and template executability between action effects, constraint expressions, and graph query templates.
[0007] Therefore, how to reduce semantic distortion in LLM candidate extraction, accurately distinguish between object state, process state and event facts, form a five-element semantic ontology that coordinates actions and constraints, and improve the executability of rule templates and cross-layer reference consistency has become a technical problem that needs to be solved. Summary of the Invention
[0008] The purpose of this invention is to overcome the shortcomings of the existing technology and provide an ontology modeling method, system, device and medium for rail transit, which reduces semantic distortion in LLM candidate extraction, accurately distinguishes object state, process state and event facts, forms a five-element semantic ontology with coordinated actions and constraints, and improves the executability of rule templates and cross-layer reference consistency.
[0009] The objective of this invention can be achieved through the following technical solutions: According to a first aspect of the present invention, a ontology modeling method for rail transit is provided, the method comprising: Candidate ontology elements are generated from rail transit documents by leveraging the semantic extraction capabilities of the Large Language Model (LLM). The candidate ontology elements output by LLM are classified, normalized and verified by modeling rules in the rail transit field, and the misjudged candidate semantic units are corrected to the correct level, forming a five-element semantic ontology covering entities, attributes, relationships, actions and constraints. The references between the five-element semantic ontology are validated, and mapping relationships are established with nodes, edges, attributes and process nodes in the underlying graph database to generate queryable and verifiable structured semantic assets.
[0010] As a preferred technical solution, the method specifically includes the following steps: Step S1: Receive scenario process documents, system function descriptions, and condition rule texts from the rail transit field, and segment them into semantic fragments; Step S2: Call the Large Language Model (LLM) to extract candidate items from the semantic fragments. The candidate items include candidate entities, candidate attributes, candidate relations, candidate actions, and candidate constraints, while retaining the source text. Step S3: Perform entity classification, inheritance verification, synonym normalization, state attribution determination and inter-layer boundary determination on the candidate items, and output the converged candidate set of entities, attributes, relations, actions and constraints. Step S4: Generate entity attribute layer, including generating rail transit entity category, identification attribute and current status attribute, and write process status into scene record and write historical event facts into event object; Step S5: Generate a relation layer, including stability judgment of candidate relations, predicate unification and direction unification, to form stable structural relations and scene context relations; Step S6: Generate the action layer, including identifying executable actions and compiling the action effects into creating objects, setting properties, and creating relationships; Step S7, generate a constraint layer, including dividing the rule candidates into action admission constraints, state invariants, triggering rules and derived rules, and binding the inspection timing and related actions; Step S8: Perform ontology graph mapping, including mapping entities, attributes, relationships and scene records into graph structures, and mapping actions and constraints into callable rule metadata; Step S9: Perform scene context binding, including automatically binding the required objects for constraint checks along the relationship path with the scene record as the root node; Step S10: Generate an executable graph query template, including compiling the constraint expression into a read-only graph query template and generating structured return fields; Step S11: Perform cross-layer reference verification, including verifying the entity references, attribute attribution, relationship paths, bidirectional mapping of action constraints, and template executability of action effects, constraint expressions, and query templates; migrate and correct identifiable error levels, and model gaps in unresolved reference outputs. Step S12: Output ontology assets, including outputting a five-element semantic ontology, graph mapping relationships, action definitions, constraint definitions, and rule query templates.
[0011] As a preferred technical solution, step S2 specifically includes: Step S2.1: Input each semantic fragment and its scene context into the LLM; Step S2.2, the LLM outputs candidate items, wherein the candidate items include candidate entities, candidate attributes, candidate relationships, candidate actions, and candidate constraints; Step S2.3: For each candidate, record the source sentence, candidate type, semantic explanation, and upstream and downstream references; Step S2.4: Mark the candidate items as pending domain rule verification status.
[0012] As a preferred technical solution, step S3 specifically includes: Step S3.1: Perform top-level type determination on the candidate entities and classify them into physical objects, system objects, spatial objects, information objects, events, participants, or scene records; Step S3.2: Perform strict Is-a validation on the candidate parent-child class relationship. If the inheritance conditions are not met, convert it into a relationship candidate or attribute candidate. Step S3.3: Perform an attribution determination on the candidate attributes or states to determine whether they belong to the current state of a long-term object, the state of a scene recording process, or a historical event fact that should be carried by an event object. Step S3.4: Perform synonym unification on the candidate terms, merging rail transit terms with the same or similar meanings into a single defined concept; Step S3.5: Output the converged candidate set of entities, attributes, relations, actions, and constraints.
[0013] As a preferred technical solution, step S5 specifically includes: Step S5.1: Perform a stability judgment on the candidate predicates to determine whether they represent long-term structural relationships, scene context relationships, short-term actions, or rule conditions. Step S5.2: Retain long-term structural relationships and scene context relationships in the relationship layer; Step S5.3: Transfer the short-term state changes of sending, opening, braking, and reporting to the action layer; Step S5.4: Move the rule conditions of "when," "must be satisfied," and "must not" to the constraint layer; Step S5.5: Perform predicate normalization and direction unification on the preserved relations, and output the canonical relation template.
[0014] As a preferred technical solution, step S6 specifically includes: Step S6.1: Determine whether the candidate action has a clear executing subject, execution goal, and direct effect; Step S6.2: Classify actions into control type, status access type, notification type, or system trigger type; Step S6.3: Compile the action effect into creating an object, setting properties, and creating relationships; Step S6.4: Perform reference validation on the objects, properties, and relationships in the action effect; Step S6.5: Derive the action influence domain based on the modified attributes and relationships of the action, which will be used for subsequent constraint matching.
[0015] As a preferred technical solution, step S7 specifically includes: Step S7.1: Identify conditional statements, prohibition statements, trigger statements, and result determination statements from the candidate rules; Step S7.2: Divide the rules into action admission constraints, state invariants, triggering rules, and derived rules; Step S7.3: Bind the action admission constraint to BeforeAction, bind the state invariant to OnWrite or AfterAction, and bind the trigger rule to OnEvent or Periodic; Step S7.4 involves constraining and recording related actions, attention attributes, scope of objects, and business responses; Step S7.5: Output constraint definitions that can be used for runtime scheduling.
[0016] As a preferred technical solution, step S8 specifically includes: Step S8.1: Map entity types and their instances to graph nodes; Step S8.2: Map entity attributes, identifier attributes, and status attributes to node attributes; Step S8.3: Map the semantic relations in the relation layer to graph edges; Step S8.4: Map the scene record to process nodes, and connect the target object, participate in the system, use resources, and trigger events through edges; Step S8.5: Treat actions and constraints as rule metadata and establish reference relationships with their related entities, scene records and inspection templates.
[0017] As a preferred technical solution, step S9 specifically includes: Step S9.1: Extract entity variables and attribute variables from the constraint expression; Step S9.2: Using scene records and action targets as anchor points, search for candidate objects along relational paths in the graph structure; Step S9.3: When there is only one candidate object, it is automatically bound; when there are multiple candidate objects, they are sorted according to path length, semantic matching degree of relationship, and scenario consistency.
[0018] As a preferred technical solution, step S10 specifically includes: Step S10.1: Decompose the constraint expression into entity variables, relational paths, rule judgment conditions, and return fields; Step S10.2: Generate graph node matching based on entity variables, generate edge connections based on relational paths, and generate WHERE conditions based on rule judgment conditions; Step S10.3 generates a read-only graph query template, returning constraint identifiers, scene records, key objects, key attributes, and violation or trigger reasons.
[0019] According to a second aspect of the present invention, an ontology modeling system for rail transit is provided, the system comprising a document access and semantic segmentation module, an LLM candidate semantic extraction module, a rail transit domain type constraint module, an entity attribute hierarchical generation module, a relation semantic normalization and disambiguation module, an action effect structured compilation module, a constraint type identification and check timing binding module, an ontology graph mapping module, a scene context binding module, an executable graph query template compilation module, a cross-layer reference verification module, and an ontology asset output and service interface module; The document access and semantic segmentation module, the LLM candidate semantic extraction module, and the rail transit domain type constraint module are connected in sequence; the rail transit domain type constraint module is connected to the entity attribute hierarchical generation module, the relation semantic normalization and disambiguation module, the action effect structured compilation module, and the constraint type identification and inspection timing binding module, respectively. The entity attribute hierarchical generation module and the relation semantic normalization and disambiguation module are respectively connected to the ontology graph mapping module, and the action effect structured compilation module and the constraint type identification and check timing binding module are respectively connected to the executable graph query template compilation module. The ontology graph mapping module, scene context binding module, executable graph query template compilation module, cross-layer reference verification module, and ontology asset output and service interface module are connected in sequence.
[0020] As a preferred technical solution, the document access and semantic segmentation module is used to receive scenario process documents, system function descriptions and conditional rule texts, and segment them into semantic fragments; The LLM candidate semantic extraction module is used to call the large language model to extract candidate entities, candidate attributes, candidate relations, candidate actions and candidate constraints from semantic fragments, and record the source text, context and initial interpretation of each candidate. The rail transit domain type constraint module is used to determine the domain type of LLM candidate outputs, including top-level entity classification, inheritance relationship verification, synonym unification, state attribution determination, and inter-layer boundary determination. The entity attribute layering generation module is used to generate rail transit entities and attribute layers, including entity category, parent-child relationship, identification attribute, current state attribute, scene record attribute and event attribute; The relation semantic normalization and disambiguation module is used to determine the stability of candidate relations, normalize predicates and unify directions, and transfer short-term behavior to the action layer and rule conditions to the constraint layer. The action effect structured compilation module is used to identify executable actions and compile action effects into a standardized set of operations; The constraint type identification and check timing binding module is used to classify rule candidates into action admission constraints, state invariants, trigger rules and derived rules, and bind them to the check timing of BeforeAction, OnWrite, OnEvent or Periodic. The ontology graph mapping module is used to map the hierarchical ontology into a graph structure, so that entities and their instances correspond to nodes, attributes correspond to node attributes, relations correspond to edges, scene records correspond to process nodes, and actions and constraints correspond to callable rule metadata. The scene context binding module is used to construct a scene context graph along the relational path with the scene record as the root node, and automatically bind the target objects, participating systems, resources used, and spatial range required for constraint checks. The executable graph query template compilation module is used to split the constraint expression into entity variables, relation paths, rule judgment conditions and return fields, and generate a read-only graph query template. The cross-layer reference verification module is used to verify the references of action effects, constraint expressions, and graph query templates to entities, attributes, and relationships before the ontology assets are output; to verify attribute attribution, relationship paths, bidirectional mapping of action constraints, and the executability of graph query templates; to migrate and correct determinable inter-layer obfuscations; and to model gaps in the output of unresolved references. The ontology asset output and service interface module is used to output five-element semantic ontology, graph mapping relationship, action definition, constraint definition and query template.
[0021] As a preferred technical solution, the cross-layer reference verification module has a feedback correction function, and establishes verification feedback connections with the rail transit domain type constraint module, entity attribute hierarchical generation module, relation semantic normalization and disambiguation module, action effect structured compilation module, constraint type identification and inspection timing binding module, and executable graph query template compilation module, respectively.
[0022] According to a third aspect of the present invention, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the program to implement the method described thereon.
[0023] According to a fourth aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method described thereon.
[0024] Compared with the prior art, the present invention has the following advantages: (1) This invention takes entities, attributes, relationships, actions and constraints as five semantic units with clear boundaries; entities and attributes carry the identity and current state of objects, relationships carry stable structural relationships and scene context relationships, actions express direct changes by creating objects, setting attributes, creating relationships and deleting relationships, and constraints independently express action admission, state invariants, triggering rules and derivation rules, and are bound to the timing of checks; thus, the graph structure mainly based on static object association is extended into an executable semantic ontology that can express state evolution and business rules; (2) This invention classifies the current state of long-term objects into the attributes of objects such as trains, equipment or systems, classifies the stages, authorizations, handling results, participating objects and resources used in a business process into the scenario operation record, and classifies historical faults, alarms and event facts into event objects; the scenario operation record serves as the context root node to associate target objects, participating objects, resources and triggering events; thereby avoiding temporary state pollution when the same long-term object participates in different processes, and providing a traceable process context for rules; (3) This invention verifies the entity references, attribute attribution, relational paths and action-constraint bidirectional mapping of action effects, constraint expressions and graph query templates, and determines whether the rule template can be parsed by confirmed scene operation records and five-element semantics; performs migration correction for determinable mis-layer semantics; outputs missing entities, attributes, relations or actions for unparsable content, avoids generating unexecutable rule templates, and improves the engineering availability of ontology assets and rule templates and the stability of subsequent system calls. Attached Figure Description
[0025] Figure 1 This is a flowchart illustrating the specific process of the method of the present invention; Figure 2 This is a schematic diagram illustrating the mapping from the five-element semantic ontology to the graph structure and rule template of this invention; Figure 3 This is a schematic diagram of the system of the present invention. Detailed Implementation
[0026] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0027] Example 1 This invention proposes an ontology modeling method for rail transit. On one hand, this method utilizes the semantic extraction capabilities of LLM to generate candidate ontology elements from rail transit documents. On the other hand, it classifies, normalizes, and verifies the LLM output using rail transit domain modeling rules, correcting misjudged candidate semantic units to the correct level, ultimately forming a five-element semantic ontology covering entities, attributes, relationships, actions, and constraints. Subsequently, the references between these five semantic elements are verified, and mapping relationships are established with nodes, edges, attributes, and process nodes in the underlying graph database, further transforming natural language rules into queryable and verifiable structured semantic assets.
[0028] like Figure 1 As shown, the ontology modeling method for rail transit of this invention includes the following steps: Step S1: Document Access and Semantic Segmentation: Receive relevant scenario process documents, system function descriptions, and conditional rule texts related to rail transit, and segment them into semantic fragments.
[0029] Step S2 LLM Candidate Semantic Extraction: Call the large language model to extract candidate entities, candidate attributes, candidate relations, candidate actions, and candidate constraints from the semantic fragments, while retaining the source text.
[0030] Step S3 Domain type constraints and candidate convergence: Perform entity classification, inheritance verification, synonym normalization, state attribution determination and inter-layer boundary judgment on candidate semantic units.
[0031] Step S4 Entity Attribute Layer Generation: Generate rail transit entity categories, identification attributes, and current status attributes, and write the process status into the scene record and write historical event facts into the event object.
[0032] Step S5 Relationship layer generation: The candidate relations are judged for stability, predicates are normalized and directions are unified to form stable structural relations and scene context relations.
[0033] Step S6 Action layer generation: Identify executable actions and compile the action effects into object creation, property setting, and relationship creation.
[0034] Step S7 Constraint Layer Generation: Divide the rule candidates into action admission constraints, state invariants, triggering rules and derived rules, and bind the inspection timing and related actions.
[0035] Step S8 Ontology Graph Mapping: Map entities, attributes, relationships, and scene records to a graph structure, and map actions and constraints to callable rule metadata.
[0036] Step S9 Scene Context Binding: Using the scene record as the root node, automatically bind the required objects for constraint checks along the relationship path.
[0037] Step S10 Executable graph query template generation: Compile the constraint expression into a read-only graph query template and generate structured return fields.
[0038] Step S11 Cross-layer reference verification: Verify the entity references, attribute attribution, relationship paths, bidirectional mapping of action constraints, and template executability of action effects, constraint expressions, and query templates; migrate and correct identifiable error levels, and model gaps in unresolved reference outputs.
[0039] Step S12 Ontology Asset Output: Output the five-element semantic ontology, graph mapping relationship, action definition, constraint definition and rule query template for subsequent use by OAG service, MCP tool or other AI applications.
[0040] As a preferred technical solution, the specific steps of step S2 are as follows: S2.1, input each semantic fragment and its scene context into the LLM; S2.2, LLM outputs candidate entities, candidate attributes, candidate relationships, candidate actions, and candidate constraints; S2.3 Record the source sentence, candidate type, semantic explanation, and upstream and downstream references for each candidate; S2.4 marks the candidate items as pending domain rule verification status instead of writing them directly into the final ontology.
[0041] As a preferred technical solution, the specific steps of step S3 are as follows: S3.1 Perform top-level type determination on candidate entities and classify them into physical objects, system objects, spatial objects, information objects, events, participants, or scene records; S3.2, perform strict is-a validation on candidate parent-child class relationships. If the inheritance conditions are not met, convert them into relationship candidates or attribute candidates. S3.3, perform attribution determination on candidate attributes or states to determine whether they belong to the current state of a long-term object, the state of a scene recording process, or historical event facts that should be carried by an event object; S3.4, perform synonym unification on candidate terms, and merge rail transit terms with the same or similar meanings into a single authoritative concept; S3.5 outputs a converged candidate set of entities, attributes, relations, actions, and constraints.
[0042] As a preferred technical solution, the specific steps of step S5 are as follows: S5.1 Perform stability judgment on candidate predicates to determine whether they represent long-term structural relationships, scene context relationships, short-term actions, or rule conditions; S5.2 preserves long-term structural relationships and scene context relationships in the relationship layer; S5.3 migrates short-term state changes such as sending, opening, braking, and reporting to the action layer; S5.4 moves rules and conditions such as "when," "must be satisfied," and "must not" to the constraint layer; S5.5 performs predicate normalization and direction unification on the preserved relations and outputs a canonical relation template.
[0043] As a preferred technical solution, the specific steps of step S6 are as follows: S6.1, determine whether the candidate action has a clear executing subject, execution goal and direct effect; S6.2, actions are classified into control type, status access type, notification type or system trigger type; S6.3 compiles the action effect into creating objects, setting properties, and creating relationships; S6.4 performs reference validation on objects, properties, and relationships in the action effect; S6.5 derives the action's influence domain based on the attributes and relationships modified by the action, which is then used for subsequent constraint matching.
[0044] As a preferred technical solution, the specific steps of step S7 are as follows: S7.1 Identify conditional statements, prohibition statements, trigger statements, and result determination statements from candidate rules; S7.2 divides the rules into action admission constraints, state invariants, triggering rules, and derived rules; S7.3 binds the action admission constraint to BeforeAction, binds the state invariant to OnWrite or AfterAction, and binds the trigger rule to OnEvent or Periodic; S7.4 is used to constrain and record related actions, attributes of interest, scope of objects affected, and business responses; S7.5 outputs constraint definitions that can be used for runtime scheduling.
[0045] As a preferred technical solution, the specific steps of step S8 are as follows: S8.1 maps entity types and their instances to graph nodes; S8.2 maps entity attributes, identifier attributes, and status attributes to node attributes; S8.3 maps semantic relations in the relation layer to graph edges; S8.4 maps scene records to process nodes and connects target objects, participates in the system, uses resources, and triggers events through edges; S8.5 treats actions and constraints as rule metadata and establishes reference relationships with their related entities, scene records, and inspection templates.
[0046] As a preferred technical solution, the specific steps of steps S9 and S10 are as follows: S9.1 Extract entity variables and attribute variables from constraint expressions; S9.2, using scene records and action targets as anchor points, searches for candidate objects along relational paths in the graph structure; S9.3 Automatically bind when there is only one candidate object; sort according to path length, semantic matching degree of relationship and scenario consistency when there are multiple candidate objects. S10.1 breaks down the constraint expression into entity variables, relational paths, rule judgment conditions, and return fields; S10.2, Generate graph node matching based on entity variables, generate edge connections based on relational paths, and generate WHERE conditions based on rule judgment conditions; S10.3 generates a read-only graph query template, returning constraint identifiers, scene records, key objects, key attributes, and violation or trigger reasons.
[0047] like Figure 2 As shown, this invention maps the five-element semantic ontology into a queryable and verifiable graph structure and rule template: entities and their instances are mapped to graph nodes; entity identifier attributes, current state attributes, etc., are mapped to node attributes; stable structural relationships and scene context relationships are mapped to graph edges; and scene operation records are mapped to process nodes associated with target objects, participating in the system, using resources, and triggering events. Actions and constraints are used as rule metadata to establish reference relationships with related entities, scene records, and query templates. Based on this, using scene operation records and action targets as context anchors, entity variables, relationship paths, judgment conditions, and return fields in constraints are compiled into node matching, edge connection, filtering conditions, and query result fields, respectively, generating a read-only graph query template for rule checking. By performing consistency checks on the action effects, constraint expressions, and entity references, attribute attribution, and relationship paths in the query template, it is ensured that the five-element semantic ontology can be transformed into executable structured rule assets.
[0048] Example 2 like Figure 3As shown, the present invention provides an ontology modeling system for rail transit, comprising a document access and semantic segmentation module 101, an LLM candidate semantic extraction module 102, a rail transit domain type constraint module 103, an entity attribute hierarchical generation module 104, a relation semantic normalization and disambiguation module 105, an action effect structured compilation module 106, a constraint type identification and check timing binding module 107, an ontology graph mapping module 108, a scene context binding module 109, an executable graph query template compilation module 110, a cross-layer reference verification module 111, and an ontology asset output and service interface module 112.
[0049] Document access and semantic segmentation module 101: It is used to receive scenario process documents, system function descriptions and condition rule texts, and segment them into semantic fragments such as term definitions, object descriptions, process actions, condition rules and exception responses.
[0050] LLM Candidate Semantic Extraction Module 102: Used to call the large language model to extract candidate entities, candidate attributes, candidate relations, candidate actions and candidate constraints from semantic fragments, and record the source text, context and initial interpretation of each candidate.
[0051] Rail transit domain type constraint module 103: used to determine the domain type of LLM candidate output, including top-level entity classification, inheritance relationship verification, synonym normalization, state attribution determination and inter-layer boundary judgment.
[0052] Entity Attribute Layer Generation Module 104: Used to generate rail transit entities and attribute layers, including entity categories, parent-child relationships, identification attributes, current status attributes, scene record attributes, and event attributes.
[0053] Relational semantic normalization and disambiguation module 105: It is used to determine the stability of candidate relations, normalize predicates and unify directions, and transfer short-term behaviors to the action layer and rule conditions to the constraint layer.
[0054] Action Effects Structured Compilation Module 106: Used to identify executable actions and compile action effects into a standardized set of operations such as creating objects, setting properties, and creating relationships.
[0055] The constraint type identification and check timing binding module 107 is used to classify rule candidates into action admission constraints, state invariants, trigger rules and derived rules, and bind them to check timings such as BeforeAction, OnWrite, OnEvent or Periodic.
[0056] Ontology Graph Mapping Module 108: Used to map hierarchical ontology into a graph structure, so that entities and their instances correspond to nodes, attributes correspond to node attributes, relations correspond to edges, scene records correspond to process nodes, and actions and constraints correspond to callable rule metadata.
[0057] Scene Context Binding Module 109: Used to construct a scene context graph along the relational path with the scene record as the root node, and automatically bind the target objects, participating systems, resources used, and spatial scope required for constraint checks.
[0058] Executable graph query template compilation module 110: used to split constraint expressions into entity variables, relation paths, rule judgment conditions and return fields, and generate read-only graph query templates.
[0059] Cross-layer reference verification module 111: Used to verify the references of action effects, constraint expressions and graph query templates to entities, attributes and relationships before the output of ontology assets; verify attribute attribution, relationship path, bidirectional mapping of action constraints and execution of graph query templates; perform migration correction for determinable inter-layer confusion; and model gaps in the output of unresolved references.
[0060] Ontology Asset Output and Service Interface Module 112: Used to output five-element semantic ontology, graph mapping relationship, action definition, constraint definition and query template, and provide structured ontology capabilities to subsequent OAG, MCP services or other AI call interfaces.
[0061] The connection relationships between the modules of this system are shown in Figure 3. The document access and semantic segmentation module 101 is connected to the LLM candidate semantic extraction module 102, providing rail transit document fragments with source context. The LLM candidate semantic extraction module 102 is connected to the rail transit domain type constraint module 103, submitting open-ended candidate outputs to the domain rule layer for constraint determination. The rail transit domain type constraint module 103 is connected to the entity attribute hierarchical generation module 104, the relation semantic normalization and disambiguation module 105, the action effect structured compilation module 106, and the constraint type identification and inspection timing binding module 107, assigning candidate semantic units to the entity attribute layer, relation layer, action layer, or constraint layer. The entity attribute hierarchical generation module 104 and the relation semantic normalization and disambiguation module 105 are connected to the ontology graph mapping module 108, providing semantic sources for nodes, node attributes, and edges in the graph structure. The action effect structured compilation module 106 and the constraint type identification and check timing binding module 107 are respectively connected to the executable graph query template compilation module 110, providing module 110 with rule metadata such as action effects, constraint types, check timing, related actions, and attention attributes. The ontology graph mapping module 108 is connected to the scene context binding module 109, providing module 109 with a queryable graph structure. The scene context binding module 109 is connected to the executable graph query template compilation module 110, providing the rule query template with object scope and relationship paths. The executable graph query template compilation module 110 is connected to the cross-layer reference verification module 111, used for reference verification before submitting the generated executable rule query template for output. The cross-layer reference verification module 111, as a pre-output verification module, is connected to the ontology asset output and service interface module 112, used to output the final ontology asset after verification passes. Meanwhile, the cross-layer reference verification module 111 has a feedback correction function, establishing verification feedback connections with the rail transit domain type constraint module 103, entity attribute hierarchical generation module 104, relation semantic normalization and disambiguation module 105, action effect structured compilation module 106, constraint type identification and inspection timing binding module 107, and executable graph query template compilation module 110. When it is found that entity or attribute references are missing, attribute attribution is incorrect, relation paths do not exist, bidirectional mapping of action constraints is inconsistent, or query templates are not executable, the cross-layer reference verification module 111 feeds back the verification results to the corresponding modules for correction; for content that cannot be corrected, it outputs modeling gaps. The ontology asset output and service interface module 112 outputs three types of results: five-element semantic ontology, graph mapping relationships, and rule query templates. The three types of results correspond to the three output boxes in the lower right corner of Figure 3, which can be called by subsequent OAG services, MCP tools, or other AI applications.
[0062] The working principle of this system includes two aspects. On the one hand, the system uses LLM to generate candidate semantic units from rail transit documents, improving the coverage and efficiency of ontology construction; on the other hand, the system applies deterministic constraints to the candidate semantic units through rail transit domain modeling rules, ensuring that the candidate results are assigned to the correct level and further transformed into executable rules.
[0063] At the entity layer, the system distinguishes physical objects, system objects, spatial objects, information objects, events, participants, and scene records through domain type constraints; at the attribute layer, the system distinguishes the current state, process state, and event attributes of an object through state attribution rules; at the relation layer, the system distinguishes long-term relations and short-term actions through stability determination and predicate normalization; at the action layer, the system compiles action effects into a set of standard operations; at the constraint layer, the system divides natural language rules into different constraint types and binds them to check timing; at the graph mapping layer, the system transforms the hierarchical ontology into a queryable graph structure; and at the rule compilation layer, the system generates executable graph query templates.
[0064] Thus, the system forms a closed loop of "document semantic input - LLM candidate extraction - five-element semantic hierarchical modeling - scene operation record anchoring - ontology graph mapping and constraint query compilation - cross-layer reference verification - ontology asset output".
[0065] This invention proposes an ontology modeling method and system for rail transit through Embodiments 1 and 2. It utilizes LLM to improve the efficiency of candidate semantic extraction from rail transit documents, and transforms rail transit object associations, state changes, and business rules into queryable, verifiable, and reusable structured ontology assets through domain type constraints, five-element semantic construction, scene operation record anchoring, ontology graph mapping, executable rule template generation, and cross-layer reference verification. The system implements the above method through mutually cooperating functional modules, thereby providing a deterministic semantic and rule foundation for subsequent artificial intelligence applications.
[0066] Example 3 This invention also provides an electronic device including a central processing unit (CPU), which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) or loaded from a storage unit into a random access memory (RAM). The RAM may also store various programs and data required for device operation. The CPU, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.
[0067] Multiple components in the device are connected to the I / O interface, including: input units such as keyboards and mice; output units such as various types of displays and speakers; storage units such as disks and optical discs; and communication units such as network interface cards (NICs), modems, and wireless transceivers. The communication unit allows the device to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0068] The processing unit executes the various methods and processes described above, such as methods S1 to S12. For example, in some embodiments, methods S1 to S12 may be implemented as computer software programs tangibly contained in a machine-readable medium, such as a storage unit. In some embodiments, part or all of the computer program may be loaded and / or installed on the device via ROM and / or a communication unit. When the computer program is loaded into RAM and executed by the CPU, one or more steps of methods S1 to S12 described above may be performed. Alternatively, in other embodiments, the CPU may be configured to execute methods S1 to S12 by any other suitable means (e.g., by means of firmware).
[0069] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0070] The program code used to implement the methods of the present invention can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0071] In the context of this invention, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0072] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A ontology modeling method for rail transit, characterized in that, The method includes: Candidate ontology elements are generated from rail transit documents by leveraging the semantic extraction capabilities of the Large Language Model (LLM). The candidate ontology elements output by LLM are classified, normalized and verified by modeling rules in the rail transit field, and the misjudged candidate semantic units are corrected to the correct level, forming a five-element semantic ontology covering entities, attributes, relationships, actions and constraints. The references between the five-element semantic ontology are validated, and mapping relationships are established with nodes, edges, attributes and process nodes in the underlying graph database to generate queryable and verifiable structured semantic assets.
2. The ontology modeling method for rail transit according to claim 1, characterized in that, The method specifically includes the following steps: Step S1: Receive scenario process documents, system function descriptions, and condition rule texts from the rail transit field, and segment them into semantic fragments; Step S2: Call the Large Language Model (LLM) to extract candidate items from the semantic fragments. The candidate items include candidate entities, candidate attributes, candidate relations, candidate actions, and candidate constraints, while retaining the source text. Step S3: Perform entity classification, inheritance verification, synonym normalization, state attribution determination and inter-layer boundary determination on the candidate items, and output the converged candidate set of entities, attributes, relations, actions and constraints. Step S4: Generate entity attribute layer, including generating rail transit entity category, identification attribute and current status attribute, and write process status into scene record and write historical event facts into event object; Step S5: Generate a relation layer, including stability judgment of candidate relations, predicate unification and direction unification, to form stable structural relations and scene context relations; Step S6: Generate the action layer, including identifying executable actions and compiling the action effects into creating objects, setting properties, and creating relationships; Step S7, generate a constraint layer, including dividing the rule candidates into action admission constraints, state invariants, triggering rules and derived rules, and binding the inspection timing and related actions; Step S8: Perform ontology graph mapping, including mapping entities, attributes, relationships and scene records into graph structures, and mapping actions and constraints into callable rule metadata; Step S9: Perform scene context binding, including automatically binding the required objects for constraint checks along the relationship path with the scene record as the root node; Step S10: Generate an executable graph query template, including compiling the constraint expression into a read-only graph query template and generating structured return fields; Step S11: Perform cross-layer reference verification, including verifying the entity references, attribute attribution, relationship paths, bidirectional mapping of action constraints, and template executability of action effects, constraint expressions, and query templates; migrate and correct identifiable error levels, and model gaps in unresolved reference outputs. Step S12: Output ontology assets, including outputting the five-element semantic ontology, graph mapping relationships, action definitions, constraint definitions, and rule query templates.
3. The ontology modeling method for rail transit according to claim 2, characterized in that, Step S2 specifically involves: Step S2.1: Input each semantic fragment and its scene context into the LLM; Step S2.2, the LLM outputs candidate items, wherein the candidate items include candidate entities, candidate attributes, candidate relationships, candidate actions, and candidate constraints; Step S2.3: For each candidate, record the source sentence, candidate type, semantic explanation, and upstream and downstream references; Step S2.4: Mark the candidate items as pending domain rule verification status.
4. The ontology modeling method for rail transit according to claim 3, characterized in that, Step S3 specifically involves: Step S3.1: Perform top-level type determination on the candidate entities and classify them into physical objects, system objects, spatial objects, information objects, events, participants, or scene records; Step S3.2: Perform strict Is-a validation on the candidate parent-child class relationship. If the inheritance conditions are not met, convert it into a relationship candidate or attribute candidate. Step S3.3: Perform an attribution determination on the candidate attributes or states to determine whether they belong to the current state of a long-term object, the state of a scene recording process, or a historical event fact that should be carried by an event object. Step S3.4: Perform synonym unification on the candidate terms, merging rail transit terms with the same or similar meanings into a single defined concept; Step S3.5: Output the converged candidate set of entities, attributes, relations, actions, and constraints.
5. The ontology modeling method for rail transit according to claim 2, characterized in that, Step S5 specifically involves: Step S5.1: Perform a stability judgment on the candidate predicates to determine whether they represent long-term structural relationships, scene context relationships, short-term actions, or rule conditions. Step S5.2: Retain long-term structural relationships and scene context relationships in the relationship layer; Step S5.3: Transfer the short-term state changes of sending, opening, braking, and reporting to the action layer; Step S5.4: Move the rule conditions of "when...", "must be satisfied" and "must not" to the constraint layer; Step S5.5: Perform predicate normalization and direction unification on the preserved relations, and output the canonical relation template.
6. The ontology modeling method for rail transit according to claim 2, characterized in that, Step S6 specifically involves: Step S6.1: Determine whether the candidate action has a clear executing subject, execution goal, and direct effect; Step S6.2: Classify actions into control type, status access type, notification type, or system trigger type; Step S6.3: Compile the action effect into creating an object, setting properties, and creating relationships; Step S6.4: Perform reference validation on the objects, properties, and relationships in the action effect; Step S6.5: Derive the action influence domain based on the modified attributes and relationships of the action, which will be used for subsequent constraint matching.
7. The ontology modeling method for rail transit according to claim 2, characterized in that, Step S7 specifically involves: Step S7.1: Identify conditional statements, prohibition statements, trigger statements, and result determination statements from the candidate rules; Step S7.2: Divide the rules into action admission constraints, state invariants, triggering rules, and derived rules; Step S7.3: Bind the action admission constraint to BeforeAction, bind the state invariant to OnWrite or AfterAction, and bind the trigger rule to OnEvent or Periodic; Step S7.4 involves constraining and recording related actions, attention attributes, scope of objects, and business responses; Step S7.5: Output constraint definitions that can be used for runtime scheduling.
8. The ontology modeling method for rail transit according to claim 2, characterized in that, Step S8 specifically involves: Step S8.1: Map entity types and their instances to graph nodes; Step S8.2: Map entity attributes, identifier attributes, and status attributes to node attributes; Step S8.3: Map the semantic relations in the relation layer to graph edges; Step S8.4: Map the scene record to process nodes, and connect the target object, participate in the system, use resources, and trigger events through edges; Step S8.5: Treat actions and constraints as rule metadata and establish reference relationships with their related entities, scene records and inspection templates.
9. The ontology modeling method for rail transit according to claim 2, characterized in that, Step S9 specifically involves: Step S9.1: Extract entity variables and attribute variables from the constraint expression; Step S9.2: Using scene records and action targets as anchor points, search for candidate objects along relational paths in the graph structure; Step S9.3: When there is only one candidate object, it is automatically bound; when there are multiple candidate objects, they are sorted according to path length, semantic matching degree of relationship, and scenario consistency.
10. The ontology modeling method for rail transit according to claim 2, characterized in that, Step S10 specifically involves: Step S10.1: Decompose the constraint expression into entity variables, relational paths, rule judgment conditions, and return fields; Step S10.2: Generate graph node matching based on entity variables, generate edge connections based on relational paths, and generate WHERE conditions based on rule judgment conditions; Step S10.3 generates a read-only graph query template, returning constraint identifiers, scene records, key objects, key attributes, and violation or triggering reasons.
11. A ontology modeling system for rail transit, characterized in that, The system includes a document access and semantic segmentation module (101), an LLM candidate semantic extraction module (102), a rail transit domain type constraint module (103), an entity attribute hierarchical generation module (104), a relation semantic normalization and disambiguation module (105), an action effect structured compilation module (106), a constraint type identification and check timing binding module (107), an ontology graph mapping module (108), a scene context binding module (109), an executable graph query template compilation module (110), a cross-layer reference verification module (111), and an ontology asset output and service interface module (112). The document access and semantic segmentation module (101), the LLM candidate semantic extraction module (102), and the rail transit domain type constraint module (103) are connected in sequence; the rail transit domain type constraint module (103) is connected to the entity attribute hierarchical generation module (104), the relation semantic normalization and disambiguation module (105), the action effect structured compilation module (106), and the constraint type identification and inspection timing binding module (107), respectively. The entity attribute hierarchical generation module (104) and the relation semantic normalization and disambiguation module (105) are respectively connected to the ontology graph mapping module (108), and the action effect structured compilation module (106) and the constraint type identification and inspection timing binding module (107) are respectively connected to the executable graph query template compilation module (110). The ontology graph mapping module (108), scene context binding module (109), executable graph query template compilation module (110), cross-layer reference verification module (111), and ontology asset output and service interface module (112) are connected in sequence.
12. The ontology modeling system for rail transit according to claim 11, characterized in that, The document access and semantic segmentation module (101) is used to receive scenario process documents, system function descriptions and conditional rule texts, and segment them into semantic fragments; The LLM candidate semantic extraction module (102) is used to call the large language model to extract candidate entities, candidate attributes, candidate relations, candidate actions and candidate constraints from semantic fragments, and record the source text, context and initial interpretation of each candidate. The rail transit domain type constraint module (103) is used to determine the domain type of LLM candidate outputs, including top-level entity classification, inheritance relationship verification, synonym normalization, state attribution determination and inter-layer boundary determination; The entity attribute layer generation module (104) is used to generate rail transit entities and attribute layers, including entity category, parent-child relationship, identification attribute, current state attribute, scene record attribute and event attribute; The relation semantic normalization and disambiguation module (105) is used to determine the stability of candidate relations, normalize predicates and unify directions, and transfer short-term behavior to the action layer and rule conditions to the constraint layer. The action effect structured compilation module (106) is used to identify executable actions and compile action effects into a standardized set of operations; The constraint type identification and check timing binding module (107) is used to divide the rule candidates into action admission constraints, state invariants, trigger rules and derived rules, and bind the check timing of BeforeAction, OnWrite, OnEvent or Periodic; The ontology graph mapping module (108) is used to map the hierarchical ontology into a graph structure, so that entities and their instances correspond to nodes, attributes correspond to node attributes, relations correspond to edges, scene records correspond to process nodes, and actions and constraints correspond to callable rule metadata. The scene context binding module (109) is used to construct a scene context graph along the relational path with the scene record as the root node, and automatically bind the target objects, participating systems, resources used and spatial range required for constraint checks. The executable graph query template compilation module (110) is used to split the constraint expression into entity variables, relation paths, rule judgment conditions and return fields, and generate a read-only graph query template; The cross-layer reference verification module (111) is used to verify the references of action effects, constraint expressions and graph query templates to entities, attributes and relationships before the ontology assets are output; to verify attribute attribution, relationship paths, bidirectional mapping of action constraints and the executability of graph query templates; to perform migration correction for determinable inter-layer obfuscation; and to model gaps in the output of unresolved references. The ontology asset output and service interface module (112) is used to output the five-element semantic ontology, graph mapping relationship, action definition, constraint definition and query template.
13. The ontology modeling system for rail transit according to claim 11, characterized in that, The cross-layer reference verification module (111) has a feedback correction function and establishes verification feedback connections with the rail transit domain type constraint module (103), entity attribute hierarchical generation module (104), relation semantic normalization and disambiguation module (105), action effect structured compilation module (106), constraint type identification and inspection timing binding module (107) and executable graph query template compilation module (110), respectively.
14. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 10.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Subway operation accident knowledge graph construction method, system, terminal and storage medium
CN121189452B
Rail transit maintenance knowledge graph construction method, terminal equipment and medium
CN121257671A
Urban rail train operation fault knowledge graph construction method based on few-sample prompt
CN121681842A
