@Override public void writeValue(QuantityValue value, Resource resource) throws RDFHandlerException { this.rdfWriter.writeTripleValueObject( resource, RdfWriter.RDF_TYPE, RdfWriter.WB_QUANTITY_VALUE); this.rdfWriter.writeTripleLiteralObject( resource, RdfWriter.WB_NUMERIC_VALUE, value.getNumericValue().toString(), RdfWriter.XSD_DECIMAL); this.rdfWriter.writeTripleLiteralObject( resource, RdfWriter.WB_LOWER_BOUND, value.getLowerBound().toString(), RdfWriter.XSD_DECIMAL); this.rdfWriter.writeTripleLiteralObject( resource, RdfWriter.WB_UPPER_BOUND, value.getUpperBound().toString(), RdfWriter.XSD_DECIMAL); String unitIri; if ("".equals(value.getUnit())) { unitIri = Vocabulary.WB_NO_UNIT; } else { unitIri = value.getUnit(); } this.rdfWriter.writeTripleUriObject(resource, RdfWriter.WB_QUANTITY_UNIT, unitIri); }
/** * Returns a hash code for the given object. * * @see java.lang.Object#hashCode() * @param o the object to create a hash for * @return the hash code of the object */ public static int hashCode(QuantityValue o) { int result; result = o.getNumericValue().hashCode(); result = prime * result + o.getLowerBound().hashCode(); result = prime * result + o.getUpperBound().hashCode(); result = prime * result + o.getUnit().hashCode(); return result; }