reasoner
Class Role

java.lang.Object
  extended by reasoner.Role
All Implemented Interfaces:
FuzzySet
Direct Known Subclasses:
Distance

public class Role
extends java.lang.Object
implements FuzzySet

This class represents a role or, more exactly, the role projection over some individual, as a fuzzy set

Author:
marco furlan

Field Summary
private  KnowledgeBase kb
          The KnowledgeBase
private  java.lang.String name
          The role name
private  java.util.Map<Individual,java.lang.Double> r
          The map between Individuals and membership values
 
Constructor Summary
Role(KnowledgeBase kb)
          Constructs an empty Role
Role(java.lang.String name, KnowledgeBase kb)
          Constructs this Role by name and KnowledgeBase
Role(java.util.TreeMap<Individual,java.lang.Double> r, KnowledgeBase kb)
          Constructs this Role by map and KnowledgeBase
 
Method Summary
 Role add(Individual s, java.lang.Double d)
          Adds a [Individual, value] couple to this Role
 java.lang.Integer card(java.lang.Double a)
          The cardinality of this Role at an alpha level
 java.lang.Integer card(java.lang.Double alpha, java.lang.String mode)
          Gives the integer cardinality at the given alpha level.
 boolean containsInd(Individual key)
          Tests the given Individual existence in this Role
 double get(Individual ind)
          Gets membership value for a given Individual
 java.util.Set<Individual> getInds()
          Gets this Role set of Individuals
 KnowledgeBase getKb()
           
 java.util.TreeSet<java.lang.Double> getLambda()
          Gets the set lambda of alpha-values belonging to this Role
 java.lang.String getName()
           
 java.util.Map<Individual,java.lang.Double> getR()
           
 Role intersection(Concept c)
          Intersection between this Role and a Concept
 void print()
          Prints a string representation for this Role
 void setKb(KnowledgeBase kb)
           
 void setName(java.lang.String name)
           
 void setR(java.util.Map<Individual,java.lang.Double> r)
           
 java.lang.String toString()
          A String representation for this Role
 java.util.TreeSet<java.lang.Double> totalLambda(Concept c)
          Gets the union set of alpha-values belonging to this Role and to a Concept
 java.util.TreeSet<java.lang.Double> totalLambda(Role c)
          Gets the union set of alpha-values belonging to this Role and to a second Role
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

r

private java.util.Map<Individual,java.lang.Double> r
The map between Individuals and membership values


name

private java.lang.String name
The role name


kb

private KnowledgeBase kb
The KnowledgeBase

Constructor Detail

Role

public Role(java.lang.String name,
            KnowledgeBase kb)
Constructs this Role by name and KnowledgeBase

Parameters:
name - the name
kb - the KnowledgeBase

Role

public Role(java.util.TreeMap<Individual,java.lang.Double> r,
            KnowledgeBase kb)
Constructs this Role by map and KnowledgeBase

Parameters:
r - a map containing Individuals and membership values
kb - the KnowledgeBase

Role

public Role(KnowledgeBase kb)
Constructs an empty Role

Parameters:
kb - the KnowledgeBase
Method Detail

getName

public java.lang.String getName()
Returns:
the name

setName

public void setName(java.lang.String name)
Parameters:
name - the name to set

add

public Role add(Individual s,
                java.lang.Double d)
Adds a [Individual, value] couple to this Role

Parameters:
s - the Individual
d - the membership value
Returns:
this role after adding point

card

public java.lang.Integer card(java.lang.Double a)
The cardinality of this Role at an alpha level

Parameters:
a - the alpha value
Returns:
the integer number cardinality of the alpha-set

totalLambda

public java.util.TreeSet<java.lang.Double> totalLambda(Concept c)
Gets the union set of alpha-values belonging to this Role and to a Concept

Parameters:
c - the Concept
Returns:
the union set of alpha-values

totalLambda

public java.util.TreeSet<java.lang.Double> totalLambda(Role c)
Gets the union set of alpha-values belonging to this Role and to a second Role

Parameters:
c - the second Role
Returns:
the union set of alpha-values

getLambda

public java.util.TreeSet<java.lang.Double> getLambda()
Gets the set lambda of alpha-values belonging to this Role

Specified by:
getLambda in interface FuzzySet
Returns:
the set of alpha-values

getInds

public java.util.Set<Individual> getInds()
Gets this Role set of Individuals

Returns:
the set of Individuals

containsInd

public boolean containsInd(Individual key)
Tests the given Individual existence in this Role

Parameters:
key - the Individual
Returns:
true if this Role contains key, false otherwise

intersection

public Role intersection(Concept c)
Intersection between this Role and a Concept

Parameters:
c - the Concept
Returns:
a new Role intersection

get

public double get(Individual ind)
Gets membership value for a given Individual

Parameters:
ind - the Individual
Returns:
the membership value

print

public void print()
Prints a string representation for this Role


getKb

public KnowledgeBase getKb()
Returns:
the kb

setKb

public void setKb(KnowledgeBase kb)
Parameters:
kb - the kb to set

getR

public java.util.Map<Individual,java.lang.Double> getR()
Returns:
the r

setR

public void setR(java.util.Map<Individual,java.lang.Double> r)
Parameters:
r - the r to set

toString

public java.lang.String toString()
A String representation for this Role

Overrides:
toString in class java.lang.Object
Returns:
the String

card

public java.lang.Integer card(java.lang.Double alpha,
                              java.lang.String mode)
Description copied from interface: FuzzySet
Gives the integer cardinality at the given alpha level. The String mode operates selection over Individuals.

Specified by:
card in interface FuzzySet
Parameters:
alpha - the given alpha level
mode - the selecting String
Returns:
the cardinality