if a triple store contains twice as many of the same triple, what (if any) is there an authoritative position on this redundancy?
Also, if triplestra is allowed to store the same triple twice in the same context?
I am asking about this because apparently in rdflib you can save the same triple twice (or more). This is the reader.
import rdflib
from rdflib import store
s = rdflib.plugin.get('MySQL', store.Store)('rdfstore')
config_string = "host=localhost,password=foo,user=foo,db=foo"
rt = s.open(config_string,create=False)
if rt != store.VALID_STORE:
s.open(config_string,create=True)
graph = rdflib.ConjunctiveGraph(s, identifier = rdflib.URIRef("urn:uuid:a19f9b78-cc43-4866-b9a1-4b009fe91f52"))
rows = graph.query("SELECT ?id ?value { ?id <http://localhost#ha> ?value . }")
for r in rows:
print r[0], r[1]
and this is a writer
import rdflib
from rdflib import store
s = rdflib.plugin.get('MySQL', store.Store)('rdfstore')
config_string = "host=localhost,password=foo,user=foo,db=foo"
rt = s.open(config_string,create=False)
if rt != store.VALID_STORE:
s.open(config_string,create=True)
graph = rdflib.ConjunctiveGraph(s, identifier = rdflib.URIRef("urn:uuid:a19f9b78-cc43-4866-b9a1-4b009fe91f52"))
graph.add( ( rdflib.URIRef("http://localhost/1000"), rdflib.URIRef("http://localhost#ha"), rdflib.Literal("18")) )
graph.commit()
This is what I get
sbo@dhcp-045:~/tmp/gd $ python ./reader2.py
table kb_7b066eca61_relations Doesn't exist
table kb_7b066eca61_relations Doesn't exist
sbo@dhcp-045:~/tmp/gd $ python ./reader2.py
sbo@dhcp-045:~/tmp/gd $ python ./reader2.py
sbo@dhcp-045:~/tmp/gd $ python ./writer2.py
sbo@dhcp-045:~/tmp/gd $ python ./reader2.py
http://localhost/1000 18
sbo@dhcp-045:~/tmp/gd $ python ./writer2.py
sbo@dhcp-045:~/tmp/gd $ python ./reader2.py
http://localhost/1000 18
http://localhost/1000 18
It seems to me that this is a mistake. The modified version shows me that both triples belong to the same context, and indeed there are two triples.
len : 2
http://localhost/1000 18
http://localhost/1000 18
(rdflib.URIRef('http://localhost/1000'), rdflib.URIRef('http://localhost#ha'), rdflib.Literal(u'18'), <Graph identifier=urn:uuid:a19f9b78-cc43-4866-b9a1-4b009fe91f52 (<class 'rdflib.Graph.Graph'>)>)
(rdflib.URIRef('http://localhost/1000'), rdflib.URIRef('http://localhost#ha'), rdflib.Literal(u'18'), <Graph identifier=urn:uuid:a19f9b78-cc43-4866-b9a1-4b009fe91f52 (<class 'rdflib.Graph.Graph'>)>)