RDFLib / sparqlwrapper

A wrapper for a remote SPARQL endpoint
https://sparqlwrapper.readthedocs.io/
Other
513 stars 121 forks source link

Unable to query the rdf:type #231

Open Gautamshahi opened 9 months ago

Gautamshahi commented 9 months ago

I am trying to get the wordnet type for each yago entity but getting the error as

query looks like

q = """ SELECT ?object WHERE { http://yago-knowledge.org/resource/Jean-Baptiste-Joseph_Gobel rdf:type ?object } """

error=

self.BadSyntax(argstr, i, 'Prefix "%s:" not bound' % (pfx)) File "/Users/admin/PycharmProjects/Uni_Caen_GYREC/venv/lib/python3.7/site-packages/rdflib/plugins/parsers/notation3.py", line 1730, in BadSyntax raise BadSyntax(self._thisDoc, self.lines, argstr, i, msg) rdflib.plugins.parsers.notation3.BadSyntax: at line 1 of <>: Bad syntax (Prefix "rdf:" not bound) at ^ in: "b'<1908_St._Louis_Browns_season>\t'^b'rdf:type\t .\n<1908_St._Louis_B'..."

How to solve the issue?

roelj commented 8 months ago

Perhaps try to include the prefix for rdf:


q = """PREFIX rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?object
WHERE {
<http://yago-knowledge.org/resource/Jean-Baptiste-Joseph_Gobel> rdf:type ?object
}
"""
Gautamshahi commented 8 months ago

Thank you. Upon time, I have fixed the issue, but how do I parse a large triples file in RDFLIB or is there any alternative for it?

ThomasThelen commented 1 month ago

Thank you. Upon time, I have fixed the issue, but how do I parse a large triples file in RDFLIB or is there any alternative for it?

Scale your machine so that it can handle your dataset in memory, use a formal graph database, etc.