Main Page | Packages | Class List | Directories | File List | Class Members

OrdussianPoliticalSystemMtWriter.java

Go to the documentation of this file.
00001 /**
00002  * Copyright (c) Dmitri Pissarenko
00003  * http://dapissarenko.com
00004  * 
00005  * Created on 05.09.2005
00006  */
00007 package com.dapissarenko.hierarchy;
00008 
00009 import java.io.IOException;
00010 import java.util.ArrayList;
00011 
00012 import org.opencyc.api.CycAccess;
00013 import org.opencyc.api.CycApiException;
00014 import org.opencyc.cycobject.CycConstant;
00015 import org.opencyc.cycobject.CycFort;
00016 
00017 /**
00018  * @author Dmitri Pissarenko
00019  *
00020  */
00021 public class OrdussianPoliticalSystemMtWriter {
00022     private static final String COLLECTION = "Collection";
00023     public OrdussianPoliticalSystemMtWriter()
00024     {
00025     }
00026     public CycConstant writeMicroTheoryToCyc(CycAccess cyc) throws IOException, CycApiException
00027     {
00028         CycConstant ordus=null;
00029         CycConstant department=null;
00030         CycConstant mt=null;
00031         CycConstant depIntAff=null;
00032         CycConstant depEthSup=null;
00033         CycConstant fieldOfWork=null;
00034         CycConstant headOfDepartment=null;
00035         CycConstant alimagomedov=null;
00036         CycConstant civilServant=null;
00037         CycConstant lobo=null;
00038         CycConstant ouiantsevSu=null;
00039         CycConstant rabinovich=null;
00040         CycFort givenNames=null;
00041         CycFort familyName=null;
00042         CycFort superiors=null;
00043         
00044         
00045         /**
00046          * create microtheory
00047          */
00048         mt=cyc.createMicrotheory("OrdussianPoliticalSystemMt", 
00049                                 "This microtheory describes the political system of Ordus'",
00050                                 "Microtheory",
00051                                 new ArrayList());
00052      
00053         /**
00054          * Enter some countries
00055          * (#$isa #$Russia #$Country)
00056          * (#$isa #$Belarus #$Country)
00057          * (#$isa #$Austria #$Country)
00058          * (#$isa #$Germany #$Country)
00059          */
00060         this.createCountry("Russia", "Russian Federation", cyc, mt);
00061         this.createCountry("Belarus", "Belorussia", cyc, mt);
00062         this.createCountry("Austria", "Republic of Austria", cyc, mt);
00063         this.createCountry("Germany", "Federative Republic of Germany", cyc, mt);
00064         
00065                 /**
00066                  * Ordus' is a country
00067                  * (#$isa #$Ordus #$Country)
00068                  */
00069                 ordus=cyc.createNewPermanent("Ordus");
00070                 cyc.assertComment(ordus, "Hypothetical country", mt);
00071                 cyc.assertIsa(ordus, cyc.getKnownConstantByName("Country"), mt);
00072                 
00073                 /**
00074                  * (#$genls #$Department #$Organization)
00075                  */
00076                 department=cyc.createNewPermanent("Department");
00077                 cyc.assertIsa(department, cyc.getKnownConstantByName(COLLECTION), mt);
00078                 cyc.assertGenls(department, cyc.getKnownConstantByName("Organization"), mt);
00079 
00080                 /**
00081                  * (#$isa #$DepartmentOfInternalAffairs #$Department)
00082                  */
00083                 depIntAff=cyc.createNewPermanent("DepartmentOfInternalAffairs");
00084                 cyc.assertIsa(depIntAff, department, mt);
00085                 
00086                 /**
00087                  * (#$isa #$DepartmentOfEthicalSupervision #$Department)
00088                  */
00089                 depEthSup=cyc.createNewPermanent("DepartmentOfEthicalSupervision");
00090                 cyc.assertIsa(depEthSup, department, mt);
00091                 
00092                 /**
00093                  * create fieldOfWork predicate
00094                  */
00095                 fieldOfWork=cyc.createNewPermanent("fieldOfWork");
00096                 cyc.assertIsa(fieldOfWork, cyc.getKnownConstantByName("BinaryPredicate"), mt);
00097                 cyc.assertComment(fieldOfWork, "(fieldOfWork a b) means that b is field of work of a", mt);
00098                 
00099                 /**
00100                  * (#$fieldOfWork #$DepartmentOfInternalAffairs "Protection of citizens against criminals")
00101                  */
00102                 cyc.assertGaf(mt, fieldOfWork, depIntAff, "Protection of citizens against criminals");
00103                 
00104                 /**
00105                  * (#$fieldOfWork #$DepartmentOfEthicalSupervision "Ensuring that the laws of Ordus are followed by its subjects")
00106                  */
00107                 cyc.assertGaf(mt, fieldOfWork, depEthSup, "Ensuring that the laws of Ordus are followed by its subjects");
00108                 
00109                 /**
00110                  * create headOfDepartment predicate
00111                  */
00112                 headOfDepartment=cyc.createNewPermanent("headOfDepartment");
00113                 cyc.assertIsa(headOfDepartment, cyc.getKnownConstantByName("BinaryPredicate"), mt);
00114                 cyc.assertComment(headOfDepartment, "(fieldOfWork a b) means that b is head of department a", mt);
00115 
00116                 /**
00117                  * create CivilServant collection
00118                  * (#$genls #$CivilServant #$Person)
00119                  */
00120                 civilServant=cyc.createNewPermanent("CivilServant");
00121                 cyc.assertIsa(civilServant, cyc.getKnownConstantByName(COLLECTION), mt);
00122                 cyc.assertGenls(civilServant, cyc.getKnownConstantByName("Person"), mt);
00123                 
00124                 /**
00125                  * create RededyaAlimagomedov
00126                  * (#$givenNames #$RededyaAlimagomedov "Rededya Peresvetovich")
00127                  * (#$familyName #$RededyaAlimagomedov "Alimagomedov")
00128                  */
00129                 givenNames=cyc.getKnownConstantByName("givenNames");
00130                 familyName=cyc.getKnownConstantByName("familyName");
00131                 
00132                 alimagomedov=cyc.createNewPermanent("RededyaAlimagomedov");
00133                 cyc.assertIsa(alimagomedov, civilServant, mt);
00134                 cyc.assertGaf(mt, givenNames, alimagomedov, "Rededya Peresvetovich");
00135                 cyc.assertGaf(mt, familyName, alimagomedov, "Alimagomedov");
00136                 
00137                 /**
00138                  * create BagaturLobo
00139                  * (#$givenNames #$BagaturLobo "Bagatur")
00140                  * (#$familyName #$BagaturLobo "Lobo")
00141                  */
00142                 lobo=cyc.createNewPermanent("BagaturLobo");
00143                 cyc.assertIsa(lobo, civilServant, mt);
00144                 cyc.assertGaf(mt, givenNames, lobo, "Bagatur");
00145                 cyc.assertGaf(mt, familyName, lobo, "Lobo");
00146                 
00147                 /**
00148                  * (#$superiors #$RededyaAlimagomedov #$BagaturLobo)
00149                  */
00150                 superiors=cyc.getKnownConstantByName("superiors");
00151                 cyc.assertGaf(mt, superiors, alimagomedov, lobo);
00152                 
00153                 /**
00154                  * (#$fieldOfWork #$BagaturLobo "Finding and catching criminals")
00155                  */
00156                 cyc.assertGaf(mt, fieldOfWork, lobo, "Finding and catching criminals");
00157                 
00158                 /**
00159                  * create MokiiNilovichRabinovich
00160                  * (#$givenNames #$MokiiNilovichRabinovich "Mokii Nilovich")
00161                  * (#$familyName #$MokiiNilovichRabinovich "Rabinovich")
00162                  * (#$isa #$MokiiNilovichRabinovich #$CivilServant)
00163                  */
00164                 rabinovich=cyc.createNewPermanent("MokiiNilovichRabinovich");
00165                 cyc.assertIsa(rabinovich, civilServant, mt);
00166                 cyc.assertGaf(mt, givenNames, rabinovich, "Mokii Nilovich");
00167                 cyc.assertGaf(mt, familyName, rabinovich, "Rabinovich");
00168                 
00169                 /**
00170                  * create BogdanRukhovichOuiantsevSu
00171                  * 
00172                  * (#$givenNames #$BogdanRukhovichOuiantsevSu "Bogdan Rukhovich")
00173                  * (#$familyName #$BogdanRukhovichOuiantsevSu "Ouiantsev-Su")
00174                  */
00175                 ouiantsevSu=cyc.createNewPermanent("BogdanRukhovichOuiantsevSu");
00176                 cyc.assertIsa(ouiantsevSu, civilServant, mt);
00177                 cyc.assertGaf(mt, givenNames, ouiantsevSu, "Bogdan Rukhovich");
00178                 cyc.assertGaf(mt, familyName, ouiantsevSu, "Ouiantsev-Su");
00179                 
00180                 /**
00181                  * (#$fieldOfWork #$BogdanRukhovichOuiantsevSu "Legal advice to Bagatur Lobo")
00182                  */
00183                 cyc.assertGaf(mt, fieldOfWork, ouiantsevSu, "Legal advice to Bagatur Lobo");
00184                 
00185                 /**
00186                  * (#$superiors #$MokiiNilovichRabinovich #$BogdanRukhovichOuiantsevSu)
00187                  */
00188                 cyc.assertGaf(mt, superiors, rabinovich, ouiantsevSu);
00189 
00190                 /**
00191                  * (#$headOfDepartment #$DepartmentOfInternalAffairs #$RededyaAlimagomedov) 
00192                  */
00193                 cyc.assertGaf(mt, headOfDepartment, depIntAff, alimagomedov);
00194                 
00195                 /**
00196                  * (#$headOfDepartment #$DepartmentOfEthicalSupervision #$MokiiNilovichRabinovich) 
00197                  */
00198                 cyc.assertGaf(mt, headOfDepartment, depEthSup, rabinovich);
00199                 
00200                 return mt;
00201     }
00202     private void createCountry(String countryName, String comment, CycAccess cyc, CycConstant mt) throws IOException, CycApiException
00203     {
00204         CycConstant country=null;
00205         
00206         country=cyc.createNewPermanent(countryName);
00207         cyc.assertComment(country, comment, mt);
00208                 cyc.assertIsa(country, cyc.getKnownConstantByName("Country"), mt);
00209     }
00210 }

Generated on Sat Sep 10 17:15:11 2005 for 2005_09_05_ordus by  doxygen 1.4.4