Hi all,
Following up on the previous thread [0] about getting literal
values out of an ODBC connection for SPASQL queries, I've
managed to make a preliminary patch for pyodbc that does this [1].
I noticed two issues when doing this. First, Virtuoso OS 6.1.2
seems to only give the proper datatype values if 'output:valmode "LONG"'
is defined. This is a bit inconvenient because it means extra
select queries to resolve them (albeit cheap ones).
The second problem, which my tests in [2] uncovered, where we
put some triples in the store and then check to see if what we
get back is the same, is that for values with xsd:date, I
seem to be getting a dvtype of VIRTUOSO_DV_DATETIME where it
should be VIRTUOSO_DV_DATE.
e.g.:
AssertionError: Round-trip mismatch:
(rdflib.term.URIRef('http://example.org/'),
rdflib.term.URIRef('http://www.w3.org/2000/01/rdf-schema#comment'),
rdflib.term.Literal(u'2010-10-23',
datatype=rdflib.term.URIRef('http://www.w3.org/2001/XMLSchema#date')))
(rdflib.term.URIRef('http://example.org/'),
rdflib.term.URIRef('http://www.w3.org/2000/01/rdf-schema#comment'),
rdflib.term.Literal(u'2010-10-23',
datatype=rdflib.term.URIRef('http://www.w3.org/2001/XMLSchema#dateTime')))
There is also the minor nit that perhaps dates would be better
returned in ISO format, e.g. '2010-10-23T20:51:00.602149' instead
of '2010-10-23 20:51:00.602149'. Haven't yet looked at what
happens when timezones are thrown into the mix.
Is all this expected? Is it an error in the documentation that
that doesn't mention the requirement for 'output:valmode "LONG"'
or an error in the server?
Cheers,
-w
[0]
http://sourceforge.net/mailarchive/forum.php?thread_name=4C978E4C.90003%40openlinksw.com&forum_name=virtuoso-users
[1] http://river.styx.org/ww/2010/10/pyodbc-spasql/index
[2] http://bitbucket.org/ww/virtuoso/src/tip/virtuoso/tests/test_rdflib3.py