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()); } }
private MappedClass resolveMappedClass(MappedClass mappedClass, PropertiesMap properties) { for (STMT stmt : properties.getDirect().get(RDF.type)) { if (stmt.getObject().isURI()) { List<MappedClass> mappedClasses = configuration.getMappedClasses(stmt.getObject().asURI()); for (MappedClass mc : mappedClasses) { if (!mc.equals(mappedClass) && mappedClass.getJavaClass().isAssignableFrom(mc.getJavaClass())) { return mc; } } } } return mappedClass; }
if (node.isBNode()) { append("_:" + node.getValue()); } else if (node.isURI()) { append("<" + node.getValue() + ">"); } else {
public static String toString(NODE node) { if (node.isURI()) { return toString(node.asURI()); } else if (node.isLiteral()) { return toString(node.asLiteral()); } else { return toString(node.asBNode()); } }
private void append(NODE node) throws IOException { if (node.isURI()) { append(node.asURI()); } else if (node.isLiteral()) { append(node.asLiteral()); } else { append(node.asBNode()); } }