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.
Cloud
,
Resource
,
CloudEdge
,
KeywordRelevance
,
TypeRelevance
Modifier and Type | Field and Description |
---|---|
double |
DEFAULT_RESOURCE_RELEVANCE |
Modifier | Constructor and Description |
---|---|
protected |
CloudNode() |
Modifier and Type | Method and Description |
---|---|
CloudEdge |
addEdge(CloudNode node,
double weight)
Adds an edge to the current node.
|
KeywordRelevance |
addEsTerm(Integer termId,
String termValue,
Double relevance)
Deprecated.
|
TypeRelevance |
addEsType(String classId,
Double relevance)
Deprecated.
|
KeywordRelevance |
addKeyword(Integer termId,
String termValue,
Double relevance)
Add a keyword (represented by the class
EsTerm ) to this node. |
void |
addProperty(Property p) |
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. |
TypeRelevance |
addType(String classId,
Double relevance)
Add a type (represented by the class
EsType ) to this node. |
void |
clearEssentials()
Removes all the keywords and types connected to the current
CloudNode . |
void |
clearKeywords()
Removes all the keywords connected to the current
CloudNode . |
void |
clearTypes()
Removes all the types connected to the current
CloudNode . |
boolean |
equals(Object other) |
Cloud |
getCloud()
Get the owner cloud (
Cloud object) of this node. |
double |
getConfidence() |
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.
|
KeywordRelevance |
getKeyword(String keywordValue)
Search for a keyword connected to this
CloudNode represented by the keyword value
keywordValue . |
SortedSet<KeywordRelevance> |
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<Property> |
getProperties() |
Set<Resource> |
getResources()
Get the set of all resources connected to this node.
|
double |
getSimilarity() |
TypeRelevance |
getType(String classId)
Search for a type connected to this
CloudNode represented by the class classId . |
SortedSet<TypeRelevance> |
getTypes()
Get the set of all types associated to this node, ordered by ascending
relevance . |
int |
hashCode() |
boolean |
removeEdge(CloudNode target)
Removes the edge having this node as source and the node
target as target (if such and edge
exists). |
boolean |
removeKeyword(KeywordRelevance kr)
Removes the given
KeywordRelevance from the current CloudNode . |
boolean |
removeKeyword(String keyword)
Search for a keyword connected to this
CloudNode represented by the keyword
and removes it. |
void |
removeProperty(Property p) |
void |
removeResources()
Removes all the resources belonging to this
CloudNode . |
boolean |
removeType(String classId)
Search for a type connected to this
CloudNode represented by the class classId
and removes it. |
boolean |
removeType(TypeRelevance type)
Removes the given
TypeRelevance from the current CloudNode . |
protected void |
setCloud(Cloud cl)
Set the owner cloud (
Cloud object) of this node. |
void |
setConfidence(double confidence) |
void |
setKeywords(SortedSet<KeywordRelevance> keywords)
Set the keywords connected to this node.
|
void |
setProminence(double prominence)
Setter for the prominence value of this node
|
void |
setProperties(Set<Property> properties) |
protected void |
setResources(Set<Resource> resources)
Set the resources connected to this node.
|
void |
setSimilarity(double similarity) |
protected void |
setTypes(SortedSet<TypeRelevance> types)
Set the types connected to this node.
|
String |
toString()
Returns a string representation of this node.
|
public final double DEFAULT_RESOURCE_RELEVANCE
public CloudEdge addEdge(CloudNode node, double weight)
Adds an edge to the current node. This method performs the same operation of the
Cloud.addEdge
method.
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 boolean removeEdge(CloudNode target)
target
as target (if such and edge
exists).target
- the target node of the edge to be removed.this->target exists and has been removed correctly
this->target has not been found.
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 void removeResources()
CloudNode
.public void addProperty(Property p)
public void removeProperty(Property p)
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 TypeRelevance addType(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)TypeRelevance
@Deprecated public TypeRelevance addEsType(String classId, Double relevance)
addType(String, Double)
.public TypeRelevance getType(String classId)
CloudNode
represented by the class classId
.classId
- the identifier of the required class (e.g., "foaf:Person").CloudNode
.public boolean removeType(String classId)
CloudNode
represented by the class classId
and removes it.classId
- the identifier of the type (e.g., "foaf:Person") that should be removed.public boolean removeType(TypeRelevance type)
TypeRelevance
from the current CloudNode
.type
- the TypeRelevance
object that should be removed.public void clearTypes()
CloudNode
.public KeywordRelevance addKeyword(Integer termId, String termValue, Double relevance)
Add a keyword (represented by the class EsTerm
) to this node.
termId
- the identifier of the added Term
in the correlated KC database.termValue
- the string representation of the added term.EsTerm
class)KeywordRelevance
@Deprecated public KeywordRelevance addEsTerm(Integer termId, String termValue, Double relevance)
addKeyword(Integer, String, Double)
.public KeywordRelevance getKeyword(String keywordValue)
CloudNode
represented by the keyword value
keywordValue
.keywordValue
- the keyword of the required KeywordRelevance
(e.g., "Computer Science").KeywordRelevance
class representing the relevance of the required keyword for the current CloudNode
.public boolean removeKeyword(String keyword)
CloudNode
represented by the keyword
and removes it.keyword
- the keyword that should be removed.public boolean removeKeyword(KeywordRelevance kr)
KeywordRelevance
from the current CloudNode
.kr
- the KeywordRelevance
object that should be removed.public void clearKeywords()
CloudNode
.public void clearEssentials()
CloudNode
.public Set<CloudEdge> getEdges()
Get the set of edges having this node as a source 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 SortedSet<TypeRelevance> 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<TypeRelevance> types)
types
- the set of all types connected with this node.public SortedSet<KeywordRelevance> 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<KeywordRelevance> keywords)
keywords
- the set of all types connected with this node.public double getSimilarity()
public void setSimilarity(double similarity)
public double getConfidence()
public void setConfidence(double confidence)