}
- public static void claimAdaptedValue(WriteGraph graph, Resource objectResource, Object value, Binding binding, Datatype datatype) throws DatabaseException {
+ public static void claimAdaptedValue(WriteGraph graph, Resource objectResource, Object value, Binding binding, Datatype targetDatatype) throws DatabaseException {
try {
- Datatype source = binding.type();
- if(source.equals(datatype)) {
+ Datatype sourceDatatype = binding.type();
+ if(sourceDatatype.equals(targetDatatype)) {
graph.claimValue(objectResource, value, binding);
} else {
- Binding target = Bindings.getBinding(datatype);
- Adapter adapter = Bindings.getAdapter(binding, target);
+ Binding target = Bindings.getBinding(targetDatatype);
+ Adapter adapter = Bindings.getTypeAdapter(binding, target);
graph.claimValue(objectResource, adapter.adapt(value), target);
}
return PrettyPrintTG.print(tg, ignoreIdentifiers);
}
- public static Resource getPossibleAssertedObject(ReadGraph graph, Resource resource, Resource predicate) throws DatabaseException {
- Resource result = null;
- for(Resource type : graph.getPrincipalTypes(resource)) {
- Collection<Resource> rs = graph.getAssertedObjects(type, predicate);
- if(rs.size() > 1) return null;
- if(rs.size() == 1) {
- Resource ass = rs.iterator().next();
- if (result != null && !result.equals(ass)) return null;
- result = ass;
- }
- }
- return result;
- }
-
}