/** * Convenience method. */ @Override public boolean contains(ResourceOrVariable subject, UriOrVariable predicate, String plainLiteral) throws ModelRuntimeException { assertModel(); return contains(subject, predicate, new PlainLiteralImpl(plainLiteral)); }
if(!this.contains(s)) added.add(s);
/** * Convenience method. */ public boolean contains(ResourceOrVariable subject, UriOrVariable predicate, String plainLiteral) throws ModelRuntimeException { assertModel(); return contains(subject, predicate, new PlainLiteralImpl(plainLiteral)); }
/** * Computes a Diff by using HashSets. */ public Diff getDiff(Iterator<? extends Statement> other) throws ModelRuntimeException { assertModel(); Set<Statement> otherSet = new HashSet<Statement>(); while (other.hasNext()) otherSet.add(other.next()); log.debug("this has " + size() + " triples, other has " + otherSet.size() + " triples"); // added Statements = present in other, but not this Set<Statement> added = new HashSet<Statement>(); for (Statement s : otherSet) { if (!this.contains(s)) added.add(s); } // removed = present here, but no longer in other Set<Statement> removed = new HashSet<Statement>(); for (Statement s : this) { if (!otherSet.contains(s)) { log.debug("otherSet does not contain " + s); removed.add(s); } } log.debug(added.size() + " triples added, " + removed.size() + " removed."); // These iterators are not closable, so we don't have to close them return new DiffImpl(added.iterator(), removed.iterator()); }
if(!abstractModel.contains(s)) { log.trace("Other model does not contain " + s); return false;
/** * Adapter implementations are strongly encouraged to overwrite this method. * It is slow and semantically not correct. */ public boolean isomorphicWith(Model other) { assertModel(); try { if (other instanceof AbstractModel) { AbstractModel abstractModel = (AbstractModel) other; if (size() == abstractModel.size()) { for (Statement s : this) { if (!abstractModel.contains(s)) { log.debug("Other model does not contain " + s); return false; } } return true; } //else log.debug("Models do not have the same size"); return false; } //else log.debug("object is not an instance of ModelAdapter, it's " + other.getClass()); return false; } catch (ModelRuntimeException e) { throw new RuntimeException(e); } }
/** * Convenience method. */ public boolean contains(Statement s) throws ModelRuntimeException { assertModel(); return contains(s.getSubject(), s.getPredicate(), s.getObject()); }
/** * Convenience method. */ @Override public boolean contains(Statement s) throws ModelRuntimeException { assertModel(); return contains(s.getSubject(), s.getPredicate(), s.getObject()); }