Skip to content

SPARQLConnector does not work with AWS Neptune #1231

@zednis

Description

@zednis

summary

  • using rdflib 5.0.0 SPARQLUpdateStore to connect to AWS Neptune SPARQL endpoint
  • programmatic reads work
  • add( ) does not work
  • query( ) does not work

versions

  • Python 3.9.1
  • rdflib 5.0.0

code:

from rdflib.resource import Resource
from rdflib.namespace import SKOS, DCTERMS, XSD, RDFS

from rdflib.plugins.stores import sparqlstore

SPARQL_ENDPOINT = "https://dev-taxonomy-neptune-cluster.cluster-cab44ucmi0fe.us-east-1.neptune.amazonaws.com:8182/sparql"

store = sparqlstore.SPARQLUpdateStore(returnFormat='application/rdf+xml')
store.open((SPARQL_ENDPOINT, SPARQL_ENDPOINT))
store.bind("dcterms", DCTERMS)
ds = Dataset(store, default_union=True)

ds.add((DCTERMS.source, RDF.type, OWL.DatatypeProperty))

error:

  File "/Users/stephan.zednik/Projects/dhi/dhi-taxonomy-knowledge-graph-editor/example.py", line 15, in <module>
    ds.add((DCTERMS.source, RDF.type, OWL.DatatypeProperty))
  File "/usr/local/lib/python3.9/site-packages/rdflib/graph.py", line 1396, in add
    self.store.add((s, p, o), context=c, quoted=False)
  File "/usr/local/lib/python3.9/site-packages/rdflib/plugins/stores/sparqlstore.py", line 551, in add
    self.commit()
  File "/usr/local/lib/python3.9/site-packages/rdflib/plugins/stores/sparqlstore.py", line 527, in commit
    self._update('\n;\n'.join(self._edits))
  File "/usr/local/lib/python3.9/site-packages/rdflib/plugins/stores/sparqlstore.py", line 606, in _update
    SPARQLConnector.update(self, update)
  File "/usr/local/lib/python3.9/site-packages/rdflib/plugins/stores/sparqlconnector.py", line 124, in update
    res.raise_for_status()
  File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://dev-taxonomy-neptune-cluster.cluster-cab44ucmi0fe.us-east-1.neptune.amazonaws.com:8182/sparql

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions