|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object it.unimi.dico.islab.idbs2.kc.KnowledgeChunk
public class KnowledgeChunk
Main class of the kc
framework, representation of a knowledge chunk. A kc is unit of knowledge,
the representation of an object, type or property of the context of interest. It is composed by a list of types,
a terminological equipment (a list of terms with associated frequency value and relevance value), a set
of predicates (i.e. a set of property paths with associated object/value), a type (i.e. {C, P, I}, as Class,
Property or Instance) and a connected Document, source of the extraction process.
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).
This class also supplies methods for Hibernate database wrapper management.
Document
,
Predicate
,
Term
,
Type
Constructor Summary | |
---|---|
protected |
KnowledgeChunk()
Empty constructor needed for Hibernate compatibility. |
|
KnowledgeChunk(String id)
Generates new empty KnowledgeChunk given an identifier. |
Method Summary | |
---|---|
void |
addDocument(Document doc)
Adds a source document to this KnowledgeChunk instance. |
Predicate |
addLink(KnowledgeChunk p1,
KnowledgeChunk pn,
KnowledgeChunk valueKc,
String value,
int pathLength,
String valueType,
int valueLength)
Adds a property path to this KnowledgeChunk object. |
void |
addTerm(String value,
Double relevance,
Integer frequency)
Add a keyword to this KnowledgeChunk specifying its relevance and frequency. |
void |
addType(KnowledgeChunk type)
Overload of the addType(type, isType) method. |
void |
addType(KnowledgeChunk type,
boolean isType)
Add a class (represented by a KnowledgeChunk instance) to this
KnowledgeChunk specifying if is an asserted or excluded type. |
boolean |
equals(Object o)
|
Set<Document> |
getDocuments()
Retrieves all the documents which this kc belongs to. |
Set<DocumentExtraction> |
getExtractedFrom()
Getter for the list of document where this kc belongs. |
Boolean |
getGlobal()
|
String |
getId()
Getter for the identifier of this class. |
Set<Predicate> |
getLinks()
Getter for the set of predicates having this node as a belongKc . |
String |
getName()
Getter for the name representation of this KnowledgeChunk . |
Set<Term> |
getTermEquipment()
Getter for the full term equipment of this object. |
String |
getTermEquipmentFlat()
Getter for the term equipment flat representation. |
Character |
getType()
Getter for the type of this object. |
Set<Type> |
getTypes()
Getter for the set of all types of this kc. |
int |
hashCode()
|
void |
removeTerm(String t)
Removes the keyword t from this
KnowledgeChunk . |
void |
removeType(KnowledgeChunk t)
Removes the type t from this
KnowledgeChunk . |
void |
removeType(String type)
Removes the type represented by the id type from this
KnowledgeChunk . |
void |
setGlobal(Boolean global)
|
void |
setName(String name)
Setter for the name representation of this KnowledgeChunk . |
void |
setTermEquipmentFlat(String terEq)
Setter for the term equipment flat representation. |
void |
setType(Character type)
Setter for the type of this object. |
String |
toString()
Give a textual representation of this object in form of its identifier. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public KnowledgeChunk(String id)
Generates new empty KnowledgeChunk given an identifier.
N.B.: A new instance of KnowledgeChunk will be in a detached state (see Hibernate
reference manual for more details about object states) until an explicit request (like a save
operation). If a KnowledgeChunk with the same
primary key will already be present on the wrapped database, an exception will be thrown while trying to save this new
instance. In order to reload an existing KnowledgeChunk use KCManager.getKnowledgeChunkById(String)
id
- string identifier for the new KnowledgeChunk
KCSessionManager.kcm
protected KnowledgeChunk()
KnowledgeChunk(String id)
instead.
id
Method Detail |
---|
public void addType(KnowledgeChunk type)
Overload of the addType(type, isType)
method. In this version isType
is assumed
true.
type
- a KnowledgeChunk
to be added as a type for this object. If type
is a null value it will be ignored raising a warning message.public void addType(KnowledgeChunk type, boolean isType)
Add a class (represented by a KnowledgeChunk
instance) to this
KnowledgeChunk
specifying if is an asserted or excluded type.
type
- a KnowledgeChunk
to be added as a type (or as a "is not type") for this object. If type
is a null value it will be ignored raising a warning message.isType
- type
is a declared class of this KnowledgeChunk
type
is a denied class of this KnowledgeChunk
public void removeType(String type)
Removes the type represented by the id type
from this
KnowledgeChunk
.
type
- the type (a String value representing the identifier of the type) to be removed. If t
is a null or a void value it will be ignored raising a warning message.public void removeType(KnowledgeChunk t)
Removes the type t
from this
KnowledgeChunk
.
t
- the type (KnowledgeChunk
of type 'T') to be removed. If t
is a null value it will be ignored raising a warning message.public void addTerm(String value, Double relevance, Integer frequency)
Add a keyword to this
KnowledgeChunk
specifying its relevance and frequency.
value
- the keyword to be added. If value
is a null value it will be ignored raising a warning message.relevance
- the relevance of the added keyword for this KnowledgeChunk
.Sfrequency
- the frequency of the added keyword in the terminological equipment of this
KnowledgeChunk
, expressed as the number of its occurrences.public void removeTerm(String t)
Removes the keyword t
from this
KnowledgeChunk
.
t
- the keyword to be removed. If t
is a null or a void value it will be ignored raising a warning message.public Predicate addLink(KnowledgeChunk p1, KnowledgeChunk pn, KnowledgeChunk valueKc, String value, int pathLength, String valueType, int valueLength)
Adds a property path to this KnowledgeChunk
object. The property path is represented by
a Predicate
instance starting from the current object (that will be the belongKc
value).
p1
- a KnowledgeChunk
representing the first edge (property) in the path.pn
- a KnowledgeChunk
representing the last edge (property) in the path.valueKc
- a KnowledgeChunk
representing the final object of the property path.value
- a literal that is the value of the last object of the path.pathLength
- the number of edges in the path.valueType
- string representation for the data type of the value
field.valueLength
- length of the value
field, materialized for efficiency reasons.
Predicate
Predicate
public void addDocument(Document doc)
Adds a source document to this KnowledgeChunk
instance.
doc
- the document to be addedpublic Set<Document> getDocuments()
Retrieves all the documents which this kc belongs to.
public String toString()
toString
in class Object
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String getId()
Getter for the identifier of this class.
KnowledgeChunk
public String getName()
Getter for the name representation of this KnowledgeChunk
. Usually the name of the
represented object.
KnowledgeChunk
.public void setName(String name)
Setter for the name representation of this KnowledgeChunk
.
name
- the name of this KnowledgeChunk
.public void setGlobal(Boolean global)
public Boolean getGlobal()
public Set<Predicate> getLinks()
Getter for the set of predicates having this node as a belongKc
.
public Set<DocumentExtraction> getExtractedFrom()
Getter for the list of document where this kc belongs.
public void setType(Character type)
Setter for the type of this object. It could be
type
- a character representing the type of this object.public Character getType()
Getter for the type of this object. It could be
public void setTermEquipmentFlat(String terEq)
Setter for the term equipment flat representation. This is a list of comma separated words.
terEq
- the comma separated list of words representing the term equipment of this object.public String getTermEquipmentFlat()
Getter for the term equipment flat representation. This is a list of comma separated words.
public Set<Term> getTermEquipment()
Getter for the full term equipment of this object. This field is a Set
of Term
objects
Type
.Term
public Set<Type> getTypes()
Getter for the set of all types of this kc.
Type
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |