org.pandora.knowledge
Class BasicVertex

java.lang.Object
  extended by org.pandora.knowledge.BasicVertex
All Implemented Interfaces:
java.io.Serializable, Vertex

public class BasicVertex
extends java.lang.Object
implements Vertex, java.io.Serializable

Represents a piece of knowledge. Vertex is a very simple structure mainly comprised of its relationships, this gives the system a very simple and extendable structure. Basic implementation to allow subclasses to avoid defining some of the basic stuff. The data attribute allows for vertices that represents something tangible such as text, sound, image, number, etc. The data is also indexed within a network, so is the only guaranteed way to lookup an existing vertex.

See Also:
Serialized Form

Field Summary
static java.lang.String SELF
           
 
Constructor Summary
BasicVertex()
           
BasicVertex(java.lang.Object data)
           
BasicVertex(Vertex original)
          Create the vertex as a clone of the original.
 
Method Summary
 Relationship addRelationship(Primitive type, Primitive target)
          Add the relation of the relationship primitive type to the target primitive.
 Relationship addRelationship(Primitive type, Primitive target, int index)
          Add the relation of the relationship type to the target vertex.
 Relationship addRelationship(Primitive type, Vertex target)
          Add the relation of the relationship primitive type to the target vertex.
 Relationship addRelationship(Primitive type, Vertex target, int index)
          Add the relation of the relationship type to the target vertex.
 Relationship addRelationship(Relationship relationship, boolean internal)
          Add the relation ensuring uniqueness.
 Relationship addRelationship(Relationship relationship, boolean internal, boolean init, float correctnessMultiplier)
          Add the relation ensuring uniqueness.
 Relationship addRelationship(Vertex type, Vertex target)
          Add the relation of the relationship type to the target vertex.
 Relationship addRelationship(Vertex type, Vertex target, int index)
          Add the relation of the relationship type to the target vertex.
 Relationship addRelationship(Vertex type, Vertex target, int index, boolean internal)
          Add the relation of the relationship type to the target vertex.
 Relationship addWeakRelationship(Primitive type, Vertex target, float correctnessMultiplier)
          Add the relation of the relationship type to the target vertex.
 Relationship addWeakRelationship(Vertex type, Vertex target, float correctnessMultiplier)
          Add the relation of the relationship type to the target vertex.
 java.util.Iterator<Relationship> allRelationships()
          Provides an easier method of traversing all the relations of all types of a vertex.
 Vertex applyQuotient(java.util.Map<Vertex,Vertex> variables)
          Apply the quotient.
 void associateAll(Vertex relationshipType, Vertex target, Vertex type)
          Associate each of the relationship target vertices with the target vertex by the type.
 boolean collectMatches(Vertex vertex, java.util.Map<Vertex,java.util.Set<Vertex>> variables)
          Compare if the two vertices match.
 int compare(Vertex vertex)
          Compare if the two vertices match.
static java.lang.String convertDataType(java.lang.Object data)
           
