On Wed, Aug 19, 2009 at 10:08:03AM +0200, Henrik Sarvell wrote:
> > Note that the tree root nodes (e.g. {2}) above are always created in file=
>  #1.
> What exactly do you mean by this?

There are external symbols in the DB which are neither entity objects
nor btree nodes. They are not under the direct control of the
application. For example, if you do

   : (show *DB)
   {1} NIL
      +WordCount {2}

there is '{2}' which is the container for the indexes of '+WordCount'

   : (show *DB '+WordCount)           # Same as (show '{2})
   {2} NIL
      article (1 . {3-2})
      word (1 . {3-1})

This says that there are two index trees for '+WordCount': 'article' and
'word'. Both contain a single entry (the count '1' in the CAR), and the
root nodes of the trees are '{3-1}' and '{3-2}'.

You have such a symbol like '{2}' for each entity. They are always
created in file #1. I addition, each hook object would also create such
an object, as a hook is an entity with its own local sub-database. Thus,
when you have hooks, there can be many such objects in file #1.

> > Forgot this one. No, 'count' doesn't need to be entered into 'dbs'. It ha=
> s no index and thus does not create external objects.
> I see but the information itself has to be stored somewhere, obviously
> in my example above it's there in #1 in my copy pasted step result.
> However, in your case it's missing from the printouts.

Yes, the information (the value of 'count') is stored in the entity
object itself.

I did not put a 'count' into the first '+WordCount' object. If I change
my test example to

(class +WordCount +Entity)
(rel word      (+Ref +String))
(rel article   (+Ref +Number))
(rel count     (+Number))

   (4 +WordCount +Similarity)
   (3 (+WordCount word article)) )

(pool "dbx" *Dbs)

(new! '(+WordCount)
   'word "abc"
   'article 123
   'count 7 )     # <-- Pass a count value

then the '+WordCount' object will have a count

   : (select +WordCount)
   {2-1} (+WordCount)
      article 123
      count 7
      word "abc"

This number '7' is just stored in the object, id does not need
additional space for an index tree node.

> Could the way I'm inserting new objects matter? I usually do a request
> followed by several put> to get some extra information into the
> object, finally I finish with commit.

Yes. Using 'request' (or 'new!') takes care of the right database file.

But if you call 'new' directly, you have to pass the file number

   (new (db: +WordCount) '(+WordCount) ...)

If you call (new T '(+WordCount) ...) the object will end up in file #1.
The index trees, however, will always show up in the right places.

- Alex
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to