The single kind of element in a UKS. A Thought can stand for anything: an object, an attribute, a word, an action. It has a label, links to other Thoughts (LinksTo), and a place in the is-a hierarchy (Parents, Children), from which it inherits.
More...
|
|
| Thought (UKS store) |
| | Creates an unlabeled Thought in the store. It becomes a stored Thought when it is given a label; usually UKS.GetOrAddThought or UKS.AddThought is simpler.
|
| | Thought (Thought r) |
| | Creates a copy of a Thought's label, weights and value, without its links.
|
| Link? | AddLink (ThoughtRef linkType, ThoughtRef to) |
| | Adds the link [this → linkType → to] unless it already exists. An unknown label creates the Thought (under LinkType for the link type, else under Unknown). The target may be empty.
|
|
Link? | HasLink (ThoughtRef linkType, ThoughtRef to=default) |
| | This Thought's own link of the given type to the given target (to any target if it is empty), or null if there is none or a label is unknown. Inherited links are not included; see UKS.GetAttributes.
|
|
Link? | HasLink (ThoughtRef from, ThoughtRef linkType, ThoughtRef to) |
| | The first of this Thought's links matching the given source, type and target, where an empty one matches anything; null if there is none, all three are empty, or a label is unknown.
|
|
void | RemoveLink (ThoughtRef linkType, ThoughtRef to) |
| | Removes the link [this → linkType → to], if present. An empty target means a link with no target; an unknown label removes nothing.
|
|
void | RemoveLink (Link r) |
| | Removes a stored link. r may be an unstored copy: the link with the same source, type and target is removed.
|
| Link? | AddParent (ThoughtRef parent) |
| | Makes this Thought a child of the parent (an is-a link) unless it already is. An unknown label creates the parent under Unknown.
|
|
void | RemoveParent (ThoughtRef parent) |
| | Removes the is-a link to the parent, if present; an unknown label removes nothing.
|
|
bool | HasAncestor (ThoughtRef ancestor) |
| | True if ancestor is this Thought or one of its ancestors. An unknown label is never an ancestor.
|
| Thought? | AddProperty (ThoughtRef property) |
| | Adds a hasProperty link to the property unless this Thought already has it, directly or by inheritance. An unknown label creates the property under Unknown.
|
|
bool | HasProperty (ThoughtRef property) |
| | True if this Thought or one of its ancestors has a hasProperty link to the property.
|
|
void | Fire () |
| | Fires the Thought: records the cycle, extends a finite time to live, and raises UKS.ThoughtFired.
|
|
bool | FiredWithin (long cycles) |
| | True if this Thought fired within the last cycles cycles.
|
|
void | Delete () |
| | Removes this Thought from its store with all its links. Its children move to its parents (a wildcard child is deleted instead), and sequences only it refers to are deleted. Deleting a link removes it from its source.
|
|
override string | ToString () |
| | The label, followed by _V: and the value if there is one.
|
|
|
long | LastFiredCycle |
| | The UKS.Cycle at which this Thought last fired; 0 if it never has.
|
|
|
UKS | Store [get] |
| | The store this Thought belongs to; it never changes.
|
|
string | Label [get, set] |
| | The Thought's name, unique in its store and case-insensitive. Setting a label already in use appends a number, and a trailing * becomes the next free number (dog* gives dog0, dog1, ...).
|
|
IReadOnlyList< Link > | LinksTo [get] |
| | This Thought's own links (it is their source), as a copy that is safe to keep.
|
|
IReadOnlyList< Link > | LinksFrom [get] |
| | The links that have this Thought as their target, as a copy that is safe to keep.
|
|
IReadOnlyList< Link > | LinksAsType [get] |
| | The links that have this Thought as their type, as a copy that is safe to keep.
|
|
IReadOnlyList< Thought > | Parents [get] |
| | The direct parents: targets of this Thought's is-a links.
|
|
IReadOnlyList< Thought > | Children [get] |
| | The direct children: sources of is-a links to this Thought.
|
|
IEnumerable< Thought > | Ancestors [get] |
| | Every ancestor (parents, their parents, ...), nearest first, each once; not this Thought.
|
|
IEnumerable< Thought > | Descendants [get] |
| | Every descendant (children, their children, ...), nearest first, each once; not this Thought.
|
|
float | Weight [get, set] |
| | Strength or confidence, 1 by default. A query multiplies the weights along an inheritance path and orders its results by weight; repeating a statement strengthens its link.
|
|
float | MaxWeight [get, set] |
| | An upper limit on Weight for learning code to respect; the store saves it but does not use it.
|
|
bool | IsPlastic [get, set] |
| | True if learning may still change this Thought's weight. The store saves the flag but does not act on it; structural Thoughts and links are not plastic.
|
|
object? | Value [get, set] |
| | Any object attached to the Thought. Only a string value is saved to a file.
|
|
long | CreatedCycle [get] |
| | The UKS.Cycle at which this Thought was created.
|
|
long | TimeToLive [get, set] |
| | Cycles left before this Thought (or link) is deleted, counted down by UKS.AdvanceCycle. Forever (the default) means it never expires; firing extends a finite time.
|
The single kind of element in a UKS. A Thought can stand for anything: an object, an attribute, a word, an action. It has a label, links to other Thoughts (LinksTo), and a place in the is-a hierarchy (Parents, Children), from which it inherits.
Thoughts are compared by identity: two Thoughts are equal only if they are the same object. A label finds a Thought (UKS.Labeled) but is never compared.
◆ Thought()
| UKS.Thought.Thought |
( |
Thought | r | ) |
|
|
inline |
Creates a copy of a Thought's label, weights and value, without its links.
- Parameters
-
| r | The Thought to copy; for a link, construct a Link instead. |
◆ AddLink()
Adds the link [this → linkType → to] unless it already exists. An unknown label creates the Thought (under LinkType for the link type, else under Unknown). The target may be empty.
- Returns
- The new or existing link, or null if the link type is empty.
◆ AddParent()
Makes this Thought a child of the parent (an is-a link) unless it already is. An unknown label creates the parent under Unknown.
- Returns
- The is-a link, or null if the parent is empty.
◆ AddProperty()
Adds a hasProperty link to the property unless this Thought already has it, directly or by inheritance. An unknown label creates the property under Unknown.
- Returns
- The property, or null if it is empty.
The documentation for this class was generated from the following file: