Closed will23332 closed 10 months ago
π€
Hello @will23332,
Nice to meet you! I'm Dosu, an AI bot here to help you solve bugs, answer questions, and guide you in contributing to the LangChain repository. While we wait for a human maintainer, feel free to use me as a resource. I'm currently looking at the issue you've posted and will provide a full answer shortly.
π€
Based on the traceback you provided, it seems like the issue is related to the serialization format used when initializing the RdfGraph
class. In your code, the default serialization format is set to "ttl" (Turtle), which might not be compatible with the .owl file format.
To resolve this issue, you should specify the correct serialization format when initializing the RdfGraph
class. The .owl files are usually serialized in RDF/XML format, so you should try setting the serialization parameter to "xml" during the initialization. Here is how you can do it:
graph = RdfGraph(
source_file="pizza.owl",
serialization="xml",
standard="owl"
)
This will instruct the rdflib library to parse the source file as an RDF/XML document, which should be compatible with the .owl file format. If the pizza.owl file is serialized in a different format, you should adjust the serialization parameter accordingly.
If the issue persists, it might be due to the content of the pizza.owl file itself. In that case, you would need to check if the file is correctly formatted and doesn't contain any syntax errors.
Additionally, I found a similar issue in the LangChain repository: langchain.graph RDFGraph does not read OWL . The solution provided there was to modify the load_schema
method of the RdfGraph
class to use the correct queries (op_query_owl
and dp_query_owl
) to fetch object properties and data properties, respectively, when the standard is set to "owl". You might want to check if this solution applies to your case as well.
I hope this helps! If you have any further questions or if the issue persists, please provide more details so I can assist you better.
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a π if this is helpful and π if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
Yes, that was the problem, I can confirm it works fine now!
System Info
Langchain version: 0.0.332 Python version: 3.11.5
Who can help?
@hwchase17
When loading a local .owl file (the standard example pizza.owl) the operation breaks and gives the following error for all the URI: does not look like a valid URI, trying to serialize this will break.
Here's the traceback
Information
Related Components
Reproduction
Steps to reproduce the behaviour:
graph = RdfGraph( source_file="pizza.owl", standard="owl" )
graph.load_schema()
print(graph.get_schema)