Issue with rdf_assert of date/3

hello,

rdf_assert of integers (and strings) work as expected:

Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.24-9-g42b97ff65)
...
?- rdf_assert(a,i,1),rdf_assert(b,i,1).
true.

?- rdf(a,i,N),rdf(b,i,N).
N = 1^^'http://www.w3.org/2001/XMLSchema#integer'.

however, for dates this doesn’t seem to work

?- rdf_assert(a,d,date(2020,1,1)),rdf_assert(b,d,date(2020,1,1)).
true.

?- rdf(a,d,D),rdf(b,d,D).      % <-- I expected this to work
false.

?- rdf(a,d,D1),rdf(b,d,D2).
D1 = D2, D2 = date(2020, 1, 1)^^'http://www.w3.org/2001/XMLSchema#date'.

I suppose this is a bug, or am I missing something?

thanks,
joost

Hello,

Apologies for the self-reply, but I found time to dig a little deeper

given the following TTL

@prefix wiki: <https://wiki.fr/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

wiki:r
	wiki:deadline "2020-01-01"^^xsd:date .

the following query fails, that I believe should succeed

% Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.24-9-g42b97ff65)
?- rdf(wiki:r, P, date(2020, 1, 1)).
false.

following

rdf(wiki:r, wiki:deadline, D).
D = date(2020, 1, 1)^^'http://www.w3.org/2001/XMLSchema#date'.

tracing yields:

rdf(wiki:r, wiki:deadline, date(2020, 1, 1)).
   Call: (10) rdf11:rdf('https://wiki.fr/r', 'https://wiki.fr/deadline', date(2020, 1, 1)) ? creep
   Call: (11) rdf11:pre_object(date(2020, 1, 1), _52806) ? skip
   Exit: (11) rdf11:pre_object(date(2020, 1, 1), literal(type('http://www.w3.org/2001/XMLSchema#date', "2020-01-01"))) ? creep
   Call: (11) rdf_db:rdf('https://wiki.fr/r', 'https://wiki.fr/deadline', literal(type('http://www.w3.org/2001/XMLSchema#date', "2020-01-01"))) ? creep
   Fail: (11) rdf_db:rdf('https://wiki.fr/r', 'https://wiki.fr/deadline', literal(type('http://www.w3.org/2001/XMLSchema#date', "2020-01-01"))) ? creep

Note the string "2020-01-01"

running the query:

?- rdf_db:rdf('https://wiki.fr/r', 'https://wiki.fr/deadline', literal(type('http://www.w3.org/2001/XMLSchema#date',D))).
D = '2020-01-01'.

returns the date as an atom, which I suppose explains the failure?

Thanks,
Joost

2 Likes

No need to apologize for diagnosing problems :slight_smile: Sorry, forgot about this one. With this analysis it was easy, so I pushed a fix.

Thanks --- Jan