public class CloudNode extends Object
Representation of a node of the cloud providing methods for content's management. A node N
is composed by
a set of resources (class Resource
), a prominence value and e set of edges (class CloudNode
pointing other nodes. This class also contains the representation of the essential.
An essential is formally a couple <K,T>
where K
is a set of keywords (related
to this node) associated with a relevance value and T
is a set of types (associated with this node)
associated with a relevance value.
In addiction it contains Hibernate information for cloud database synchronization.
Modifier and Type | Field and Description |
---|---|
double |
DEFAULT_RESOURCE_RELEVANCE |
Modifier and Type | Method and Description |
---|---|
protected CloudEdge |
addEdge(CloudNode node,
double weight)
Adds an edge to the current node.
|
EsTerm |
addEsTerm(Integer termId,
String termValue,
Double relevance)
Add a keyword (represented by the class
EsTerm ) to this node. |
EsType |
addEsType(String classId,
Double relevance)
Add a type (represented by the class
EsType ) to this node. |
Resource |
addResource(String resId,
Double relevance)
Create and add a resource (instance of the
Resource class) to this node. |
Set<Resource> |
addResources(List<String> resources,
List<Double> relevances)
Creates and add a list of resources (instances of the
Resource class) to this node. |
Cloud |
getCloud()
Get the owner cloud (
Cloud object) of this node. |
CloudEdge |
getEdge(CloudNode target)
Get the edge having this node as a source node and the given node as target if such
an edge exists.
|
Set<CloudEdge> |
getEdges()
Get the set of edges having this node as a source node.
|
Integer |
getId()
Get the id of the corresponding database persisted object.
|
SortedSet<EsTerm> |
getKeywords()
Get the set of all keywords associated to this node, ordered by ascending
relevance . |
double |
getProminence()
Getter for the prominence value of this node
|
Set<Resource> |
getResources()
Get the set of all resources connected to this node.
|
SortedSet<EsType> |
getTypes()
Get the set of all types associated to this node, ordered by ascending
relevance . |
protected void |
setCloud(Cloud cl)
Set the owner cloud (
Cloud object) of this node. |
protected void |
setEdges(Set<CloudEdge> edges)
Set the edges having this node as a source node.
|
void |
setKeywords(SortedSet<EsTerm> keywords)
Set the keywords connected to this node.
|
void |
setProminence(double prominence)
Setter for the prominence value of this node
|
protected void |
setResources(Set<Resource> resources)
Set the resources connected to this node.
|
protected void |
setTypes(SortedSet<EsType> types)
Set the types connected to this node.
|
String |
toString()
Returns a string representation of this node.
|
public final double DEFAULT_RESOURCE_RELEVANCE
protected CloudEdge addEdge(CloudNode node, double weight)
Adds an edge to the current node. Direct use of this method is discouraged. use the
Cloud.addEdge
method instead.
node
- the CloudNode to which the edge is directed (the source node is the current node).weight
- the edge weight.CloudEdge
).Cloud.addEdge(CloudNode, CloudNode, double)
public Resource addResource(String resId, Double relevance)
Create and add a resource (instance of the Resource
class) to this node.
Recalling the fact that a CloudNode
is a collection of resources (resulting from a clustering
operation), this method is used to put in the node its belonging resources.
resId
- the string representing the knowledge chunk identifier of the inserted resource.relevance
- the relevance value of the inserted resourceResource
instance.Resource
public Set<Resource> addResources(List<String> resources, List<Double> relevances)
Creates and add a list of resources (instances of the Resource
class) to this node.
resources
- a list of resource ids to be included in this node.relevances
- a list of relevances values to be associated (respecting the order of the list)
to the ids in resources
. This parameter could be null: in this case the
DEFAULT_RESOURCE_RELEVANCE default value will be used for all resources.CloudNode
addResource(String, Double)
public CloudEdge getEdge(CloudNode target)
Get the edge having this node as a source node and the given node as target if such an edge exists.
target
- connected node.CloudEdge
object or null if not found.public EsType addEsType(String classId, Double relevance)
Add a type (represented by the class EsType
) to this node.
classId
- the identifier of the added type (RDF class).relevance
- the relevance of the added type for this node.EsType
class)EsType
public EsTerm addEsTerm(Integer termId, String termValue, Double relevance)
Add a keyword (represented by the class EsTerm
) to this node.
public Set<Resource> getResources()
Get the set of all resources connected to this node.
protected void setResources(Set<Resource> resources)
Set the resources connected to this node.
resources
- a set of the resources to be inserted in this node.public double getProminence()
Getter for the prominence value of this node
public void setProminence(double prominence)
Setter for the prominence value of this node
prominence
- the prominence value to be set.public Cloud getCloud()
Cloud
object) of this node.protected void setCloud(Cloud cl)
Cloud
object) of this node.cl
- the owner cloud of this node.public Integer getId()
Get the id of the corresponding database persisted object.
public Set<CloudEdge> getEdges()
Get the set of edges having this node as a source node.
protected void setEdges(Set<CloudEdge> edges)
Set the edges having this node as a source node.
edges
- a set of all edges starting from this node.public SortedSet<EsType> getTypes()
Get the set of all types associated to this node, ordered by ascending relevance
.
EsType
class) associated with this node.protected void setTypes(SortedSet<EsType> types)
types
- the set of all types connected with this node.public SortedSet<EsTerm> getKeywords()
Get the set of all keywords associated to this node, ordered by ascending relevance
.
EsKeyword
class) associated with this node.public void setKeywords(SortedSet<EsTerm> keywords)
keywords
- the set of all types connected with this node.