static java.lang.String convertDataValue(java.lang.Object data)
           
 void decrementConsciousnessLevel()
          Decrease the vertices's level of consciousness.
 void decrementConsciousnessLevel(int amount)
          Decrease the vertices's level of consciousness by the amount.
 java.lang.String description()
          Return a short toString, or header of the vertex.
 boolean equals(java.lang.Object object)
          Two vertices are equal if they have the same data.
 boolean equalsIgnoreCase(Vertex vertex)
          Compare the vertices ignoring case.
 void fixRelationships(Vertex type)
          Fix the corrupted relationship index order.
 int getAccessCount()
          Return the number of times the vertex has been accessed.
 java.util.Calendar getAccessDate()
          Return the date the vertex was last accessed.
 int getConsciousnessLevel()
          Return the vertices's level of consciousness.
 java.util.Calendar getCreationDate()
          Return the date the vertex was created.
 java.lang.Object getData()
          Return the data value that the vertex represents.
 java.lang.String getDataType()
          Return the String name of the data's type.
 java.lang.String getDataValue()
          Return the String value of the data.
 java.lang.Long getId()
          Unique id for the vertex.
 java.lang.String getName()
          Return the name of the vertex.
 Network getNetwork()
          Return the network the vertex is derived from.
 Vertex getRelationship(Primitive type)
          Return any relationship target of the primitive type.
 Relationship getRelationship(Primitive type, Primitive target)
          Return the relationship of the type primitive to the target.
 Relationship getRelationship(Primitive type, Vertex target)
          Return the relationship of the type primitive to the target.
 Vertex getRelationship(Vertex type)
          Return any relationship target of the type.
 Relationship getRelationship(Vertex type, Vertex target)
          Return the relationship of the type primitive to the target.
 java.util.Map<Vertex,java.util.Map<Relationship,Relationship>> getRelationships()
          Return all relationships.
 java.util.Collection<Relationship> getRelationships(Primitive type)
          Return any relationship target of the primitive type.
 java.util.Collection<Relationship> getRelationships(Vertex relationshipType)
          Return all of the relationships of the type.
 boolean hasAnyRelationshipToTarget(Vertex target)
          Return if the vertex has any relationship to any target.
 boolean hasAnyRelationshipToTargetOfType(Vertex classification)
          Return if the vertex has any relationship to any target that is an instantiation of the classification.
 boolean hasData()
          Return if the vertex has a data value that it represents.
 int hashCode()
          Hash first on data then id for equality compatibility.
 boolean hasInverseRelationship(Vertex type, Vertex target)
          Return if the vertex has an inverse relationship of the type to the target.
 boolean hasName()
          Some vertices have no name, this provides an easy test method.
 boolean hasRelationship(Primitive type)
          Return if the vertex has a relationship of the type primitive.
 boolean hasRelationship(Primitive type, Primitive target)
          Return if the vertex has a relationship of the type primitive to the target primitive.
 boolean hasRelationship(Primitive type, Vertex target)
          Return if the vertex has a relationship of the type primitive to the target.
 boolean hasRelationship(Vertex type)
          Return if the vertex has any (non-inverse) relationship of the type.
 boolean hasRelationship(Vertex type, Vertex target)
          Return if the vertex has a relationship of the type to the target.
 boolean hasRelationships()
          Return if the relationships have been instantiated.
 void incrementAccessCount()
          Record that the vertex was accessed, update the access time and increment the access count.
 void incrementConsciousnessLevel()
          Increase the vertices's level of consciousness.
 void incrementConsciousnessLevel(int amount)
          Increase the vertices's level of consciousness by the amount.
 boolean instanceOf(Primitive type)
          Return if the vertex is an instantiation of the primitive type.
 boolean instanceOf(Vertex type)
          Return if the vertex is an instantiation of the type.
 boolean internalHasRelationship(Vertex type, Vertex target)
          Return if the vertex has a relationship of the type to the target.
 void internalRemoveRelationship(Relationship relationship)
          Remove the relationship.
 void inverseAssociateAll(Vertex relationshipType, Vertex source, Vertex type)
          Associate the source with each of the relationship targets by the type.
 boolean is(java.lang.Object data)
          Return if the vertex data is equal to the data.
 boolean isEquation()
          Return if the vertex is a equation.
 boolean isPinned()
          Return if the vertex is pinned to memory, and will not be forgotten.
 boolean isPrimitive()
          Return if the vertex is a system primitive.
 boolean isVariable()
          Return if the vertex is a variable.
 void iterate(VertexIterator iterator)
          Iterator over all related vertices to the vertex.
 Vertex lastRelationship(Primitive type)
          Return the fromLast last of the ordered relationship, or null.
 Vertex lastRelationship(Primitive type, int fromLast)
          Return the last of the ordered relationship, or null.
 Vertex lastRelationship(Vertex type)
          Return the last of the ordered relationship, or null.
 Vertex lastRelationship(Vertex type, int fromLast)
          Return the fromLast last of the ordered relationship, or null.
 boolean matches(Vertex vertex, java.util.Map<Vertex,Vertex> variables)
          Compare if the two vertices match.
 Vertex mostConscious(Primitive type)
          Return the target vertex related by the type with the high consciousness level.
 Vertex mostConscious(Primitive type, float min)
          Return the target vertex related by the type, with the high consciousness level greater than the value.
 Vertex mostConscious(Vertex type)
          Return the target vertex related by the type with the high consciousness level.
 Vertex mostConscious(Vertex type, float min)
          Return the target vertex related by the type, with the high consciousness level greater than the value.
 Vertex mostConscious(Vertex type, float min, boolean inverse)
          Return the target vertex related by the type, with the high consciousness level greater than the value.
 Vertex mostConscious(Vertex type, Vertex classification)
          Return the target vertex related by the type, with the high consciousness level.
 Relationship mostConsciousRelationship(Primitive type)
          Return the relationship related by the type, with the high consciousness level.
 Relationship mostConsciousRelationship(Primitive type, float correctness)
          Return the relationship related by the type, with the high consciousness level.
 Relationship mostConsciousRelationship(Vertex type)
          Return the relationship related by the type, with the high consciousness level.
 Vertex mostConsciousTargetOfType(Vertex classification)
          Return the most conscious target the vertex has any relationship to that is an instantiation of the classification.
 Vertex mostConsciousWithAssoiate(Vertex type, Vertex associate, Vertex associateType)
          Return the target vertex related by the type, that is also most correctly related to the associate vertex by the relationship.
 Vertex nextMostConscious(Primitive type, Vertex ignoring, float min)
          Return the target vertex related by the type, with the high consciousness level greater than the value.
 Vertex nextMostConscious(Vertex type, Vertex ignoring, float min)
          Return the target vertex related by the type, with the high consciousness level greater than the value.
 Vertex nextMostConscious(Vertex type, Vertex ignoring, float min, boolean inverse)
          Return the target vertex inversely/negatively related by the type, with the high consciousness level.
 Relationship nextMostConsciousRelationship(Primitive type, Vertex ignoring)
          Return the relationship related by the type, with the high consciousness level.
 Relationship nextMostConsciousRelationship(Primitive type, Vertex ignoring, float min)
          Return the target vertex related by the type, with the high consciousness level greater than the value.
 Relationship nextMostConsciousRelationship(Vertex type, Vertex ignoring)
          Return the relationship related by the type, with the high consciousness level.
 Relationship nextMostConsciousRelationship(Vertex type, Vertex ignoring, float min, boolean inverse)
          Return the target vertex inversely/negatively related by the type, with the high consciousness level.
 java.util.Iterator<Relationship> orderedAllRelationships()
          Provides an easier method of traversing all the relations of all types of a vertex.
 java.util.List<Vertex> orderedRelations(Primitive primitive)
          Return all of the relationships targets of the primitive type, sorted by index.
 java.util.List<Vertex> orderedRelations(Vertex relationshipType)
          Return all of the relationship targets of the type, sorted by index.
 java.util.List<Relationship> orderedRelationships(Primitive primitive)
          Return all of the relationships of the primitive type, sorted by index.
 java.util.List<Relationship> orderedRelationships(Vertex relationshipType)
          Return all of the relationships of the type, sorted by index.
 void pinDescendants()
          Pin the vertex and all of its descendants into memory.
 void removeRelationship(Primitive type, Primitive target)
          Remove the relationship of the relation primitive type to the target vertex.
 void removeRelationship(Primitive type, Vertex target)
          Remove the relationship of the relation primitive type to the target vertex.
 void removeRelationship(Relationship relationship)
          Remove the relationship.
 void removeRelationship(Vertex type, Vertex target)
          Remove the relationship of the relation type to the target vertex.
 void setAccessCount(int accessCount)
          Set the number of times the vertex has been accessed.
 void setAccessDate(java.util.Calendar accessDate)
          Set the date the vertex was last accessed.
 void setAccessDate(java.util.Date accessDate)
          Set the date the vertex was last accessed.
 void setConsciousnessLevel(int consciousnessLevel)
          Set the vertices's level of consciousness.
 void setCreationDate(java.util.Calendar creationDate)
          Set the date the vertex was created.
 void setCreationDate(java.util.Date creationDate)
          Set the date the vertex was created.
 void setData(java.lang.Object data)
          Set the data value that the vertex represents.
 void setId(java.lang.Long id)
          Set the vertex id.
 void setName(java.lang.String name)
          Set the name of the vertex.
 void setNetwork(Network network)
          Set the network the vertex is derived from.
 void setOriginal(Vertex original)
          Set the original long term vertex the short term vertex was derived from.
 void setPinned(boolean pinned)
          Set if the vertex should be pinned to memory.
 void setRelationship(Primitive type, Vertex newValue)
          Set the relationship, removing the old value.
 void setRelationship(Vertex type, Vertex newValue)
          Set the relationship, removing the old value.
 java.lang.String toString()
           
 int totalRelationships()
          Return the total number of all relationships.
 void unpinDescendants()
          Unpin the vertex and all of its descendants from memory.
