On Feb 26, 2007, at 6:38 AM, Drew Perttula wrote:

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.

The code is working on the current trunk for me (the assertion is not failing). What version of rdflib is causing the assertion to get hit? And I don't see two entries in the i2k table:

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\0aNPU\0a(Vhttp://www.w3.org/2001/XMLSchema#date \0ap2\0atRp3\0atRp4\0a.
PG\0a(PS\0aPB\0a(VEomZQtxM0\0ap1\0atRp2\0atRp3\0a.
DATA=END

I'll turn this into a test case since we're mostly there already.

#!/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

Daniel Krech, http://eikeon.com/



_______________________________________________
Dev mailing list
Dev@rdflib.net
http://rdflib.net/mailman/listinfo/dev

Reply via email to