Package edu.cmu.cs.fusion.constraint

Examples of edu.cmu.cs.fusion.constraint.Substitution


    RelationshipDelta startRels = new RelationshipDelta();
    startRels.setRelationship(new Relationship(utils.getRelation(1), new ObjectLabel[]{labels[1], labels[1]}), SevenPointLattice.FAL);
    startRels.setRelationship(new Relationship(utils.getRelation(1), new ObjectLabel[]{labels[1], labels[6]}), SevenPointLattice.FAL);
    RelationshipContext rels = new RelationshipContext(false).applyChangesFromDelta(startRels);

    Substitution partialSub = new Substitution();
    partialSub = partialSub.addSub(utils.getVar(0), labels[0]);
    partialSub = partialSub.addSub(utils.getVar(1), labels[1]);
    partialSub = partialSub.addSub(Constraint.RESULT, labels[6]);
    partialSub = partialSub.addSub(Constraint.RECEIVER, labels[1]);

    Relationship eRel = new Relationship(utils.getRelation(1), new ObjectLabel[]{labels[6], labels[1]});

    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, rels, null, types, new InferenceEnvironment(null), variant);   
    Pair<RelationshipDelta, Substitution> deltas = runFullyBound(env, partialSub, cons);
View Full Code Here


   
    assertEquals(1, subs.size());
   
    Iterator<Substitution> itr = subs.iterator();
    assertTrue(itr.hasNext());
    Substitution sub = itr.next();
   
    assertEquals(2, sub.size());
    assertEquals(labels[0], sub.getSub(new SpecVar("a")));
    assertEquals(labels[1], sub.getSub(new SpecVar("b")))
  }
View Full Code Here

   
    assertEquals(2, subs.size());
   
    Iterator<Substitution> itr = subs.iterator();
    assertTrue(itr.hasNext());
    Substitution subA = itr.next();
    assertTrue(itr.hasNext());
    Substitution subB = itr.next();
   
    assertEquals(2, subA.size());
    assertEquals(2, subB.size());
   
    if (subA.getSub(new SpecVar("a")).equals(labels[4])) {
      assertEquals(labels[1], subA.getSub(new SpecVar("b")));     
      assertEquals(labels[3], subB.getSub(new SpecVar("a")));     
      assertEquals(labels[1], subB.getSub(new SpecVar("b")));     
    }
    else {
      assertEquals(labels[3], subA.getSub(new SpecVar("a")));     
      assertEquals(labels[1], subA.getSub(new SpecVar("b")));     
      assertEquals(labels[4], subB.getSub(new SpecVar("a")));     
      assertEquals(labels[1], subB.getSub(new SpecVar("b")));           
    }
  }
View Full Code Here

   
    assertEquals(2, subs.size());

    Iterator<Substitution> itr = subs.iterator();
    assertTrue(itr.hasNext());
    Substitution subA = itr.next();
    assertTrue(itr.hasNext());
    Substitution subB = itr.next()
   
    assertEquals(2, subA.size());
    assertEquals(2, subB.size());
   
    if (subA.getSub(new SpecVar("b")).equals(labels[6])) {
      assertEquals(labels[0], subA.getSub(new SpecVar("a")));     
      assertEquals(labels[5], subB.getSub(new SpecVar("b")));     
      assertEquals(labels[0], subB.getSub(new SpecVar("a")));     
    }
    else {
      assertEquals(labels[5], subA.getSub(new SpecVar("b")));     
      assertEquals(labels[0], subA.getSub(new SpecVar("a")));     
      assertEquals(labels[6], subB.getSub(new SpecVar("b")));     
      assertEquals(labels[0], subB.getSub(new SpecVar("a")));           
    }
  }
View Full Code Here

   
    assertEquals(4, subs.size());

    Iterator<Substitution> itr = subs.iterator();
    assertTrue(itr.hasNext());
    Substitution subA = itr.next();
    assertTrue(itr.hasNext());
    Substitution subB = itr.next();
   
    assertTrue(itr.hasNext());
    Substitution subC = itr.next();
    assertTrue(itr.hasNext());
    Substitution subD = itr.next()
   
    assertEquals(2, subA.size());
    assertEquals(2, subB.size());
    assertEquals(2, subC.size())
    assertEquals(2, subD.size());
  }
View Full Code Here

    RelationshipDelta startRels = new RelationshipDelta();
    startRels.setRelationship(new Relationship(utils.getRelation(0), new ObjectLabel[]{labels[0], labels[1]}), SevenPointLattice.TRU);
    startRels.setRelationship(new Relationship(utils.getRelation(1), new ObjectLabel[]{labels[1], labels[6]}), SevenPointLattice.TRU);
    RelationshipContext rels = new RelationshipContext(false).applyChangesFromDelta(startRels);

    Substitution partialSub = new Substitution();
    partialSub = partialSub.addSub(utils.getVar(0), labels[0]);
    partialSub = partialSub.addSub(utils.getVar(1), labels[1]);
    partialSub = partialSub.addSub(Constraint.RESULT, labels[6]);
    partialSub = partialSub.addSub(Constraint.RECEIVER, labels[3]);

    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, rels, null, types, new InferenceEnvironment(null), variant);   
    Pair<RelationshipDelta, Substitution> deltas = runFullyBound(env, partialSub, cons);

    assertEquals(partialSub, deltas.snd());