static void writeHeader(Vertex vertex, java.io.PrintWriter writer)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SELF

public static java.lang.String SELF
Constructor Detail

BasicVertex

public BasicVertex()

BasicVertex

public BasicVertex(java.lang.Object data)

BasicVertex

public BasicVertex(Vertex original)
Create the vertex as a clone of the original.

Method Detail

setOriginal

public void setOriginal(Vertex original)
Set the original long term vertex the short term vertex was derived from.

Specified by:
setOriginal in interface Vertex

getNetwork

public Network getNetwork()
Return the network the vertex is derived from.

Specified by:
getNetwork in interface Vertex

setNetwork

public void setNetwork(Network network)
Set the network the vertex is derived from.

Specified by:
setNetwork in interface Vertex

getCreationDate

public java.util.Calendar getCreationDate()
Return the date the vertex was created.

Specified by:
getCreationDate in interface Vertex

setCreationDate

public void setCreationDate(java.util.Calendar creationDate)
Set the date the vertex was created.

Specified by:
setCreationDate in interface Vertex

setCreationDate

public void setCreationDate(java.util.Date creationDate)
Set the date the vertex was created.

Specified by:
setCreationDate in interface Vertex

getAccessDate

public java.util.Calendar getAccessDate()
Return the date the vertex was last accessed.

