context/world and asserting in multiple contexts

"Kambiz Darabi" <[email protected]> Sun, 19 Nov 2006 16:54:32 +0100
Newsgroups gmane.comp.ai.powerloom
Message-ID <[email protected]>
Hello,

I have some questions concerning worlds and cotexts. The manual mentions
worlds in addition to modules:

> A PowerLoom context is either a "module", a somewhat heavyweight object
> that includes its own symbol table, or a "world", a very lightweight 
> object designed for fast switching from one world to another

How are they more 'lightweight'? If I plan to use many (hundreds of) 
contexts, is it then better to use worlds? If yes, what are the 
functions/commands to work with worlds? 

And when using many contexts, is there a way of defining things and
asserting facts in multiple contexts simultaneously?

As an example, I have included some statements at the end, which
try to represent the fact, that the car model, which is called
Rabbit in the US, is called Golf in UK and Portugal and Caribe 
in Brazil. Assertions about the name of that model are made in
different modules which represent languages.

With simple 

(cc context) 
(assert ...)  

terms, one has to repeat assertions in different modules.

Is there a way of asserting facts in multiple contexts, so that
one would only have to write one assert and add to it all
contexts in which it is valid?

Many thanks


Kambiz
---
(defmodule "TEST" :includes "PL-KERNEL-KB")
(defmodule "LANGUAGE" :includes TEST)
(defmodule "DE" :includes LANGUAGE)
(defmodule "DE_DE" :includes DE)
(defmodule DE_CH :includes DE)
(defmodule "EN" :includes LANGUAGE)
(defmodule "EN_US" :includes EN)
(defmodule "EN_GB" :includes EN)
(defmodule "PT" :includes LANGUAGE)
(defmodule "PT_PT" :includes PT)
(defmodule "PT_BR" :includes PT)

(in-module "TEST")

(defconcept model-rabbit)

;; the model which is called Rabbit in the US
;; is called Golf in European countries
;; and Caribe in South America
(cc "DE")
(assert (= (name model-rabbit) "Golf"))

;; We take Rabbit as the default name, as
;; there are more English speaking US citizens
;; than there are Englishmen (although I ignore
;; the Commonwealth, so this is probably a mistake :-)
(cc "EN")
(assert (= (name model-rabbit) "Rabbit"))
(cc "EN_GB")
(assert (= (name model-rabbit) "Golf"))
(cc "EN_US")
(all-facts-of model-rabbit)
;; gives
;; (|P|(CONCEPT MODEL-RABBIT) 
;; |P?|(DUPLICATE-FREE MODEL-RABBIT) 
;; |P|(= (NAME MODEL-RABBIT) sk07//"Rabbit"))

;; Golf in Portugal and Caribe in Brazil
(cc "PT")
(assert (= (name model-rabbit) "Golf"))
(cc "PT_BR")
(assert (= (name model-rabbit) "Caribe"))