@Override public boolean equalTo(Element el2, NodeIsomorphismMap isoMap) { if ( ! ( el2 instanceof ElementData ) ) return false ; ElementData f2 = (ElementData)el2 ; if ( ! vars.equals(f2.vars) ) return false ; if ( ! ResultSetCompare.equalsByTest(rows, f2.rows, new ResultSetCompare.BNodeIso(NodeUtils.sameTerm)) ) return false ; return true ; }
/** Compare two result sets for equivalence. Equivalance means: * A row rs1 has one matching row in rs2, and vice versa. * A row is only matched once. * Rows match if they have the same variables with the same values. * bNodes must map to a consistent other bNodes. Value comparisons of nodes. * * Destructive - rs1 and rs2 are both read, possibly to exhaustion. * @param rs1 * @param rs2 * @return true if they are equivalent */ public static boolean equalsByValue(ResultSet rs1, ResultSet rs2) { if ( ! compareHeader(rs1, rs2) ) return false ; //return equivalent(convert(rs1), convert(rs2), new BNodeIso(NodeUtils.sameValue)) ; // Add the isomprohism test // Imperfect - need by-value and isomorphism - but this covers test suite needs. ResultSetRewindable rs1a = ResultSetFactory.makeRewindable(rs1) ; ResultSetRewindable rs2a = ResultSetFactory.makeRewindable(rs2) ; if ( equivalent(convert(rs1a), convert(rs2a), new BNodeIso(NodeUtils.sameValue)) ) return true ; rs1a.reset() ; rs2a.reset() ; return isomorphic(rs1, rs2) ; }
/** compare two result sets for equivalence. Equivalance means: * A row rs1 has one matching row in rs2, and vice versa. * A row is only matched once. * Rows match if they have the same variables with the same values, * bNodes must map to a consistent other bNodes. * Term comparisons of nodes. * * Destructive - rs1 and rs2 are both read, possibly to exhaustion. * @param rs1 * @param rs2 * @return true if they are equivalent */ public static boolean equalsByTerm(ResultSet rs1, ResultSet rs2) { if ( ! compareHeader(rs1, rs2) ) return false ; //return equivalent(convert(rs1), convert(rs2), new BNodeIso(NodeUtils.sameTerm)) ; ResultSetRewindable rs1a = ResultSetFactory.makeRewindable(rs1) ; ResultSetRewindable rs2a = ResultSetFactory.makeRewindable(rs2) ; if ( equivalent(convert(rs1a), convert(rs2a), new BNodeIso(NodeUtils.sameTerm)) ) return true ; rs1a.reset() ; rs2a.reset() ; return isomorphic(rs1, rs2) ; }
/** Compare two result sets for equivalence. Equivalance means: * A row rs1 has one matching row in rs2, and vice versa. * A row is only matched once. * Rows match if they have the same variables with the same values. * bNodes must map to a consistent other bNodes. Value comparisons of nodes. * * Destructive - rs1 and rs2 are both read, possibly to exhaustion. * @param rs1 * @param rs2 * @return true if they are equivalent */ public static boolean equalsByValue(ResultSet rs1, ResultSet rs2) { //return equivalent(convert(rs1), convert(rs2), new BNodeIso(NodeUtils.sameValue)) ; // Add the isomprohism test // Imperfect - need by-value and isomorphism - but this covers test suite needs. ResultSetRewindable rs1a = ResultSetFactory.makeRewindable(rs1) ; ResultSetRewindable rs2a = ResultSetFactory.makeRewindable(rs2) ; if ( equivalent(convert(rs1a), convert(rs2a), new BNodeIso(NodeUtils.sameValue)) ) return true ; rs1a.reset() ; rs2a.reset() ; return isomorphic(rs1, rs2) ; }
/** compare two result sets for equivalence. Equivalance means: * A row rs1 has one matching row in rs2, and vice versa. * A row is only matched once. * Rows match if they have the same variables with the same values, * bNodes must map to a consistent other bNodes. * Term comparisons of nodes. * * Destructive - rs1 and rs2 are both read, possibly to exhaustion. * @param rs1 * @param rs2 * @return true if they are equivalent */ public static boolean equalsByTerm(ResultSet rs1, ResultSet rs2) { //return equivalent(convert(rs1), convert(rs2), new BNodeIso(NodeUtils.sameTerm)) ; ResultSetRewindable rs1a = ResultSetFactory.makeRewindable(rs1) ; ResultSetRewindable rs2a = ResultSetFactory.makeRewindable(rs2) ; if ( equivalent(convert(rs1a), convert(rs2a), new BNodeIso(NodeUtils.sameTerm)) ) return true ; rs1a.reset() ; rs2a.reset() ; return isomorphic(rs1, rs2) ; }
/** compare two result sets for equivalence. Equivalance means: * Each row in rs1 matchs the same index row in rs2. * Rows match if they have the same variables with the same values, * bNodes must map to a consistent other bNodes. * RDF term comparisons of nodes. * * Destructive - rs1 and rs2 are both read, possibly to exhaustion. * @param rs1 * @param rs2 * @return true if they are equivalent */ public static boolean equalsByTermAndOrder(ResultSet rs1, ResultSet rs2) { if ( ! compareHeader(rs1, rs2) ) return false ; return equivalentByOrder(convert(rs1) , convert(rs2), new BNodeIso(NodeUtils.sameTerm)) ; }
/** compare two result sets for equivalence. Equivalance means: * Each row in rs1 matchs the same index row in rs2. * Rows match if they have the same variables with the same values, * bNodes must map to a consistent other bNodes. * Value comparisons of nodes. * * Destructive - rs1 and rs2 are both read, possibly to exhaustion. * @param rs1 * @param rs2 * @return true if they are equivalent */ public static boolean equalsByValueAndOrder(ResultSet rs1, ResultSet rs2) { if ( ! compareHeader(rs1, rs2) ) return false ; return equivalentByOrder(convert(rs1) , convert(rs2), new BNodeIso(NodeUtils.sameValue)) ; }
/** compare two result sets for equivalence. Equivalance means: * Each row in rs1 matchs the same index row in rs2. * Rows match if they have the same variables with the same values, * bNodes must map to a consistent other bNodes. * Value comparisons of nodes. * * Destructive - rs1 and rs2 are both read, possibly to exhaustion. * @param rs1 * @param rs2 * @return true if they are equivalent */ public static boolean equalsByValueAndOrder(ResultSet rs1, ResultSet rs2) { return equivalentByOrder(convert(rs1) , convert(rs2), new BNodeIso(NodeUtils.sameValue)) ; }
/** compare two result sets for equivalence. Equivalance means: * Each row in rs1 matchs the same index row in rs2. * Rows match if they have the same variables with the same values, * bNodes must map to a consistent other bNodes. * RDF term comparisons of nodes. * * Destructive - rs1 and rs2 are both read, possibly to exhaustion. * @param rs1 * @param rs2 * @return true if they are equivalent */ public static boolean equalsByTermAndOrder(ResultSet rs1, ResultSet rs2) { return equivalentByOrder(convert(rs1) , convert(rs2), new BNodeIso(NodeUtils.sameTerm)) ; }