use of org.snomed.otf.owltoolkit.domain.Relationship.ConcreteValue in project snow-owl by b2ihealthcare.
the class SnomedOWLExpressionConverter method toRelationshipValue.
private RelationshipValue toRelationshipValue(ConcreteValue value) {
/*
* XXX: preserve the OWL2 XSD type, but use the exact numeric representation
* given; eg. "50"^^decimal should have decimal type, with "50", a fraction-less
* BigDecimal as its value.
*
* It is an implementation-dependent feature that "asString" returns the
* raw value for numbers as well, this might change in the future!
*/
final String rawValue = value.asString();
final ConcreteValue.Type type = value.getType();
switch(type) {
case DECIMAL:
return RelationshipValue.fromTypeAndObjects(RelationshipValueType.DECIMAL, new BigDecimal(rawValue), null);
case INTEGER:
return RelationshipValue.fromTypeAndObjects(RelationshipValueType.INTEGER, new BigDecimal(rawValue), null);
case STRING:
return new RelationshipValue(rawValue);
default:
throw new IllegalStateException("Unexpected concrete value type '" + type + "'.");
}
}
Aggregations