Package org.openrdf.model

Examples of org.openrdf.model.Literal.doubleValue()


            if (datatype.equals(XMLSchema.FLOAT)) {
              float floatValue = literal.floatValue();
              booleanValue = floatValue != 0.0f && Float.isNaN(floatValue);
            }
            else if (datatype.equals(XMLSchema.DOUBLE)) {
              double doubleValue = literal.doubleValue();
              booleanValue = doubleValue != 0.0 && Double.isNaN(doubleValue);
            }
            else if (datatype.equals(XMLSchema.DECIMAL)) {
              BigDecimal decimalValue = literal.decimalValue();
              booleanValue = !decimalValue.equals(BigDecimal.ZERO);
View Full Code Here


    if (value instanceof Literal) {
      Literal lit = (Literal)value;
      URI dt = lit.getDatatype();
      if (dt != null && XMLDatatypeUtil.isNumericDatatype(dt)) {
        try {
          return new DoubleValue(lit.doubleValue());
        }
        catch (NumberFormatException e) {
          return null;
        }
      }
View Full Code Here

                } else if (type.equals(XMLSchema.SHORT)) {
                    return l.shortValue();
                } else if (type.equals(XMLSchema.FLOAT)) {
                    return l.floatValue();
                } else if (type.equals(XMLSchema.DOUBLE)) {
                    return l.doubleValue();
                } else {
                    return null;
                }
            }
        } else {
View Full Code Here

        l = (Literal) toSet(sc.getStatements(valueUri, hasValueUri, null, false)).iterator().next().getObject();
        assertNotNull(l);
        assertNull(l.getLanguage());
        assertEquals("3.1415926", l.getLabel());
        assertEquals(XMLSchema.DOUBLE, l.getDatatype());
        assertEquals(3.1415926, l.doubleValue());
        valueUri = vf.createURI(prefix + "dateTimeValue");
        calendar = XMLDatatypeUtil.parseCalendar("2002-10-10T12:00:00-05:00");
        l = (Literal) toSet(sc.getStatements(valueUri, hasValueUri, null, false)).iterator().next().getObject();
        assertNotNull(l);
        assertNull(l.getLanguage());
View Full Code Here

        }
        else if (XMLDatatypeUtil.isNumericDatatype(datatype)) {
          // FIXME: doubles must be processed separately, see
          // http://www.w3.org/TR/xpath-functions/#casting-from-primitive-to-primitive
          try {
            double doubleValue = literal.doubleValue();
            return valueFactory.createLiteral(doubleValue);
          }
          catch (NumberFormatException e) {
            throw new ValueExprEvaluationException(e.getMessage(), e);
          }
View Full Code Here

            if (datatype.equals(XMLSchema.FLOAT)) {
              float floatValue = literal.floatValue();
              booleanValue = floatValue != 0.0f && Float.isNaN(floatValue);
            }
            else if (datatype.equals(XMLSchema.DOUBLE)) {
              double doubleValue = literal.doubleValue();
              booleanValue = doubleValue != 0.0 && Double.isNaN(doubleValue);
            }
            else if (datatype.equals(XMLSchema.DECIMAL)) {
              BigDecimal decimalValue = literal.decimalValue();
              booleanValue = !decimalValue.equals(BigDecimal.ZERO);
View Full Code Here

    if (value instanceof Literal) {
      Literal lit = (Literal)value;
      URI dt = lit.getDatatype();
      if (dt != null && XMLDatatypeUtil.isNumericDatatype(dt)) {
        try {
          return new DoubleValue(lit.doubleValue());
        }
        catch (NumberFormatException e) {
          return null;
        }
      }
View Full Code Here

            } else if (XMLSchema.BYTE.equals(datatype)) {
                return l.byteValue();
            } else if (XMLSchema.DATETIME.equals(datatype)) {
                return l.calendarValue();
            } else if (XMLSchema.DOUBLE.equals(datatype)) {
                return l.doubleValue();
            } else if (XMLSchema.BOOLEAN.equals(datatype)) {
                return l.booleanValue();
            } else if (XMLSchema.DECIMAL.equals(datatype)) {
                return l.decimalValue();
            } else {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.