Closed
Description
System Info
Langchain version: 0.0.332
Python version: 3.11.5
Who can help?
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
Traceback (most recent call last):
File ~\AppData\Roaming\Python\Python311\site-packages\IPython\core\interactiveshell.py:3526 in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
Cell In[13], line 4
graph = RdfGraph(
File C:\Python311\Lib\site-packages\langchain\graphs\rdf_graph.py:159 in __init__
self.graph.parse(source_file, format=self.serialization)
File C:\Python311\Lib\site-packages\rdflib\graph.py:1501 in parse
raise se
File C:\Python311\Lib\site-packages\rdflib\graph.py:1492 in parse
parser.parse(source, self, **args)
File C:\Python311\Lib\site-packages\rdflib\plugins\parsers\notation3.py:2021 in parse
p.loadStream(stream)
File C:\Python311\Lib\site-packages\rdflib\plugins\parsers\notation3.py:479 in loadStream
return self.loadBuf(stream.read()) # Not ideal
File C:\Python311\Lib\site-packages\rdflib\plugins\parsers\notation3.py:485 in loadBuf
self.feed(buf)
File C:\Python311\Lib\site-packages\rdflib\plugins\parsers\notation3.py:511 in feed
i = self.directiveOrStatement(s, j)
File C:\Python311\Lib\site-packages\rdflib\plugins\parsers\notation3.py:532 in directiveOrStatement
return self.checkDot(argstr, j)
File C:\Python311\Lib\site-packages\rdflib\plugins\parsers\notation3.py:1214 in checkDot
self.BadSyntax(argstr, j, "expected '.' or '}' or ']' at end of statement")
File C:\Python311\Lib\site-packages\rdflib\plugins\parsers\notation3.py:1730 in BadSyntax
raise BadSyntax(self._thisDoc, self.lines, argstr, i, msg)
File <string>
BadSyntax
Information
- The official example notebooks/scripts
- My own modified scripts
Related Components
- LLMs/Chat Models
- Embedding Models
- Prompts / Prompt Templates / Prompt Selectors
- Output Parsers
- Document Loaders
- Vector Stores / Retrievers
- Memory
- Agents / Agent Executors
- Tools / Toolkits
- Chains
- Callbacks/Tracing
- Async
Reproduction
Steps to reproduce the behaviour:
- Get the source file from : https://protege.stanford.edu/ontologies/pizza/pizza.owl and place it where the code runs
- Use the following code:
from langchain.chains import GraphSparqlQAChain
from langchain.graphs import RdfGraph
graph = RdfGraph(
source_file="pizza.owl",
standard="owl"
)
graph.load_schema()
print(graph.get_schema)
Expected behavior
For the graph to load and for graph.get_schema to show the classes and object properties.
Activity