View Full Code Here

 
    RelationshipDelta startRels = new RelationshipDelta();
    startRels.setRelationship(new Relationship(utils.getRelation(0), new ObjectLabel[]{labels[0], labels[1]}), SevenPointLattice.TRU);
    RelationshipContext rels = new RelationshipContext(false).applyChangesFromDelta(startRels);

    Substitution partialSub = new Substitution();
    partialSub = partialSub.addSub(utils.getVar(0), labels[0]);
    partialSub = partialSub.addSub(utils.getVar(1), labels[1]);
    partialSub = partialSub.addSub(Constraint.RESULT, labels[6]);
    partialSub = partialSub.addSub(Constraint.RECEIVER, labels[3]);

    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, rels, null, types, new InferenceEnvironment(null), variant);   
    Pair<RelationshipDelta, Substitution> deltas = runFullyBound(env, partialSub, noSubCons);

    assertNull(deltas.snd());
View Full Code Here

    startRels.setRelationship(new Relationship(utils.getRelation(1), new ObjectLabel[]{labels[1], labels[1]}), SevenPointLattice.FAL);
    startRels.setRelationship(new Relationship(utils.getRelation(1), new ObjectLabel[]{labels[1], labels[6]}), SevenPointLattice.TRU);
    startRels.setRelationship(new Relationship(utils.getRelation(1), new ObjectLabel[]{labels[1], labels[2]}), SevenPointLattice.UNK);
    RelationshipContext rels = new RelationshipContext(false).applyChangesFromDelta(startRels);

    Substitution partialSub = new Substitution();
    partialSub = partialSub.addSub(utils.getVar(0), labels[0]);
    partialSub = partialSub.addSub(utils.getVar(1), labels[1]);
    partialSub = partialSub.addSub(Constraint.RESULT, labels[6]);
    partialSub = partialSub.addSub(Constraint.RECEIVER, labels[1]);

    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, rels, null, types, new InferenceEnvironment(null), variant);   
    Pair<RelationshipDelta, Substitution> deltas = runFullyBound(env, partialSub, cons);
    assertEquals(partialSub, deltas.snd());
  }
View Full Code Here

    startRels.setRelationship(new Relationship(utils.getRelation(2), new ObjectLabel[]{labels[1], labels[1]}), SevenPointLattice.FAL);
    startRels.setRelationship(new Relationship(utils.getRelation(2), new ObjectLabel[]{labels[1], labels[2]}), SevenPointLattice.TRU);
    startRels.setRelationship(new Relationship(utils.getRelation(2), new ObjectLabel[]{labels[1], labels[6]}), SevenPointLattice.FAL);
    RelationshipContext rels = new RelationshipContext(false).applyChangesFromDelta(startRels);

    Substitution partialSub = new Substitution();
    partialSub = partialSub.addSub(utils.getVar(0), labels[0]);
    partialSub = partialSub.addSub(utils.getVar(1), labels[1]);
    partialSub = partialSub.addSub(Constraint.RESULT, labels[6]);
    partialSub = partialSub.addSub(Constraint.RECEIVER, labels[1]);

    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, rels, null, types, new InferenceEnvironment(null), variant);   
    Pair<RelationshipDelta, Substitution> deltas = runFullyBound(env, partialSub, cons);
    assertEquals(partialSub, deltas.snd());
  }
View Full Code Here

    startRels.setRelationship(new Relationship(utils.getRelation(1), new ObjectLabel[]{labels[1], labels[1]}), SevenPointLattice.FAL);
    startRels.setRelationship(new Relationship(utils.getRelation(1), new ObjectLabel[]{labels[1], labels[6]}), SevenPointLattice.FAL);
    startRels.setRelationship(new Relationship(utils.getRelation(1), new ObjectLabel[]{labels[1], labels[2]}), SevenPointLattice.FAL);
    RelationshipContext rels = new RelationshipContext(false).applyChangesFromDelta(startRels);

    Substitution partialSub = new Substitution();
    partialSub = partialSub.addSub(utils.getVar(0), labels[0]);
    partialSub = partialSub.addSub(utils.getVar(1), labels[1]);
    partialSub = partialSub.addSub(Constraint.RESULT, labels[6]);
    partialSub = partialSub.addSub(Constraint.RECEIVER, labels[1]);

    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, rels, null, types, new InferenceEnvironment(null), variant);   
    Pair<RelationshipDelta, Substitution> deltas = runFullyBound(env, partialSub, cons);
    assertNull(deltas.snd());
  }
View Full Code Here

TOP

Related Classes of edu.cmu.cs.fusion.constraint.Substitution

Copyright © 2018 www.massapicom. 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.