reasoner
Class Concept

java.lang.Object
  extended by reasoner.Concept
All Implemented Interfaces:
FuzzySet
Direct Known Subclasses:
Dynamic, Static

public class Concept
extends java.lang.Object
implements FuzzySet

This class represents a logic Concept as a FuzzySet of Individual

Author:
marco furlan

Field Summary
private  java.util.Map<Individual,java.lang.Double> alwaysMap
          the always map
protected  java.util.Map<Individual,java.lang.Double> events
          the map of EventInd and values
protected  java.text.NumberFormat formatter
          utility formatter
protected static KnowledgeBase kb
          the Knowledge Base
private  java.lang.String name
          the concept name
protected static double NOW
          the constant _now_
protected static double SELF
          the constant _self_
private  java.util.Map<Individual,java.lang.Double> sometimeMap
          the sometime map
protected  java.util.Map<Individual,java.lang.Double> staticMap
          the map of StaticInd and values
protected  java.util.Map<Individual,java.lang.Double> uLineMap
          the map of ULineInd and values
 
Constructor Summary
Concept(java.util.Map<Individual,java.lang.Double> ev, java.lang.String name, KnowledgeBase kb)
          Constructs a Concept from the given map of EventInds and values and with a given name and in a given knowledge base
Concept(java.lang.String name, KnowledgeBase kb)
          Constructs an empty Concept, with a given name and in a given KnowledgeBase
 
Method Summary
 Concept add(Individual i, java.lang.Double d)
          Add an Individual to this Concept, with a given membership value
 double always(Individual ind)
          Returns the membership value of the given Individual on the logical expression [alwaysA(ind)], where A is this Concept, using the 'inf' semantics.
 java.lang.Integer card(java.lang.Double alpha, java.lang.String mode)
          Gives this Concept cardinality at an alpha level.
 boolean containsIndivName(java.lang.String name)
          Tests on existence of a given EventInd name in this Concept
 boolean containsKey(Individual key)
          Tests on existence of a given Individual, as EventInd or ULineInd or StaticInd, in this Concept
 double get(Individual key)
          Gives the membership value of the given Individual, 0.0 if it does not exist
 java.util.Map<Individual,java.lang.Double> getAlwaysMap()
           
 java.util.Map<Individual,java.lang.Double> getEvents()
           
 java.util.Set<Individual> getEvKeys()
           
static KnowledgeBase getKb()
           
 java.util.TreeSet<java.lang.Double> getLambda()
          Gives Lambda, the alpha values set, for the EventInds only
private  Individual getLastAlways(ULineEvent ul)
          Returns the last Individual, belonging to the given ULineEvent, for which the always value has been evaluated.
private  Individual getLastSometime(ULineEvent ul)
          Returns the last Individual, belonging to the given ULineEvent, for which the sometime value has been evaluated.
 java.lang.String getName()
          Gives this Concept name
 Concept getNextConcept(Individual ind)
          Returns a new Concept being NextConcept for this Concept, for Individuals preceeding the given Individual.
static double getNOW()
           
static double getSELF()
           
 java.util.Map<Individual,java.lang.Double> getSometimeMap()
           
 java.util.Map<Individual,java.lang.Double> getStaticMap()
           
 java.util.Map<Individual,java.lang.Double> getULineMap()
           
 java.util.Set<Individual> getUlKeys()
           
 java.util.TreeSet<java.lang.Double> getUlLambda()
          Gives Lambda, the alpha values set, for the ULineInds only
 Point interpole()
          Constructs an ArrayList of Points, containing Concept values, and, with it, produces a linear interpolation.
 Concept intersection(Concept c)
          The intersection between this Concept and a given second one
 void print()
          Prints on the standard output a String representation for this Concept, with all EventInds and values.
 void printUlines()
          Prints on the standard output a String representation for this Concept, with all ULineInds and values.
 void setAlwaysMap(java.util.Map<Individual,java.lang.Double> alwaysMap)
           
 void setEvents(java.util.Map<Individual,java.lang.Double> ev)
           
private  void setFormatter(int number)
           
static void setKb(KnowledgeBase kkb)
           
 void setName(java.lang.String name)
          Sets this Concept name
static void setNOW(double now)
           
