DefinedSetNode

From OpenCog
Jump to: navigation, search

The DefinedSetNode is a proposed atom type meant to be used with MemberLink to create sets in a declarative fashion. This node type is meant to be used with PutLink and BindLink to instantiate multiple instances.

See https://github.com/opencog/atomspace/issues/1502 for the implementation status and issue-tracking related to this node type.

The general structure should be:

 MemberLink
    SomeAtom
    DefinedSetNode "Name of Set"

An example usage is shown below. First, a set called "putter" is defined, having two members:

 MemberLink
     Concept "foo"
     DefinedSetNode "putter"
 
 MemberLink
      Concept "bar"
      DefinedSetNode "putter"


Then a PutLink is defined, using this set:

 PutLink
     ThingLink
         Variable "$x"
     DefinedSetNode "putter"

Evaluating this PutLink would result in the creation of two atoms, shown below:

 ThingLink
     Concept "foo"
 
 ThingLink
     Concept "bar"

The idea here is that the PutLink will examine every member of the defined set, and then plug each in for the Variable "$x". The point, the reason for this is that it is much more convenient and usable than specifying

 PutLink
     ThingLink
         Variable "$x"
     SetLink
         Concept "foo"
         Concept "bar"

which would accomplish the same substitution, but require the use of a SetLink.