Package org.aksw.limes.core.io.ls
Class LinkSpecification
- java.lang.Object
-
- org.aksw.limes.core.io.ls.LinkSpecification
-
- All Implemented Interfaces:
ILinkSpecification,Clonable<ILinkSpecification>
- Direct Known Subclasses:
ExtendedLinkSpecification
public class LinkSpecification extends Object implements ILinkSpecification
- Version:
- Nov 12, 2015
- Author:
- Mohamed Sherif (sherif@informatik.uni-leipzig.de), Klaus Lyko (lyko@informatik.uni-leipzig.de)
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringADDprotected static StringANDprotected StringatomicMeasureprotected List<LinkSpecification>childrenprotected List<LinkSpecification>dependenciesprotected StringfilterExpressionprotected StringfullExpressionprotected static StringMAXprotected static StringMINprotected static StringMINUSprotected LogicOperatoroperatorprotected static StringORprotected LinkSpecificationparentprotected Stringprop1protected Stringprop2protected doublequalityprotected doublethresholdprotected StringtreePathprotected static StringXOR
-
Constructor Summary
Constructors Constructor Description LinkSpecification()LinkSpecification(String measure, double threshold)Creates a spec with a measure read inside
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChild(LinkSpecification spec)Adds a child to the current node of the specvoidaddDependency(LinkSpecification spec)Adds a child to the current node of the specLinkSpecificationclone()Generates a clone of the current specintcompareTo(Object o)booleancontainsRedundantProperties()Checks of at least two leaves compare the same properties, possibly with different measures though.booleanequals(Object other)List<LinkSpecification>getAllLeaves()Returns all leaves of the link specStringgetAtomicMeasure()List<LinkSpecification>getChildren()List<LinkSpecification>getDependencies()intgetDepth()StringgetFilterExpression()StringgetFullExpression()doublegetLowThreshold()StringgetMeasure()LogicOperatorgetOperator()LinkSpecificationgetParent()StringgetProperty1()StringgetProperty2()doublegetQuality()StringgetShortendFilterExpression()doublegetThreshold()StringgetTreePath()booleanhasDependencies()Checks whether a spec has dependenciesinthashCode()Computes a hashCode for the current specbooleanisAtomic()booleanisEmpty()booleanisRoot()Checks whether the current node is the root of the whole specvoidpathOfAtomic()Create the path of operators for each leaf specvoidreadSpec(String spec, double theta)Reads a spec expression into its canonical form Don't forget to optimize the filters by checking (if threshold_left and threshold_right grater than or equal to theta, then theta = 0)voidremoveDependency(LinkSpecification spec)Removes a dependency from the list of dependenciesvoidsetAtomicFilterExpression(String atomicMeasure, String prop1, String prop2)voidsetAtomicMeasure(String atomicMeasure)voidsetChildren(List<LinkSpecification> children)voidsetDependencies(List<LinkSpecification> dependencies)voidsetFullExpression(String fullExpression)LinkSpecificationsetLeaf(LinkSpecification leaf, int n)voidsetLowThreshold(double lowThreshold)voidsetOperator(LogicOperator operator)voidsetParent(LinkSpecification parent)voidsetQuality(double quality)voidsetThreshold(double threshold)voidsetTreePath(String treePath)intsize()Returns size of the spec, i.e., 1 for atomic spec, 0 for empty spec and else 1 + sum of size of all childrenStringtoString()StringtoStringOneLine()StringtoStringPretty()
-
-
-
Field Detail
-
MAX
protected static final String MAX
- See Also:
- Constant Field Values
-
OR
protected static final String OR
- See Also:
- Constant Field Values
-
ADD
protected static final String ADD
- See Also:
- Constant Field Values
-
MINUS
protected static final String MINUS
- See Also:
- Constant Field Values
-
XOR
protected static final String XOR
- See Also:
- Constant Field Values
-
MIN
protected static final String MIN
- See Also:
- Constant Field Values
-
AND
protected static final String AND
- See Also:
- Constant Field Values
-
threshold
protected double threshold
-
operator
protected LogicOperator operator
-
children
protected List<LinkSpecification> children
-
dependencies
protected List<LinkSpecification> dependencies
-
filterExpression
protected String filterExpression
-
parent
protected LinkSpecification parent
-
quality
protected double quality
-
atomicMeasure
protected String atomicMeasure
-
prop1
protected String prop1
-
prop2
protected String prop2
-
treePath
protected String treePath
-
fullExpression
protected String fullExpression
-
-
Constructor Detail
-
LinkSpecification
public LinkSpecification()
-
LinkSpecification
public LinkSpecification(String measure, double threshold)
Creates a spec with a measure read inside- Parameters:
measure- String representation of the specthreshold- of the spec
-
-
Method Detail
-
getTreePath
public String getTreePath()
-
setTreePath
public void setTreePath(String treePath)
-
setAtomicFilterExpression
public void setAtomicFilterExpression(String atomicMeasure, String prop1, String prop2)
-
addChild
public void addChild(LinkSpecification spec)
Adds a child to the current node of the spec- Parameters:
spec- to be added
-
addDependency
public void addDependency(LinkSpecification spec)
Adds a child to the current node of the spec- Parameters:
spec- to be added
-
removeDependency
public void removeDependency(LinkSpecification spec)
Removes a dependency from the list of dependencies- Parameters:
spec- Input spec
-
hasDependencies
public boolean hasDependencies()
Checks whether a spec has dependencies- Returns:
- true if the spec has dependencies, false otherwise
-
isEmpty
public boolean isEmpty()
- Returns:
- True if the spec is empty, all false
-
isAtomic
public boolean isAtomic()
- Returns:
- True if the spec is a leaf (has no children), else false
-
pathOfAtomic
public void pathOfAtomic()
Create the path of operators for each leaf spec
-
readSpec
public void readSpec(String spec, double theta)
Reads a spec expression into its canonical form Don't forget to optimize the filters by checking (if threshold_left and threshold_right grater than or equal to theta, then theta = 0)- Parameters:
spec- expression to readtheta- Global threshold
-
getAllLeaves
public List<LinkSpecification> getAllLeaves()
Returns all leaves of the link spec- Returns:
- List of atomic spec, i.e., all leaves of the link spec
-
setLeaf
public LinkSpecification setLeaf(LinkSpecification leaf, int n)
-
size
public int size()
Returns size of the spec, i.e., 1 for atomic spec, 0 for empty spec and else 1 + sum of size of all children- Returns:
- Size of the current spec
-
hashCode
public int hashCode()
Computes a hashCode for the current spec
-
clone
public LinkSpecification clone()
Generates a clone of the current spec- Specified by:
clonein interfaceClonable<ILinkSpecification>- Overrides:
clonein classObject- Returns:
- Clone of current spec
-
toString
public String toString()
-
getDepth
public int getDepth()
-
toStringPretty
public String toStringPretty()
-
toStringOneLine
public String toStringOneLine()
- Returns:
- A string representation of the spec in a single line
-
isRoot
public boolean isRoot()
Checks whether the current node is the root of the whole spec- Returns:
- True if root, else false
-
getMeasure
public String getMeasure()
- Returns:
- the filter expression implemented in the spec
-
compareTo
public int compareTo(Object o)
- Specified by:
compareToin interfaceILinkSpecification
-
getShortendFilterExpression
public String getShortendFilterExpression()
-
getFilterExpression
public String getFilterExpression()
-
getAtomicMeasure
public String getAtomicMeasure()
- Returns:
- the atomicMeasure
-
setAtomicMeasure
public void setAtomicMeasure(String atomicMeasure)
- Parameters:
atomicMeasure- the atomicMeasure to set
-
containsRedundantProperties
public boolean containsRedundantProperties()
Checks of at least two leaves compare the same properties, possibly with different measures though.- Returns:
- true if two leaves compare the same properties, possibly with different measures
-
getThreshold
public double getThreshold()
-
setThreshold
public void setThreshold(double threshold)
-
getOperator
public LogicOperator getOperator()
-
setOperator
public void setOperator(LogicOperator operator)
-
getChildren
public List<LinkSpecification> getChildren()
-
setChildren
public void setChildren(List<LinkSpecification> children)
-
getDependencies
public List<LinkSpecification> getDependencies()
-
setDependencies
public void setDependencies(List<LinkSpecification> dependencies)
-
getFullExpression
public String getFullExpression()
-
setFullExpression
public void setFullExpression(String fullExpression)
-
getParent
public LinkSpecification getParent()
-
setParent
public void setParent(LinkSpecification parent)
-
getProperty1
public String getProperty1()
-
getProperty2
public String getProperty2()
-
getQuality
public double getQuality()
-
setQuality
public void setQuality(double quality)
-
getLowThreshold
public double getLowThreshold()
-
setLowThreshold
public void setLowThreshold(double lowThreshold)
-
-