Specified by:
getAccessDate in interface Vertex

setAccessDate

public void setAccessDate(java.util.Calendar accessDate)
Set the date the vertex was last accessed. Access is considered moving from long term to short term memory.

Specified by:
setAccessDate in interface Vertex

setAccessDate

public void setAccessDate(java.util.Date accessDate)
Set the date the vertex was last accessed. Access is considered moving from long term to short term memory.

Specified by:
setAccessDate in interface Vertex

getAccessCount

public int getAccessCount()
Return the number of times the vertex has been accessed. Access is considered moving from long term to short term memory.

Specified by:
getAccessCount in interface Vertex

setAccessCount

public void setAccessCount(int accessCount)
Set the number of times the vertex has been accessed.

Specified by:
setAccessCount in interface Vertex

incrementAccessCount

public void incrementAccessCount()
Record that the vertex was accessed, update the access time and increment the access count.

Specified by:
incrementAccessCount in interface Vertex

incrementConsciousnessLevel

public void incrementConsciousnessLevel()
Increase the vertices's level of consciousness.

Specified by:
incrementConsciousnessLevel in interface Vertex

decrementConsciousnessLevel

public void decrementConsciousnessLevel()
Decrease the vertices's level of consciousness.

Specified by:
decrementConsciousnessLevel in interface Vertex

decrementConsciousnessLevel

public void decrementConsciousnessLevel(int amount)
Decrease the vertices's level of consciousness by the amount.

Specified by:
decrementConsciousnessLevel in interface Vertex

incrementConsciousnessLevel

public void incrementConsciousnessLevel(int amount)
Increase the vertices's level of consciousness by the amount.

Specified by:
incrementConsciousnessLevel in interface Vertex

getConsciousnessLevel

public int getConsciousnessLevel()
Return the vertices's level of consciousness.

Specified by:
getConsciousnessLevel in interface Vertex

setConsciousnessLevel

public void setConsciousnessLevel(int consciousnessLevel)
Set the vertices's level of consciousness.

Specified by:
setConsciousnessLevel in interface Vertex

addRelationship

public Relationship addRelationship(Primitive type,
                                    Primitive target)
Add the relation of the relationship primitive type to the target primitive.

Specified by:
addRelationship in interface Vertex

addRelationship

public Relationship addRelationship(Primitive type,
                                    Vertex target)
Add the relation of the relationship primitive type to the target vertex.

Specified by:
addRelationship in interface Vertex

addRelationship

public Relationship addRelationship(Vertex type,
                                    Vertex target)
Add the relation of the relationship type to the target vertex. These are currently uni-directional. Only a single relation of a type can be defined to the same target, i.e. relationships to the same vertex are unique. unless the relationship is ordered, then they are only equal if the same index.

Specified by:
addRelationship in interface Vertex

addRelationship

public Relationship addRelationship(Primitive type,
                                    Vertex target,
                                    int index)
Add the relation of the relationship type to the target vertex. These are currently uni-directional. Only a single relation of a type can be defined to the same target, i.e. relationships to the same vertex are unique. unless the relationship is ordered, then they are only equal if the same index.

Specified by:
addRelationship in interface Vertex

addRelationship

public Relationship addRelationship(Primitive type,
                                    Primitive target,
                                    int index)
Add the relation of the relationship type to the target vertex. These are currently uni-directional. Only a single relation of a type can be defined to the same target, i.e. relationships to the same vertex are unique. unless the relationship is ordered, then they are only equal if the same index.

Specified by:
addRelationship in interface Vertex

addRelationship

