public ObservationObject(Observation observation) { this.setObservationURI(observation.getObservationURI().toString()); this.setDateComputed(observation.getDateComputed()); this.setValue(observation.getValue()); this.setValueType(observation.getValueType()); this.setComputedOn(observation.getComputedOn().toString()); this.setGraphURI(observation.getGraphURI().toString()); }
public Observation(Resource observationURI, Date dateComputed, Object value, String valueType, Resource computedOn, Resource graphURI, Boolean isEstimate){ this.setObservationURI(observationURI); this.setDateComputed(dateComputed); this.setValue(value); this.setValueType(valueType); this.setComputedOn(computedOn); this.setGraphURI(graphURI); this.setIsEstimate(isEstimate); }
public int compareTo(Observation anotherObservation) { if (this.getDateComputed().after(anotherObservation.getDateComputed())) return 1; if (this.getDateComputed().before(anotherObservation.getDateComputed())) return -1; else return 0; }
Observation obs = new Observation(res, date, value, value.getClass().getSimpleName(), computedOn, cubeDS, isEstimate); List<Observation> lst = new ArrayList<Observation>(); lst.add(obs);
List<Observation> obs = ObservationHelper.extractObservations(d.getNamedModel(graphName),metric_type); Optional<Observation> observation = obs.stream().filter(o -> Date.dateToString(o.getDateComputed()).equals(date)).findFirst();
Observation obs = ObservationHelper.getLatestObservation(lst); if (metricExpectedDataType.asResource().equals(XSD.xdouble)) { Double value = (Double) obs.getValue(); weightedValue = value * weight; } else if (metricExpectedDataType.asResource().equals(XSD.integer)) { weightedValue = (getRelativePercentage(metric, datasetPLD) / 100.0) * weight; } else if (metricExpectedDataType.asResource().equals(XSD.xboolean)) { Boolean value = (Boolean) obs.getValue(); if (metric.equals(LQM.SyntaxErrorsMetric)) weightedValue = ((value) ? 0.0 : 1.0) * weight; weightedValue = getRelativePercentage(metric, datasetPLD) * weight; } else { logger.debug("Cannot calculate weight for {} datatype", obs.getValue().getClass().getSimpleName());
Observation obs = new Observation(res, date, value, value.getClass().getSimpleName(), computedOn, cubeDS, isEstimate); lst.add(obs);
Observation obs = new Observation(res, date, value, value.getClass().getSimpleName(), computedOn, cubeDS, isEstimate);