private static void deleteWhileEmptyAndNoIncomingRelations(ContextNode contextNode) { ContextNode currentContextNode = contextNode; ContextNode parentContextNode; while (currentContextNode.isEmpty() && (! currentContextNode.containsIncomingRelations()) && (! currentContextNode.isRootContextNode())) { parentContextNode = currentContextNode.getContextNode(); currentContextNode.delete(); currentContextNode = parentContextNode; } }
@Override public boolean isImplied() { if (this instanceof ContextNodeStatement) { ContextNode contextNode = ((ContextNodeStatement) this).getContextNode(); if (contextNode == null) return false; if (! contextNode.isEmpty()) return true; if (contextNode.containsIncomingRelations()) return true; } if (this instanceof RelationStatement) { Relation relation = ((RelationStatement) this).getRelation(); if (relation == null) return false; ContextNode targetContextNode = relation.followContextNode(); if (targetContextNode == null) return false; XdiInnerRoot innerRoot = XdiInnerRoot.fromContextNode(targetContextNode); if (innerRoot != null && relation.equals(innerRoot.getPredicateRelation()) && ! innerRoot.getContextNode().isEmpty()) return true; } return false; }