| Prolog, which is currently one of the most influential AI languages, attracts great attention and is being applied in the information-processing field for its prominence in intellectualization. However, one is confronted with mass data when developing applications with this language, a problem to which the basic solution is through data persistence. In Prolog, the data exist mainly in the form of facts constituting the fact database. The so-called persistence is a process to perpetuate the fact database and extend it to the external memory. At present, the persistence in Prolog relies on the database product of the third party, a fact that complicates the system and increases costs.This paper presents a wholly new idea. It researches and makes possible the Prolog fact-database persistence that is based on raw devices and that eventually acts as a built-in persistence sub-system of Prolog. The developing hardware technology enables the capacity of raw devices to continue to grow with decreasing costs. The raw device, as it does not experience formatting of the file system, results in less maintenance fees. Besides, because of the fact that the file system has no need for caching, the RAW I/O works more efficiently. For these reasons, this solution can increase the access frequency and reduce complexity and maintenance costs more than its counterparts.This paper is broken into four parts. The first deals with the closely related information about the raw device, the current situation of data persistence, external language interface and foreign predicates in SWI-Prolog, the whole functions of the system and how to use it in SWI-Prolog. In the second part, a series of data structures are designed that are capable of organizing the data in the raw device, with the structures associated by rooted hierarchy that forms the structure tree of this system. In the third part, there is a discussion about two ways raw devices are used, namely, RAW&O_DIRECT and RAW I/O. We have analyzed and implemented the basic functions of the persistence layer, say, functions of creating new facts and selecting fact, enhanced the utility rates of raw device block by adding sorting facts and moving data blocks; we have also added backup and restore functions, thus made the system more robust. The implementation of persistence layer mirrors the backtrack mechanism of Prolog. In the last part, a synchronization control method is devised. The synchronization control of visits to the structure variables of the structure tree can be completed by the synchronization object. And the self-synchronization and longitudinal pertinent synchronization of the synchronization object can be achieved through the message queue and mutex mechanism.First successfully performed in Linux and SWI-Prolog, this system provides a set of standardized persistence interface predicates for the program to call. It is hoped that the system can later be applied in other versions of Prolog.Figure 10 table 0 references 42... |