A natural language query method and system based on spatiotemporal knowledge cube
By building a spatiotemporal knowledge cube and virtual knowledge graph, combined with a large language model, the shortcomings of the existing technology in spatiotemporal data query accuracy and multi-source data integration are solved, and intelligent integration and friendly interactive methods of multi-dimensional data in the field of geo observation are realized. Query simplifies user operations and improves query accuracy.
Patent Information
- Application Number
- CN202411240362.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-09-05
AI Technical Summary
The existing virtual knowledge graphs, Text2SQL and large language models have insufficient accuracy when processing complex spatiotemporal data queries, and the integration and processing effects of multi-source heterogeneous data need to be improved, making it difficult to achieve intelligent integration of multidimensional data in the field of geographic observation. and friendly interactive query.
By building a spatiotemporal knowledge cube, the intermediate ontology layer is introduced to extend data relationships in semantics, and combined with a large language model to process spatiotemporal data, realizing natural language query of multi-source spatiotemporal data, lowering the threshold for user query. The specific steps include building a spatiotemporal data cube based on the relational data table, building a virtual knowledge graph, and using a large language model to convert natural language query into GeoSPARQL query statements.
It realizes accurate query and analysis of multi-dimensional spatiotemporal data, simplifies user operations, improves the integration and processing capabilities of multi-source data, and reduces users' dependence on database query language.
Smart Images

