/** Demonstrates usage of the unassertGaf api function. */ protected void demo15() throws IOException, UnknownHostException, CycApiException { Log.current.println("Demonstrating usage of the unassertGaf api function.\n"); CycFort mt = cycAccess.getKnownConstantByName("PeopleDataMt"); CycFormulaSentence gaf = cycAccess.makeCycSentence("(#$likesAsFriend #$BillClinton #$JimmyCarter)"); cycAccess.unassertGaf(gaf, mt); }
/** Demonstrates usage of isQueryTrue api function. */ protected void demo13() throws IOException, UnknownHostException, CycApiException { Log.current.println("Demonstrating isQueryTrue api function.\n"); CycFormulaSentence gaf = cycAccess.makeCycSentence("(#$likesAsFriend #$BillClinton #$JimmyCarter)"); CycFort mt = cycAccess.getKnownConstantByName("PeopleDataMt"); InferenceParameters queryProperties = new DefaultInferenceParameters(cycAccess); boolean isQueryTrue = cycAccess.isQueryTrue(gaf, mt, queryProperties); if (isQueryTrue) Log.current.println("\nThe assertion\n" + gaf + "\nis true in the " + mt.cyclify()); else Log.current.println( "\nThe assertion\n" + gaf + "\nis not known to be true in the " + mt.cyclify()); }
/** Demonstrates getParaphrase (with quantified formula) api function. */ protected void demo10() throws IOException, UnknownHostException, CycApiException { if (cycAccess.isOpenCyc()) { Log.current.println("\nThis demo is not available in OpenCyc"); } else { Log.current.println("Demonstrating getParaphrase api function.\n"); CycFormulaSentence formula = cycAccess.makeCycSentence( "(#$thereExists ?PLANET\n" + " (#$and\n" + " (#$isa ?PLANET #$Planet)\n" + " (#$orbits ?PLANET #$Sun)))"); String paraphrase = cycAccess.getParaphrase(formula); Log.current.println("\nThe obtained paraphrase for\n" + formula + "\nis:\n" + paraphrase); } }
/** Demonstrates getImpreciseParaphrase (with quantified formula) api function. */ protected void demo11() throws IOException, UnknownHostException, CycApiException { if (cycAccess.isOpenCyc()) { Log.current.println("\nThis demo is not available in OpenCyc"); } else { Log.current.println("Demonstrating getImpreciseParaphrase api function.\n"); CycFormulaSentence formula = cycAccess.makeCycSentence( "(#$forAll ?PERSON1\n" + " (#$implies\n" + " (#$isa ?PERSON1 #$Person)\n" + " (#$thereExists ?PERSON\n" + " (#$and\n" + " (#$isa ?PERSON2 #$Person)\n" + " (#$loves ?PERSON1 ?PERSON2)))))"); String paraphrase = cycAccess.getImpreciseParaphrase(formula); Log.current.println( "\nThe obtained imprecise paraphrase for\n" + formula + "\nis:\n" + paraphrase); } }