return PrettyPrintTG.print(tg);
}
+ 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;
+ }
+
}
}
+ if(!asserted) {
+ Resource assertedObject = Layer0Utils.getPossibleAssertedObject(graph, container, property);
+ if(assertedObject != null) {
+ if(graph.isInstanceOf(assertedObject, newType)) {
+ Object assertedValue = graph.getValue(assertedObject, (Binding)_binding);
+ if(assertedValue.equals(value)) {
+ graph.deny(container, property);
+ return null;
+ }
+ }
+ }
+ }
+
Datatype datatype = variable.getDatatype(graph);
Binding binding = (Binding)_binding;
Layer0Utils.claimAdaptedValue(graph, objectResource, value, binding, datatype);