Hi Kashyap

Is there documentation about the file format of the database file

See file @doc64/structures within the picolisp directory.
There are the picolisp VM internals described, including Database file format. Like every database binary file format, it is based on fixed blocks (block size). External symbols (= database records) are stored using or multiple blocks. The data itself is encoded using PLIO format (PicoLisp I/O), referenced to as "encoded binary format" in the (rd) and (pr) functions in reference. A small C-library (one .c and one .h file) providing PLIO to C/C++ programs is available at https://software-lab.de/plio.tgz


I am looking at the possibility of using it for the tripple store [1].

The wikipedia article contains this nice line "A graph database has a more generalized structure than a triplestore". The picolisp database is a graph database, though it contains additional/more features than what is usually understood by the term.

On lowest level, pilDB records are external symbols, which is nothing else than the persistently saved picolisp symbol data type. Unlike normal runtime picolisp symbols, external symbols have always a fixed name (but arbitrary value and arbitrary properties). The name of an external symbol is the block location (so the index in the physical file) of the saved external symbol. This way, every record in pilDB has always a global (per database instance) unique identifier (GUID), which technically is the pointer to the external symbols storage location. Knowing the name of an external symbol is thus enough to load the record from the physical file (seek to the specific location in the file and read the PLIO-encoded data), no need to go via a primary key field as in relational databases.

Usually in practice a object-oriented schema is used, so database records are objects (which in picolisp are based on the symbol data type), which have properties and a property might directly point to another object or be a list of other objects (graph-like, see +Link and especially +Joint) with additional (relational-like optional) indexing (and full ACID transaction mechanism as common in relational database). The index structures are B-Trees (or special variant of it like UB-Tree) which are automatically created and maintained according to the property (in database context: relations) definitions in the entity relationship definitions (= the database schema). These index trees are again stored as external symbol structure.

So you could either build a triple store using naked external symbols, or do it the usual pilDB way by creating a (very small/simple) entity/relation schema. Maybe this old tutorial might be of help: http://www.prodevtips.com/2008/04/23/simple-oodb-in-pico-lisp/

Kind regards
beneroth

--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to