@Override public boolean contains( Triple t ) { int i = size; while (i > 0) if (t.equals( elements[--i] )) return true; return false; }
@Override public void remove( Triple t ) { changes += 1; for (int i = 0; i < size; i += 1) { if (t.equals( elements[i] )) { elements[i] = elements[--size]; return; } } }
public boolean equals(Object o) { if (!(o instanceof WritableTriple)) return false; WritableTriple that=(WritableTriple) o; return that.getTriple().equals(getTriple()); }
public boolean equivalent(OpBGP opBGP) { BasicPattern bgp = opBGP.getPattern() ; if ( bgp.size() != 1 ) return false ; Triple t = bgp.get(0) ; return triple.equals(t) ; }
public boolean equivalent(OpBGP opBGP) { BasicPattern bgp = opBGP.getPattern() ; if ( bgp.size() != 1 ) return false ; Triple t = bgp.get(0) ; return triple.equals(t) ; }
/** * Compare two derivations. This is a shallow comparison, two derivations * are the same if they contain the same conclusion, rule and match list. * They do not need to be derived from the same (or any) infGraph. */ @Override public boolean equals(Object other) { if (other instanceof RuleDerivation) { RuleDerivation otherD = (RuleDerivation)other; return conclusion.equals(otherD.getConclusion()) && matches.equals(otherD.getMatches()) && rule.equals(otherD.getRule()); } else { return false; } } }
public Graph explain(Triple pattern) { if( !pattern.equals( INCONCISTENCY_TRIPLE ) ) { if( !pattern.isConcrete() ) { if( log.isLoggable( Level.WARNING ) ) {
@Override public boolean equals(Object other) { if ( this == other) return true ; if ( ! ( other instanceof TriplePath) ) return false ; TriplePath tp = (TriplePath)other ; // True if one is true and one is false if ( tp.isTriple() ^ this.isTriple() ) return false ; if ( isTriple() ) return asTriple().equals(tp.asTriple()) ; else return subject.equals(tp.subject) && object.equals(tp.object) && path.equals(tp.path) ; }
@Override public boolean equals(Object other) { if ( this == other) return true ; if ( ! ( other instanceof TriplePath) ) return false ; TriplePath tp = (TriplePath)other ; // True if one is true and one is false if ( tp.isTriple() ^ this.isTriple() ) return false ; if ( isTriple() ) return asTriple().equals(tp.asTriple()) ; else return subject.equals(tp.subject) && object.equals(tp.object) && path.equals(tp.path) ; }
private static boolean checkEntailment(PelletInfGraph pellet, Triple pattern, boolean withExplanation) { boolean doExplanation = pellet.getKB().doExplanation(); pellet.getKB().setDoExplanation( withExplanation ); boolean entailed = false; if( pattern.equals( INCONCISTENCY_TRIPLE ) ) { entailed = !pellet.isConsistent(); } else { entailed = pellet.containsTriple( pattern ); } pellet.getKB().setDoExplanation( doExplanation ); return entailed; }
protected ConjunctiveQuery replace(ConjunctiveQuery q, Triple oldT, Triple newT) { ElementTriplesBlock newPattern = new ElementTriplesBlock(); for (Triple t:q.getTriples()) { if (t.equals(oldT)) { newPattern.addTriple(newT); } else { newPattern.addTriple(t); } } ConjunctiveQuery ret = q.cloneConjQuery(); ret.setQueryPattern(newPattern); for (ElementFilter ef: q.getFilters()) { ret.addFilter(ef.getExpr()); } return ret; }
public Node reifyAs(Node node, Triple triple) { if ( node == null ) node = Node.createAnon() ; else { Triple t = getTriple(node) ; if ( t != null && ! t.equals(triple) ) throw new AlreadyReifiedException(node) ; if ( t != null ) // Already there return node ; } graph.add(new Triple(node, rdfType, statement)) ; graph.add(new Triple(node, subject, triple.getSubject())) ; graph.add(new Triple(node, predicate, triple.getPredicate())) ; graph.add(new Triple(node, object, triple.getObject())) ; // Check it's a well-formed reification by Jena's uniqueness rules Triple t = getTriple(node) ; if ( t == null ) throw new CannotReifyException(node) ; return node ; }
if ( t != null && ! t.equals(triple) ) throw new AlreadyReifiedException(node) ; if ( t != null )