Querying knowledge bases using ontologies is usually performed using dedicated query languages, question-answering systems, or visual query editors for Knowledge Graphs. We propose a novel approach that enables users to query the knowledge graph by specifying prototype graphs in natural language and visually editing them. This approach enables non-experts to formulate queries without prior knowledge of the ontology and specific query languages. Our approach converts natural language to these prototype graphs by utilizing a two-step constrained language model generation based on semantically similar features within an ontology. The resulting prototype graph serves as the building block for further user refinements within a dedicated visual query builder. Our approach consistently generates a valid SPARQL query within the constraints imposed by the ontology, without requiring any additional corrections to the syntax or classes and links used. Unlike related language models approaches, which often require multiple iterations to fix invalid syntax, non-existent classes, and non-existent links, our approach achieves this consistently. We evaluate the performance of our system using graph retrieval on synthetic queries, comparing multiple metrics, models, and ontologies. We further validate our system through a preliminary user study. By utilizing our constrained pipeline, we show that the system can perform efficient and accurate retrieval using more efficient models compared to other approaches.
翻译:基于本体的知识库查询通常通过专用查询语言、问答系统或知识图谱可视化查询编辑器实现。本文提出一种创新方法,允许用户通过自然语言描述原型图并对其进行可视化编辑来查询知识图谱。该方法使非专业用户无需预先掌握本体论知识或特定查询语言即可构建查询。我们的方法通过利用本体中语义相似特征的两阶段约束语言模型生成,将自然语言转换为原型图。生成的原型图可作为专用可视化查询构建器中用户进一步细化的基础模块。我们的方法始终能在本体约束下生成有效的SPARQL查询,无需对语法、类别或链接进行额外修正。相较于常需多次迭代修复无效语法、不存在类别及链接的相关语言模型方法,我们的方案能持续稳定实现这一目标。我们通过合成查询的图检索任务评估系统性能,对比多种指标、模型与本体,并借助初步用户研究进一步验证系统有效性。实验表明,采用约束生成流程的系统能使用更高效的模型实现比其他方法更精准高效的检索。