Examples of RelationshipContext


Examples of edu.cmu.cs.fusion.relationship.RelationshipContext

    assertTrue(join.getValue(new Relationship(tB, new ObjectLabel[] {z, y})) == SevenPointLattice.UNK);
  }
 
  @Test
  public void testStrictPrecise() {
    RelationshipContext ctx = new RelationshipContext(false).applyChangesFromDelta(d1);
    RelationshipDelta delta;
   
    //test the empty delta
    delta = new RelationshipDelta();
    assertTrue(!delta.isStrictlyMorePrecise(ctx));
View Full Code Here

Examples of edu.cmu.cs.fusion.relationship.RelationshipContext

    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {w, z}), SevenPointLattice.FAL);
    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {x, y}), SevenPointLattice.TRU);
    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {x, z}), SevenPointLattice.FAL);
    delta.setRelationship(new Relationship(tB, new ObjectLabel[] {y, z}), SevenPointLattice.TRU);
    delta.setRelationship(new Relationship(tB, new ObjectLabel[] {z, y}), SevenPointLattice.UNK);
    c1 = new RelationshipContext(true).applyChangesFromDelta(delta);
   
    delta = new RelationshipDelta();
    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {w, y}), SevenPointLattice.TRU);
    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {w, z}), SevenPointLattice.FAL);
    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {x, y}), SevenPointLattice.FAL);
    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {x, z}), SevenPointLattice.TRU);
    delta.setRelationship(new Relationship(tB, new ObjectLabel[] {y, z}), SevenPointLattice.UNK);
    delta.setRelationship(new Relationship(tB, new ObjectLabel[] {z, y}), SevenPointLattice.UNK);
    c2 = new RelationshipContext(true).applyChangesFromDelta(delta);

    delta = new RelationshipDelta();
    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {w, y}), SevenPointLattice.TRU);
    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {w, z}), SevenPointLattice.FAL);
    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {x, y}), SevenPointLattice.UNK);
    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {x, z}), SevenPointLattice.UNK);
    delta.setRelationship(new Relationship(tB, new ObjectLabel[] {y, z}), SevenPointLattice.UNK);
    delta.setRelationship(new Relationship(tB, new ObjectLabel[] {z, y}), SevenPointLattice.UNK);
    c3 = new RelationshipContext(true).applyChangesFromDelta(delta);

    delta = new RelationshipDelta();
    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {w, y}), SevenPointLattice.TRU);
    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {w, z}), SevenPointLattice.UNK);
    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {x, y}), SevenPointLattice.FAL);
    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {x, z}), SevenPointLattice.UNK);
    delta.setRelationship(new Relationship(tB, new ObjectLabel[] {y, z}), SevenPointLattice.UNK);
    delta.setRelationship(new Relationship(tB, new ObjectLabel[] {z, y}), SevenPointLattice.UNK);
    c4 = new RelationshipContext(true).applyChangesFromDelta(delta);
   
   
    d1 = new RelationshipDelta();
    d1.setRelationship(new Relationship(tA, new ObjectLabel[] {w, y}), SevenPointLattice.TRU);
    d1.setRelationship(new Relationship(tA, new ObjectLabel[] {x, z}), SevenPointLattice.FAL);
View Full Code Here

Examples of edu.cmu.cs.fusion.relationship.RelationshipContext

    d4.setRelationship(new Relationship(tB, new ObjectLabel[] {z, y}), SevenPointLattice.TRU_STAR);
}
 
  @Test
  public void testJoinSame() {
    RelationshipContext joined = c1.join(c2);
    assertTrue(joined.getRelationship(new Relationship(tA, new ObjectLabel[] {w, y})) == ThreeValue.TRUE);
    assertTrue(joined.getRelationship(new Relationship(tA, new ObjectLabel[] {w, z})) == ThreeValue.FALSE);
    assertTrue(joined.getRelationship(new Relationship(tA, new ObjectLabel[] {x, y})) == ThreeValue.UNKNOWN);
    assertTrue(joined.getRelationship(new Relationship(tA, new ObjectLabel[] {x, z})) == ThreeValue.UNKNOWN);
    assertTrue(joined.getRelationship(new Relationship(tB, new ObjectLabel[] {y, z})) == ThreeValue.UNKNOWN);
    assertTrue(joined.getRelationship(new Relationship(tB, new ObjectLabel[] {z, y})) == ThreeValue.UNKNOWN);
  }
View Full Code Here

Examples of edu.cmu.cs.fusion.relationship.RelationshipContext

    assertTrue(joined.getRelationship(new Relationship(tB, new ObjectLabel[] {z, y})) == ThreeValue.UNKNOWN);
  }
 
  @Test
  public void testJoinMorePrecise() {
    RelationshipContext joined = c2.join(c3);
    assertTrue(joined.equals(c3));
  }
View Full Code Here

Examples of edu.cmu.cs.fusion.relationship.RelationshipContext

    assertTrue(joined.equals(c3));
  }
 
  @Test
  public void testJoinBottom() {
    RelationshipContext b1 = new RelationshipContext(true);
    RelationshipContext b2 = new RelationshipContext(true);
    RelationshipContext joined;
   
    joined = c2.join(b1);
    assertTrue(joined.equals(c2));
   
    joined = b1.join(c4);
    assertTrue(joined.equals(c4));
 
    joined = b1.join(b2);
    assertTrue(joined.equals(b2));
    assertTrue(joined.equals(b1));
  }