static void setSELF(double self)
           
 void setSometimeMap(java.util.Map<Individual,java.lang.Double> sometimeMap)
           
 void setStaticMap(java.util.Map<Individual,java.lang.Double> staticMap)
           
 void setULineMap(java.util.Map<Individual,java.lang.Double> lineMap)
           
 double sometime(Individual ind)
          Returns the membership value of the given Individual on the logical expression [sometimeA(ind)], where A is this Concept, using the 'sup' semantics.
 double subsumed(Concept c)
          Gives the subsumption value for this Concept in a given second one
 double subsumed(Quantifier q, Concept c)
          Returns the quantified subsumption value for this Concept in a given second one, given the quantifier.
 java.lang.String toString()
           
 java.util.TreeSet<java.lang.Double> totalLambda(Concept c)
          Gets the union set of alpha-values belonging to this Concept and to a given other Concept, for the EventInds only
 java.util.TreeSet<java.lang.Double> totalUlLambda(Concept c)
          gets the total set of alpha-values belonging to this Concept and to a given other concept, for the ULine Individuals only
 double until(Concept b, Individual ind)
          Return the evaluation of the logical expression [A until B(ind)], where A is this Concept, B is a given Concept, ind is the Individual for which expression has to be evaluted.
 double until(Concept b, Individual ind, double lastUntil)
          Returns the evaluation of the logical expression [A until B(ind)], where A is this Concept, B is a given other Concept, ind is the Individual for which expression has to be evaluated; lastUntil is the given expression value for the last (previous) Individual with respect to ind.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

events

protected java.util.Map<Individual,java.lang.Double> events
the map of EventInd and values


uLineMap

protected java.util.Map<Individual,java.lang.Double> uLineMap
the map of ULineInd and values


staticMap

protected java.util.Map<Individual,java.lang.Double> staticMap
the map of StaticInd and values


sometimeMap

private java.util.Map<Individual,java.lang.Double> sometimeMap
the sometime map


alwaysMap

private java.util.Map<Individual,java.lang.Double> alwaysMap
the always map


name

private java.lang.String name
the concept name


kb

protected static KnowledgeBase kb
the Knowledge Base


NOW

protected static double NOW
the constant _now_


SELF

protected static double SELF
the constant _self_


formatter

protected java.text.NumberFormat formatter
utility formatter

Constructor Detail

Concept

public Concept(java.lang.String name,
               KnowledgeBase kb)
Constructs an empty Concept, with a given name and in a given KnowledgeBase

Parameters:
name - the name
kb - the KnowledgeBase

Concept

public Concept(java.util.Map<Individual,java.lang.Double> ev,
               java.lang.String name,
               KnowledgeBase kb)
Constructs a Concept from the given map of EventInds and values and with a given name and in a given knowledge base

Parameters:
ev - the given map of EventInds and values
name - the name
kb - the knowledge base
Method Detail

setFormatter

private void setFormatter(int number)

getName

public java.lang.String getName()
Gives this Concept name

Returns:
the name

setName

public void setName(java.lang.String name)
Sets this Concept name

Parameters:
name - the name to set

sometime

public double sometime(Individual ind)
Returns the membership value of the given Individual on the logical expression [sometimeA(ind)], where A is this Concept, using the 'sup' semantics.

Parameters:
ind - the given Individual
Returns:
the membership value

always

public double always(Individual ind)
Returns the membership value of the given Individual on the logical expression [alwaysA(ind)], where A is this Concept, using the 'inf' semantics.

Parameters:
ind - the given Individual
Returns:
the membership value

getLastSometime

private Individual getLastSometime(ULineEvent ul)
Returns the last Individual, belonging to the given ULineEvent, for which the sometime value has been evaluated.

Parameters:
ul - the given ULineEvent
Returns:
the last Individual

getLastAlways

private Individual getLastAlways(ULineEvent ul)
Returns the last Individual, belonging to the given ULineEvent, for which the always value has been evaluated.

Parameters:
ul - the given ULineEvent
Returns:
the last Individual

until

public double until(Concept b,
                    Individual ind,
                    double lastUntil)
Returns the evaluation of the logical expression [A until B(ind)], where A is this Concept, B is a given other Concept, ind is the Individual for which expression has to be evaluated; lastUntil is the given expression value for the last (previous) Individual with respect to ind. Operator Until has the weak and inclusive definition. Algorithm is incremental and dynamic: has last values memory.

Parameters:
b - the Concept B
ind - the Individual
lastUntil - the last value
Returns:
the until evaluation

until

public double until(Concept b,
                    Individual ind)
Return the evaluation of the logical expression [A until B(ind)], where A is this Concept, B is a given Concept, ind is the Individual for which expression has to be evaluted. Operator Until has the weak and inclusive definition. Algorithm is incremental and not dynamic: without memory, scan all the ULineEvent history.

