Added Similarity and Levenshstein
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@113653 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a1748af328
commit
5a6453f479
|
@ -10,6 +10,9 @@ import org.gcube.portlets.user.td.expressionwidget.client.operation.Operation;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.operation.OperationProperties;
|
import org.gcube.portlets.user.td.expressionwidget.client.operation.OperationProperties;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.operation.OperationsStore;
|
import org.gcube.portlets.user.td.expressionwidget.client.operation.OperationsStore;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources;
|
import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources;
|
||||||
|
import org.gcube.portlets.user.td.expressionwidget.client.threshold.Threshold;
|
||||||
|
import org.gcube.portlets.user.td.expressionwidget.client.threshold.ThresholdProperties;
|
||||||
|
import org.gcube.portlets.user.td.expressionwidget.client.threshold.ThresholdStore;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.condition.ConditionTypeMap;
|
import org.gcube.portlets.user.td.expressionwidget.shared.condition.ConditionTypeMap;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.exception.ConditionTypeMapException;
|
import org.gcube.portlets.user.td.expressionwidget.shared.exception.ConditionTypeMapException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
|
@ -61,6 +64,8 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
protected String itemIdSecondArg;
|
protected String itemIdSecondArg;
|
||||||
protected String itemIdFirstArgDate;
|
protected String itemIdFirstArgDate;
|
||||||
protected String itemIdSecondArgDate;
|
protected String itemIdSecondArgDate;
|
||||||
|
protected String itemIdComboThreshold;
|
||||||
|
|
||||||
protected String itemIdBtnAdd;
|
protected String itemIdBtnAdd;
|
||||||
protected String itemIdBtnDel;
|
protected String itemIdBtnDel;
|
||||||
protected VerticalLayoutContainer vert;
|
protected VerticalLayoutContainer vert;
|
||||||
|
@ -92,6 +97,7 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
itemIdSecondArg = "SecondArg" + column.getName();
|
itemIdSecondArg = "SecondArg" + column.getName();
|
||||||
itemIdFirstArgDate = "FirstArgDate" + column.getName();
|
itemIdFirstArgDate = "FirstArgDate" + column.getName();
|
||||||
itemIdSecondArgDate = "SecondArgDate" + column.getName();
|
itemIdSecondArgDate = "SecondArgDate" + column.getName();
|
||||||
|
itemIdComboThreshold = "ComboThreshold" + column.getName();
|
||||||
itemIdBtnAdd = "BtnAdd" + column.getName();
|
itemIdBtnAdd = "BtnAdd" + column.getName();
|
||||||
itemIdBtnDel = "BtnDel" + column.getName();
|
itemIdBtnDel = "BtnDel" + column.getName();
|
||||||
|
|
||||||
|
@ -122,7 +128,7 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
groupMatch.setValue(radioAll);
|
groupMatch.setValue(radioAll);
|
||||||
|
|
||||||
vert = new VerticalLayoutContainer();
|
vert = new VerticalLayoutContainer();
|
||||||
//vert.setScrollMode(ScrollMode.AUTO); Set In GXT 3.0.1
|
// vert.setScrollMode(ScrollMode.AUTO); Set In GXT 3.0.1
|
||||||
vert.setAdjustForScroll(true);
|
vert.setAdjustForScroll(true);
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
|
@ -156,6 +162,33 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
secondArgDate.setItemId(itemIdSecondArgDate);
|
secondArgDate.setItemId(itemIdSecondArgDate);
|
||||||
secondArgDate.setVisible(false);
|
secondArgDate.setVisible(false);
|
||||||
|
|
||||||
|
// Combo Similarity and Levenshtein threshold
|
||||||
|
ThresholdProperties propsThreshold = GWT
|
||||||
|
.create(ThresholdProperties.class);
|
||||||
|
Log.debug("Props: " + propsThreshold);
|
||||||
|
final ListStore<Threshold> storeThreshold = new ListStore<Threshold>(
|
||||||
|
propsThreshold.id());
|
||||||
|
Log.debug("StoreThreshold: " + storeThreshold);
|
||||||
|
storeThreshold.addAll(ThresholdStore.thresholdsLevenshtein);
|
||||||
|
|
||||||
|
Log.debug("StoreThreshold created");
|
||||||
|
final ComboBox<Threshold> comboThreshold = new ComboBox<Threshold>(
|
||||||
|
storeThreshold, propsThreshold.label());
|
||||||
|
|
||||||
|
Log.debug("Combo Threshold created");
|
||||||
|
|
||||||
|
comboThreshold.setEmptyText("Select a threshold...");
|
||||||
|
comboThreshold.setItemId(itemIdComboThreshold);
|
||||||
|
comboThreshold.setWidth("100px");
|
||||||
|
comboThreshold.setEditable(false);
|
||||||
|
comboThreshold.setTriggerAction(TriggerAction.ALL);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
|
|
||||||
|
final HTML thresholdText = new HTML(
|
||||||
|
"<div style='vertical-align:middle; margin-left:2px;margin-right:2px;margin-top:4px;'>Threshold:</div>");
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
|
||||||
|
// Button
|
||||||
final IconButton btnAdd = new IconButton();
|
final IconButton btnAdd = new IconButton();
|
||||||
btnAdd.setItemId(itemIdBtnAdd);
|
btnAdd.setItemId(itemIdBtnAdd);
|
||||||
btnAdd.setIcon(ExpressionResources.INSTANCE.add());
|
btnAdd.setIcon(ExpressionResources.INSTANCE.add());
|
||||||
|
@ -195,6 +228,7 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
});
|
});
|
||||||
btnDel.setVisible(false);
|
btnDel.setVisible(false);
|
||||||
|
|
||||||
|
// Operation
|
||||||
OperationProperties props = GWT.create(OperationProperties.class);
|
OperationProperties props = GWT.create(OperationProperties.class);
|
||||||
Log.debug("Props: " + props);
|
Log.debug("Props: " + props);
|
||||||
ListStore<Operation> storeOp = new ListStore<Operation>(props.id());
|
ListStore<Operation> storeOp = new ListStore<Operation>(props.id());
|
||||||
|
@ -238,10 +272,14 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
firstArgDate.setVisible(true);
|
firstArgDate.setVisible(true);
|
||||||
andText.setVisible(false);
|
andText.setVisible(false);
|
||||||
secondArgDate.setVisible(false);
|
secondArgDate.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
firstArg.setVisible(true);
|
firstArg.setVisible(true);
|
||||||
andText.setVisible(false);
|
andText.setVisible(false);
|
||||||
secondArg.setVisible(false);
|
secondArg.setVisible(false);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
}
|
}
|
||||||
btnAdd.setVisible(true);
|
btnAdd.setVisible(true);
|
||||||
btnDel.setVisible(true);
|
btnDel.setVisible(true);
|
||||||
|
@ -252,10 +290,66 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
firstArgDate.setVisible(false);
|
firstArgDate.setVisible(false);
|
||||||
andText.setVisible(false);
|
andText.setVisible(false);
|
||||||
secondArgDate.setVisible(false);
|
secondArgDate.setVisible(false);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
firstArg.setVisible(true);
|
firstArg.setVisible(true);
|
||||||
andText.setVisible(true);
|
andText.setVisible(true);
|
||||||
secondArg.setVisible(true);
|
secondArg.setVisible(true);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
|
}
|
||||||
|
btnAdd.setVisible(true);
|
||||||
|
btnDel.setVisible(true);
|
||||||
|
break;
|
||||||
|
case LEVENSHTEIN:
|
||||||
|
if (column.getDataTypeName().compareTo("Date") == 0) {
|
||||||
|
firstArgDate.setVisible(false);
|
||||||
|
andText.setVisible(false);
|
||||||
|
secondArgDate.setVisible(false);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
|
} else {
|
||||||
|
firstArg.setVisible(true);
|
||||||
|
andText.setVisible(false);
|
||||||
|
secondArg.setVisible(false);
|
||||||
|
thresholdText.setVisible(true);
|
||||||
|
storeThreshold.clear();
|
||||||
|
storeThreshold
|
||||||
|
.addAll(ThresholdStore.thresholdsLevenshtein);
|
||||||
|
storeThreshold.commitChanges();
|
||||||
|
comboThreshold.clear();
|
||||||
|
comboThreshold.reset();
|
||||||
|
comboThreshold.setVisible(true);
|
||||||
|
comboThreshold.setValue(ThresholdStore
|
||||||
|
.defaultThresholdLevenshtein());
|
||||||
|
|
||||||
|
}
|
||||||
|
btnAdd.setVisible(true);
|
||||||
|
btnDel.setVisible(true);
|
||||||
|
break;
|
||||||
|
case SIMILARITY:
|
||||||
|
if (column.getDataTypeName().compareTo("Date") == 0) {
|
||||||
|
firstArgDate.setVisible(false);
|
||||||
|
andText.setVisible(false);
|
||||||
|
secondArgDate.setVisible(false);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
|
} else {
|
||||||
|
firstArg.setVisible(true);
|
||||||
|
andText.setVisible(false);
|
||||||
|
secondArg.setVisible(false);
|
||||||
|
thresholdText.setVisible(true);
|
||||||
|
storeThreshold.clear();
|
||||||
|
storeThreshold
|
||||||
|
.addAll(ThresholdStore.thresholdsSimilarity);
|
||||||
|
storeThreshold.commitChanges();
|
||||||
|
comboThreshold.clear();
|
||||||
|
comboThreshold.reset();
|
||||||
|
comboThreshold.setVisible(true);
|
||||||
|
comboThreshold.setValue(ThresholdStore
|
||||||
|
.defaultThresholdSimilarity());
|
||||||
|
|
||||||
}
|
}
|
||||||
btnAdd.setVisible(true);
|
btnAdd.setVisible(true);
|
||||||
btnDel.setVisible(true);
|
btnDel.setVisible(true);
|
||||||
|
@ -266,10 +360,14 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
firstArgDate.setVisible(false);
|
firstArgDate.setVisible(false);
|
||||||
andText.setVisible(false);
|
andText.setVisible(false);
|
||||||
secondArgDate.setVisible(false);
|
secondArgDate.setVisible(false);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
firstArg.setVisible(false);
|
firstArg.setVisible(false);
|
||||||
andText.setVisible(false);
|
andText.setVisible(false);
|
||||||
secondArg.setVisible(false);
|
secondArg.setVisible(false);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
}
|
}
|
||||||
btnAdd.setVisible(true);
|
btnAdd.setVisible(true);
|
||||||
btnDel.setVisible(true);
|
btnDel.setVisible(true);
|
||||||
|
@ -296,10 +394,14 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
horiz.add(firstArgDate, new BoxLayoutData(new Margins(0)));
|
horiz.add(firstArgDate, new BoxLayoutData(new Margins(0)));
|
||||||
horiz.add(andText, new BoxLayoutData(new Margins(0)));
|
horiz.add(andText, new BoxLayoutData(new Margins(0)));
|
||||||
horiz.add(secondArgDate, new BoxLayoutData(new Margins(0)));
|
horiz.add(secondArgDate, new BoxLayoutData(new Margins(0)));
|
||||||
|
horiz.add(thresholdText, new BoxLayoutData(new Margins(0)));
|
||||||
|
horiz.add(comboThreshold, new BoxLayoutData(new Margins(0)));
|
||||||
} else {
|
} else {
|
||||||
horiz.add(firstArg, new BoxLayoutData(new Margins(0)));
|
horiz.add(firstArg, new BoxLayoutData(new Margins(0)));
|
||||||
horiz.add(andText, new BoxLayoutData(new Margins(0)));
|
horiz.add(andText, new BoxLayoutData(new Margins(0)));
|
||||||
horiz.add(secondArg, new BoxLayoutData(new Margins(0)));
|
horiz.add(secondArg, new BoxLayoutData(new Margins(0)));
|
||||||
|
horiz.add(thresholdText, new BoxLayoutData(new Margins(0)));
|
||||||
|
horiz.add(comboThreshold, new BoxLayoutData(new Margins(0)));
|
||||||
}
|
}
|
||||||
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 0, 2, 0)));
|
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 0, 2, 0)));
|
||||||
horiz.add(btnDel, new BoxLayoutData(new Margins(2, 0, 2, 0)));
|
horiz.add(btnDel, new BoxLayoutData(new Margins(2, 0, 2, 0)));
|
||||||
|
@ -340,6 +442,35 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
secondArgDate.setItemId(itemIdSecondArgDate);
|
secondArgDate.setItemId(itemIdSecondArgDate);
|
||||||
secondArgDate.setVisible(false);
|
secondArgDate.setVisible(false);
|
||||||
|
|
||||||
|
// Combo Similarity and Levenshtein threshold
|
||||||
|
ThresholdProperties propsThreshold = GWT
|
||||||
|
.create(ThresholdProperties.class);
|
||||||
|
Log.debug("Props: " + propsThreshold);
|
||||||
|
final ListStore<Threshold> storeThreshold = new ListStore<Threshold>(
|
||||||
|
propsThreshold.id());
|
||||||
|
Log.debug("StoreThreshold: " + storeThreshold);
|
||||||
|
storeThreshold.addAll(ThresholdStore.thresholdsLevenshtein);
|
||||||
|
|
||||||
|
Log.debug("StoreThreshold created");
|
||||||
|
final ComboBox<Threshold> comboThreshold = new ComboBox<Threshold>(
|
||||||
|
storeThreshold, propsThreshold.label());
|
||||||
|
|
||||||
|
Log.debug("Combo Threshold created");
|
||||||
|
|
||||||
|
comboThreshold.setEmptyText("Select a threshold...");
|
||||||
|
comboThreshold.setItemId(itemIdComboThreshold);
|
||||||
|
comboThreshold.setWidth("100px");
|
||||||
|
comboThreshold.setEditable(false);
|
||||||
|
comboThreshold.setTriggerAction(TriggerAction.ALL);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
|
final HTML thresholdText = new HTML(
|
||||||
|
"<div style='vertical-align:middle; margin-left:2px;margin-right:2px;margin-top:4px;'>Threshold:</div>");
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
|
// Button
|
||||||
final IconButton btnAdd = new IconButton();
|
final IconButton btnAdd = new IconButton();
|
||||||
btnAdd.setItemId(itemIdBtnAdd);
|
btnAdd.setItemId(itemIdBtnAdd);
|
||||||
btnAdd.setIcon(ExpressionResources.INSTANCE.add());
|
btnAdd.setIcon(ExpressionResources.INSTANCE.add());
|
||||||
|
@ -420,10 +551,14 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
firstArgDate.setVisible(true);
|
firstArgDate.setVisible(true);
|
||||||
andText.setVisible(false);
|
andText.setVisible(false);
|
||||||
secondArgDate.setVisible(false);
|
secondArgDate.setVisible(false);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
firstArg.setVisible(true);
|
firstArg.setVisible(true);
|
||||||
andText.setVisible(false);
|
andText.setVisible(false);
|
||||||
secondArg.setVisible(false);
|
secondArg.setVisible(false);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
}
|
}
|
||||||
btnAdd.setVisible(true);
|
btnAdd.setVisible(true);
|
||||||
btnDel.setVisible(true);
|
btnDel.setVisible(true);
|
||||||
|
@ -434,10 +569,66 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
firstArgDate.setVisible(false);
|
firstArgDate.setVisible(false);
|
||||||
andText.setVisible(false);
|
andText.setVisible(false);
|
||||||
secondArgDate.setVisible(false);
|
secondArgDate.setVisible(false);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
firstArg.setVisible(true);
|
firstArg.setVisible(true);
|
||||||
andText.setVisible(true);
|
andText.setVisible(true);
|
||||||
secondArg.setVisible(true);
|
secondArg.setVisible(true);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
|
}
|
||||||
|
btnAdd.setVisible(true);
|
||||||
|
btnDel.setVisible(true);
|
||||||
|
break;
|
||||||
|
case LEVENSHTEIN:
|
||||||
|
if (column.getDataTypeName().compareTo("Date") == 0) {
|
||||||
|
firstArgDate.setVisible(false);
|
||||||
|
andText.setVisible(false);
|
||||||
|
secondArgDate.setVisible(false);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
|
} else {
|
||||||
|
firstArg.setVisible(true);
|
||||||
|
andText.setVisible(false);
|
||||||
|
secondArg.setVisible(false);
|
||||||
|
thresholdText.setVisible(true);
|
||||||
|
storeThreshold.clear();
|
||||||
|
storeThreshold
|
||||||
|
.addAll(ThresholdStore.thresholdsLevenshtein);
|
||||||
|
storeThreshold.commitChanges();
|
||||||
|
comboThreshold.clear();
|
||||||
|
comboThreshold.reset();
|
||||||
|
comboThreshold.setVisible(true);
|
||||||
|
comboThreshold.setValue(ThresholdStore
|
||||||
|
.defaultThresholdLevenshtein());
|
||||||
|
|
||||||
|
}
|
||||||
|
btnAdd.setVisible(true);
|
||||||
|
btnDel.setVisible(true);
|
||||||
|
break;
|
||||||
|
case SIMILARITY:
|
||||||
|
if (column.getDataTypeName().compareTo("Date") == 0) {
|
||||||
|
firstArgDate.setVisible(false);
|
||||||
|
andText.setVisible(false);
|
||||||
|
secondArgDate.setVisible(false);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
|
} else {
|
||||||
|
firstArg.setVisible(true);
|
||||||
|
andText.setVisible(false);
|
||||||
|
secondArg.setVisible(false);
|
||||||
|
thresholdText.setVisible(true);
|
||||||
|
storeThreshold.clear();
|
||||||
|
storeThreshold
|
||||||
|
.addAll(ThresholdStore.thresholdsSimilarity);
|
||||||
|
storeThreshold.commitChanges();
|
||||||
|
comboThreshold.clear();
|
||||||
|
comboThreshold.reset();
|
||||||
|
comboThreshold.setVisible(true);
|
||||||
|
comboThreshold.setValue(ThresholdStore
|
||||||
|
.defaultThresholdSimilarity());
|
||||||
|
|
||||||
}
|
}
|
||||||
btnAdd.setVisible(true);
|
btnAdd.setVisible(true);
|
||||||
btnDel.setVisible(true);
|
btnDel.setVisible(true);
|
||||||
|
@ -448,10 +639,14 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
firstArgDate.setVisible(false);
|
firstArgDate.setVisible(false);
|
||||||
andText.setVisible(false);
|
andText.setVisible(false);
|
||||||
secondArgDate.setVisible(false);
|
secondArgDate.setVisible(false);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
firstArg.setVisible(false);
|
firstArg.setVisible(false);
|
||||||
andText.setVisible(false);
|
andText.setVisible(false);
|
||||||
secondArg.setVisible(false);
|
secondArg.setVisible(false);
|
||||||
|
thresholdText.setVisible(false);
|
||||||
|
comboThreshold.setVisible(false);
|
||||||
}
|
}
|
||||||
btnAdd.setVisible(true);
|
btnAdd.setVisible(true);
|
||||||
btnDel.setVisible(true);
|
btnDel.setVisible(true);
|
||||||
|
@ -478,10 +673,14 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
horiz.add(firstArgDate, new BoxLayoutData(new Margins(0)));
|
horiz.add(firstArgDate, new BoxLayoutData(new Margins(0)));
|
||||||
horiz.add(andText, new BoxLayoutData(new Margins(0)));
|
horiz.add(andText, new BoxLayoutData(new Margins(0)));
|
||||||
horiz.add(secondArgDate, new BoxLayoutData(new Margins(0)));
|
horiz.add(secondArgDate, new BoxLayoutData(new Margins(0)));
|
||||||
|
horiz.add(thresholdText, new BoxLayoutData(new Margins(0)));
|
||||||
|
horiz.add(comboThreshold, new BoxLayoutData(new Margins(0)));
|
||||||
} else {
|
} else {
|
||||||
horiz.add(firstArg, new BoxLayoutData(new Margins(0)));
|
horiz.add(firstArg, new BoxLayoutData(new Margins(0)));
|
||||||
horiz.add(andText, new BoxLayoutData(new Margins(0)));
|
horiz.add(andText, new BoxLayoutData(new Margins(0)));
|
||||||
horiz.add(secondArg, new BoxLayoutData(new Margins(0)));
|
horiz.add(secondArg, new BoxLayoutData(new Margins(0)));
|
||||||
|
horiz.add(thresholdText, new BoxLayoutData(new Margins(0)));
|
||||||
|
horiz.add(comboThreshold, new BoxLayoutData(new Margins(0)));
|
||||||
}
|
}
|
||||||
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 0, 2, 0)));
|
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 0, 2, 0)));
|
||||||
horiz.add(btnDel, new BoxLayoutData(new Margins(2, 0, 2, 0)));
|
horiz.add(btnDel, new BoxLayoutData(new Margins(2, 0, 2, 0)));
|
||||||
|
@ -490,6 +689,8 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public C_Expression getExpression() throws ConditionTypeMapException {
|
public C_Expression getExpression() throws ConditionTypeMapException {
|
||||||
C_Expression exp = null;
|
C_Expression exp = null;
|
||||||
readableExpression = new String();
|
readableExpression = new String();
|
||||||
|
@ -499,6 +700,8 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
TextField secondArg;
|
TextField secondArg;
|
||||||
DateField firstArgDate;
|
DateField firstArgDate;
|
||||||
DateField secondArgDate;
|
DateField secondArgDate;
|
||||||
|
ComboBox<Threshold> comboThreshold;
|
||||||
|
|
||||||
C_Expression expression;
|
C_Expression expression;
|
||||||
|
|
||||||
DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd");
|
DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd");
|
||||||
|
@ -508,7 +711,6 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
HBoxLayoutContainer horiz;
|
HBoxLayoutContainer horiz;
|
||||||
while (iteratorVert.hasNext()) {
|
while (iteratorVert.hasNext()) {
|
||||||
horiz = (HBoxLayoutContainer) iteratorVert.next();
|
horiz = (HBoxLayoutContainer) iteratorVert.next();
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
ComboBox<Operation> comboOp = (ComboBox<Operation>) horiz
|
ComboBox<Operation> comboOp = (ComboBox<Operation>) horiz
|
||||||
.getItemByItemId(itemIdCombo);
|
.getItemByItemId(itemIdCombo);
|
||||||
Log.debug("combo: " + comboOp.getCurrentValue().toString());
|
Log.debug("combo: " + comboOp.getCurrentValue().toString());
|
||||||
|
@ -527,18 +729,22 @@ public class ConditionWidget extends SimpleContainer {
|
||||||
expression = mapOp.map(column, comboOp.getCurrentValue()
|
expression = mapOp.map(column, comboOp.getCurrentValue()
|
||||||
.getOperatorType(),
|
.getOperatorType(),
|
||||||
firstDate == null ? null : sdf.format(firstDate),
|
firstDate == null ? null : sdf.format(firstDate),
|
||||||
secondDate == null ? null : sdf.format(secondDate));
|
secondDate == null ? null : sdf.format(secondDate)
|
||||||
|
,null);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
firstArg = (TextField) horiz.getItemByItemId(itemIdFirstArg);
|
firstArg = (TextField) horiz.getItemByItemId(itemIdFirstArg);
|
||||||
secondArg = (TextField) horiz.getItemByItemId(itemIdSecondArg);
|
secondArg = (TextField) horiz.getItemByItemId(itemIdSecondArg);
|
||||||
|
comboThreshold =(ComboBox<Threshold>) horiz.getItemByItemId(itemIdComboThreshold);
|
||||||
|
|
||||||
Log.debug("argLeft: " + firstArg.getCurrentValue()
|
Log.debug("argLeft: " + firstArg.getCurrentValue()
|
||||||
+ " argRight: " + secondArg.getCurrentValue());
|
+ " argRight: " + secondArg.getCurrentValue());
|
||||||
|
|
||||||
expression = mapOp.map(column, comboOp.getCurrentValue()
|
expression = mapOp.map(column, comboOp.getCurrentValue()
|
||||||
.getOperatorType(),
|
.getOperatorType(),
|
||||||
firstArg == null ? null : firstArg.getCurrentValue(),
|
firstArg == null ? null : firstArg.getCurrentValue(),
|
||||||
secondArg == null ? null : secondArg.getCurrentValue());
|
secondArg == null ? null : secondArg.getCurrentValue(),
|
||||||
|
comboThreshold.getCurrentValue()==null?null:comboThreshold.getCurrentValue());
|
||||||
}
|
}
|
||||||
readableExpressionList.add(mapOp.getReadableExpression());
|
readableExpressionList.add(mapOp.getReadableExpression());
|
||||||
Log.debug(expression.toString());
|
Log.debug(expression.toString());
|
||||||
|
|
|
@ -55,6 +55,8 @@ public class OperationsStore {
|
||||||
add(new Operation(15,"IN","The value is in",C_OperatorType.IN));
|
add(new Operation(15,"IN","The value is in",C_OperatorType.IN));
|
||||||
add(new Operation(16,"NOT_IN","The value is not in",C_OperatorType.NOT_IN));
|
add(new Operation(16,"NOT_IN","The value is not in",C_OperatorType.NOT_IN));
|
||||||
add(new Operation(17,"SOUNDEX","The soundex is equal to", C_OperatorType.SOUNDEX));
|
add(new Operation(17,"SOUNDEX","The soundex is equal to", C_OperatorType.SOUNDEX));
|
||||||
|
add(new Operation(18,"LEVENSHTEIN","Levenshtein", C_OperatorType.LEVENSHTEIN));
|
||||||
|
add(new Operation(19,"SIMILARITY","Similarity", C_OperatorType.SIMILARITY));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
protected ArrayList<Operation> operationsBoolean = new ArrayList<Operation>() {
|
protected ArrayList<Operation> operationsBoolean = new ArrayList<Operation>() {
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
package org.gcube.portlets.user.td.expressionwidget.client.threshold;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Threshold implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 3713817747863556150L;
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private Float value;
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
|
||||||
|
public Threshold(Integer id,Integer value,String label){
|
||||||
|
this.id=id;
|
||||||
|
this.value=new Float(value);
|
||||||
|
this.label=label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Threshold(Integer id,Float value, String label){
|
||||||
|
this.id=id;
|
||||||
|
this.value=value;
|
||||||
|
this.label=label;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIntegerValue() {
|
||||||
|
return value.intValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(Float value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Threshold [id=" + id + ", value=" + value + ", label=" + label
|
||||||
|
+ "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.gcube.portlets.user.td.expressionwidget.client.threshold;
|
||||||
|
|
||||||
|
import com.google.gwt.editor.client.Editor.Path;
|
||||||
|
import com.sencha.gxt.data.shared.LabelProvider;
|
||||||
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface ThresholdProperties extends PropertyAccess<Threshold> {
|
||||||
|
|
||||||
|
@Path("id")
|
||||||
|
ModelKeyProvider<Threshold> id();
|
||||||
|
|
||||||
|
LabelProvider<Threshold> label();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package org.gcube.portlets.user.td.expressionwidget.client.threshold;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ThresholdStore {
|
||||||
|
|
||||||
|
|
||||||
|
public static ArrayList<Threshold> thresholdsLevenshtein = new ArrayList<Threshold>() {
|
||||||
|
private static final long serialVersionUID = -6559885743626876431L;
|
||||||
|
{
|
||||||
|
add(new Threshold(1,1,"1"));
|
||||||
|
add(new Threshold(2,2,"2"));
|
||||||
|
add(new Threshold(3,3,"3"));
|
||||||
|
add(new Threshold(4,4,"4"));
|
||||||
|
add(new Threshold(5,5,"5"));
|
||||||
|
add(new Threshold(6,6,"6"));
|
||||||
|
add(new Threshold(7,7,"7"));
|
||||||
|
add(new Threshold(8,8,"8"));
|
||||||
|
add(new Threshold(9,9,"9"));
|
||||||
|
add(new Threshold(10,10,"10"));
|
||||||
|
}};
|
||||||
|
|
||||||
|
public static Threshold defaultThresholdLevenshtein(){
|
||||||
|
return new Threshold(2,2,"2");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static ArrayList<Threshold> thresholdsSimilarity = new ArrayList<Threshold>() {
|
||||||
|
private static final long serialVersionUID = -6559885743626876431L;
|
||||||
|
{
|
||||||
|
add(new Threshold(1,0.0f,"0"));
|
||||||
|
add(new Threshold(2,0.1f,"0.1"));
|
||||||
|
add(new Threshold(3,0.2f,"0.2"));
|
||||||
|
add(new Threshold(4,0.3f,"0.3"));
|
||||||
|
add(new Threshold(5,0.4f,"0.4"));
|
||||||
|
add(new Threshold(6,0.5f,"0.5"));
|
||||||
|
add(new Threshold(7,0.6f,"0.6"));
|
||||||
|
add(new Threshold(8,0.7f,"0.7"));
|
||||||
|
add(new Threshold(9,0.8f,"0.8"));
|
||||||
|
add(new Threshold(10,0.9f,"0.9"));
|
||||||
|
}};
|
||||||
|
|
||||||
|
public static Threshold defaultThresholdSimilarity(){
|
||||||
|
return new Threshold(9,0.8f,"0.8");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -28,8 +28,10 @@ import org.gcube.data.analysis.tabulardata.expression.composite.comparable.NotEq
|
||||||
import org.gcube.data.analysis.tabulardata.expression.composite.comparable.NotGreater;
|
import org.gcube.data.analysis.tabulardata.expression.composite.comparable.NotGreater;
|
||||||
import org.gcube.data.analysis.tabulardata.expression.composite.comparable.NotLess;
|
import org.gcube.data.analysis.tabulardata.expression.composite.comparable.NotLess;
|
||||||
import org.gcube.data.analysis.tabulardata.expression.composite.text.Concat;
|
import org.gcube.data.analysis.tabulardata.expression.composite.text.Concat;
|
||||||
|
import org.gcube.data.analysis.tabulardata.expression.composite.text.Levenshtein;
|
||||||
import org.gcube.data.analysis.tabulardata.expression.composite.text.Lower;
|
import org.gcube.data.analysis.tabulardata.expression.composite.text.Lower;
|
||||||
import org.gcube.data.analysis.tabulardata.expression.composite.text.MD5;
|
import org.gcube.data.analysis.tabulardata.expression.composite.text.MD5;
|
||||||
|
import org.gcube.data.analysis.tabulardata.expression.composite.text.Similarity;
|
||||||
import org.gcube.data.analysis.tabulardata.expression.composite.text.Soundex;
|
import org.gcube.data.analysis.tabulardata.expression.composite.text.Soundex;
|
||||||
import org.gcube.data.analysis.tabulardata.expression.composite.text.SubstringByIndex;
|
import org.gcube.data.analysis.tabulardata.expression.composite.text.SubstringByIndex;
|
||||||
import org.gcube.data.analysis.tabulardata.expression.composite.text.SubstringByRegex;
|
import org.gcube.data.analysis.tabulardata.expression.composite.text.SubstringByRegex;
|
||||||
|
@ -92,8 +94,10 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.compar
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_NotLess;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_NotLess;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.functions.C_Cast;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.functions.C_Cast;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_Concat;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_Concat;
|
||||||
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_Levenshtein;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_Lower;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_Lower;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_MD5;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_MD5;
|
||||||
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_Similarity;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_Soundex;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_Soundex;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_SubstringByIndex;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_SubstringByIndex;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_SubstringByRegex;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_SubstringByRegex;
|
||||||
|
@ -271,6 +275,13 @@ public class C_ExpressionParser {
|
||||||
break;
|
break;
|
||||||
case "Soundex":
|
case "Soundex":
|
||||||
ex = getSoundex(exp);
|
ex = getSoundex(exp);
|
||||||
|
break;
|
||||||
|
case "Levenshtein":
|
||||||
|
ex = getLevenshtein(exp);
|
||||||
|
break;
|
||||||
|
case "Similarity":
|
||||||
|
ex = getSimilarity(exp);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -661,6 +672,27 @@ public class C_ExpressionParser {
|
||||||
return soundex;
|
return soundex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Expression getLevenshtein(C_Expression exp)
|
||||||
|
throws ExpressionParserException {
|
||||||
|
C_Levenshtein e = (C_Levenshtein) exp;
|
||||||
|
Expression left = parse(e.getLeftArgument());
|
||||||
|
Expression right = parse(e.getRightArgument());
|
||||||
|
|
||||||
|
Levenshtein levenshtein = new Levenshtein(left,right);
|
||||||
|
return levenshtein;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Expression getSimilarity(C_Expression exp)
|
||||||
|
throws ExpressionParserException {
|
||||||
|
C_Similarity e = (C_Similarity) exp;
|
||||||
|
Expression left = parse(e.getLeftArgument());
|
||||||
|
Expression right = parse(e.getRightArgument());
|
||||||
|
|
||||||
|
Similarity similarity = new Similarity(left,right);
|
||||||
|
return similarity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected Expression getEquals(C_Expression exp)
|
protected Expression getEquals(C_Expression exp)
|
||||||
throws ExpressionParserException {
|
throws ExpressionParserException {
|
||||||
|
|
|
@ -3,6 +3,8 @@ package org.gcube.portlets.user.td.expressionwidget.shared.condition;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.expressionwidget.client.threshold.Threshold;
|
||||||
|
import org.gcube.portlets.user.td.expressionwidget.client.threshold.ThresholdStore;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.exception.ConditionTypeMapException;
|
import org.gcube.portlets.user.td.expressionwidget.shared.exception.ConditionTypeMapException;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_Equals;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_Equals;
|
||||||
|
@ -13,6 +15,8 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.compar
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_NotEquals;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_NotEquals;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_NotGreater;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_NotGreater;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_NotLess;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_NotLess;
|
||||||
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_Levenshtein;
|
||||||
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_Similarity;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_Soundex;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_Soundex;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_TextBeginsWith;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_TextBeginsWith;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_TextContains;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_TextContains;
|
||||||
|
@ -51,21 +55,21 @@ public class ConditionTypeMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
public C_Expression map(ColumnData column, C_OperatorType operatorType,
|
public C_Expression map(ColumnData column, C_OperatorType operatorType,
|
||||||
String firstArg, String secondArg) throws ConditionTypeMapException {
|
String firstArg, String secondArg, Threshold threshold) throws ConditionTypeMapException {
|
||||||
Log.debug("ConditionTypeMap Map");
|
Log.debug("ConditionTypeMap Map");
|
||||||
C_Expression exp = null;
|
C_Expression exp = null;
|
||||||
readableExpression = new String();
|
readableExpression = new String();
|
||||||
if (column.getTrId() == null) {
|
if (column.getTrId() == null) {
|
||||||
exp = mapPlaceHolder(column, operatorType, firstArg, secondArg);
|
exp = mapPlaceHolder(column, operatorType, firstArg, secondArg, threshold);
|
||||||
} else {
|
} else {
|
||||||
exp = mapTypedColumnReference(column, operatorType, firstArg,
|
exp = mapTypedColumnReference(column, operatorType, firstArg,
|
||||||
secondArg);
|
secondArg, threshold);
|
||||||
}
|
}
|
||||||
return exp;
|
return exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public C_Expression mapPlaceHolder(ColumnData column,
|
public C_Expression mapPlaceHolder(ColumnData column,
|
||||||
C_OperatorType operatorType, String firstArg, String secondArg)
|
C_OperatorType operatorType, String firstArg, String secondArg, Threshold threshold)
|
||||||
throws ConditionTypeMapException {
|
throws ConditionTypeMapException {
|
||||||
Log.debug("ConditionTypeMap Map Place Holder");
|
Log.debug("ConditionTypeMap Map Place Holder");
|
||||||
C_Expression exp = null;
|
C_Expression exp = null;
|
||||||
|
@ -337,6 +341,37 @@ public class ConditionTypeMap {
|
||||||
readableExpression = "Equals(Soundex(" + readablePlaceHolder + "),Soundex("
|
readableExpression = "Equals(Soundex(" + readablePlaceHolder + "),Soundex("
|
||||||
+ firstArg + "))";
|
+ firstArg + "))";
|
||||||
break;
|
break;
|
||||||
|
case LEVENSHTEIN:
|
||||||
|
checkTypeArgument(column, firstArg);
|
||||||
|
C_Levenshtein levenshstein=new C_Levenshtein(placeHolder,new TD_Value(dataType, firstArg));
|
||||||
|
Threshold thresholdLev;
|
||||||
|
|
||||||
|
if(threshold==null){
|
||||||
|
thresholdLev=ThresholdStore.defaultThresholdLevenshtein();
|
||||||
|
} else {
|
||||||
|
thresholdLev=threshold;
|
||||||
|
}
|
||||||
|
exp= new C_LessOrEquals(levenshstein,new TD_Value(ColumnDataType.Integer,
|
||||||
|
thresholdLev.getIntegerValue().toString()));
|
||||||
|
readableExpression = "LessOrEquals(Levenshtein(" + readablePlaceHolder + ","+firstArg+"),"
|
||||||
|
+ thresholdLev.getIntegerValue().toString() + ")";
|
||||||
|
break;
|
||||||
|
case SIMILARITY:
|
||||||
|
checkTypeArgument(column, firstArg);
|
||||||
|
C_Similarity similarity=new C_Similarity(placeHolder,new TD_Value(dataType, firstArg));
|
||||||
|
Threshold thresholdSim;
|
||||||
|
|
||||||
|
if(threshold==null){
|
||||||
|
thresholdSim=ThresholdStore.defaultThresholdSimilarity();
|
||||||
|
} else {
|
||||||
|
thresholdSim=threshold;
|
||||||
|
}
|
||||||
|
exp= new C_GreaterOrEquals(similarity,new TD_Value(ColumnDataType.Numeric,
|
||||||
|
thresholdSim.getLabel()));
|
||||||
|
readableExpression = "GreaterOrEquals(Similarity(" + readablePlaceHolder + ","+firstArg+"),"
|
||||||
|
+ thresholdSim.getLabel() + ")";
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -345,7 +380,7 @@ public class ConditionTypeMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
public C_Expression mapTypedColumnReference(ColumnData column,
|
public C_Expression mapTypedColumnReference(ColumnData column,
|
||||||
C_OperatorType operatorType, String firstArg, String secondArg)
|
C_OperatorType operatorType, String firstArg, String secondArg, Threshold threshold)
|
||||||
throws ConditionTypeMapException {
|
throws ConditionTypeMapException {
|
||||||
Log.debug("ConditionTypeMap Map Typed Column Reference");
|
Log.debug("ConditionTypeMap Map Typed Column Reference");
|
||||||
C_Expression exp = null;
|
C_Expression exp = null;
|
||||||
|
@ -623,6 +658,36 @@ public class ConditionTypeMap {
|
||||||
readableExpression = "Equals(Soundex(" + columnReference + "),Soundex("
|
readableExpression = "Equals(Soundex(" + columnReference + "),Soundex("
|
||||||
+ firstArg + "))";
|
+ firstArg + "))";
|
||||||
break;
|
break;
|
||||||
|
case LEVENSHTEIN:
|
||||||
|
checkTypeArgument(column, firstArg);
|
||||||
|
C_Levenshtein levenshstein=new C_Levenshtein(columnReference,new TD_Value(dataType, firstArg));
|
||||||
|
Threshold thresholdLev;
|
||||||
|
|
||||||
|
if(threshold==null){
|
||||||
|
thresholdLev=ThresholdStore.defaultThresholdLevenshtein();
|
||||||
|
} else {
|
||||||
|
thresholdLev=threshold;
|
||||||
|
}
|
||||||
|
exp= new C_LessOrEquals(levenshstein,new TD_Value(ColumnDataType.Integer,
|
||||||
|
thresholdLev.getIntegerValue().toString()));
|
||||||
|
readableExpression = "LessOrEquals(Levenshtein(" + readableColumnReference + ","+firstArg+"),"
|
||||||
|
+ thresholdLev.getIntegerValue().toString() + ")";
|
||||||
|
break;
|
||||||
|
case SIMILARITY:
|
||||||
|
checkTypeArgument(column, firstArg);
|
||||||
|
C_Similarity similarity=new C_Similarity(columnReference,new TD_Value(dataType, firstArg));
|
||||||
|
Threshold thresholdSim;
|
||||||
|
|
||||||
|
if(threshold==null){
|
||||||
|
thresholdSim=ThresholdStore.defaultThresholdSimilarity();
|
||||||
|
} else {
|
||||||
|
thresholdSim=threshold;
|
||||||
|
}
|
||||||
|
exp= new C_GreaterOrEquals(similarity,new TD_Value(ColumnDataType.Numeric,
|
||||||
|
thresholdSim.getLabel()));
|
||||||
|
readableExpression = "GreaterOrEquals(Similarity(" + readableColumnReference + ","+firstArg+"),"
|
||||||
|
+ thresholdSim.getLabel() + ")";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue