### Question:
QueryTreeEditDistance { public static <T> double getDistanceApprox(RDFResourceTree tree1, RDFResourceTree tree2) { LGGGenerator lggGenerator = new LGGGeneratorSimple(); RDFResourceTree lgg = lggGenerator.getLGG(tree1, tree2); double complexityLGG = QueryTreeUtils.getComplexity(lgg); double complexityTree1 = QueryTreeUtils.getComplexity(tree1); double complexityTree2 = QueryTreeUtils.getComplexity(tree2); double distance = Math.max( complexityTree1 - complexityLGG, complexityTree2 - complexityLGG); return distance; }  static double getDistance(RDFResourceTree tree1, RDFResourceTree tree2); static double getDistanceApprox(RDFResourceTree tree1, RDFResourceTree tree2);  }### Answer:
@Test public void test08() { RDFResourceTree tree1 = new RDFResourceTree(NodeFactory.createURI("A")); RDFResourceTree subTree1 = new RDFResourceTree(); subTree1.addChild(new RDFResourceTree(NodeFactory.createURI("A1")), NodeFactory.createURI("p")); tree1.addChild(subTree1, NodeFactory.createURI("p")); RDFResourceTree tree2 = new RDFResourceTree(NodeFactory.createURI("B")); RDFResourceTree subTree2 = new RDFResourceTree(NodeFactory.createURI("B1")); subTree2.addChild(new RDFResourceTree(NodeFactory.createURI("A1")), NodeFactory.createURI("p")); tree2.addChild(subTree2, NodeFactory.createURI("p")); RDFResourceTree tree3 = new RDFResourceTree(NodeFactory.createURI("C")); RDFResourceTree subTree3 = new RDFResourceTree(); subTree3.addChild(new RDFResourceTree(), NodeFactory.createURI("p")); tree3.addChild(subTree3, NodeFactory.createURI("p")); System.out.println(tree1.getStringRepresentation()); System.out.println(tree2.getStringRepresentation()); System.out.println(tree3.getStringRepresentation()); double distance1_2 = QueryTreeEditDistance.getDistanceApprox(tree1, tree2); double distance1_3 = QueryTreeEditDistance.getDistanceApprox(tree1, tree3); double distance2_3 = QueryTreeEditDistance.getDistanceApprox(tree2, tree3); System.out.println("d(t1,t2) = " + distance1_2); System.out.println("d(t1,t3) = " + distance1_3); System.out.println("d(t2,t3) = " + distance2_3); boolean moreSimilar = distance1_2 < distance1_3; assertEquals(distance1_2 < distance1_3, moreSimilar); }