Exemple #1
0
  @Test
  public void testAddAndGetSentence() throws KBApiException {
    System.out.println("Running testAddAndGetSentence");
    KBIndividualImpl i = KBIndividualImpl.findOrCreate("SomeRandom-LS");
    i.isInstanceOf(KBCollectionImpl.get("LogicalSchema"));
    KBPredicateImpl p = KBPredicateImpl.get("meaningSentenceOfSchema");
    List<Object> l = new ArrayList<Object>();
    l.add(KBPredicateImpl.get("isa"));
    l.add(i);
    l.add(p);
    Sentence s = new SentenceImpl(l.toArray());

    i.addFact(ContextImpl.get("UniversalVocabularyMt"), p, 1, s);

    Collection<Fact> lfs = i.getFacts(p, 1, ContextImpl.get("UniversalVocabularyMt"));
    KBIndividual iback = lfs.iterator().next().<KBIndividual>getArgument(1);
    Sentence a = lfs.iterator().next().<Sentence>getArgument(2);
    assertTrue("Didn't get sentence", (a instanceof Sentence));
  }