I am having trouble with ntriples-parsed data not showing up in queries. 
Below, I seem to have found a case where the same datatyped literal 
makes two entries in the i2k table, which seems like it would be the 
problem.


#!/usr/bin/python
import sys, tempfile, shutil, os, time
sys.path.append("bin")
import _boot
import unittest
from rdflib import URIRef, Variable, Literal, BNode, StringInputSource
from rdflib.Graph import Graph

tmpdir = tempfile.mkdtemp()
try:
     g = Graph("Sleepycat")
     g.open(tmpdir, create=True)
     try:
         g.parse(StringInputSource('''<http://example.com/t1> 
<http://example.com/date> 
"2007-02-03"^^<http://www.w3.org/2001/XMLSchema#date>.\n'''), format="nt")

         # this should re-add the same statment
         g.add((URIRef("http://example.com/t1";),
                URIRef("http://example.com/date";),
                Literal("2007-02-03", 
datatype=URIRef("http://www.w3.org/2001/XMLSchema#date";))))
         assert len(g) == 1, "sleepycat backend created %s triples 
instead of 1" % len(g)
     finally:
         g.close()
     """
     my db looked like this:

     % db4.3_dump -p -h /tmp/tmp4Zf-T4 i2k
db_dump: DB_ENV->set_flags: DB_CDB_ALLDB: method not permitted after 
handle's open method
VERSION=3
format=print
type=recno
db_pagesize=4096
HEADER=END
  PU\0a(Vhttp://example.com/t1\0ap1\0atRp2\0a.
  PU\0a(Vhttp://example.com/date\0ap1\0atRp2\0a.
 
PL\0a(V2007-02-03\0ap1\0aNS'http://www.w3.org/2001/XMLSchema#date'\0ap2\0atRp3\0a.
  PG\0a(PS\0aPB\0a(VaemtAOFv0\0ap1\0atRp2\0atRp3\0a.
 
PL\0a(V2007-02-03\0ap1\0aNPU\0a(Vhttp://www.w3.org/2001/XMLSchema#date\0ap2\0atRp3\0atRp4\0a.
DATA=END

     """
finally:
     print "\nHere's the i2k table:"
     os.system("db4.3_dump -p -h %s i2k" % tmpdir)
     print "\n"
     shutil.rmtree(tmpdir)
_______________________________________________
Dev mailing list
Dev@rdflib.net
http://rdflib.net/mailman/listinfo/dev

Reply via email to