UKS
|
Contains a collection of Things linked by Relationships to implement Common Sense and general knowledge. More...
Public Member Functions | |
UKS () | |
Creates a new reference to the UKS and initializes it if it is the first reference. | |
virtual Thing | AddThing (string label, Thing parent) |
This is a primitive method needed only to create ROOT Things which have no parents. | |
virtual void | DeleteThing (Thing t) |
This is a primitive method to Delete a Thing...the Thing must not have any children. | |
Thing | Labeled (string label) |
Uses a hash table to return the Thing with the given label or null if it does not exist. | |
bool | ThingInTree (Thing t1, Thing t2) |
List< Thing > | ThingListFromObject (object o, string parentLabel="unknownObject") |
void | DeleteAllChildren (Thing t) |
Recursively removes all the descendants of a Thing. If these descendants have no other parents, they will be deleted as well. | |
Thing | GetOrAddThing (string label, object parent=null, Thing source=null) |
Creates a new Thing in the UKS OR returns an existing Thing, based on the label. | |
List< Thing > | GetAllAttributes (Thing t) |
Gets all relationships to a gropu of Things includeing inherited relationships. | |
List< Relationship > | GetAllRelationships (List< Thing > sources, bool reverse) |
IList< Relationship > | FilterResults (List< Relationship > result, List< Thing > ancestors) |
Filters a list of Relationships returning only those with at least one component which has an ancestor in the list of Ancestors. | |
List< Thing > | HasSequence (List< Thing > targetAttributes) |
Returns a list of Things which have all the target attributes as Relationships. | |
List< Thing > | FindThingsWithAttributes (List< Thing > attributes) |
Returns a list of Things which have ALL the given attributes (IS Relationships) | |
List< Relationship > | WhyNot () |
Returns a list of Relationships which were false in the previous query. | |
List< Relationship > | Why () |
Returns a list of Relatioships which were true in the previous query. | |
Relationship | AddStatement (object oSource, object oRelationshipType, object oTarget, object oSourceProperties=null, object oTypeProperties=null, object oTargetProperties=null) |
Creates a Relationship. Parameters may be Things or strings. If strings, they represent Thing labels and if the Things with those lables do not exist, they will be created. If the RelationshipType has an inverse, the inverse will be used and the Relationship will be reversed so that Fido IsA Dog become Dog HasChild Fido. If Attributes are given, they apply to the applicable source, type, or target parameter. Example "Fido","IsA","Dog",null,null,"Big" creates or locates an existing Thing which is a child of Dog and has the attribute IS Big (perhaps labeled Dog.Big). Then Fido is made a child of that Thing. | |
Relationship | CreateTheRelationship (ref Thing source, ref Thing relType, ref Thing target, ref List< Thing > sourceProperties, List< Thing > typeProperties, ref List< Thing > targetProperties) |
Thing | SubclassExists (Thing t, List< Thing > thingAttributes, ref Thing bestMatch, ref List< Thing > missingAttributes) |
Thing | CreateInstanceOf (Thing t) |
Static Public Member Functions | |
static List< Thing > | FindCommonParents (Thing t, Thing t1) |
static void | WriteTheRelationship (Relationship r) |
Static Public Attributes | |
static List< Relationship > | transientRelationships = new List<Relationship>() |
Properties | |
IList< Thing > | UKSList [get] |
Occasionally a list of all the Things in the UKS is needed. This is READ ONLY. There is only one (shared) list for the App. | |
Contains a collection of Things linked by Relationships to implement Common Sense and general knowledge.
|
inline |
Creates a Relationship.
Parameters may be Things or strings. If strings, they represent Thing labels and if the Things with those lables do not exist, they will be created.
If the RelationshipType has an inverse, the inverse will be used and the Relationship will be reversed so that Fido IsA Dog become Dog HasChild Fido.
If Attributes are given, they apply to the applicable source, type, or target parameter. Example "Fido","IsA","Dog",null,null,"Big" creates or locates an existing Thing which is a child of Dog and has the attribute IS Big (perhaps labeled Dog.Big). Then Fido is made a child of that Thing.
oSource | string or Thing |
oRelationshipType | string or Thing |
oTarget | string or Thing (or null) |
oSourceAttributess | String containing one or more Thing labels separated by spaces, list of strings with individusl Thing Labels, Thing, OR List of Things |
oTypeAttributes | Same |
oTargetAttributess | Same |
This is a primitive method needed only to create ROOT Things which have no parents.
label | |
parent | May be null |
|
inline |
Recursively removes all the descendants of a Thing. If these descendants have no other parents, they will be deleted as well.
t | The Thing to remove the children from |
|
inlinevirtual |
This is a primitive method to Delete a Thing...the Thing must not have any children.
t | The Thing to delete |
|
inline |
Filters a list of Relationships returning only those with at least one component which has an ancestor in the list of Ancestors.
result | List of Relationships from a previous Query |
ancestors | Filter |
Returns a list of Things which have ALL the given attributes (IS Relationships)
attributes | List of Things |
Gets all relationships to a gropu of Things includeing inherited relationships.
sources | |
reverse | if true, the first parameter is a list of targets rather than sources |
Creates a new Thing in the UKS OR returns an existing Thing, based on the label.
label | The new label OR if it ends in an asterisk, the astrisk will be replaced by digits to create a new Thing with a unique label. |
parent | |
source |
ArgumentException |
Returns a list of Things which have all the target attributes as Relationships.
targetAttributes | An ordered list of Things which must occur as attributes in the search target |
|
inline |
Uses a hash table to return the Thing with the given label or null if it does not exist.
label |
|
inline |
Returns a list of Relatioships which were true in the previous query.
|
inline |
Returns a list of Relationships which were false in the previous query.