public Relationship addRelationship(Vertex type,
                                    Vertex target,
                                    int index)
Add the relation of the relationship type to the target vertex. These are currently uni-directional. Only a single relation of a type can be defined to the same target, i.e. relationships to the same vertex are unique. unless the relationship is ordered, then they are only equal if the same index.

Specified by:
addRelationship in interface Vertex

addRelationship

public Relationship addRelationship(Vertex type,
                                    Vertex target,
                                    int index,
                                    boolean internal)
Add the relation of the relationship type to the target vertex. Only increment the correctness if not internal.

Specified by:
addRelationship in interface Vertex

addWeakRelationship

public Relationship addWeakRelationship(Primitive type,
                                        Vertex target,
                                        float correctnessMultiplier)
Add the relation of the relationship type to the target vertex. The correctness decreases the correctness of the relation.

Specified by:
addWeakRelationship in interface Vertex

addWeakRelationship

public Relationship addWeakRelationship(Vertex type,
                                        Vertex target,
                                        float correctnessMultiplier)
Add the relation of the relationship type to the target vertex. The correctness decreases the correctness of the relation.

Specified by:
addWeakRelationship in interface Vertex

addRelationship

public Relationship addRelationship(Relationship relationship,
                                    boolean internal)
Add the relation ensuring uniqueness.

Specified by:
addRelationship in interface Vertex

addRelationship

public Relationship addRelationship(Relationship relationship,
                                    boolean internal,
                                    boolean init,
                                    float correctnessMultiplier)
Add the relation ensuring uniqueness.


equals

public boolean equals(java.lang.Object object)
Two vertices are equal if they have the same data.

Overrides:
equals in class java.lang.Object

equalsIgnoreCase

public boolean equalsIgnoreCase(Vertex vertex)
Compare the vertices ignoring case.

Specified by:
equalsIgnoreCase in interface Vertex

getId

public java.lang.Long getId()
Description copied from interface: Vertex
Unique id for the vertex. All vertices should define a unique identifier.

Specified by:
getId in interface Vertex

setId

public void setId(java.lang.Long id)
Set the vertex id. The id can only be set when loading or creating a vertex.

Specified by:
setId in interface Vertex

hashCode

public int hashCode()
Hash first on data then id for equality compatibility.

Overrides:
hashCode in class java.lang.Object

getData

public java.lang.Object getData()
Return the data value that the vertex represents.

Specified by:
getData in interface Vertex

setData

public void setData(java.lang.Object data)
Set the data value that the vertex represents.

Specified by:
setData in interface Vertex

hasData

public boolean hasData()
Return if the vertex has a data value that it represents.

Specified by:
hasData in interface Vertex

hasRelationships

public boolean hasRelationships()
Return if the relationships have been instantiated.

Specified by:
hasRelationships in interface Vertex

getRelationships

public java.util.Map<Vertex,java.util.Map<Relationship,Relationship>> getRelationships()
Return all relationships. Relationships are stored as a map keyed on the relationship type, with ordered list of relationship targets.

Specified by:
getRelationships in interface Vertex

applyQuotient

public Vertex applyQuotient(java.util.Map<Vertex,Vertex> variables)
Apply the quotient. Apply the equation to the variable matches. This is basically a meta-language (4GL) based on Equation objects (vertices).

Specified by:
applyQuotient in interface Vertex

matches

public boolean matches(Vertex vertex,
                       java.util.Map<Vertex,Vertex> variables)
Compare if the two vertices match. Used for rule processing.

Specified by:
matches in interface Vertex

collectMatches

public boolean collectMatches(Vertex vertex,
                              java.util.Map<Vertex,java.util.Set<Vertex>> variables)
Compare if the two vertices match. Depth allows breadth first search for variables. Used for rule processing.

Specified by:
collectMatches in interface Vertex

compare

public int compare(Vertex vertex)
Compare if the two vertices match. 0 means perfect match. -n means n relationships that do not match. +n means n relationships that do match.


fixRelationships

public void fixRelationships(Vertex type)
Fix the corrupted relationship index order. The order can get corrupted when relationships are forgotten.

Specified by:
fixRelationships in interface Vertex

totalRelationships

public int totalRelationships()
Return the total number of all relationships.

Specified by:
totalRelationships in interface Vertex

getRelationship

public Vertex getRelationship(Primitive type)
Return any relationship target of the primitive type.

Specified by:
getRelationship in interface Vertex

getRelationship

public Vertex getRelationship(Vertex type)
Return any relationship target of the type.

