Hello, I’ve made an Stackoverflow question (https://stackoverflow.com/questions/68297234/how-to-persist-custom-or-non-trivial-data-types-in-swi-prolog-with-persistency-l) about how to enable persistency to date type datas.
Rewriting the question here (for somebody that can help me):
I have a module file with something like this:
:- module(model, [ campament/5 ]). :- use_module(library(persistency)). :- persistent campament(name:atom, date_from:date, date_to:date, ubication:text, description:text).
This definition is related to
date
data type (SWI-Prolog -- Dealing with time and date), that is not present inerror
library mentioned inpersistent/1
.So, when I try to persist this clause I get an error:
?- use_module(model). ?- model:bd('data.db'). ?- parse_time('20180720', iso_8601, From), | parse_time('20180729', iso_8601, To), | model:assert_campament('My campament', From, To, 'there', 'nothing'). ERROR: type `date' does not exist ERROR: In: ERROR: [15] throw(error(existence_error(type,date),_37572)) ERROR: [11] model:assert_campament('My campament', From, To, 'there', 'nothing') at /home/xxx/model.pl:9 ERROR: [9] <user> ERROR: ERROR: Note: some frames are missing due to last-call optimization. ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
How can I persist
date
like types? Inmust_be/2
, one of possible types is:
any
any term
type
Term is a valid type specification
Regards.