it.unimi.dico.islab.idbs2.kc
Class Predicate

java.lang.Object
  extended by it.unimi.dico.islab.idbs2.kc.Predicate

public class Predicate
extends Object

This class represents a property value (or an inferred property value) attached to a KnowledgeChunk. More in detail, this is a representation of a path of properties in a knowledge graph where belongKc is the starting node, p1 is the first edge (property) in the path, pn is the last property and valueKc is the last object in the path (if the last object is a literal then valueKc will be empty and the value will be in the value field). The following image shows the relations between the fields of this object and the fields of the wrapped database table (fields with the same color represents a mapping between relational schema and the corresponding object).


Author:
Vegeziel
See Also:
KnowledgeChunk

Constructor Summary
protected Predicate()
          Only Hibernate and KnowledgeChunk are able to instantiate this object.
protected Predicate(KnowledgeChunk belongKc, KnowledgeChunk p1, KnowledgeChunk pn, KnowledgeChunk valueKc, String value, int pathLength, String valueType, int valueLength)
          Direct use of this constructor is discouraged.
 
Method Summary
 KnowledgeChunk getBelongKc()
          Getter for the kc which is the starting point of this properties path.
 Integer getId()
          Getter for the identifier of this object (database purpose).
 KnowledgeChunk getP1()
           Getter for the first property of this path.
 Integer getPathLength()
          Getter for the pathLength field.
 KnowledgeChunk getPn()
           Getter for the last property of this path.
 String getValue()
           Getter for the literal representation of the object of this predicate.
 KnowledgeChunk getValueKc()
          Getter for the kc which is the ending point of this properties path.
 Integer getValueLength()
          Getter for the valueLength field.
 String getValueType()
          Getter for the valueType field.
 void setPathLength(Integer pathLength)
          Setter for the pathLength field.
 void setValue(String value)
          Setter for the literal representation of the object of this predicate.
 void setValueLength(Integer valueLength)
          Setter for the valueLength field.
 void setValueType(String valueType)
          Setter for the valueType field.
 String toString()
          Get a string representation of the current Predicate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Predicate

protected Predicate()
Only Hibernate and KnowledgeChunk are able to instantiate this object. Direct use is discouraged.


Predicate

protected Predicate(KnowledgeChunk belongKc,
                    KnowledgeChunk p1,
                    KnowledgeChunk pn,
                    KnowledgeChunk valueKc,
                    String value,
                    int pathLength,
                    String valueType,
                    int valueLength)

Direct use of this constructor is discouraged. Use the KnowledgeChunk.addLink method instead.

Parameters:
belongKc - the knowledge chunk that is the starting point of this properties path.
p1 - the knowledge chunk (of type P) which is the first property in the properties path.
pn - the knowledge chunk (of type P) which is the last property in the properties path.
valueKc - the knowledge chunk which is the final object of the properties path.
value - the value of the last object of the properties path. Could be the name of valueKc or a literal (depending on the nature of the last object).
pathLength - the number of properties encountered in the path.
valueType - a string representation of the domain of the value.
valueLength - the number of characters of the value, materialized for performance purposes.
See Also:
KnowledgeChunk.addLink(KnowledgeChunk, KnowledgeChunk, KnowledgeChunk, String, int, String, int)
Method Detail

toString

public String toString()

Get a string representation of the current Predicate.

Overrides:
toString in class Object
Returns:
a string composed by: belongKc -- p1 --> * -- pn --> valueKc(value)

getId

public Integer getId()

Getter for the identifier of this object (database purpose).

Returns:
the key identifier for the relational database link.

getBelongKc

public KnowledgeChunk getBelongKc()

Getter for the kc which is the starting point of this properties path.

Returns:
the subject KnowledgeChunk

getP1

public KnowledgeChunk getP1()

Getter for the first property of this path.

Returns:
the KnowledgeChunk that represents the first property of this path.

getPn

public KnowledgeChunk getPn()

Getter for the last property of this path.

Returns:
the KnowledgeChunk that represents the last property of this path.

getValueKc

public KnowledgeChunk getValueKc()

Getter for the kc which is the ending point of this properties path.

Returns:
the object KnowledgeChunk of this predicate.

getValue

public String getValue()

Getter for the literal representation of the object of this predicate.

Returns:
literal representation of the object of this predicate.

setValue

public void setValue(String value)

Setter for the literal representation of the object of this predicate.

Parameters:
value - literal representation of the object of this predicate.

getPathLength

public Integer getPathLength()

Getter for the pathLength field.

Returns:
the length of the path of this predicate (expressed as the number of encountered properties).

setPathLength

public void setPathLength(Integer pathLength)

Setter for the pathLength field.

Parameters:
pathLength - the length of the path of this predicate (expressed as the number of encountered properties).

getValueLength

public Integer getValueLength()

Getter for the valueLength field.

Returns:
the length of the value field (expressed as the number of its characters).

setValueLength

public void setValueLength(Integer valueLength)

Setter for the valueLength field.

Parameters:
valueLength - the length of the value field (expressed as the number of its characters).

getValueType

public String getValueType()

Getter for the valueType field.

Returns:
a string representation of the type of the literal property value

setValueType

public void setValueType(String valueType)

Setter for the valueType field.

Parameters:
valueType - a string representation of the type of the literal property value