/** 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); }
/** * Find or create the microtehory gave by name * * @param mt the microtheory * @return a CycConstant who represent the microtheory * @exception java.net.UnknownHostException if OpenCyc'host wasn't founded. * @exception java.io.IOException if an I/O error occurs. * @exception org.opencyc.api.CycApiException if occurs an error in communicating with OpenCyc. */ protected CycConstant findOrCreateMt(String mt) throws IOException, UnknownHostException, CycApiException { createAccess(); CycConstant context = myAccess.findOrCreate(mt); myAccess.assertIsa(mt, "Microtheory"); return context; }
/** * Executes a query in the specified microtheory, swhowing variables to substitute. Returns the * Cyc terms present in the Cyc KB that match the query applying inference. * * @param query String that contains the Cyc formula (i.e. the query). * @param var the unbounds variables in the query for which bindings are sought. * @param mt the microtheory in which the query is asked. * @return a list of bindings for the query (<code>null</code> null if doesn't exist). * @throw java.net.UnknownHostException if Cyc server host not found on the network. * @throw java.io.IOException if a data communication error occurs. * @throw org.opencyc.api.CycApiException if the api request results in a Cyc server error. */ @SuppressWarnings("deprecation") protected CycList askQuery(String query, CycVariable var, CycConstant mt) throws IOException, UnknownHostException, CycApiException { query = cyclify(query); CycList l = new CycList(); l = myAccess.askWithVariable(myAccess.makeCycList(query), var, mt); // , Integer.MAX_VALUE); return l; }
/** Demonstrates usage of CycNart and getInstanceSiblings api function. */ protected void demo12() throws IOException, UnknownHostException, CycApiException { Log.current.println("Demonstrating CycNart and getInstanceSiblings api function.\n"); CycNart usGovernment = new CycNart( cycAccess.getKnownConstantByName("GovernmentFn"), cycAccess.getKnownConstantByName("UnitedStatesOfAmerica")); CycList siblings = cycAccess.getInstanceSiblings(usGovernment); Log.current.println( "\nThe obtained instance sibling terms of " + usGovernment + "\nare:\n" + siblings.cyclify()); }
/** 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 usage of the rkfPhraseReader api function. */ protected void demo16() throws IOException, UnknownHostException, CycApiException { if (cycAccess.isOpenCyc()) { Log.current.println("\nThis demo is not available in OpenCyc"); } else { Log.current.println("Demonstrating usage of the rkfPhraseReader api function.\n"); String phrase = "penguins"; CycFort inferencePsc = cycAccess.getKnownConstantByGuid("bd58915a-9c29-11b1-9dad-c379636f7270"); CycFort rkfEnglishLexicalMicrotheoryPsc = cycAccess.getKnownConstantByGuid("bf6df6e3-9c29-11b1-9dad-c379636f7270"); CycList parsingExpression = cycAccess.rkfPhraseReader(phrase, rkfEnglishLexicalMicrotheoryPsc, inferencePsc); Log.current.println( "the result of parsing the phrase \"" + phrase + "\" is\n" + parsingExpression); } }
/** * Executes a CycL instruction represented by a String. * * @param instruction a String who represents the CyL formula. * @return the result of the conversation with Cyc in a String format. Converse directly Cyt term * for false in "FALSE" and Cyc term for true in "TRUE". */ public String executeCycL(String instruction) throws CycSupportError { String result = null; createAccess(); try { // Execute the CycL formula and convert its result into a String. result = (myAccess.converseObject(instruction)).toString(); if (result.equals(CYC_FALSE)) { result = FALSE; } else if (trimBracketAndQuote(result).equals(CYC_FALSE)) { // converseObject, al posto di TRUE, ritorna una CycList con NIL // all'interno, come (NIL) result = TRUE; } checkAndStore(instruction, result); return result; } catch (CycApiException ce) { checkAndStore(instruction, "Cyc communication error!"); throw new CycSupportError("Cyc communication error!"); } catch (UnknownHostException oe) { checkAndStore(instruction, "Unable to find OpenCyc!"); throw new CycSupportError("Unable to find OpenCyc!"); } catch (IOException ioe) { checkAndStore(instruction, "I/O error!"); throw new CycSupportError("I/O error!"); } catch (Exception e) { checkAndStore(instruction, "Unknow error!"); throw new CycSupportError("Unknow error!"); } }
private void demo1() throws IOException, UnknownHostException, CycApiException { Log.current.println("Demonstrating getKnownConstantByName api function.\n"); CycFort snowSkiing = cycAccess.getKnownConstantByName("SnowSkiing"); Log.current.println("\nThe obtained constant is " + snowSkiing.cyclify()); System.out.println(snowSkiing.cyclify()); }
/** End previously opened connection to Cyc. */ public void endConnection() throws CycSupportError { try { myAccess.close(); } catch (Exception e) { throw new CycSupportError("Unknow error!"); } }
/** Demonstrates usage of the generateDisambiguationPhraseAndTypes api function. */ protected void demo17() throws IOException, UnknownHostException, CycApiException { if (cycAccess.isOpenCyc()) { Log.current.println("\nThis demo is not available in OpenCyc"); } else { Log.current.println( "Demonstrating usage of the generateDisambiguationPhraseAndTypes api function.\n"); CycFort mt = cycAccess.getKnownConstantByName("PeopleDataMt"); CycList objects = cycAccess.makeCycList("(#$Penguin #$PittsburghPenguins)"); CycList disambiguationExpression = cycAccess.generateDisambiguationPhraseAndTypes(objects); Log.current.println( "the result of disambiguating the objects \"" + objects.cyclify() + "\" is\n" + disambiguationExpression); } }
/** 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); } }
@BeforeClass public static void initializeCyc() throws Exception { Log.makeLog(); Log.current.println("Initializing Cyc server connection, and caching frequently used terms."); try { cyc = new CycAccess(); } catch (Exception e) { Log.current.errorPrintln(e.getMessage()); Log.current.printStackTrace(e); } cyc.traceOn(); Log.current.println("Now tracing Cyc server messages"); }
@Test public void setupTest() throws Exception { // sample one of the asserted facts String cycl = "(#$orbits #$PlanetEarth ?SUN)"; CycDatasetGraph dsg = new CycDatasetGraph(cyc); CycGraph graph = (CycGraph) dsg.getDefaultGraph(); CycList<Object> results = graph.query(cycl, SPECIFIC_MICROTHEORY); if (results == null || results.isEmpty()) { // the fact doesn't exist so run the setup CycFort mt = cyc.getKnownConstantByName(SPECIFIC_MICROTHEORY); Demo.setup(cyc, mt); results = graph.query(cycl, SPECIFIC_MICROTHEORY); } Object[] a = results.toArray(); System.out.println(a.length + " results"); assertTrue(a.length == 1); }
@SuppressWarnings("unchecked") public String executeRandomCycL(String formula) throws CycSupportError { createAccess(); try { Object res = myAccess.converseObject(formula); // This will store the result String result = res.toString(); if (result.equals(CYC_FALSE)) { result = FALSE; checkAndStore(formula, result); } else if (trimBracketAndQuote(result).equals(CYC_FALSE)) { result = TRUE; checkAndStore(formula, result); } else if (res instanceof CycList) { checkAndStore(formula, result); CycList cl = ((CycList) res).randomPermutation(); ArrayList results = getVariables(cl); if (results.size() > 0) { result = getContentVariable(results.get(0).toString()); } else result = UNKNOWN; } return result; } catch (CycApiException ce) { ce.printStackTrace(); checkAndStore(formula, "Cyc communication error!"); throw new CycSupportError("Cyc communication error!"); } catch (UnknownHostException oe) { checkAndStore(formula, "Unable to find OpenCyc!"); throw new CycSupportError("Unable to find OpenCyc!"); } catch (IOException ioe) { checkAndStore(formula, "I/O error!"); throw new CycSupportError("I/O error!"); } catch (Exception e) { checkAndStore(formula, "Unknow error!"); throw new CycSupportError("Unknow error!"); } }
@AfterClass public static void shutdown() { cyc.close(); }
/** * Provides the main method for an EELD DAML export. * * @parameter args the optional command line arguments */ public static void main(String[] args) { try { cycAccess = new CycAccess( CycConnection.DEFAULT_HOSTNAME, CycConnection.DEFAULT_BASE_PORT, CycConnection.DEFAULT_COMMUNICATION_MODE, CycAccess.DEFAULT_CONNECTION); /* new CycAccess(CycConnection.DEFAULT_HOSTNAME, 3620, CycConnection.DEFAULT_COMMUNICATION_MODE, CycAccess.DEFAULT_CONNECTION); */ ExportDaml exportDaml = new ExportDaml(cycAccess); exportDaml.verbosity = ExportDaml.DEFAULT_VERBOSITY; // exportDaml.verbosity = 9; String choice = "eeld-core"; if (args.length > 0) choice = args[0]; Log.current.println("Choosing KB selection: " + choice); // These require the Cycorp IKB or full KB to work as setup below. if (choice.equals("all")) { exportDaml.includeUpwardClosure = false; exportDaml.title = "Open Cyc Ontology"; exportDaml.outputPath = "open-cyc.daml"; exportDaml.export(ExportDaml.EXPORT_ENTIRE_KB); } if (choice.equals("eeld-core")) { exportDaml.cycKbSubsetCollectionGuid = eeldSharedOntologyCoreConstantGuid; exportDaml.cycKbSubsetFilterGuid = ikbConstantGuid; exportDaml.title = "EELD Shared Core Ontology"; exportDaml.outputPath = "eeld-shared-core-ontology.daml"; exportDaml.export(ExportDaml.EXPORT_KB_SUBSET); } else if (choice.equals("eeld")) { exportDaml.cycKbSubsetCollectionGuid = eeldSharedOntologyConstantGuid; exportDaml.cycKbSubsetFilterGuid = ikbConstantGuid; exportDaml.title = "EELD Shared Ontology"; exportDaml.outputPath = "eeld-shared-ontology.daml"; CycList kbSubsetCollections = new CycList(); kbSubsetCollections.add(cycAccess.getKnownConstantByName("EELDSyntheticDataConstant")); kbSubsetCollections.add(cycAccess.getKnownConstantByName("EELDNaturalDataConstant")); CycList applicableBinaryPredicates = cycAccess.getApplicableBinaryPredicates(kbSubsetCollections); applicableBinaryPredicates.remove(cycAccess.isa); applicableBinaryPredicates = applicableBinaryPredicates.sort(); Log.current.println( "applicableBinaryPredicates: \n" + applicableBinaryPredicates.cyclify()); exportDaml.applicableBinaryPredicates = applicableBinaryPredicates; exportDaml.export(ExportDaml.EXPORT_KB_SUBSET); } else if (choice.equals("transportation-device")) { Guid transportationDeviceGuid = CycObjectFactory.makeGuid("bd58d540-9c29-11b1-9dad-c379636f7270"); exportDaml.rootTermGuid = transportationDeviceGuid; exportDaml.cycKbSubsetFilterGuid = counterTerrorismConstantGuid; exportDaml.export(ExportDaml.EXPORT_KB_SUBSET_BELOW_TERM); } else { System.out.println("specified choice not found - " + choice); System.exit(1); } } catch (Exception e) { e.printStackTrace(); System.exit(1); } }
// Opencyc // algrism***************************************************************************************************************************************************// private void sample() { // TODO Auto-generated method stub System.out.println("Starting Cyc NART examples."); try { access = new CycAccess(); // Log.current.println("Demonstrating getConstantGuid api function.\n"); // Guid a = access.getConstantGuid("apple"); CycConstant cycAdministrator = access.getKnownConstantByName("CycAdministrator"); System.out.println("Unique id ?" + cycAdministrator.guid); System.out.println("Unique id ?" + DefaultCycObject.toCompactExternalId("AppleInc")); CycList isas = access.getIsas(access.getKnownConstantByName("AppleInc")); Log.current.println("\nThe obtained isas are:\n" + isas.cyclify()); CycConstant generalCycKE = access.getKnownConstantByName("GeneralCycKE"); access.setCyclist(cycAdministrator); // needed to maintain // bookeeping information access.setKePurpose(generalCycKE); // needed to maintain bookeeping // information // find nart by external id (preferred lookup mechanism) CycNart apple = (CycNart) DefaultCycObject.fromCompactExternalId( "Mx8Ngh4rvVipdpwpEbGdrcN5Y29ycB4rvVjBnZwpEbGdrcN5Y29ycA", access); // access.getConstantId(""); // find nart by name (dispreferred because names in the KB can // change) CycNart apple2 = access.getCycNartFromCons( (CycList) CycLParserUtil.parseCycLDenotationalTerm("(FruitFn AppleTree)", true, access)); assert apple.equals(apple2) : "Lookup failed to produce equal results."; // getting the external id DefaultCycObject.tofor a NART String appleEID = DefaultCycObject.toCompactExternalId(apple, access); // creating a nart // There is no direct way of creating NARTs, they are an // implementation detail // of the inference engine. However, if you make an assertion using // arguments // to a reifiable function that the inference engine hasn't seen // before, then it will be create // automatically. CycNart elmFruit = new CycNart( access.getKnownConstantByName("FruitFn"), access.getKnownConstantByName("ElmTree")); // NOTE: the previous call only makes the NART locally and not in // the KB // Asserting the isa and genls relations // every new term should have at least 1 isa assertion made on it access.assertIsa(elmFruit, CycAccess.collection, CycAccess.baseKB); // Note: the previous line causes the new NART to be created in the // KB! // Every new collection should have at least 1 genls assertion made // on it, // however, in this case, the inference engine has made it for you // since // any new terms involving FruitFn's must be types of fruits. // access.assertGenls(elmFruit, // access.getKnownConstantByName("Fruit"), CycAccess.baseKB); // verify genls relation assert access.isSpecOf(elmFruit, access.getKnownConstantByName("Fruit"), CycAccess.baseKB) : "Good grief! Elm fruit isn't known to be a type of fruit."; // find everything that is an apple System.out.println("Got instances of Apple: " + access.getInstances(apple)); System.out.println( "Got instances of Apple: " + access.getAllInstances(apple, CycAccess.baseKB)); // find everything that a apple is a type of System.out.println( "Got generalizations of Apple: " + access.getAllGenls(apple, CycAccess.baseKB)); // find everything that is a type of apple System.out.println( "Got specializations of Apple: " + access.getAllSpecs(apple, CycAccess.baseKB)); // generating NL // System.out.println("The concept " + apple.cyclify() // + " can be referred to in English as '" + // access.getGeneratedPhrase(apple) + "'."); // Killing a NART -- removing a NART and all assertions involving // that NART from the KB // Warning: you can potentially do serious harm to the KB if you // remove critical information access.kill(elmFruit); // CycConstant dog2 = access.getKnownConstantByName("Dog"); // CycFort snowSkiing = access.getKnownConstantByName("SnowSkiing"); } catch (UnknownHostException nohost) { nohost.printStackTrace(); } catch (IOException io) { io.printStackTrace(); } catch (CycApiException cyc_e) { cyc_e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } System.out.println("Finished."); }
/* * Find the first Cyc Constant that match the input String. * * @param input the input String * * @return a String who represents a Cyc Constant. * * @throw CycSupportError if any error occurs. */ @SuppressWarnings("unchecked") public String findFirstMatch(String input) throws CycSupportError { createAccess(); CycFort result; ArrayList attempt = makeCycLike(input); int size = attempt.size(); for (int index = 0; index < size; index++) { try { result = myAccess.getConstantByName(attempt.get(index++).toString()); if (result != null) return result.cyclify(); } catch (Exception e) { } } try { ArrayList vars = new ArrayList(); // Try CycTerm vars = askQuery( "(#$denotation #$" + attempt.get(1) + " ?TEXT ?TYPE ?CYCOBJECT)", "?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); vars = askQuery( "(#$denotationRelatedTo #$" + attempt.get(1) + " ?TEXT ?TYPE ?CYCOBJECT)", "?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); // Name look up vars = askQuery( "(#$nameString \"" + attempt.get(0) + "\" ?CYCOBJECT)", " ?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); // '#$initialismString' vars = askQuery( "(#$initialismString ?CYCOBJECT \"" + attempt.get(0) + "\")", " ?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); // '#$abbreviationString-PN' vars = askQuery( "(#$abbreviationString-PN ?CYCOBJECT \"" + attempt.get(0) + "\")", " ?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); // '#$preferredNameString' vars = askQuery( "(#$preferredNameString ?CYCOBJECT \"" + attempt.get(0) + "\")", " ?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); // '#$countryName-LongForm' vars = askQuery( "(#$countryName-LongForm ?CYCOBJECT \"" + attempt.get(0) + "\")", " ?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); // '#$countryName-ShortForm' vars = askQuery( "(#$countryName-ShortForm ?CYCOBJECT \"" + attempt.get(0) + "\")", " ?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); // '#$acronymString' vars = askQuery( "(#$acronymString ?CYCOBJECT \"" + attempt.get(0) + "\")", " ?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); // '#$scientificName' vars = askQuery( "(#$scientificName ?CYCOBJECT \"" + attempt.get(0) + "\")", " ?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); // '#$termStrings' vars = askQuery( "(#$termStrings ?CYCOBJECT \"" + attempt.get(0) + "\")", " ?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); // '#$initialismString' vars = askQuery( "(#$initialismString ?CYCOBJECT \"" + attempt.get(0) + "\")", " ?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); // '#$termStrings-GuessedFromName' vars = askQuery( "(#$termStrings-GuessedFromName ?CYCOBJECT \"" + attempt.get(0) + "\")", " ?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); // '#$prettyName' vars = askQuery( "(#$prettyName ?CYCOBJECT \"" + attempt.get(0) + "\")", " ?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); // '#$nicknames' vars = askQuery( "(#$nicknames ?CYCOBJECT \"" + attempt.get(0) + "\")", " ?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); // '#$preferredTermStrings' vars = askQuery( "(#$preferredTermStrings ?CYCOBJECT \"" + attempt.get(0) + "\")", " ?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); // Generic word lookup vars = askQuery( "(#$and (#$massNumber ?WORD \"" + attempt.get(0) + "\") (#$or (#$denotation ?WORD ?TEXT ?TYPE ?CYCOBJECT) (#$denotationRelatedTo ?WORD ?TEXT ?TYPE ?CYCOBJECT) ))", "?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); vars = askQuery( "(#$and (#$wordStrings ?WORD \"" + attempt.get(0) + "\") (#$or (#$denotation ?WORD ?TEXT ?TYPE ?CYCOBJECT) (#$denotationRelatedTo ?WORD ?TEXT ?TYPE ?CYCOBJECT) ))", "?CYCOBJECT", "#$EverythingPSC"); if (vars.size() > 0) if (vars.get(0) != null) return cyclify(vars.get(0).toString()); } catch (Exception e) { } // If not founded, return a "cyc-format" text return "#$" + attempt.get(0).toString(); }
/** Demonstrates getComment api function. */ protected void demo3() throws IOException, UnknownHostException, CycApiException { Log.current.println("Demonstrating getComment api function.\n"); String comment = cycAccess.getComment(cycAccess.getKnownConstantByName("bordersOn")); Log.current.println("\nThe obtained comment is:\n" + comment); }
/** Demonstrates getConstantGuid api function. */ protected void demo2() throws IOException, UnknownHostException, CycApiException { Log.current.println("Demonstrating getConstantGuid api function.\n"); Guid unitedStatesOfAmericaGuid = cycAccess.getConstantGuid("UnitedStatesOfAmerica"); Log.current.println("\nThe obtained guid is " + unitedStatesOfAmericaGuid); }
/** Demonstrates getIsas api function. */ protected void demo4() throws IOException, UnknownHostException, CycApiException { Log.current.println("Demonstrating getIsas api function.\n"); CycList isas = cycAccess.getIsas(cycAccess.getKnownConstantByName("BillClinton")); Log.current.println("\nThe obtained isas are:\n" + isas.cyclify()); }
/** Demonstrates getGenls api function. //Type 取得 */ protected void demo5() throws IOException, UnknownHostException, CycApiException { Log.current.println("Demonstrating getGenls api function.\n"); CycList genls = cycAccess.getGenls(cycAccess.getKnownConstantByName("Dog")); Log.current.println("\nThe obtained direct genls are:\n" + genls.cyclify()); }
/** Demonstrates getArity api function. */ protected void demo6() throws IOException, UnknownHostException, CycApiException { Log.current.println("Demonstrating getArity api function.\n"); int arity = cycAccess.getArity(cycAccess.getKnownConstantByName("likesAsFriend")); Log.current.println("\nThe obtained arity is " + arity); }
/** Demonstrates arg1Isas api function. //subject Type取得 */ protected void demo7() throws IOException, UnknownHostException, CycApiException { Log.current.println("Demonstrating arg1Isas api function.\n"); CycList arg1Isas = cycAccess.getArg1Isas(cycAccess.getKnownConstantByName("performedBy")); Log.current.println("\nThe obtained arg1Isas are:\n" + arg1Isas.cyclify()); }
/** Demonstrates getArgNGenls api function. */ protected void demo8() throws IOException, UnknownHostException, CycApiException { Log.current.println("Demonstrating getArgNGenls api function.\n"); CycList argNGenls = cycAccess.getArgNGenls(cycAccess.getKnownConstantByName("skillCapableOf"), 2); Log.current.println("\nThe obtained getArgNGenls are:\n" + argNGenls.cyclify()); }