View Full Code Here

Examples of edu.cmu.cs.fusion.relationship.RelationshipContext

    assertTrue(joined.equals(b1));
  }
 
  @Test
  public void testBottomIsMorePrecise() {
    RelationshipContext b1 = new RelationshipContext(true);
    RelationshipContext b2 = new RelationshipContext(true);
   
    assertTrue(b1.isMorePreciseOrEqualTo(c3));
    assertTrue(!c1.isMorePreciseOrEqualTo(b2));
    assertTrue(b1.isMorePreciseOrEqualTo(b2));
  }
View Full Code Here

Examples of edu.cmu.cs.fusion.relationship.RelationshipContext

  }
 
 
  @Test
  public void testBottomStrictlyIsMorePrecise() {
    RelationshipContext b1 = new RelationshipContext(true);
    RelationshipContext b2 = new RelationshipContext(true);
   
    assertTrue(b1.isStrictlyMorePrecise(c3));
    assertTrue(!c1.isStrictlyMorePrecise(b2));
    assertTrue(!b1.isStrictlyMorePrecise(b2));
  }
View Full Code Here

Examples of edu.cmu.cs.fusion.relationship.RelationshipContext

  }

 
  @Test
  public void testApplyChangesToContext() {
    RelationshipContext applied;
   
    applied = c1.applyChangesFromDelta(d1);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {w, y})) == ThreeValue.TRUE);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {w, z})) == ThreeValue.FALSE);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {x, y})) == ThreeValue.TRUE);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {x, z})) == ThreeValue.FALSE);
    assertTrue(applied.getRelationship(new Relationship(tB, new ObjectLabel[] {y, z})) == ThreeValue.TRUE);
    assertTrue(applied.getRelationship(new Relationship(tB, new ObjectLabel[] {z, y})) == ThreeValue.UNKNOWN);
 
    applied = c1.applyChangesFromDelta(d2);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {w, y})) == ThreeValue.TRUE);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {w, z})) == ThreeValue.FALSE);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {x, y})) == ThreeValue.FALSE);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {x, z})) == ThreeValue.FALSE);
    assertTrue(applied.getRelationship(new Relationship(tB, new ObjectLabel[] {y, z})) == ThreeValue.UNKNOWN);
    assertTrue(applied.getRelationship(new Relationship(tB, new ObjectLabel[] {z, y})) == ThreeValue.UNKNOWN);

    applied = c1.applyChangesFromDelta(d3);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {w, y})) == ThreeValue.TRUE);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {w, z})) == ThreeValue.FALSE);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {x, y})) == ThreeValue.UNKNOWN);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {x, z})) == ThreeValue.UNKNOWN);
    assertTrue(applied.getRelationship(new Relationship(tB, new ObjectLabel[] {y, z})) == ThreeValue.UNKNOWN);
    assertTrue(applied.getRelationship(new Relationship(tB, new ObjectLabel[] {z, y})) == ThreeValue.UNKNOWN);

    applied = c1.applyChangesFromDelta(d4);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {w, y})) == ThreeValue.TRUE);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {w, z})) == ThreeValue.UNKNOWN);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {x, y})) == ThreeValue.TRUE);
    assertTrue(applied.getRelationship(new Relationship(tA, new ObjectLabel[] {x, z})) == ThreeValue.FALSE);
    assertTrue(applied.getRelationship(new Relationship(tB, new ObjectLabel[] {y, z})) == ThreeValue.UNKNOWN);
    assertTrue(applied.getRelationship(new Relationship(tB, new ObjectLabel[] {z, y})) == ThreeValue.UNKNOWN);
  }
View Full Code Here

Examples of edu.cmu.cs.fusion.relationship.RelationshipContext

    assertTrue(applied.getRelationship(new Relationship(tB, new ObjectLabel[] {z, y})) == ThreeValue.UNKNOWN);
  }

  @Test
  public void testApplyChangesToContextBottom() {
    RelationshipContext b1 = new RelationshipContext(true);
    RelationshipDelta delta = new RelationshipDelta();
    RelationshipContext changes;
   
    changes = b1.applyChangesFromDelta(delta);
    assertTrue(b1.isMorePreciseOrEqualTo(changes));
    assertTrue(changes.isMorePreciseOrEqualTo(b1));
   
    delta.setRelationship(new Relationship(tA, new ObjectLabel[] {w, y}), SevenPointLattice.UNK);
    changes = b1.applyChangesFromDelta(delta);
    assertTrue(b1.isMorePreciseOrEqualTo(changes));
    assertTrue(!changes.isMorePreciseOrEqualTo(b1));
  }
View Full Code Here

Examples of edu.cmu.cs.fusion.relationship.RelationshipContext

    relations = new Relation[2];
    relations[0] = new Relation("A", new String[] {"Foo", "Bar"});
    relations[1] = new Relation("B", new String[] {"Foo", "Foo"});
   
    ctx = new RelationshipContext(false);
    RelationshipDelta delta = new RelationshipDelta();
    delta.setRelationship(new Relationship(relations[0], new ObjectLabel[] {labels[0], labels[1]}), SevenPointLattice.TRU);
    ctx = ctx.applyChangesFromDelta(delta);
   
    FreeVars.setHierarchy(testH);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.