private LIT toRDFLiteral(Object o) { if (o instanceof LIT) { return (LIT) o; } UID dataType = configuration.getConverterRegistry().getDatatype(o.getClass()); return new LIT(configuration.getConverterRegistry().toString(o), dataType); }
public BeanQueryImpl(Session session, Ontology ontology, RDFConnection connection) { super(new QueryMixin<BeanQueryImpl>()); queryMixin.setSelf(this); this.session = session; this.ontology = ontology; this.converterRegistry = session.getConfiguration().getConverterRegistry(); this.connection = connection; }
private Object convertValue(NODE node, Class<?> targetClass) { UID targetType = configuration.getConverterRegistry().getDatatype(targetClass); if (targetClass.isAssignableFrom(node.getClass())) { return node; } else if (targetType != null && node.isLiteral()) { // TODO : make sure this works also with untyped literals etc if (((LIT) node).getDatatype().equals(targetType)) { return configuration.getConverterRegistry().fromString(node.getValue(), targetClass); } else { throw new IllegalArgumentException("Literal " + node + " is not of type " + targetType); } } else if (targetType == null && node.isURI()) { return get(targetClass, node.asURI()); } else { throw new IllegalArgumentException("Node " + node + " could not be converted to " + targetClass.getName()); } }
convertedValue = configuration.getConverterRegistry().fromString(value.getValue(), targetClass);
public Expression<?> visit(Constant<?> constant, Filters filters) { Object javaValue = constant.getConstant(); ConverterRegistry converter = configuration.getConverterRegistry(); if (List.class.isAssignableFrom(constant.getType()) && ((List<?>) constant.getConstant()).isEmpty()) { return new ConstantImpl<UID>(RDF.nil); } else if (NODE.class.isAssignableFrom(constant.getType())) { return constant; } else if (javaValue instanceof Class<?>) { UID datatype = converter.getDatatype((Class<?>) javaValue); if (datatype != null) { return new ConstantImpl<UID>(datatype); } else { return new ConstantImpl<UID>(getTypeForDomainClass((Class<?>) javaValue)); } } else if (javaValue instanceof String) { return new ConstantImpl<LIT>(new LIT(javaValue.toString(), XSD.stringType)); } else if (converter.supports(javaValue.getClass())) { String label = converter.toString(javaValue); UID datatype = converter.getDatatype(javaValue.getClass()); return new ConstantImpl<LIT>(new LIT(label, datatype)); } else { ID id = session.getId(javaValue); return new ConstantImpl<ID>(id); } }
UID dataType = configuration.getConverterRegistry().getDatatype(componentType); if (dataType == null || !stmt.getObject().asLiteral().getDatatype().equals(dataType)) { continue;