Beispiel #1
0
  @Test
  public void ComplexEqual() {
    System.out.println("ComplexEqual");

    HeliosPlanner p = new HeliosPlanner(source, target);

    LinkSpecification ls =
        new LinkSpecification(
            "OR(cosine(x.description,y.description)|0.3,OR(cosine(x.description,y.description)|0.5,cosine(x.title,y.name)|0.6)|0.7)",
            0.8);
    System.out.println(ls.isAtomic());

    NestedPlan plan = p.plan(ls);
    //////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////

    NestedPlan plan2 = new NestedPlan();
    Instruction run1 =
        new Instruction(Command.RUN, "cosine(x.description,y.description)", "0.3", -1, -1, 0);
    plan2.addInstruction(run1);
    //////////////////////////////////////////////////////////////////////////////////
    NestedPlan plan3 = new NestedPlan();

    NestedPlan plan31 = new NestedPlan();
    Instruction run2 =
        new Instruction(Command.RUN, "cosine(x.description,y.description)", "0.5", -1, -1, 0);
    plan31.addInstruction(run2);
    NestedPlan plan32 = new NestedPlan();
    Instruction run3 = new Instruction(Command.RUN, "cosine(x.title,y.name)", "0.6", -1, -1, 0);
    plan32.addInstruction(run3);

    plan3.setSubPlans(new ArrayList<NestedPlan>());
    plan3.addSubplan(plan31);
    plan3.addSubplan(plan32);

    plan3.setOperator(Command.UNION);
    plan3.setFilteringInstruction(new Instruction(Command.FILTER, null, "0.7", -1, -1, 0));

    /////////////////////////////////////////////////////////////////////////////////////
    NestedPlan planNew = new NestedPlan();
    planNew.setSubPlans(new ArrayList<NestedPlan>());
    planNew.addSubplan(plan2);
    planNew.addSubplan(plan3);
    planNew.setOperator(Command.UNION);
    planNew.setFilteringInstruction(new Instruction(Command.FILTER, null, "0.8", -1, -1, 0));

    assertTrue(plan.equals(planNew));
  }
Beispiel #2
0
  @Test
  public void AtomicEqual() {
    System.out.println("AtomicEqual");

    HeliosPlanner p = new HeliosPlanner(source, target);

    LinkSpecification ls = new LinkSpecification("cosine(x.label,y.label)", 0.8);
    System.out.println(ls.isAtomic());

    NestedPlan plan = p.plan(ls);

    NestedPlan plan2 = new NestedPlan();
    Instruction run1 = new Instruction(Command.RUN, "cosine(x.label,y.label)", "0.8", -1, -1, 0);
    plan2.addInstruction(run1);

    assertTrue(plan.equals(plan2));
  }