Persistent Objects

Tips and tricks when running Logtalk using SWI-Prolog as the back-end compiler

Moderator: Paulo Moura

Post Reply
yari
Posts: 2
Joined: Mon Feb 23, 2015 6:32 pm

Persistent Objects

Post by yari » Mon Feb 23, 2015 8:10 pm

Hello everyone...
I'm trying to create persistant objects in logtalk. Assertions and retractions should update a file.
I need multiple objects to be stored in the persistent database.
I am trying to use the persistency library in SWI-prolog, is this possible?
If so, how should the 'persistent' directive be used in a logtalk file?
if not, what is the best to integrate swipl persistency and logtalk?
Thanks in advance.

Paulo Moura
Logtalk developer
Posts: 474
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Persistent Objects

Post by Paulo Moura » Mon Feb 23, 2015 8:42 pm

The SWI-Prolog "persistency" library assumes and requires that the calls to the persistent predicates be made from within modules. Thus, it cannot be used as-is with Logtalk objects. The library code can be ported, however, if necessary. A simpler solution is possible, however, if it would be enough to load the files holding the persistent databases when the Logtalk objects are loaded and to dump the updated databases when terminating the session.
Paulo Moura
Logtalk developer

Paulo Moura
Logtalk developer
Posts: 474
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Persistent Objects

Post by Paulo Moura » Mon Feb 23, 2015 11:12 pm

Added a simple implementation of a persistent object database (using the includes/1 directive) to the current Logtalk git version:

https://github.com/LogtalkDotOrg/logtal ... s/includes
Paulo Moura
Logtalk developer

yari
Posts: 2
Joined: Mon Feb 23, 2015 6:32 pm

Re: Persistent Objects

Post by yari » Wed Feb 25, 2015 1:24 pm

Thank you for your answer and for creating logtalk :)

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests