UKS
Loading...
Searching...
No Matches
UKS.UKS Class Reference

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< ThingThingListFromObject (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< ThingGetAllAttributes (Thing t)
 Gets all relationships to a gropu of Things includeing inherited relationships.
 
List< RelationshipGetAllRelationships (List< Thing > sources, bool reverse)
 
IList< RelationshipFilterResults (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< ThingHasSequence (List< Thing > targetAttributes)
 Returns a list of Things which have all the target attributes as Relationships.
 
List< ThingFindThingsWithAttributes (List< Thing > attributes)
 Returns a list of Things which have ALL the given attributes (IS Relationships)
 
List< RelationshipWhyNot ()
 Returns a list of Relationships which were false in the previous query.
 
List< RelationshipWhy ()
 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< ThingFindCommonParents (Thing t, Thing t1)
 
static void WriteTheRelationship (Relationship r)
 

Static Public Attributes

static List< RelationshiptransientRelationships = new List<Relationship>()
 

Properties

IList< ThingUKSList [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.
 

Detailed Description

Contains a collection of Things linked by Relationships to implement Common Sense and general knowledge.

Member Function Documentation

◆ AddStatement()

Relationship UKS.UKS.AddStatement ( object oSource,
object oRelationshipType,
object oTarget,
object oSourceProperties = null,
object oTypeProperties = null,
object oTargetProperties = null )
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.

Parameters
oSourcestring or Thing
oRelationshipTypestring or Thing
oTargetstring or Thing (or null)
oSourceAttributessString containing one or more Thing labels separated by spaces, list of strings with individusl Thing Labels, Thing, OR List of Things
oTypeAttributesSame
oTargetAttributessSame
Returns
The primary relationship which was created (others may be created for given attributes

◆ AddThing()

virtual Thing UKS.UKS.AddThing ( string label,
Thing parent )
inlinevirtual

This is a primitive method needed only to create ROOT Things which have no parents.

Parameters
label
parentMay be null
Returns

◆ DeleteAllChildren()

void UKS.UKS.DeleteAllChildren ( Thing t)
inline

Recursively removes all the descendants of a Thing. If these descendants have no other parents, they will be deleted as well.

Parameters
tThe Thing to remove the children from

◆ DeleteThing()

virtual void UKS.UKS.DeleteThing ( Thing t)
inlinevirtual

This is a primitive method to Delete a Thing...the Thing must not have any children.

Parameters
tThe Thing to delete

◆ FilterResults()

IList< Relationship > UKS.UKS.FilterResults ( List< Relationship > result,
List< Thing > ancestors )
inline

Filters a list of Relationships returning only those with at least one component which has an ancestor in the list of Ancestors.

Parameters
resultList of Relationships from a previous Query
ancestorsFilter
Returns

◆ FindThingsWithAttributes()

List< Thing > UKS.UKS.FindThingsWithAttributes ( List< Thing > attributes)
inline

Returns a list of Things which have ALL the given attributes (IS Relationships)

Parameters
attributesList of Things
Returns

◆ GetAllAttributes()

List< Thing > UKS.UKS.GetAllAttributes ( Thing t)
inline

Gets all relationships to a gropu of Things includeing inherited relationships.

Parameters
sources
reverseif true, the first parameter is a list of targets rather than sources
Returns
List of matching relationships

◆ GetOrAddThing()

Thing UKS.UKS.GetOrAddThing ( string label,
object parent = null,
Thing source = null )
inline

Creates a new Thing in the UKS OR returns an existing Thing, based on the label.

Parameters
labelThe 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
Returns
Exceptions
ArgumentException

◆ HasSequence()

List< Thing > UKS.UKS.HasSequence ( List< Thing > targetAttributes)
inline

Returns a list of Things which have all the target attributes as Relationships.

Parameters
targetAttributesAn ordered list of Things which must occur as attributes in the search target
Returns
All the Things which match the criteria

◆ Labeled()

Thing UKS.UKS.Labeled ( string label)
inline

Uses a hash table to return the Thing with the given label or null if it does not exist.

Parameters
label
Returns
The Thing or null

◆ Why()

List< Relationship > UKS.UKS.Why ( )
inline

Returns a list of Relatioships which were true in the previous query.

Returns

◆ WhyNot()

List< Relationship > UKS.UKS.WhyNot ( )
inline

Returns a list of Relationships which were false in the previous query.

Returns

The documentation for this class was generated from the following files: