public class KCManager extends Object
KnowledgeChunk
wrapper. This class contains
most used interrogations (such as getKnowledgeChunkById
and methods for saving an
object of this class.
IMPORTANT: this class has no public constructor. A singleton instance of this class is contained
in KCSessionManager
class
Modifier and Type | Method and Description |
---|---|
List<KnowledgeChunk> |
getAllProperties()
Used to load a list of all properties (KnowledgeChunk of type
P ) in the connected database. |
protected static KCManager |
getKCManager() |
KnowledgeChunk |
getKnowledgeChunkById(String id)
Used to load a KnowledgeChunk instance from the database.
|
HashSet<KnowledgeChunk> |
getKnowledgeChunksByClass(String classId)
Fetch all KnowledgeChunks having
classId as a declared class. |
HashSet<KnowledgeChunk> |
getKnowledgeChunksWithIdLike(String likeExpr)
Fetch all the objects of type
KnowledgeChunk having an identifier matching the
expression likeExpr . |
void |
saveOrUpdate(KnowledgeChunk kc)
Give persistence to the given
KnowledgeChunk object using associated Hibernate mappings. |
protected static KCManager getKCManager()
public KnowledgeChunk getKnowledgeChunkById(String id)
getSessionFactory
method.id
- the identifier of a Knowledge Chunk.public HashSet<KnowledgeChunk> getKnowledgeChunksWithIdLike(String likeExpr)
KnowledgeChunk
having an identifier matching the
expression likeExpr
.likeExpr
- an expression with jolly characters of the SQL Standard LIKE clause.public List<KnowledgeChunk> getAllProperties()
P
) in the connected database. This method uses the internal
Session Factory of this class (different from the one obtained calling the getSessionFactory
method.P
.public HashSet<KnowledgeChunk> getKnowledgeChunksByClass(String classId)
classId
as a declared class.
N.B.: Doesn't work if negated classes are present!! Work in progress...classId
- the identifier of the KnowledgeChunk
of type C
that
represents the class of the returned KnowledgeChunks.classId
as asserted class.public void saveOrUpdate(KnowledgeChunk kc)
Give persistence to the given KnowledgeChunk
object using associated Hibernate mappings.
This method executes the saveOrUpdate
method of the Hibernate Session
using
internal Session Factory of KCSessionManager
.
As the KnowledgeChunk
is the main class of this package, by saving this object a cascade save is started for all connected objects (predicates
and all referred kcs, types, terms, documents and documentextractions).