public void testDifferenceFunction() {
   XPathEvaluator xe = new XPathEvaluator();
   assertEquals(xe.evaluateList("g:difference(g:append(1,2,3,4),3,4)").size(), 2);
   assertTrue(xe.evaluateList("g:difference(g:append(1,2,3,4),3,4)").contains(1.0));
   assertTrue(xe.evaluateList("g:difference(g:append(1,2,3,4),3,4)").contains(2.0));
   assertEquals(xe.evaluateList("g:difference(g:append(1,2,3,4),g:append(1,2))").size(), 2);
   assertTrue(xe.evaluateList("g:difference(g:append(1,2,3,4),g:append(1,2))").contains(3.0));
   assertTrue(xe.evaluateList("g:difference(g:append(1,2,3,4),g:append(1,2))").contains(4.0));
   assertEquals(xe.evaluateList("g:difference(1,2)").size(), 1);
   assertEquals(xe.evaluateList("g:difference(1,1)").size(), 0);
 }
  public void testAddEdgeFunction() {
    Graph graph = new TinkerGraph();
    XPathEvaluator xe = new XPathEvaluator();
    xe.setVariable(Tokens.GRAPH_VARIABLE, graph);
    xe.setVariable("$v", graph.addVertex('1'));
    xe.setVariable("$u", graph.addVertex('2'));
    assertEquals(count(graph.getVertices()), 2);
    assertEquals(count(graph.getEdges()), 0);
    xe.evaluateList("g:add-e($v,'knows1',$u)");
    assertEquals(count(graph.getEdges()), 1);
    xe.evaluateList("g:add-e('42', $v,'knows2',$u)");
    assertEquals(count(graph.getEdges()), 2);
    xe.evaluateList("g:add-e($_g, $v,'knows3',$u)");
    assertEquals(count(graph.getEdges()), 3);
    xe.evaluateList("g:add-e($_g, '52', $v,'knows4',$u)");
    assertEquals(count(graph.getEdges()), 4);
    try {
      xe.evaluateList("g:add-e($_g, '52', $v,'knows4',$u,10)");
      assertTrue(false);

    } catch (EvaluationException e) {
      assertTrue(true);
    }
  }