Search in sources :

Example 1 with ConcreteValue

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 + "'.");
    }
}
Also used : RelationshipValue(com.b2international.snowowl.snomed.core.domain.RelationshipValue) BigDecimal(java.math.BigDecimal) ConcreteValue(org.snomed.otf.owltoolkit.domain.Relationship.ConcreteValue)

Aggregations

RelationshipValue (com.b2international.snowowl.snomed.core.domain.RelationshipValue)1 BigDecimal (java.math.BigDecimal)1 ConcreteValue (org.snomed.otf.owltoolkit.domain.Relationship.ConcreteValue)1