find-or-create-instance [Function]


Purpose

The find-or-create-instance function either finds an instance having a given identifier, or creates a new instance with that identifier.

Syntax

find-or-create-instance instance concept

Arguments

The instance argument is an instance, or an instance identifier.

The concept argument is a concept, or the name of a concept, that is used as the creation type of the new instance. If concept is nil, the creation type is Thing.

Value

The found or newly-created instance is returned.

Remarks

The new instance does not actually assume its creation type until tellm, new-time-point, or some other function, causes the knowledge base state to be advanced.

Examples

(find-or-create-instance 'Joe nil) ==> |I|JOE 
(find-or-create-instance 'Fred 'Man) ==> |I|FRED 
(find-or-create-instance 'Mary (fc Woman)) ==> |I|MARY 
(pi Mary) ==> (TELL (:ABOUT MARY THING)) 
(new-time-point) 
(pi Mary) ==> (TELL (:ABOUT MARY WOMAN))

See Also

Last modified: Jun 1 1995