Specified by:
getRelationship in interface Vertex

getRelationships

public java.util.Collection<Relationship> getRelationships(Primitive type)
Return any relationship target of the primitive type.

Specified by:
getRelationships in interface Vertex

getRelationships

public java.util.Collection<Relationship> getRelationships(Vertex relationshipType)
Return all of the relationships of the type.

Specified by:
getRelationships in interface Vertex

lastRelationship

public Vertex lastRelationship(Vertex type)
Return the last of the ordered relationship, or null.

Specified by:
lastRelationship in interface Vertex

lastRelationship

public Vertex lastRelationship(Vertex type,
                               int fromLast)
Return the fromLast last of the ordered relationship, or null. i.e. 2nd last, or 3rd last, etc.

Specified by:
lastRelationship in interface Vertex

lastRelationship

public Vertex lastRelationship(Primitive type)
Return the fromLast last of the ordered relationship, or null.

Specified by:
lastRelationship in interface Vertex

lastRelationship

public Vertex lastRelationship(Primitive type,
                               int fromLast)
Return the last of the ordered relationship, or null.

Specified by:
lastRelationship in interface Vertex

orderedRelationships

public java.util.List<Relationship> orderedRelationships(Primitive primitive)
Return all of the relationships of the primitive type, sorted by index.

Specified by:
orderedRelationships in interface Vertex

orderedRelationships

public java.util.List<Relationship> orderedRelationships(Vertex relationshipType)
Return all of the relationships of the type, sorted by index.

Specified by:
orderedRelationships in interface Vertex

orderedRelations

public java.util.List<Vertex> orderedRelations(Primitive primitive)
Return all of the relationships targets of the primitive type, sorted by index.

Specified by:
orderedRelations in interface Vertex

orderedRelations

public java.util.List<Vertex> orderedRelations(Vertex relationshipType)
Return all of the relationship targets of the type, sorted by index.

Specified by:
orderedRelations in interface Vertex

mostConscious

public Vertex mostConscious(Vertex type,
                            float min)
Return the target vertex related by the type, with the high consciousness level greater than the value.

Specified by:
mostConscious in interface Vertex

mostConsciousRelationship

public Relationship mostConsciousRelationship(Vertex type)
Return the relationship related by the type, with the high consciousness level.

Specified by:
mostConsciousRelationship in interface Vertex

nextMostConsciousRelationship

public Relationship nextMostConsciousRelationship(Vertex type,
                                                  Vertex ignoring)
Return the relationship related by the type, with the high consciousness level.

Specified by:
nextMostConsciousRelationship in interface Vertex

mostConsciousRelationship

public Relationship mostConsciousRelationship(Primitive type)
Return the relationship related by the type, with the high consciousness level.

Specified by:
mostConsciousRelationship in interface Vertex

mostConsciousRelationship

public Relationship mostConsciousRelationship(Primitive type,
                                              float correctness)
Return the relationship related by the type, with the high consciousness level.

Specified by:
mostConsciousRelationship in interface Vertex

nextMostConsciousRelationship

public Relationship nextMostConsciousRelationship(Primitive type,
                                                  Vertex ignoring)
Return the relationship related by the type, with the high consciousness level.

Specified by:
nextMostConsciousRelationship in interface Vertex

mostConscious

public Vertex mostConscious(Primitive type,
                            float min)
Return the target vertex related by the type, with the high consciousness level greater than the value.

Specified by:
mostConscious in interface Vertex

mostConscious

public Vertex mostConscious(Vertex type,
                            float min,
                            boolean inverse)
Return the target vertex related by the type, with the high consciousness level greater than the value.

Specified by:
mostConscious in interface Vertex

nextMostConscious

public Vertex nextMostConscious(Primitive type,
                                Vertex ignoring,
                                float min)
Return the target vertex related by the type, with the high consciousness level greater than the value.

Specified by:
nextMostConscious in interface Vertex

nextMostConsciousRelationship

public Relationship nextMostConsciousRelationship(Primitive type,
                                                  Vertex ignoring,
                                                  float min)
Return the target vertex related by the type, with the high consciousness level greater than the value.

Specified by:
nextMostConsciousRelationship in interface Vertex

nextMostConscious

public Vertex nextMostConscious(Vertex type,
                                Vertex ignoring,
                                float min)
Return the target vertex related by the type, with the high consciousness level greater than the value.

Specified by:
nextMostConscious in interface Vertex

mostConscious

