Domains, Facts, Properties, Classes sharing confusion ?

Discussions related to Visual Prolog
kingchris
Active Member
Posts: 30
Joined: 26 Sep 2005 9:35

Domains, Facts, Properties, Classes sharing confusion ?

Unread post by kingchris » 27 Dec 2015 6:27

I currently have a working class called calcWindow that uses a few facts to hold info consulted from a physical fact file.

To try and improved the speed of this program I now wish to consult the facts then move these facts into a chainDB with a btree index. The chainDB and btIndex stuff I know how to do.

For many years I have never known how to share or inherit a fact declaration between two classes as I now wish to write a separate class that will from now on, handle my facts database but in a btree database.

Here is a current example

Code: Select all

class facts     %    ID       Lat  Log Weight Distance         gift:(integer,real,real,real,   real).
How and where do I declare this gift fact template/type so that I can use instances of this fact in both places. The existing calcWindow class and my new soon to be written btree class that will hold a btree database of the pool of gift. I still need to access this gift template/type in my existing calcWindow as I create small collections of gifts for optimisation purposes.

Or do I simply duplicate the declaration in both places and hope to remember to change both if the fact format changes.

User avatar
Thomas Linder Puls
VIP Member
Posts: 1625
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 27 Dec 2015 14:02

You cannot share a fact database between two class implementations. You can duplicate the declarations but that is a bad idea as it will eventually lead to inconsistencies. I will suggest that you place your fact database in a dedicated class and access the data through this class from both your new classes.

I will also suggest that you consider using the collection classes (see Collection Library) rather than "playing" with chainDB and B+-trees.
Regards Thomas Linder Puls
PDC

kingchris
Active Member
Posts: 30
Joined: 26 Sep 2005 9:35

Unread post by kingchris » 27 Dec 2015 16:29

Thanks. I will look at making a facts only class.

I have used the chainDB and Btree library from as way back as the VIP 5.2 days so I am happy I know what I am doing.

Because of my projects high volume data, Btree's are a little faster. :lol:

Post Reply