public static boolean sameNode(Node n1, Node n2) {
        if (n1 instanceof URIReference && n2 instanceof URIReference) {
            return sameResource((URIReference) n1, (URIReference) n2);
        } else if (n1 instanceof Literal && n2 instanceof Literal) {
            return sameLiteral((Literal) n1, (Literal) n2);
        } else {
            return false;
        }
    }
public static boolean sameNode ( Node n1 , Node n2 ) { if ( n1 instanceof URIReference && n2 instanceof URIReference ) { return sameResource ( ( URIReference ) n1 , ( URIReference ) n2 ) ; } else if ( n1 instanceof Literal && n2 instanceof Literal ) { return sameLiteral ( ( Literal ) n1 , ( Literal ) n2 ) ; } else { return false ; } }
Tells whether the given nodes are equivalent.
<p>
Nodes are equivalent if they are both resources or both literals and they
match according to the rules of those types.

@param n1
first node.
@param n2
second node.
@return true if equivalent, false otherwise.