This is a project of the Pointrel Foundation. More details about the foundation can be found on its main page. (The pointrel.org link will go directly to the main page in a few days.) |
This is the very first version of the Pointrel Data Repository System.
You may download is here: Pointrel20000513.zip if you agree with the license.
Pointrel was coined by Paul Fernhout from pointers and relationships around 1982. The main conceptual difference from other storage systems based on lists or objects is that the focus in the Pointrel Data Repository System is on relationships.
The Pointrel Data Repository System is a loosely coupled set of concepts for data representation. It can be thought of as an information storage architecture. The code presented here implements the simplest concepts in this system. William Kent's ROSE/STAR system described in his 1979 book "Data and Reality" is similar to the Pointrel Data Repository System in intent in many ways.
The Pointrel Data Repository System includes a triadal data storage system. Using triads, one can build arbitrary complex networks of relationships. These dynamic relationships can define the equivalent of records or objects in a database.
A primary concept in the Pointrel Data Repository System is a triad. A triad is an object with three links and an optional string. These links can point to other triads. This allows one to build arbitrarily complex structures, as well as add to these structures at any time.
The code in "PointrelRepository20000513.py" defines a repository for such triads.
Pointrel triads in this version consist of these fields:
A B C S
A, B, and C can be pointers to other Pointrel objects.
S is an optional string.
Note that strings can also be encoded in triad sequences pointing to characters;
the approach here is for efficiency on circa 2000 A.D. hardware.
The intial repository is made by running (instead of importing) "PointrelRepository20000513.py".
It is set up as follows:
Triad 0 is reserved as a null entity.
Triads 1 - 256 are reserved to represent characters in the ascii character set.
Triads 257 - 1023 are reserved to represent base shared concepts.
These values may be adjusted in future versions, most likely being expanding the range for shared concepts up to several millions or so.
The only fixed position nodes right now are these three:
nameTreeBase = 257
nameForConceptConcept = 258
definesSymbolNodeConcept = 259
These are used to define symbolic names and abstract named concepts.
The Pointrel Data Repository System can be implimented in a variety of ways. This first public release chooses one that leans towards simplicity, and uses four files: two for data and two for indexes. Pointrel data is stored in two main files "PointrelRepository.triads" and "PointrelRepository.strings". In addition, two index files are used called "PointrelRepository.indexLast" and "PointrelRepository.indexPrevious". The index files could be regenerated from the contents of "PointrelRepository.triads". Future implementations may merge these into one single physical file with four internal logical parts.
Here is what is in each of the four repository files:
Filename | Contents |
PointrelRepository.triads | For each triad, four 32-bit integers, representing pointers A, B, C and S. The first three point to other triads in the same file (or zero if not used). The last points to a location in a related string file (or zero if not used). |
PointrelRepository.strings | Strings which may be pointed to by the S field of a triad. Strings are of variable length. The position, related triad, and syncronizing information are also stored. |
PointrelRepository.indexLast | For each related triad, three 32 bit-integers used as pointers to the triad where the related triad is last used in an A, B, or C field. |
PointrelRepository.indexPrevious | For each related triad, three 32-bit integers used as pointers to the triad where the triad in the A, B, or C of the related triad was previously used in the same position. |
Here is an example of a made up set of files:
[UNFINISHED]
The main low level API of methods of class Repository::
#file handling def createFiles(self): def openFiles(self, defineConstants = 1): def closeFiles(self): #support referring to common concepts def addCommonSharedConcepts(self): def defineCommonSharedConceptConstants(self): #internal routines used for symbol storage def entityForCharacter(self, c): def characterForEntity(self, node): # support for building a triad def findLast(self, triadIndex, offset): def setLast(self, triadIndex, offset, newValue): #the primary function to add a new triad with all four fields def addTriadABCString(self, a, b, c, string): # functions to add simplified types of triads def addTriadABC(self, a, b, c): def addTriadString(self, string): def addTriadAbstract(self): #functions to return one or more fields of a triad def triadA(self, triadIndex): def triadB(self, triadIndex): def triadC(self, triadIndex): def triadString(self, triadIndex): def triadABC(self, triadIndex): def triadABCString(self, triadIndex): #functions to return information about repository def triadCount(self): #functions to search #return list of triad with this triad in the defined (offset = 0,4,8) slot def search(self, triadIndex, offset): #other simplified search functions def searchForTriadOrAdd(self, a, b, c): def searchForTriadOrNone(self, a, b, c): def searchABForAllCLinks(self, a, b): def searchBCForAllALinks(self, b, c): def searchACForAllBLinks(self, a, c): def searchABForAllCs(self, a, b): def searchBCForAllAs(self, b, c): def searchACForAllBs(self, a, c): def searchStart(self, triadIndex, offset): def searchNext(self, previous, offset): def searchABForLatestCLink(self, a, b): def searchBCForLatestALink(self, b, c): def searchACForLatestBLink(self, a, c): def searchABForLatestC(self, a, b): def searchBCForLatestA(self, b, c): def searchACForLatestB(self, a, c): #searches for a unique name using tree of characters #not incredibly efficient but easy to impliment #if name not found, adds it def triadForName(self, name): def nameForTriad(self, nameNode): #find a triad for a concept which may have multiple names #throws exception if more than one concept associated with a name def triadForConcept(self, name): #transaction support stubs #bracket code which must make multiple changes at once with these #eventually these may be implimented def beginTransaction(self): def endTransaction(self): #future support routines def checkIndexes(self): def rebuildIndexes(self):
See "PythonRepository20000513.py" for examples of using this API.
See readme.txt for the files distributed with this release.
This system is:
Copyright 2000 Paul D. Fernhout.
pdfernhout@kurtz-fernhout.com
Pointrel is a trademark of Paul D. Fernhout.
Reuse of the Pointrel code is allowed under an X11 type license. See license.txt for details.