From b2e4b9dca4cd493ef6fec45151f6d2bfc0d9a038 Mon Sep 17 00:00:00 2001 From: Caitlin2694 <21324675@student.uwa.edu.au> Date: Fri, 28 Jul 2023 07:51:32 +0800 Subject: [PATCH] Fix exception caused by restrictions in OWL (#8341) Description: Fix exception caused by restrictions in OWL Issue: #8331 Dependencies: none Maintainer: @baskaryan --- libs/langchain/langchain/graphs/rdf_graph.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/langchain/langchain/graphs/rdf_graph.py b/libs/langchain/langchain/graphs/rdf_graph.py index 5025137147..342d4dfc80 100644 --- a/libs/langchain/langchain/graphs/rdf_graph.py +++ b/libs/langchain/langchain/graphs/rdf_graph.py @@ -32,7 +32,14 @@ cls_query_rdfs = prefixes["rdfs"] + ( """}""" ) -cls_query_owl = cls_query_rdfs +cls_query_owl = prefixes["rdfs"] + ( + """SELECT DISTINCT ?cls ?com\n""" + """WHERE { \n""" + """ ?instance a/rdfs:subClassOf* ?cls . \n""" + """ FILTER (isIRI(?cls)) . \n""" + """ OPTIONAL { ?cls rdfs:comment ?com } \n""" + """}""" +) rel_query_rdf = prefixes["rdfs"] + ( """SELECT DISTINCT ?rel ?com\n"""