reasoner
Class OpQuery

java.lang.Object
  extended by reasoner.OpQuery
All Implemented Interfaces:
Query

public class OpQuery
extends java.lang.Object
implements Query

This class represents a Query in the form (Q)AopB, where A and B are ConcreteConcept, op is binary operator between Concepts and Q is Quantifier.

Author:
marco furlan

Field Summary
private  Concept c1
          The first Concept
private  Concept c2
          The second Concept
private  Concept d
           
private  java.text.NumberFormat formatter
           
private  Role is
           
private  KnowledgeBase kb
          The KnowledgeBase
private  java.util.Map<java.lang.String,java.lang.Double> lastvalues
          The last value map, for incremental evaluation
private  java.lang.String operator
          The operator
private  Quantifier q
          The Quantifier
private  ConcreteConcept tc1
          The first ConcreteConcept
private  ConcreteConcept tc2
          The second ConcreteConcept
 
Constructor Summary
OpQuery(ConcreteConcept tc1, java.lang.String operator, ConcreteConcept tc2, KnowledgeBase kb)
          Constructor by two ConcreteConcepts, binary operator and KnowledgeBase
OpQuery(Quantifier q, ConcreteConcept tc1, java.lang.String operator, ConcreteConcept tc2, KnowledgeBase kb)
          Constructor by Quantifier, two ConcreteConcepts, binary operator and KnowledgeBase
 
Method Summary
 double evaluate()
          Evaluates this Query.
 java.lang.String evaluateString(boolean incremental)
          Evaluates this OpQuery and returns a String result.
 Concept getC1()
           
 Concept getC2()
           
 Concept getD()
           
 Role getIs()
           
 KnowledgeBase getKb()
           
 java.util.Map<java.lang.String,java.lang.Double> getLastvalues()
           
 java.lang.String getMeaning()
          Gives a String about this Query meaning
 java.lang.String getOperator()
           
 Quantifier getQ()
           
 ConcreteConcept getTc1()
           
 ConcreteConcept getTc2()
           
 void setC1(Concept c1)
           
 void setC2(Concept c2)
           
 void setD(Concept d)
           
 void setIs(Role r)
           
 void setKb(KnowledgeBase kb)
           
 void setLastvalues(java.util.Map<java.lang.String,java.lang.Double> lastvalues)
           
 void setOperator(java.lang.String operator)
           
 void setQ(Quantifier q)
           
 void setTc1(ConcreteConcept tc1)
           
 void setTc2(ConcreteConcept tc2)
           
 java.lang.String toString()
          Gives a String representation for this Query
private  Concept trap2Concept(ConcreteConcept tc)
          Converts a ConcreteConcept in a Concept
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tc1

private ConcreteConcept tc1
The first ConcreteConcept


tc2

private ConcreteConcept tc2
The second ConcreteConcept


c1

private Concept c1
The first Concept


c2

private Concept c2
The second Concept


q

private Quantifier q
The Quantifier


operator

private java.lang.String operator
The operator


kb

private KnowledgeBase kb
The KnowledgeBase


lastvalues

private java.util.Map<java.lang.String,java.lang.Double> lastvalues
The last value map, for incremental evaluation


is

private Role is

d

private Concept d

formatter

private java.text.NumberFormat formatter
Constructor Detail

OpQuery

public OpQuery(ConcreteConcept tc1,
               java.lang.String operator,
               ConcreteConcept tc2,
               KnowledgeBase kb)
Constructor by two ConcreteConcepts, binary operator and KnowledgeBase

Parameters:
tc1 - the first ConcreteConcept
operator - the operator
tc2 - the second ConcreteConcept
kb - the KnowledgeBase

OpQuery

public OpQuery(Quantifier q,
               ConcreteConcept tc1,
               java.lang.String operator,
               ConcreteConcept tc2,
               KnowledgeBase kb)
Constructor by Quantifier, two ConcreteConcepts, binary operator and KnowledgeBase

Parameters:
q - the Quantifier
tc1 - the first ConcreteConcept
operator - the operator
tc2 - the second ConcreteConcept
kb - the KnowledgeBase
Method Detail

trap2Concept

private Concept trap2Concept(ConcreteConcept tc)
Converts a ConcreteConcept in a Concept

Parameters:
tc - the ConcreteConcept
Returns:
the Concept

evaluate

public double evaluate()
Description copied from interface: Query
Evaluates this Query.

Specified by:
evaluate in interface Query
Returns:
the result

evaluateString

public java.lang.String evaluateString(boolean incremental)
Evaluates this OpQuery and returns a String result.

Parameters:
incremental - if true then incremental evaluation
Returns:
the result

getOperator

public java.lang.String getOperator()
Returns:
the operator

setOperator

public void setOperator(java.lang.String operator)
Parameters:
operator - the operator to set

getTc1

public ConcreteConcept getTc1()
Returns:
the tc1

setTc1

public void setTc1(ConcreteConcept tc1)
Parameters:
tc1 - the tc1 to set

getTc2

public ConcreteConcept getTc2()
Returns:
the tc2

setTc2

public void setTc2(ConcreteConcept tc2)
Parameters:
tc2 - the tc2 to set

toString

public java.lang.String toString()
Description copied from interface: Query
Gives a String representation for this Query

Specified by:
toString in interface Query
Overrides:
toString in class java.lang.Object
Returns:
the String

getMeaning

public java.lang.String getMeaning()
Description copied from interface: Query
Gives a String about this Query meaning

Specified by:
getMeaning in interface Query
Returns:
the meaning

getKb

public KnowledgeBase getKb()
Returns:
the kb

setKb

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

getC1

public Concept getC1()
Returns:
the c1

setC1

public void setC1(Concept c1)
Parameters:
c1 - the c1 to set

getC2

public Concept getC2()
Returns:
the c2

setC2

public void setC2(Concept c2)
Parameters:
c2 - the c2 to set

getLastvalues

public java.util.Map<java.lang.String,java.lang.Double> getLastvalues()
Returns:
the lastvalues

setLastvalues

public void setLastvalues(java.util.Map<java.lang.String,java.lang.Double> lastvalues)
Parameters:
lastvalues - the lastvalues to set

getQ

public Quantifier getQ()
Returns:
the q

setQ

public void setQ(Quantifier q)
Parameters:
q - the q to set

getD

public Concept getD()
Returns:
the d

setD

public void setD(Concept d)
Parameters:
d - the d to set

getIs

public Role getIs()
Returns:
the is

setIs

public void setIs(Role r)
Parameters:
r - the r to set