return triggers;
}
private void addTrigger(Leaf leaf) {
Measure meas = leaf.getMeasure();
Question q = null;
if (leaf.getTransformer() instanceof OrdinalTransformer) {
// TODO
} else if (leaf.getTransformer() instanceof NumericTransformer){
NumericTransformer numericT = (NumericTransformer)leaf.getTransformer();
String name = meas.getName();
String operator;
if (numericT.hasIncreasingOrder()) {
// values must be greater or equal threshold 1, therefore we watch for smaller values
operator = " < ";
} else {
// values must be smaller or equal threshold 1, therefore we watch for higher values
operator = " > ";
}
if ("http://purl.org/DP/quality/measures#11".equals(meas.getUri())) {
// this value is accumulated, we check for min/max
if (numericT.hasIncreasingOrder()) {
name = "Minimum " + name;
} else {
name = "Maximum " + name;
}
String threshold = "" + numericT.getThreshold1();
String sparql = String.format(
"?p rdf:type watch:Property. " +
"?p watch:name ?n . " +
"?v watch:property ?p. " +
"?v watch:floatValue ?fv. " +
"FILTER (?n = \"%s\" && ?fv %s %s ) " +
" BIND(CONCAT(?n, \" is \", str(?fv) , \", should not be %s %s \") AS ?s )",
name, operator, threshold, operator, threshold);
q = new Question(sparql, RequestTarget.PROPERTY_VALUE);
}
}
if (q != null) {
final Notification n = new Notification("email", Arrays.asList(new DictionaryItem("recepients",
this.recipients)));