return stm != null && stm.isAsserted(subject);
}
+ /*
+ * Works around problems in WriteGraph methods with similar signature.
+ * Especially handles better some cases with existing literals.
+ *
+ */
+ public static void claimLiteral(WriteGraph graph, Resource r, Resource p, Resource i, Resource t, Object value, Binding binding) throws DatabaseException {
+ Statement stm = graph.getPossibleStatement(r, p);
+ if(stm != null && !stm.isAsserted(r)) {
+ if(graph.isInstanceOf(stm.getObject(), t)) {
+ // Existing statement is compatible, reuse the literal
+ graph.claimValue(stm.getObject(), value, binding);
+ return;
+ } else {
+ // Existing statement is incompatible - remove it
+ graph.deny(stm);
+ }
+ }
+ // Create new statement
+ graph.claimLiteral(r, p, i, t, value, binding);
+ }
+
public static void setExpression(WriteGraph graph, Variable context, String text, Resource expressionValueType) throws DatabaseException {
Resource value = context.getRepresents(graph);