@Override
  public double compare(Set<URI> ancA, Set<URI> ancB, SMconf conf) {

    Set<URI> interSecAncestors = SetUtils.intersection(ancA, ancB);

    int nbAncest_a = ancA.size();
    int nbAncest_b = ancB.size();

    double simpson = (double) interSecAncestors.size() / Math.min(nbAncest_a, nbAncest_b);

    return simpson;
  }
  /** @throws SLIB_Ex_Critic */
  @Test
  public void test_dag_descendant_1() throws SLIB_Ex_Critic {

    WalkConstraint wc = new WalkConstraintGeneric(RDFS.SUBCLASSOF, Direction.IN);
    rvf = new RVF_DAG(g, wc);

    Set<URI> desc = rvf.getRV(testValues.G_BASIC_THING);
    int sizeInter = SetUtils.intersection(desc, g.getV()).size();

    System.out.println(sizeInter + "/" + g.getV().size());

    assertTrue(sizeInter == g.getV().size() - 1);
  }
  @Override
  public double compare(Set<URI> ancA, Set<URI> ancB, SMconf conf) {

    Set<URI> interSecAncestors = SetUtils.intersection(ancA, ancB);

    double nbAncest_a = ancA.size();
    double nbAncest_b = ancB.size();

    double knappe =
        (double) k * (interSecAncestors.size() / nbAncest_a)
            + (1 - k) * (interSecAncestors.size() / nbAncest_b);

    return knappe;
  }
Esempio n. 4
0
 public static Set<URI> getV_NoEdgeType(G g, URI edgeType, Direction dir) {
   return getV_NoEdgeType(g, SetUtils.buildSet(edgeType), dir);
 }