Figure CN118760698B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of information technology, and in particular to the field of large-model natural language processing, intelligent data mining and analysis technology, and specifically to a natural language query method and system based on spatiotemporal knowledge cube. Background Art
[0002] In recent years, spatiotemporal data cubes have gradually become a popular data integration solution in the field of earth observation. This data structure can effectively organize, store and manage data with time and space dimensions, thereby supporting complex spatiotemporal data query and analysis. However, earth observation data comes from various sources, including different sensors, satellites, drones and ground observation stations; the data structure is complex, and each source may use different data formats, resolutions and measurement standards, making data integration and unified processing complicated; in addition, users need a lot of database technology and professional background knowledge to query existing database systems, and the interactivity is poor.
[0003] Virtual knowledge graph is a method to create knowledge graph using existing data sources without physically copying the data to a central warehouse. It allows users to directly query raw data sources distributed in different locations and formats, such as relational databases, CSV files, and web services, through the graph query interface. Text2SQL is a natural language processing (NLP) technology that can convert natural language queries into SQL query statements, so that users who have no knowledge of database query language can also make database query requests through natural language, making database queries more intuitive and easy. The large language model (LLM) is a deep learning model trained on massive text data. It can not only generate natural language text, but also deeply understand the meaning of the text and handle various natural language tasks. Prompt engineering is used to develop and optimize prompt words (Prompt), helping users to effectively use large language models in various application scenarios and research fields.
[0004] Although existing technologies such as virtual knowledge graphs, Text2SQL, and large language models have solved the problems of data integration and query to a certain extent, they still have some shortcomings. First, although virtual knowledge graphs can query data distributed in different locations, they do not provide sufficient query support for complex spatiotemporal data. Secondly, although Text2SQL makes natural language queries more intuitive, its accuracy still needs to be improved when processing complex spatiotemporal data queries. Large language models have powerful natural language processing capabilities. Although prompt engineering can optimize the application of large language models, its effect depends on the design of prompt words. When faced with the integration and processing of multi-source heterogeneous data, its performance still needs to be improved. Therefore, it is urgent to find a solution to achieve intelligent integration and friendly interactive query of multi-dimensional data in the field of earth observation. Summary of the invention
[0005] In view of the deficiencies of the prior art, the present invention provides a natural language query solution based on spatiotemporal knowledge cube, which is used to describe and analyze data in different time and space dimensions, and enhance the meaning and relevance of data through semantic extension. By using virtual knowledge graph, an intermediate ontology layer is introduced to enrich the semantic relationship between data, construct spatiotemporal knowledge cube, and then use large language model to process complex data query in spatiotemporal knowledge cube, so as to realize natural language query of multi-source spatiotemporal data and lower the user query threshold.
[0006] In order to achieve the above object, the present invention provides a natural language query method based on spatiotemporal knowledge cube, comprising the following steps:
[0007] Step 1, constructing a spatiotemporal data cube based on the relational data table;
[0008] Step 2: Based on the spatiotemporal data cube, a virtual knowledge graph describing the spatiotemporal knowledge cube is constructed;
[0009] Step 2.1, construct domain ontology based on relational data tables;
[0010] Step 2.2, express the ontology structure in the form of triples;
[0011] Step 2.3, according to the table name, field and foreign key of the relational data table of the spatiotemporal data cube, refer to the OGC standard GeoSPARQL, define the ontology concepts, relations and attributes of the spatiotemporal knowledge cube, and form an RDF graph;
[0012] Step 2.4, construct a mapping model based on the RDF graph, map the data in the relational data table to the concepts and attributes defined in the ontology of the spatiotemporal knowledge cube, and express it using the W3C standard R2RML;
[0013] Step 2.5, using the ontology structure of the spatiotemporal knowledge cube represented in the triple form in step 2.2 and the mapping model constructed according to the RDF graph in step 2.4 as the virtual knowledge graph of the spatiotemporal knowledge cube;
[0014] Step 3: Based on the spatiotemporal knowledge cube, use the large language model to perform natural language data query;
[0015] Step 3.1, use the large language model to perform entity recognition on the natural language input by the user, and parse out the required GeoSPARQL field information and calculation information;
[0016] Step 3.2: Use the domain ontology in the spatiotemporal knowledge cube to assemble the prompt engineering required by the large language model;
[0017] Step 3.3, based on the large language model, the natural language query is converted into a corresponding GeoSPARQL query statement using the selected hint engineering;
[0018] Step 3.4: execute the GeoSPARQL query statement in the OBDA system to obtain data results.
[0019] Furthermore, in step 1, the spatiotemporal data cube is represented by a relational data table, including a product dimension table, a time dimension table, a space dimension table, a raster fact table, and a vector fact table. The product dimension table contains 3 columns, the first column is the product ID, the second column is the product name, and the third column is the product type. The time dimension table contains 3 columns, the first column is the time ID, the second column is the observation time, and the third column is the update time. The space dimension table contains 4 columns, the first column is the space ID, the second column is the place name, the third column is the four-to-range, and the fourth column is the precise range. The raster fact table contains 5 columns, the first column is the raster fact ID, the second column is the product ID, the third column is the time ID, the fourth column is the space ID, and the fifth column is the raster data address. The vector fact table contains 5 columns, the first column is the vector fact ID, the second column is the product ID, the third column is the time ID, the fourth column is the space ID, and the fifth column is the vector data address.
[0020] The raster fact table and the vector fact table are associated with the product dimension table, the time dimension table, and the space dimension table. The product ID is the primary key of the product dimension table and is a foreign key to the product ID in the raster fact table and the vector fact table. The time ID is the primary key of the time dimension table and is a foreign key to the time ID in the raster fact table and the vector fact table. The space ID is the primary key of the space dimension table and is a foreign key to the space ID in the raster fact table and the vector fact table.
[0021] Furthermore, the core concepts of the domain ontology in step 2.1 include "time", "space", "measurement" and "dimension", among which "time" and "space" constitute the basic dimensions of spatiotemporal data, "measurement" refers to the numerical value obtained by observation or calculation at a specific time and space point, and "dimension" is not limited to time and space, but can also be extended to other analysis dimensions.
[0022] Furthermore, in the triple (O, C, R, P) in step 2.2, O represents the ontology, C represents the ontology concept, R represents the ontology relationship, and P represents the ontology attribute.
[0023] Furthermore, in step 3.1, the natural language understanding capability of the large language model is utilized to extract important information elements in the user's query intent, including entity names, attributes, and relationships between entities. Based on the extracted important information elements, an intermediate representation is constructed to extract the relationships and attributes between entities and specific grammatical elements required for GeoSPARQL queries.
[0024] Furthermore, in step 3.2, based on the ontological concepts and relationships in the spatiotemporal knowledge cube defined in step 2.3, prompt information suitable for the large language model is designed and organized, and the predictive ability of the large language model is used to integrate the designed prompt information into the input of the large language model to form a complete prompt project.
[0025] Furthermore, in step 3.4, the virtual knowledge graph is connected to the ontology database query OBDA system through the API, and the GeoSPARQL query statement is used to perform data query.
[0026] The present invention also provides a natural language query system based on spatiotemporal knowledge cube, which is used to implement the natural language query method based on spatiotemporal knowledge cube as described above.
[0027] Furthermore, it includes a processor and a memory, wherein the memory is used to store program instructions, and the processor is used to call the stored instructions in the memory to execute the natural language query method based on the spatiotemporal knowledge cube as described above.
[0028] Alternatively, it includes a readable storage medium having a computer program stored thereon, and when the computer program is executed, the natural language query method based on the spatiotemporal knowledge cube as described above is implemented.
[0029] Compared with the prior art, the present invention has the following advantages:
[0030] 1) Simplify query operations: The present invention uses natural language processing technology and a large language model, so that users do not need to master complex database query languages, and can query spatiotemporal data using natural language.
[0031] 2) Multi-source data integration: Based on the data organization form of spatiotemporal data cube, it can effectively organize, store and manage data with time and space dimensions, and use virtual knowledge graph technology to effectively integrate multi-source heterogeneous data.
[0032] 3) Intelligent data query: By utilizing ontology hints and large language models, natural language queries input by users can be accurately parsed and converted into corresponding structured query (GeoSPARQL) statements, enabling accurate query and analysis of multidimensional data. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0034] Figure 1 It is a flow chart of a natural language query method based on spatiotemporal knowledge cube according to an embodiment of the present invention.
[0035] Figure 2 It is a schematic diagram of the ontology relationship of the spatiotemporal knowledge cube defined in the embodiment of the present invention.
[0036] Figure 3 It is an RDF graph of an embodiment of the present invention. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in combination with the drawings and embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0038] Example 1
[0039] like Figure 1 As shown, the embodiment of the present invention provides a natural language query method based on spatiotemporal knowledge cube, comprising the following steps:
[0040] Step 1: Build a spatiotemporal data cube based on the relational data table.
[0041] The spatiotemporal data cube is represented by relational data tables, including product dimension table, time dimension table, space dimension table, raster fact table and vector fact table. The product dimension table contains 3 columns, the first column is product ID, the second column is product name, and the third column is product type. The time dimension table contains 3 columns, the first column is time ID, the second column is observation time, and the third column is update time. The space dimension table contains 4 columns, the first column is space ID, the second column is place name, the third column is four-to-range, and the fourth column is precise range. The raster fact table contains 5 columns, the first column is raster fact ID, the second column is product ID, the third column is time ID, the fourth column is space ID, and the fifth column is raster data address. The vector fact table contains 5 columns, the first column is vector fact ID, the second column is product ID, the third column is time ID, the fourth column is space ID, and the fifth column is vector data address.
[0042] The raster fact table and the vector fact table are associated with the product dimension table, the time dimension table, and the space dimension table. The product ID is the primary key of the product dimension table and is a foreign key to the product ID in the raster fact table and the vector fact table. The time ID is the primary key of the time dimension table and is a foreign key to the time ID in the raster fact table and the vector fact table. The space ID is the primary key of the space dimension table and is a foreign key to the space ID in the raster fact table and the vector fact table.
[0043] The structures of the above five data tables can be implemented in a variety of relational database management systems, such as OracleSpatial database, PostgreSQL database, etc. Taking the PostgreSQL database mode as an example, the table information is as follows:
[0044] Table 1 Metadata table of spatiotemporal data cube
[0045]
[0046] Step 2: Based on the spatiotemporal data cube, construct a virtual knowledge graph that describes the spatiotemporal knowledge cube.
[0047] Step 2.1, build the domain ontology based on the relational data table in step 1.
[0048] The core concepts of domain ontology include "time", "space", "measurement" and "dimension". Among them, "time" and "space" constitute the basic dimensions of spatiotemporal data, "measurement" refers to the value obtained by observation or calculation at a specific time and space point, and "dimension" is not limited to time and space, but can also be extended to other analysis dimensions.
[0049] Step 2.2, express the ontology structure in the form of triples.
[0050] In the triple (O, C, R, P), O represents the ontology, C represents the ontology concept, R represents the ontology relationship, and P represents the ontology attribute.
[0051] An example of building a domain ontology based on the relational data table in step 1 is as follows:
[0052] <http: / / www.semanticweb.org / geocube / ontologies / spatial-temporal-cube#Product> rdf:type owl:Class .
[0053] <http: / / www.semanticweb.org / geocube / ontologies / spatial-temporal-cube#Productname>rdf:type owl:DatatypeProperty ;
[0054] rdfs:domain :Product;
[0055] rdfs:range xsd:string .
[0056] <http: / / www.semanticweb.org / geocube / ontologies / spatial-temporal-cube#Productname>rdf:type owl:DatatypeProperty ;
[0057] rdfs:domain :Product;
[0058] rdfs:range xsd:string .
[0059] <http: / / www.semanticweb.org / geocube / ontologies / spatial-temporal-cube#Observation>rdf:type owl:DatatypeProperty ;
[0060] rdfs:domain :Product ;
[0061] rdfs:range xsd:dateTime .
[0062] <http: / / www.semanticweb.org / geocube / ontologies / spatial-temporal-cube#Raster>rdf:type owl:Class .
[0063] <http: / / www.semanticweb.org / geocube / ontologies / spatial-temporal-cube#belongsToProduct>rdf:type owl:ObjectProperty;
[0064] rdfs:domain : Raster;
[0065] rdfs:range :Product .
[0066] Ontology <http: / / www.semanticweb.org / geocube / ontologies / spatial-temporal-cube#
[0067] Product>rdf:type owl:Class . For example, the ontology O is http: / / www.semanticweb.org / geocube /
[0068] ontologies / spatial-temporal-cube#Product, the ontology relationship concept C is Product, the ontology relationship R is rdf:type, the ontology attribute is owl:Class, and the entire ontology means that Product is a class (Class).
[0069] Step 2.3, according to the table name, fields and foreign keys of the relational data table of the spatiotemporal data cube, refer to the OGC standard (Open Geospatial Consortium) GeoSPARQLA (Geographic Query Language for RDF Data), define the ontology concepts, relationships and attributes of the spatiotemporal knowledge cube, and form an RDF graph (Resource Description Framework).
[0070] This embodiment defines the ontology relationship of the spatiotemporal knowledge cube according to the table name, field and foreign key of the relational data table of the spatiotemporal data cube and with reference to the OGC standard GeoSPARQL. Figure 2 As shown, the established RDF graph is as follows Figure 3 shown.
[0071] Step 2.4, build a mapping model based on the RDF graph, map the data in the relational data table to the concepts and attributes defined in the ontology of the spatiotemporal knowledge cube, and express it using the W3C standard (World Wide Web Consortium) R2RML (RDB to RDF Mapping Language).
[0072] The following is an example of building a mapping based on an RDF graph and expressing it using the W3C standard R2RML:
[0073] @prefix rr:<http: / / www.w3.org / ns / r2rml#>.
[0074] @prefix rml:<http: / / semweb.mmlab.be / ns / rml#>.
[0075] @prefix ql:<http: / / semweb.mmlab.be / ns / ql#>.
[0076] @prefix xsd:<http: / / www.w3.org / 2001 / XMLSchema#>.
[0077] @prefix stc:<http: / / www.semanticweb.org / geocube / ontologies / spatial -temporal -cube #>.
[0078] @prefix geo:<http: / / www.opengis.net / ont / geosparql#>.
[0079] <#RasterMapping>
[0080] rr:logicalTable [
[0081] rr:sqlQuery """
[0082] SELECT r.id AS id_rs, p.id AS id_pr, ST_AsText(s.geom) AS geom
[0083] FROM "Raster" r, "Spatial" s, "Product" p
[0084] WHERE r.spatial_key = s.key
[0085] AND r.product_key = p.key
[0086] """ ] ;
[0088] rr:subjectMap [
[0089] rr:template "http: / / www.semanticweb.org / geocube / ontologies / spatial-temporal-cube / raster-{id_rs}" ;
[0090] rr:class :Raster ] ;
[0092] rr:predicateObjectMap [
[0093] rr:predicate :belongsToProduct ;
[0094] rr:objectMap [
[0095] rr:template
[0096] "http: / / www.semanticweb.org / geocube / ontologies / spatial-temporal-cube / product-{id_pr}" ; ] ] ;
[0099] rr:predicateObjectMap [
[0100] rr:predicate geo:hasGeometry ;
[0101] rr:objectMap [
[0102] rr:template
[0103] "http: / / www.semanticweb.org / geocube / ontologies / spatial-temporal-cube / geom-{id_rs}" ; ] ] .
[0106] <#GeometryMapping>
[0107] rr:logicalTable [
[0108] rr:sqlQuery """
[0109] SELECT r.id AS id_rs, ST_AsText(s.geom) AS geom
[0110] FROM "Raster" r, "Spatial" s
[0111] WHERE r.spatial_key = s.key
[0112] """ ] ;
[0114] rr:subjectMap [
[0115] rr:template "http: / / www.semanticweb.org / geocube / ontologies / spatial-temporal-cube / geom-{id_rs}" ;
[0116] rr:class geo:Geometry ] ;
[0118] rr:predicateObjectMap [
[0119] rr:predicate geo:asWKT ;
[0120] rr:objectMap [
[0121] rr:column "geom" ;
[0122] rr:datatype geo:wktLiteral ] ] .
[0125] In step 2.5, the ontology structure of the spatiotemporal knowledge cube expressed in triple form in step 2.2 and the mapping model constructed according to the RDF graph in step 2.4 are used as the virtual knowledge graph of the spatiotemporal knowledge cube.
[0126] Step 3: Based on the spatiotemporal knowledge cube, use the large language model to perform natural language data query.
[0127] Step 3.1: Use the large language model to perform entity recognition on the natural language input by the user and parse out the required GeoSPARQL field information and calculation information.
[0128] By leveraging the natural language understanding capabilities of the large language model, we extract important information elements in the user's query intent, including entity names, attributes, and relationships between entities. Based on the extracted important information elements, we build an intermediate representation to extract GeoSPARQL field information (relationships and attributes between entities) and calculation information (specific grammatical elements required for GeoSPARQL queries).
[0129] Step 3.2, use the domain ontology in the spatiotemporal knowledge cube to piece together the prompt engineering required by the large language model.
[0130] According to the ontological concepts and relationships in the spatiotemporal knowledge cube defined in step 2.3, design and organize prompt information suitable for the large language model. Using the predictive ability of the large language model, integrate the designed prompt information into the input of the large language model to form a complete prompt project.
[0131] Step 3.3, based on the large language model, the selected hint engineering is used to convert the natural language query into the corresponding GeoSPARQL query statement.
[0132] Step 3.4: execute the GeoSPARQL query statement in the OBDA (ontology-based data access) system to obtain data results.
[0133] The virtual knowledge graph is connected to the OBDA system through API, and GeoSPARQL statements are used to query data.
[0134] Taking the natural language input by the user "How many raster images are there in Wuhan?" as an example, the important information elements involved in the natural language query statement are parsed in turn according to the rules:
[0135] (1) Query fields (SELECT): All fields ( ), precise range (geom)
[0136] (2) Tables involved (WHERE): Raster, Spatial, Product
[0137] (3) FILTER: st_intersects
[0138] The SPARQL field information is "Raster", and the calculation information is "SELECT", "WHERE", "FILTER", and "COUNT".
[0139] The above information is spliced into a prompt project, and the prompt project is as follows:
[0140] "Now this is a text2sparql task. Please convert the user question into a GeoSPARQL query statement based on the following ontology information. The ontology is: {RDF ontology}, and the question is: {natural language question}."
[0141] According to the above tips, we use the large language model technology to generate GeoSPARQL query statements. The resulting GeoSPARQL is as follows:
[0142] PREFIX geo:<http: / / www.opengis.net / ont / geosparql#>
[0143] PREFIX geof:<http: / / www.opengis.net / def / function / geosparql / >
[0144] PREFIX stc: <http: / / www.semanticweb.org / geocube / ontologies / spatial-temporal
[0145] -cube#>
[0146] SELECT (COUNT(?image) AS ?imageCount)
[0147] WHERE {
[0148] ?image a stc:Raster;
[0149] geo:hasGeometry ? image_geom.
[0150] ?image_geom geo:asWKT ?image_wkt.
[0151] ?wuhan_region a geo:Geometry;
[0152] geo:asWKT ?region_wkt. #wuhan_region is a geographic entity generated by the large language model that represents the geographical scope of Wuhan City
[0153] FILTER(geof:sfIntersects(?image_wkt, ?region_wkt))
[0154] }
[0155] In the OBDA system, execute this GeoSPARQL query statement to obtain the data required by the end user: The total number of raster data in Wuhan is 126
[0156] Example 2
[0157] Based on the same inventive concept, the present invention also provides a natural language query system based on spatiotemporal knowledge cube, including a processor and a memory, the memory is used to store program instructions, and the processor is used to call the program instructions in the memory to execute a natural language query method based on spatiotemporal knowledge cube as described above.
[0158] Example 3
[0159] Based on the same inventive concept, the present invention also provides a natural language query system based on spatiotemporal knowledge cube, including a readable storage medium, on which a computer program is stored. When the computer program is executed, a natural language query method based on spatiotemporal knowledge cube as described above is implemented.
[0160] In specific implementation, the method proposed in the technical solution of the present invention can be implemented by technical personnel in this field using computer software technology to realize automatic operation process. System devices for implementing the method, such as computer-readable storage media storing the corresponding computer program of the technical solution of the present invention and computer equipment running the corresponding computer program, should also be within the scope of protection of the present invention.
[0161] The specific embodiments described herein are merely examples of the spirit of the present invention. Those skilled in the art may make various modifications or additions to the specific implementation cases described, or replace them with similar methods, without departing from the spirit of the present invention or exceeding the scope defined by the appended claims.
Claims
1. A natural language query method based on spatiotemporal knowledge cube, characterized in that: The following steps are involved: Step 1, constructing a spatiotemporal data cube based on the relational data table; The spatiotemporal data cube is represented by relational data tables, including product dimension table, time dimension table, space dimension table, raster fact table and vector fact table; The product dimension table contains 3 columns, the first column is the product ID, the second column is the product name, and the third column is the product type; the time dimension table contains 3 columns, the first column is the time ID, the second column is the observation time, and the third column is the update time; The spatial dimension table contains 4 columns, the first column is the spatial ID, the second column is the place name, the third column is the four-dimensional range, and the fourth column is the precise range; the raster fact table contains 5 columns, the first column is the raster fact ID, the second column is the product ID, the third column is the time ID, the fourth column is the spatial ID, and the fifth column is the raster data address; The vector fact table contains 5 columns, the first column is the vector fact ID, the second column is the product ID, the third column is the time ID, the fourth column is the space ID, and the fifth column is the vector data address; Step 2: Based on the spatiotemporal data cube, a virtual knowledge graph describing the spatiotemporal knowledge cube is constructed; Step 2.1, construct domain ontology based on relational data tables; Step 2.2, express the ontology structure in the form of triples; In the triple (O, C, R, P), O represents the ontology, C represents the ontology concept, R represents the ontology relationship, and P represents the ontology attribute; Step 2.3, according to the table name, field and foreign key of the relational data table of the spatiotemporal data cube, refer to the OGC standard GeoSPARQL, define the ontology concepts, relations and attributes of the spatiotemporal knowledge cube, and form an RDF graph; Step 2.4, construct a mapping model based on the RDF graph, map the data in the relational data table to the concepts and attributes defined in the ontology of the spatiotemporal knowledge cube, and express it using the W3C standard R2RML; Step 2.5, using the ontology structure of the spatiotemporal knowledge cube represented in the triple form in step 2.2 and the mapping model constructed according to the RDF graph in step 2.4 as the virtual knowledge graph of the spatiotemporal knowledge cube; Step 3: Based on the spatiotemporal knowledge cube, use the large language model to perform natural language data query; Step 3.1, use the large language model to perform entity recognition on the natural language input by the user, and parse out the required GeoSPARQL field information and calculation information; Step 3.2: Use the domain ontology in the spatiotemporal knowledge cube to assemble the prompt engineering required by the large language model; Step 3.3, based on the large language model, the natural language query is converted into a corresponding GeoSPARQL query statement using the selected hint engineering; Step 3.4, execute the GeoSPARQL query statement in the OBDA system to obtain data results; The virtual knowledge graph is connected to the ontology database query OBDA system through API, and GeoSPARQL statements are used to query data.
2. A natural language query method based on spatiotemporal knowledge cube as claimed in claim 1, characterized in that: In step 1, the raster fact table and the vector fact table are associated with the product dimension table, the time dimension table, and the space dimension table. The product ID is the primary key of the product dimension table and is a foreign key to the product ID in the raster fact table and the vector fact table. The time ID is the primary key of the time dimension table and is a foreign key to the time ID in the raster fact table and the vector fact table. The space ID is the primary key of the space dimension table and is a foreign key to the space ID in the raster fact table and the vector fact table.
3. A natural language query method based on spatiotemporal knowledge cube as claimed in claim 1, characterized in that: The core concepts of the domain ontology in step 2.1 include "time", "space", "measurement" and "dimension". Among them, "time" and "space" constitute the basic dimensions of spatiotemporal data, "measurement" refers to the numerical value obtained by observation or calculation at a specific time and space point, and "dimension" is not limited to time and space, but can also be extended to other analysis dimensions.
4. A natural language query method based on spatiotemporal knowledge cube as claimed in claim 1, characterized in that: In step 3.1, the natural language understanding capability of the large language model is used to extract important information elements in the user's query intent, including entity names, attributes, and relationships between entities. Based on the extracted important information elements, an intermediate representation is constructed to extract the relationships and attributes between entities and the specific grammatical elements required for GeoSPARQL queries.
5. The natural language query method based on spatiotemporal knowledge cube according to claim 1, characterized in that: In step 3.2, based on the ontological concepts and relationships in the spatiotemporal knowledge cube defined in step 2.3, the prompt information suitable for the large language model is designed and organized. The predictive ability of the large language model is used to integrate the designed prompt information into the input of the large language model to form a complete prompt project.
6. A natural language query system based on spatiotemporal knowledge cube, characterized in that: It includes a processor and a memory, the memory is used to store program instructions, and the processor is used to call the program instructions in the memory to execute a natural language query method based on spatiotemporal knowledge cube as described in any one of claims 1-5.
7. A natural language query system based on spatiotemporal knowledge cube, characterized in that: It comprises a readable storage medium, on which a computer program is stored. When the computer program is executed, a natural language query method based on a spatiotemporal knowledge cube as described in any one of claims 1 to 5 is implemented.