I need to make a program to add triples to a Virtuoso triplestore, I'm using Python and RDFLib. I've installed the Virtuoso plugin and tried a connection as seen in http://pythonhosted.org/virtuoso/rdflib.html#virtuoso-storage. I got:
from rdflib.graph import ConjunctiveGraph as Graph
from rdflib.store import Store
from rdflib.plugin import get as plugin
from rdflib.term import URIRef, Literal
Virtuoso = plugin("Virtuoso", Store)
store = Virtuoso("DSN=VOS;UID=dba;PWD=dba;WideAsUTF16=Y")
It seems that it has no problems, the matter is: now what? How to add the new triples? I tried:
default_graph_uri = "http://llisa.dlsi.uji.es/productset/"
graph = Graph(store,identifier = URIRef(default_graph_uri))
graph.add((URIRef("http://llisa.dlsi.uji.es/productset#0g9x91t"),URIRef("http://xmlns.com/foaf/0.1/nick"),Literal("The Car")))
store.commit()
print graph.serialize(format='pretty-xml')
that produced the following error:
File "/usr/local/lib/python2.7/dist-packages/virtuoso-0.12-py2.7.egg/virtuoso/vstore.py", line 345, in resolve
(value, dvtype, dttype, flag, lang, dtype) = args
ValueError: need more than 4 values to unpack
The question is What's the problem with that? and How do I add the triples properly? Thanks.