Search code examples
pythonsparqlrdflibstardogblank-nodes

Adding triple containing blank node to Stardog with RDFLib


I'm using the RDFLib Python library to manipulate a Stardog database. How do I add a blank node? I'm trying g.add((BNode(),FOAF.knows,Literal('amy'))), but I get an exception "SPARQLStore does not support Bnodes!". What is the alternative?


Solution

  • This is a restriction of RDFLib's SPARQLStore implementation, which you seem to be using. See the docs.

    You may be able to accomplish this by using SPARQLWrapper to insert the triples directly without using the RDFLib interface.