예제 #1
0
 @Test
 public void testAddSet() throws KBApiException {
   System.out.println("Running testAddSet");
   KBIndividual i = Constants.getInstance().THESET_FUNC;
   Set<KBObjectImpl> ls = new HashSet<KBObjectImpl>();
   ls.add(KBIndividualImpl.findOrCreate("SomeIndividual001"));
   ls.add(KBIndividualImpl.findOrCreate("SomeIndividual002"));
   ls.add(KBIndividualImpl.findOrCreate("SomeIndividual003"));
   ls.add(KBIndividualImpl.findOrCreate("SomeIndividual004"));
   // Fact f = i.addFact(Context.get("UniversalVocabularyMt"), Predicate.get("exampleNATs"), 1,
   // ls);
   SentenceImpl s = new SentenceImpl(TestConstants.kbapitc.exampleNATS, i, ls);
   Fact f = new FactImpl(Constants.uvMt(), s);
   assertTrue("Didn't get a fact", f instanceof Fact);
 }
예제 #2
0
 @BeforeClass
 public static void setConnBeforeClass() throws Exception {
   isCluster = Constants.isCluster();
   sdb = new Sequoiadb(Constants.COOR_NODE_CONN, "", "");
   if (sdb.isCollectionSpaceExist(Constants.TEST_CS_NAME_1)) {
     sdb.dropCollectionSpace(Constants.TEST_CS_NAME_1);
     cs = sdb.createCollectionSpace(Constants.TEST_CS_NAME_1);
   } else cs = sdb.createCollectionSpace(Constants.TEST_CS_NAME_1);
   BSONObject conf = new BasicBSONObject();
   conf.put("ReplSize", 0);
   cl = cs.createCollection(Constants.TEST_CL_NAME_1, conf);
 }
예제 #3
0
  @Test
  public void testFactContextObject() throws KBApiException {
    System.out.println("Running testFactContextObject");
    Context uctx = Constants.uvMt();
    Fact anA =
        new FactImpl(
            "(SomeAirlineEquipmentLogFn Plane-APITest)",
            "(flyingDoneBySomething-Move FlightXYZ-APITest Plane-APITest)");

    Fact anAonA =
        new FactImpl(
            "(SomeAirlineEquipmentLogFn Plane-APITest)",
            "(#$assertionUtility  (#$ist (SomeAirlineEquipmentLogFn Plane-APITest) (flyingDoneBySomething-Move FlightXYZ-APITest Plane-APITest))  0.5 )");

    KBPredicate p = KBPredicateImpl.get("assertionUtility");
    FactImpl a = new FactImpl(uctx, p, anA, 0.89);
    assertEquals(
        "(ist UniversalVocabularyMt (assertionUtility (() ((#$flyingDoneBySomething-Move #$FlightXYZ-APITest #$Plane-APITest))) 0.89))",
        a.toString());

    assertEquals(a.getContext().toString(), "UniversalVocabularyMt");
  }