Add a triple into a named graph via pystardog

Hi everyone,

I'm pretty new to Stardog, and am trying to add a triple -created with rdflib- into a graph via pystardog. for example:

from rdflib import Graph, URIRef, BNode, Literal
bob = URIRef("http://example.org/people/Bob")
linda = BNode()
name = Literal("Bob")
triple = (bob, FOAF.name, name)

It seems that the

stardog.content.Raw*(content, *content_type=
"text/turtle")]

is the best content type, however, the triple can not be passes to it as object. (Error: too many values to unpack ) and when I turn it to a string (by converting to string each element in the triple and concatenating them),

stardog.exceptions.StardogException: [400] QEIVR2: Namespace prefix 'http' used but not defined [L1]

arises.
I was wondering what is the type of the input to content.Raw and what would be the best practice for adding the triple?

Thanks!

You have to serialize your Graph into some RDF format and then provide that to Raw:

self.conn.add(stardog.content.Raw(self.buffer.serialize(format="turtle").encode('utf-8'), stardog.content_types.TURTLE), graph_uri=MY_GRAPH)

Dear Michael,

Thank you for the help!