public Vertex mostConscious(Primitive type)
Return the target vertex related by the type with the high consciousness level.

Specified by:
mostConscious in interface Vertex

mostConscious

public Vertex mostConscious(Vertex type)
Return the target vertex related by the type with the high consciousness level.

Specified by:
mostConscious in interface Vertex

nextMostConscious

public Vertex nextMostConscious(Vertex type,
                                Vertex ignoring,
                                float min,
                                boolean inverse)
Return the target vertex inversely/negatively related by the type, with the high consciousness level. The level is multiplied by the relationship correctness.


nextMostConsciousRelationship

public Relationship nextMostConsciousRelationship(Vertex type,
                                                  Vertex ignoring,
                                                  float min,
                                                  boolean inverse)
Return the target vertex inversely/negatively related by the type, with the high consciousness level. The level is multiplied by the relationship correctness.


mostConsciousTargetOfType

public Vertex mostConsciousTargetOfType(Vertex classification)
Return the most conscious target the vertex has any relationship to that is an instantiation of the classification.

Specified by:
mostConsciousTargetOfType in interface Vertex

mostConscious

public Vertex mostConscious(Vertex type,
                            Vertex classification)
Return the target vertex related by the type, with the high consciousness level.

Specified by:
mostConscious in interface Vertex

mostConsciousWithAssoiate

public Vertex mostConsciousWithAssoiate(Vertex type,
                                        Vertex associate,
                                        Vertex associateType)
Return the target vertex related by the type, that is also most correctly related to the associate vertex by the relationship. If no related vertices are related to the associate, then return the most conscious.

Specified by:
mostConsciousWithAssoiate in interface Vertex

associateAll

public void associateAll(Vertex relationshipType,
                         Vertex target,
                         Vertex type)
Associate each of the relationship target vertices with the target vertex by the type.

Specified by:
associateAll in interface Vertex

inverseAssociateAll

public void inverseAssociateAll(Vertex relationshipType,
                                Vertex source,
                                Vertex type)
Associate the source with each of the relationship targets by the type.

Specified by:
inverseAssociateAll in interface Vertex

removeRelationship

public void removeRelationship(Vertex type,
                               Vertex target)
Remove the relationship of the relation type to the target vertex. This records the relationships with a negative correctness, or subtracts from the current correctness.

Specified by:
removeRelationship in interface Vertex

removeRelationship

public void removeRelationship(Primitive type,
                               Vertex target)
Remove the relationship of the relation primitive type to the target vertex. This records the relationships with a negative correctness, or subtracts from the current correctness.

Specified by:
removeRelationship in interface Vertex

removeRelationship

public void removeRelationship(Primitive type,
                               Primitive target)
Remove the relationship of the relation primitive type to the target vertex. This records the relationships with a negative correctness, or subtracts from the current correctness.

Specified by:
removeRelationship in interface Vertex

removeRelationship

public void removeRelationship(Relationship relationship)
Remove the relationship. This records the relationships with a negative correctness, or subtracts from the current correctness.


internalRemoveRelationship

public void internalRemoveRelationship(Relationship relationship)
Remove the relationship.

Specified by:
internalRemoveRelationship in interface Vertex

setRelationship

public void setRelationship(Primitive type,
                            Vertex newValue)
Set the relationship, removing the old value.

Specified by:
setRelationship in interface Vertex

setRelationship

public void setRelationship(Vertex type,
                            Vertex newValue)
Set the relationship, removing the old value.

Specified by:
setRelationship in interface Vertex

allRelationships

public java.util.Iterator<Relationship> allRelationships()
Provides an easier method of traversing all the relations of all types of a vertex.

Specified by:
allRelationships in interface Vertex

iterate

public void iterate(VertexIterator iterator)
Iterator over all related vertices to the vertex.

Specified by:
iterate in interface Vertex

pinDescendants

public void pinDescendants()
Pin the vertex and all of its descendants into memory. This can be used for important data such as language rules.

Specified by:
pinDescendants in interface Vertex

unpinDescendants

public void unpinDescendants()
Unpin the vertex and all of its descendants from memory. This can be used to release removed language rules.

Specified by:
unpinDescendants in interface Vertex

orderedAllRelationships

public java.util.Iterator<Relationship> orderedAllRelationships()
Provides an easier method of traversing all the relations of all types of a vertex.

Specified by:
orderedAllRelationships in interface Vertex

writeHeader

public static void writeHeader(Vertex vertex,
                               java.io.PrintWriter writer)

isPrimitive

