sofie.maxsat
Class Hypothesis

java.lang.Object
  extended by sofie.maxsat.Hypothesis
All Implemented Interfaces:
java.lang.Comparable<Hypothesis>
Direct Known Subclasses:
Literal

public class Hypothesis
extends java.lang.Object
implements java.lang.Comparable<Hypothesis>

Class Hypothesis This class is part of the SOFIE system (http://mpii.de/yago-naga/sofie). It is licensed under the Creative Commons Attribution-Noncommercial-Share-Alike 3.0 Unported License (http://creativecommons.org/licenses/by-nc-sa/3.0/) by Fabian M. Suchanek (http://suchanek.name). If you use this class for scientific purposes, please cite Fabian M. Suchanek, Mauro Sozio, Gerhard Weikum "SOFIE: A Self-Organizing Framework for Information Extraction" (International World Wide Web Conference 2009) This class prepresents a hypothesis with 2 or more arguments for SOFIE.


Nested Class Summary
static class Hypothesis.Truth
          3-valued Truth values
 
Field Summary
protected  java.util.List<java.lang.String> components
          Holds the relation followed by the arguments
static basics.datagraph.Relation DISAMBIGUATEDAS
          Special Relation: disambiguatedAs(wordInContext,entity)
static basics.datagraph.Relation DISAMBIGUATIONPRIOR
          Special Relation: disambiguationPrior(wordInContext,entity)
static basics.datagraph.Relation FLAGSET
          Special Relation: flagSet(flagName)
static basics.datagraph.Relation PATTERNOCCURRENCES
          Special Relation: patternOccurrences(patternId,x,y,count)
protected  double priority
          Holds the priority of this hypothesis
protected  basics.datagraph.Relation relation
          Holds the relation, if it is a registered relation
protected  double value
          Holds the confidence value
static basics.datagraph.LiteralYagoClass WORDINCONTEXT
          Special class for wordInContext
 
Constructor Summary
  Hypothesis(boolean value, java.util.List<java.lang.String> components)
          Constructs a fact
  Hypothesis(boolean value, basics.datagraph.Relation rel, java.lang.String... args)
          Constructs a fact
  Hypothesis(boolean value, java.lang.String... components)
          Constructs a fact
  Hypothesis(double value, java.util.List<java.lang.String> components)
          Constructs a fact
  Hypothesis(double value, basics.datagraph.Relation rel, java.lang.String... args)
          Constructs a fact
  Hypothesis(double value, java.lang.String... components)
          Constructs a fact
protected Hypothesis(Hypothesis hyp)
          Copies a hypothesis
  Hypothesis(java.lang.String... components)
          Constructs a fact
 
Method Summary
 java.lang.String arg(int i)
          Returns the i-th argument (0-based)
 int compareTo(Hypothesis o)
          Standard compareTo
 java.lang.String component(int i)
          Returns the i-th component (0-based)
 java.util.List<java.lang.String> components()
          Returns the components
 boolean containsPolysem()
          TRUE is any component is a polysem
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 boolean hasVirtualRelation()
          TRUE if the relation is virtual
static boolean isEntity(java.lang.String s)
          True if a string is not null and starts not with a '^'
static boolean isPolysem(java.lang.String s)
          True if a string starts with a '^'
static boolean isString(java.lang.String s)
          True if a string is not null and starts with a '"'
static boolean isVariable(java.lang.String s)
          True if a string starts with a '?'
 int numArgs()
          Returns the number of arguments
 int numComponents()
          Returns the number of components
 double priority()
          Returns the priority
 basics.datagraph.Relation relationIfKnown()
          Returns the relation
 java.lang.String relationName()
          Returns the relation name (or variable)
 void saveTo(long id, javatools.filehandlers.CSVFile out)
          Stores a hypothesis with 2 arguments to writer
 void saveTo(long id, javatools.database.Database.Inserter hypBulki)
          Stores a hypothesis with 2 arguments to a database
 void setPriority(double v)
          Sets the priority
static void setRelations()
          Adds the relations to the gloabl contains
 double setValue(boolean v)
          Sets the value
 double setValue(double v)
          Sets the value
 double setValue(Hypothesis.Truth v)
          Sets the value
 java.lang.String toString()
           
 boolean trace()
          TRUE for hypotheses that are to be traced
 double value()
          Returns the current value
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

WORDINCONTEXT

public static final basics.datagraph.LiteralYagoClass WORDINCONTEXT
Special class for wordInContext


PATTERNOCCURRENCES

public static final basics.datagraph.Relation PATTERNOCCURRENCES
Special Relation: patternOccurrences(patternId,x,y,count)


FLAGSET

public static final basics.datagraph.Relation FLAGSET
Special Relation: flagSet(flagName)


DISAMBIGUATIONPRIOR

public static final basics.datagraph.Relation DISAMBIGUATIONPRIOR
Special Relation: disambiguationPrior(wordInContext,entity)


DISAMBIGUATEDAS

public static final basics.datagraph.Relation DISAMBIGUATEDAS
Special Relation: disambiguatedAs(wordInContext,entity)


components

protected java.util.List<java.lang.String> components
Holds the relation followed by the arguments


relation

protected basics.datagraph.Relation relation
Holds the relation, if it is a registered relation


value

protected double value
Holds the confidence value


priority

protected double priority
Holds the priority of this hypothesis

Constructor Detail

Hypothesis

protected Hypothesis(Hypothesis hyp)
Copies a hypothesis


Hypothesis

public Hypothesis(double value,
                  java.util.List<java.lang.String> components)
Constructs a fact


Hypothesis

public Hypothesis(double value,
                  java.lang.String... components)
Constructs a fact


Hypothesis

public Hypothesis(double value,
                  basics.datagraph.Relation rel,
                  java.lang.String... args)
Constructs a fact


Hypothesis

public Hypothesis(boolean value,
                  basics.datagraph.Relation rel,
                  java.lang.String... args)
Constructs a fact


Hypothesis

public Hypothesis(boolean value,
                  java.lang.String... components)
Constructs a fact


Hypothesis

public Hypothesis(java.lang.String... components)
Constructs a fact


Hypothesis

public Hypothesis(boolean value,
                  java.util.List<java.lang.String> components)
Constructs a fact

Method Detail

setRelations

public static void setRelations()
Adds the relations to the gloabl contains


trace

public boolean trace()
TRUE for hypotheses that are to be traced


isPolysem

public static boolean isPolysem(java.lang.String s)
True if a string starts with a '^'


isEntity

public static boolean isEntity(java.lang.String s)
True if a string is not null and starts not with a '^'


isString

public static boolean isString(java.lang.String s)
True if a string is not null and starts with a '"'


isVariable

public static boolean isVariable(java.lang.String s)
True if a string starts with a '?'


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

priority

public double priority()
Returns the priority


setPriority

public void setPriority(double v)
Sets the priority


value

public double value()
Returns the current value


setValue

public double setValue(double v)
Sets the value


setValue

public double setValue(boolean v)
Sets the value


setValue

public double setValue(Hypothesis.Truth v)
Sets the value


arg

public java.lang.String arg(int i)
Returns the i-th argument (0-based)


component

public java.lang.String component(int i)
Returns the i-th component (0-based)


components

public java.util.List<java.lang.String> components()
Returns the components


relationIfKnown

public basics.datagraph.Relation relationIfKnown()
Returns the relation


relationName

public java.lang.String relationName()
Returns the relation name (or variable)


numArgs

public int numArgs()
Returns the number of arguments


numComponents

public int numComponents()
Returns the number of components


hasVirtualRelation

public boolean hasVirtualRelation()
TRUE if the relation is virtual


compareTo

public int compareTo(Hypothesis o)
Standard compareTo

Specified by:
compareTo in interface java.lang.Comparable<Hypothesis>

containsPolysem

public boolean containsPolysem()
TRUE is any component is a polysem


saveTo

public void saveTo(long id,
                   javatools.database.Database.Inserter hypBulki)
            throws java.sql.SQLException
Stores a hypothesis with 2 arguments to a database

Throws:
java.sql.SQLException

saveTo

public void saveTo(long id,
                   javatools.filehandlers.CSVFile out)
            throws java.io.IOException
Stores a hypothesis with 2 arguments to writer

Throws:
java.io.IOException