Your JSON
output is showing the type being used to display the date
value in the browser, as was the case when querying the SQL table, where in the browser output a datetime field is being used to display all date datatypes (ie date, datetime, timestamp etc) and pads the date value time elements with “0”'s.
If you add BIND (DATATYPE(?o) as ?datatype)
to the query to return the date
object values datatype stored in the Virtuoso RDF Quad Store you will see it is xsd:date
.
Once again, for a RDFView of the northwind database orders table in PostgreSQL :
isql:
SQL> SPARQL SELECT * FROM <http://demo.openlinksw.com/PostgresDate#> WHERE {?s <http://demo.openlinksw.com/schemas/PostgresDate/order_date> ?o BIND (DATATYPE(?o) as ?datatype)} limit 1;
s o datatype
VARCHAR DATE VARCHAR NOT NULL
_______________________________________________________________________________
http://demo.openlinksw.com/PostgresDate/orders/order_id/10248#this 1996.7.4 http://www.w3.org/2001/XMLSchema#date
1 Rows. -- 9 msec.
SQL>
ODBC:
iODBC Demonstration program
This program shows an interactive SQL processor
Driver Manager: 03.52.0815.0106
Driver: 08.03.3313 OpenLink Virtuoso ODBC Driver (virtodbc.so)
SQL>SPARQL SELECT * FROM <http://demo.openlinksw.com/PostgresDate#> WHERE {?s <http://demo.openlinksw.com/schemas/PostgresDate/order_date> ?o BIND (DATATYPE(?o) as ?datatype)} limit 1
s | o | datatype
--------------------+----------+--------------
http://demo.openlinksw.com/Pos | 1996-07-04 | http://www.w3.org/2001/XMLSchema#date
result set 1 returned 1 rows.
SQL>
SPARQL endpoint JSON output:
{ "head": { "link": [], "vars": ["s", "o", "datatype"] },
"results": { "distinct": false, "ordered": true, "bindings": [
{ "s": { "type": "uri", "value": "http://demo.openlinksw.com/PostgresDate/orders/order_id/10248#this" } , "o": { "type": "typed-literal", "datatype": "http://www.w3.org/2001/XMLSchema#dateTime", "value": "1996-07-04T00:00:00" } , "datatype": { "type": "uri", "value": "http://www.w3.org/2001/XMLSchema#date" }} ] } }