public boolean isPrimitive()
Return if the vertex is a system primitive.

Specified by:
isPrimitive in interface Vertex

isVariable

public boolean isVariable()
Return if the vertex is a variable.

Specified by:
isVariable in interface Vertex

isEquation

public boolean isEquation()
Return if the vertex is a equation.

Specified by:
isEquation in interface Vertex

is

public boolean is(java.lang.Object data)
Return if the vertex data is equal to the data.

Specified by:
is in interface Vertex

instanceOf

public boolean instanceOf(Primitive type)
Return if the vertex is an instantiation of the primitive type.

Specified by:
instanceOf in interface Vertex

instanceOf

public boolean instanceOf(Vertex type)
Return if the vertex is an instantiation of the type.

Specified by:
instanceOf in interface Vertex

hasRelationship

public boolean hasRelationship(Primitive type)
Return if the vertex has a relationship of the type primitive.

Specified by:
hasRelationship in interface Vertex

hasRelationship

public boolean hasRelationship(Primitive type,
                               Primitive target)
Return if the vertex has a relationship of the type primitive to the target primitive.

Specified by:
hasRelationship in interface Vertex

hasRelationship

public boolean hasRelationship(Primitive type,
                               Vertex target)
Return if the vertex has a relationship of the type primitive to the target.

Specified by:
hasRelationship in interface Vertex

getRelationship

public Relationship getRelationship(Primitive type,
                                    Vertex target)
Return the relationship of the type primitive to the target.

Specified by:
getRelationship in interface Vertex

getRelationship

public Relationship getRelationship(Primitive type,
                                    Primitive target)
Return the relationship of the type primitive to the target.

Specified by:
getRelationship in interface Vertex

hasRelationship

public boolean hasRelationship(Vertex type,
                               Vertex target)
Return if the vertex has a relationship of the type to the target.

Specified by:
hasRelationship in interface Vertex

getRelationship

public Relationship getRelationship(Vertex type,
                                    Vertex target)
Return the relationship of the type primitive to the target.

Specified by:
getRelationship in interface Vertex

internalHasRelationship

public boolean internalHasRelationship(Vertex type,
                                       Vertex target)
Return if the vertex has a relationship of the type to the target. Include inverses.

Specified by:
internalHasRelationship in interface Vertex

hasRelationship

public boolean hasRelationship(Vertex type)
Return if the vertex has any (non-inverse) relationship of the type.

Specified by:
hasRelationship in interface Vertex

hasAnyRelationshipToTarget

public boolean hasAnyRelationshipToTarget(Vertex target)
Return if the vertex has any relationship to any target.

Specified by:
hasAnyRelationshipToTarget in interface Vertex

hasAnyRelationshipToTargetOfType

public boolean hasAnyRelationshipToTargetOfType(Vertex classification)
Return if the vertex has any relationship to any target that is an instantiation of the classification.

Specified by:
hasAnyRelationshipToTargetOfType in interface Vertex

hasInverseRelationship

public boolean hasInverseRelationship(Vertex type,
                                      Vertex target)
Return if the vertex has an inverse relationship of the type to the target.

Specified by:
hasInverseRelationship in interface Vertex

description

public java.lang.String description()
Description copied from interface: Vertex
Return a short toString, or header of the vertex.

Specified by:
description in interface Vertex

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDataType

public java.lang.String getDataType()
Description copied from interface: Vertex
Return the String name of the data's type.

Specified by:
getDataType in interface Vertex

getDataValue

public java.lang.String getDataValue()
Description copied from interface: Vertex
Return the String value of the data.

Specified by:
getDataValue in interface Vertex

convertDataValue

public static java.lang.String convertDataValue(java.lang.Object data)

convertDataType

public static java.lang.String convertDataType(java.lang.Object data)

getName

public java.lang.String getName()
Return the name of the vertex. The name is used as a hint to refer to what the vertex represents.

Specified by:
getName in interface Vertex

setName

public void setName(java.lang.String name)
Set the name of the vertex. The name is used as a hint to refer to what the vertex represents.

Specified by:
setName in interface Vertex

hasName

public boolean hasName()
Some vertices have no name, this provides an easy test method.

Specified by:
hasName in interface Vertex

isPinned

public boolean isPinned()
Return if the vertex is pinned to memory, and will not be forgotten.

Specified by:
isPinned in interface Vertex

setPinned

public void setPinned(boolean pinned)
Set if the vertex should be pinned to memory. Pinned vertices will not be forgotten.

Specified by:
setPinned in interface Vertex