예제 #1
0
  @Test
  public void reverse() {
    System.out.println("reverse");
    LinkSpecification ls =
        new LinkSpecification(
            "tmp_is_started_by(x.beginsAtDateTime|endsAtDateTime,y.beginsAtDateTime|endsAtDateTime)",
            1.0);
    DynamicPlanner p = new DynamicPlanner(source, target);
    ExecutionEngine e = new SimpleExecutionEngine(source, target, "?x", "?y");
    AMapping m = e.execute(ls, p);
    System.out.println(m);
    //////////////////////////////////////////////////////////////////////////////////////////////////
    LinkSpecification ls2 =
        new LinkSpecification(
            "tmp_starts(x.beginsAtDateTime|endsAtDateTime,y.beginsAtDateTime|endsAtDateTime)", 1.0);
    AMapping m2 = e.execute(ls2, p);
    AMapping m3 = MappingFactory.createDefaultMapping();
    for (String s : m2.getMap().keySet()) {
      for (String t : m2.getMap().get(s).keySet()) {
        m3.add(t, s, 1);
      }
    }

    System.out.println(m3);
    assertTrue(m.equals(m3));
  }
예제 #2
0
 @Test
 public void simpleLS() {
   System.out.println("simpleLS");
   LinkSpecification ls =
       new LinkSpecification(
           "tmp_is_started_by(x.beginsAtDateTime|endsAtDateTime,y.beginsAtDateTime|endsAtDateTime)",
           1.0);
   DynamicPlanner p = new DynamicPlanner(source, target);
   ExecutionEngine e = new SimpleExecutionEngine(source, target, "?x", "?y");
   AMapping m = e.execute(ls, p);
   System.out.println(m);
 }
예제 #3
0
  @Test
  public void similarity() {
    System.out.println("similarity");
    LinkSpecification ls =
        new LinkSpecification(
            "tmp_is_started_by(x.beginsAtDateTime|endsAtDateTime,y.beginsAtDateTime|endsAtDateTime)",
            1.0);
    DynamicPlanner p = new DynamicPlanner(source, target);
    ExecutionEngine e = new SimpleExecutionEngine(source, target, "?x", "?y");
    AMapping m = e.execute(ls, p);
    System.out.println(m);

    AMapping m2 = MappingFactory.createDefaultMapping();
    for (Instance s : source.getAllInstances()) {
      for (Instance t : target.getAllInstances()) {
        IsStartedByMeasure measure = new IsStartedByMeasure();
        double sim =
            measure.getSimilarity(
                s, t, "beginsAtDateTime|endsAtDateTime", "beginsAtDateTime|endsAtDateTime");
        if (sim != 0) m2.add(s.getUri(), t.getUri(), sim);
      }
    }
    assertTrue(m.equals(m2));
  }