|
UKS
Universal Knowledge Store
|
One element of a sequence: a Thought with a FRST link to the sequence's first element, an NXT link to the next element (none on the last), and a VLU link to its value. A value can itself be a sequence, so sequences nest; identical sequences are stored once and shared. More...
Public Member Functions | |
| SeqElement (UKS store) | |
| Creates an unlinked sequence element. | |
| override string | ToString () |
| Returns the sequence in text-file notation, e.g. ^c a t. | |
| Public Member Functions inherited from UKS.Thought | |
| 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. | |
Properties | |
| SeqElement? | FRST [get, set] |
| The first element of this element's sequence (itself, for the first element). | |
| SeqElement? | NXT [get, set] |
| The next element of the sequence, or null for the last element. | |
| Thought? | VLU [get, set] |
| The element's primary value (a non-metadata VLU target), or null. | |
| Properties inherited from UKS.Thought | |
| 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. | |
Additional Inherited Members | |
| Public Attributes inherited from UKS.Thought | |
| long | LastFiredCycle |
| The UKS.Cycle at which this Thought last fired; 0 if it never has. | |
| Static Public Attributes inherited from UKS.Thought | |
| const long | Forever = -1 |
| A TimeToLive of -1: the Thought never expires. | |
One element of a sequence: a Thought with a FRST link to the sequence's first element, an NXT link to the next element (none on the last), and a VLU link to its value. A value can itself be a sequence, so sequences nest; identical sequences are stored once and shared.