Parameters:
b - the Concept B
ind - the Individual
Returns:
the until evaluation

add

public Concept add(Individual i,
                   java.lang.Double d)
Add an Individual to this Concept, with a given membership value

Parameters:
i - the Individual
d - the membership value
Returns:
this Concept after adding Individual

card

public java.lang.Integer card(java.lang.Double alpha,
                              java.lang.String mode)
Gives this Concept cardinality at an alpha level. If mode = "any", evaluation on all Events; if mode = "now", evaluation on now Events; if mode = "ul", evaluation on ULines

Specified by:
card in interface FuzzySet
Parameters:
alpha - the alpha level
mode - the mode
Returns:
the integer number cardinality of the alpha-set

interpole

public Point interpole()
Constructs an ArrayList of Points, containing Concept values, and, with it, produces a linear interpolation.

Returns:
a new Point as the couple [angular coefficient, intercept]

getEvKeys

public java.util.Set<Individual> getEvKeys()
Returns:
a TreeSet as the this Concept EventInd set.

getUlKeys

public java.util.Set<Individual> getUlKeys()
Returns:
a TreeSet as the this Concept ULineInd set.

getLambda

public java.util.TreeSet<java.lang.Double> getLambda()
Gives Lambda, the alpha values set, for the EventInds only

Specified by:
getLambda in interface FuzzySet
Returns:
Lambda as a TreeSet

totalLambda

public java.util.TreeSet<java.lang.Double> totalLambda(Concept c)
Gets the union set of alpha-values belonging to this Concept and to a given other Concept, for the EventInds only

Parameters:
c - the Concept
Returns:
the union Lambda as a TreeSet

getUlLambda

public java.util.TreeSet<java.lang.Double> getUlLambda()
Gives Lambda, the alpha values set, for the ULineInds only

Returns:
Lambda as a TreeSet

totalUlLambda

public java.util.TreeSet<java.lang.Double> totalUlLambda(Concept c)
gets the total set of alpha-values belonging to this Concept and to a given other concept, for the ULine Individuals only

Parameters:
c - the given Concept
Returns:
Lambda as a TreeSet

intersection

public Concept intersection(Concept c)
The intersection between this Concept and a given second one

Parameters:
c - the given second Concept
Returns:
a new Concept intersection

containsKey

public boolean containsKey(Individual key)
Tests on existence of a given Individual, as EventInd or ULineInd or StaticInd, in this Concept

Parameters:
key - the Individual
Returns:
true if key is in, otherwise false

containsIndivName

public boolean containsIndivName(java.lang.String name)
Tests on existence of a given EventInd name in this Concept

Parameters:
name - the name as String
Returns:
true if any EventInd with this name is in, false otherwise

get

public double get(Individual key)
Gives the membership value of the given Individual, 0.0 if it does not exist

Parameters:
key - the Individual
Returns:
the membership value

subsumed

public double subsumed(Concept c)
Gives the subsumption value for this Concept in a given second one

Parameters:
c - the subsuming Concept
Returns:
the value as double

subsumed

public double subsumed(Quantifier q,
                       Concept c)
Returns the quantified subsumption value for this Concept in a given second one, given the quantifier.

Parameters:
q - the Quantifier
c - the subsuming Concept
Returns:
the value as double

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a String representation for this Concept, with all EventInds and values

print

public void print()
Prints on the standard output a String representation for this Concept, with all EventInds and values.


printUlines

public void printUlines()
Prints on the standard output a String representation for this Concept, with all ULineInds and values.


getNextConcept

public Concept getNextConcept(Individual ind)
Returns a new Concept being NextConcept for this Concept, for Individuals preceeding the given Individual. If the given Individual is ULineInd, then NextConcept is for all the Individuals.

Parameters:
ind - the Individual
Returns:
the NextConcept

getEvents

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

setEvents

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

getULineMap

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

setULineMap

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

getKb

public static KnowledgeBase getKb()
Returns:
the kb

setKb

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

getNOW

public static double getNOW()
Returns:
the NOW

setNOW

public static void setNOW(double now)
Parameters:
now - the NOW to set

getSELF

public static double getSELF()
Returns:
the SELF

setSELF

public static void setSELF(double self)
Parameters:
self - the SELF to set

getSometimeMap

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

setSometimeMap

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

getAlwaysMap

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

setAlwaysMap

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

getStaticMap

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

setStaticMap

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