コード例 #1
0
 @Test
 public void begin() {
   Set<String> dates = new TreeSet<String>();
   for (Instance s : source.getAllInstances()) {
     String d = s.getProperty("beginsAtDateTime").first();
     if (!dates.contains(d)) dates.add(d);
     String e = s.getProperty("endsAtDateTime").first();
     if (!dates.contains(e)) dates.add(e);
   }
   for (String s : dates) {
     System.out.println(s);
   }
 }
コード例 #2
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));
  }