import java.io.*; import java.util.*; class TypeSt { //public static final TypeSt Class = new TypeSt("Class"); public static final TypeSt subClass = new TypeSt("http://www.daml.org/2001/03/daml+oil#subClassOf"); public static final TypeSt subClassb = new TypeSt("http://www.w3.org/2000/01/rdf-schema#subClassOf"); public static final TypeSt hasValue = new TypeSt("http://www.daml.org/2001/03/daml+oil#hasValue"); public static final TypeSt hasValueb = new TypeSt("http://www.w3.org/2001/10/daml+oil#hasValue"); public static final TypeSt hasClass = new TypeSt("http://www.daml.org/2001/03/daml+oil#hasClass"); public static final TypeSt hasClassq = new TypeSt("http://www.daml.org/2001/03/daml+oil#hasClassQ"); public static final TypeSt hasClassb = new TypeSt("http://www.w3.org/2001/10/daml+oil#hasClass"); public static final TypeSt toClass = new TypeSt("http://www.daml.org/2001/03/daml+oil#toClass"); public static final TypeSt toClassb = new TypeSt("http://www.w3.org/2001/10/daml+oil#toClass"); public static final TypeSt cardinality = new TypeSt("http://www.daml.org/2001/03/daml+oil#cardinality"); public static final TypeSt cardinalityb = new TypeSt("http://www.w3.org/2001/10/daml+oil#cardinality"); public static final TypeSt minCardinality = new TypeSt("http://www.daml.org/2001/03/daml+oil#minCardinality"); public static final TypeSt minCardinalityb = new TypeSt("http://www.w3.org/2001/10/daml+oil#minCardinality"); public static final TypeSt maxCardinality = new TypeSt("http://www.daml.org/2001/03/daml+oil#maxCardinality"); public static final TypeSt maxCardinalityb = new TypeSt("http://www.w3.org/2001/10/daml+oil#maxCardinality"); public static final TypeSt cardinalityQ = new TypeSt("http://www.daml.org/2001/03/daml+oil#CardinalityQ"); public static final TypeSt cardinalityQb = new TypeSt("http://www.w3.org/2001/10/daml+oil#CardinalityQ"); public static final TypeSt minCardinalityQ = new TypeSt("http://www.daml.org/2001/03/daml+oil#minCardinalityQ"); public static final TypeSt minCardinalityQb = new TypeSt("http://www.w3.org/2001/10/daml+oil#minCardinalityQ"); public static final TypeSt maxCardinalityQ = new TypeSt("http://www.daml.org/2001/03/daml+oil#maxCardinalityQ"); public static final TypeSt maxCardinalityQb = new TypeSt("http://www.w3.org/2001/10/daml+oil#maxCardinalityQ"); public static final TypeSt onProperty = new TypeSt("http://www.daml.org/2001/03/daml+oil#onProperty"); public static final TypeSt onPropertyb = new TypeSt("http://www.w3.org/2001/10/daml+oil#onProperty"); public static final TypeSt type = new TypeSt("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); public static final TypeSt comment = new TypeSt("http://www.w3.org/2000/01/rdf-schema#comment"); public static final TypeSt None = new TypeSt("None"); public static final TypeSt _import = new TypeSt("http://www.daml.org/2001/03/daml+oil#imports"); public static final TypeSt _import2 = new TypeSt("http://www.w3.org/2001/10/daml+oil#imports"); public static final TypeSt value = new TypeSt("http://www.w3.org/1999/02/22-rdf-syntax-ns#value"); public static final TypeSt subPropertyOf = new TypeSt("http://www.daml.org/2001/03/daml+oil#subPropertyOf"); public static final TypeSt subPropertyOfb = new TypeSt("http://www.w3.org/2000/01/rdf-schema#subPropertyOf"); public static final TypeSt objectProperty = new TypeSt("http://www.daml.org/2001/03/daml+oil#ObjectProperty"); public static final TypeSt objectPropertyb = new TypeSt("http://www.w3.org/2001/10/daml+oil#ObjectProperty"); public static final TypeSt uniqueProperty = new TypeSt("http://www.w3.org/2001/10/daml+oil#UniqueProperty"); public static final TypeSt transitiveProperty = new TypeSt("http://www.w3.org/2001/10/daml+oil#TransitiveProperty"); public static final TypeSt unambigousProperty = new TypeSt("http://www.w3.org/2001/10/daml+oil#UnambigousProperty"); public static final TypeSt Ontology = new TypeSt("http://www.daml.org/2001/03/daml+oil#Ontology"); public static final TypeSt Ontologyb = new TypeSt("http://www.w3.org/2001/10/daml+oil#Ontology"); public static final TypeSt Class = new TypeSt("http://www.daml.org/2001/03/daml+oil#Class"); public static final TypeSt Classb = new TypeSt("http://www.w3.org/2001/10/daml+oil#Class"); public static final TypeSt Restriction = new TypeSt("http://www.daml.org/2001/03/daml+oil#Restriction"); public static final TypeSt Restrictionb = new TypeSt("http://www.w3.org/2001/10/daml+oil#Restriction"); public static final TypeSt Literal = new TypeSt("http://www.daml.org/2001/03/daml+oil#Literal"); public static final TypeSt Literalb = new TypeSt("http://www.w3.org/1999/02/22-rdf-syntax-ns#Literal"); // http://www.w3.org/1999/02/22-rdf-syntax-ns#Litera public static final TypeSt version = new TypeSt("http://www.w3.org/2001/10/daml+oil#versionInfo"); public static final TypeSt label = new TypeSt("http://www.w3.org/2000/01/rdf-schema#label"); public static final TypeSt disjointWith = new TypeSt("http://www.w3.org/2001/10/daml+oil#disjointWith"); public static final TypeSt disjointUnionOf = new TypeSt("http://www.w3.org/2001/10/daml+oil#disjointUnionOf"); public static final TypeSt sameClassAs = new TypeSt("http://www.w3.org/2001/10/daml+oil#sameClassAs"); public static final TypeSt equivalentTo = new TypeSt("http://www.w3.org/2001/10/daml+oil#disjointWith"); public static final TypeSt domain = new TypeSt("http://www.w3.org/2000/01/rdf-schema#domain"); public static final TypeSt range = new TypeSt("http://www.w3.org/2000/01/rdf-schema#range"); public static final TypeSt first = new TypeSt("http://www.daml.org/2001/03/daml+oil#first"); public static final TypeSt rest = new TypeSt("http://www.daml.org/2001/03/daml+oil#rest"); public static final TypeSt nil = new TypeSt("http://www.daml.org/2001/03/daml+oil#nil"); public static final TypeSt intersectionOf = new TypeSt("http://www.w3.org/2001/10/daml+oil#intersectionOf"); public static final TypeSt unionOf = new TypeSt("http://www.w3.org/2001/10/daml+oil#unionOf"); public static final TypeSt oneOf = new TypeSt("http://www.w3.org/2001/10/daml+oil#oneOf"); public static final TypeSt disjoint = new TypeSt("http://www.w3.org/2001/10/daml+oil#Disjoint"); public static final TypeSt complementOf = new TypeSt("http://www.w3.org/2001/10/daml+oil#complementOf"); public static final TypeSt samePropertyAs = new TypeSt("http://www.w3.org/2001/10/daml+oil#samePropertyAs"); public static final TypeSt inverseOf = new TypeSt("http://www.w3.org/2001/10/daml+oil#inverseOf"); String name; /** Creates new TypeSt */ private TypeSt(String s) { name = s; } } class TL { StringTokenizer st; String ResFile; String me; TypeSt S[] = new TypeSt[1000]; String V[] = new String[1000]; String O[] = new String[1000]; String SP[] = new String[1000]; String VP[] = new String[1000]; String OP[] = new String[1000]; int flag[] = new int[1000]; String ns1[] = new String[1000]; String ns2[] = new String[1000]; String Literal1[] = new String[1000]; String Literal2[] = new String[1000]; int num; int numP; int Debug = 0; int indNS; int indLit; public static void main(String args[]) { //TL unArchivo= new TL(); } public TL()//InputStream sbuis) { //go(sbuis); } public String go(InputStream sbuis){ //;escribeArchivo(); num = 0; numP = 0; //me = " ResFile =""; ns1[0] ="rdf"; ns2[0] ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; ns1[1] = "rdfs"; ns2[1] = "http://www.w3.org/2000/01/rdf-schema#"; ns1[2] = "daml"; ns2[2] = "http://www.daml.org/2001/03/daml+oil#"; ns1[3] = "xsd"; ns2[3] = "http://www.w3.org/2000/10/XMLschema#"; indNS = 4; indLit = 0; GetTokens(leeArchivo(sbuis)); String Temp = ""; String a = ""; processLiterals(); for (int i=0;i\n<"+ns+" rdf:resource=\""+OP[i]+"\"/>\n\n\n"; //Res = "<"+ns+" rdf:about=\""++"\"/>\n\n"; ResFile2 = ResFile2 + Res; // System.out.println("Warning: "+SP[i]+","+VP[i]+","+OP[i]+" not processed Add???????????????????\n"); } ResFile = "\n \n\n"; ResFile = ResFile + Temp; ResFile = ResFile +ResFile2; ResFile = ResFile +""; printErrors(); try { FileWriter fw = new FileWriter("escribeme.txt"); BufferedWriter bw = new BufferedWriter(fw); PrintWriter salida = new PrintWriter(bw); salida.println(ResFile); salida.close(); } catch(java.io.IOException ioex) { } //System.out.println(ResFile); return ResFile; } public void printErrors() { for (int i=0;i=1) System.out.println("\n*********************Creando "+ns1[indNS]+" "+ns2[indNS]); indNS=indNS+1; return (""+ns1[indNS-1]+":"+subTok2); } /* Get the namespace, if it doesn't exist add it to the list */ public String getShortName(String tok) { String n1 =""; String n2 =""; int ind = tok.indexOf("#"); String subTok2 = tok.substring(ind+1); String subTok = tok.substring(0,ind+1); //System.out.println("original: " + tok +" "+subTok+" "+subTok2); for (int i =0;i=1) System.out.println("\n*********************Creando "+ns1[indNS]+" "+ns2[indNS]+" "+tok); indNS=indNS+1; return (subTok2); } public String leeArchivo(InputStream is) { String linea=""; String CadFile=""; try { BufferedReader input = new BufferedReader(new InputStreamReader(is));//new FileReader("hhh.txt")); while ((linea=input.readLine())!=null) { //System.out.println(linea); CadFile = CadFile + linea; } } catch(IOException e) { System.out.println("No se pudo abrir el archivo");} return CadFile; } public int getTok34(String tok1, String tok2) { boolean notFound = true; for (int i=0;(i\n\n"; //System.out.println("\n\nyep...is literal....................almostGOTttttttttttttttttttttttttttttt "+tok3); Literal1[indLit]=tok3; Literal2[indLit]=""; indLit=indLit+1; int j = getTok23(TypeSt.value.name, tok3); if (j!=-1) { Literal2[indLit]=O[j]; //System.out.println("GOTttttttttttttttttttttttttttttt "+O[j]+" "+tok3); flag[j]=2; int k = getTok4(tok3); if (k!=-1) { //System.out.println("\nGOT "+O[j]+" "+tok3+" "+S[k].name+" "+V[k]+" "+O[k]); String lit = O[j]; if (lit.startsWith("\"")) O[k] = lit.substring(2,lit.length()-3)+"\""; else O[k] = lit; } //else System.out.println("\but didn't found value of \n"+tok3); //flag[i]=2; } //else System.out.println("\n but didn't found\n"+tok3+" "+tok2.name); flag[i]=2; } //else System.out.println("no e sliteral\n"+tok4+"\n"+TypeSt.Literal.name); } else { //System.out.println("nop..."+tok2.name); } } } public String GetFirst(String NameList) { String First =""; boolean found= false; for (int i =0;i\n"; String Rest = GetRest(NameList); if (Rest.compareTo(TypeSt.nil.name)==0) fin = true; //System.out.println(Rest); NameList = Rest; } return Res; } public String process(TypeSt tok2, String tok3, String tok4, int n) { String Res="ERROR "+tok2.name+" "+tok3+" "+tok4; Res=""; if (flag[n]==0) { /* */ if (tok2 == TypeSt.value) { //System.out.println("pppppppppppppppppppppp"); Res = " \n\t\"" +tok4+ "\"\n\n\n"; //Res = "<"+TypeSt.value.name+ " rdf:about=\""+tok3+"\"> \n\t\n\n\n"; flag[n]=2; return Res; } if ((tok2 == TypeSt._import)||(tok2 == TypeSt._import2)) { //flag[n]=1; Res = "\n\t\n \n\n"; // int j = getTok34(tok3,TypeSt.Ontology.name); // if (j!=-1) // { // if (O[j].compareTo(TypeSt.Ontology.name)==0) // flag[j]=2; // else // { // if (Debug>=1) // System.out.println("Imports assignment without ontology definition "+O[j]); // } // } flag[n]=2; return Res; } /* */ if (tok2 == TypeSt.type) { /* If it's an object property */ if (tok4.compareTo(TypeSt.objectProperty.name)==0) { //String ns = getShortName(tok3); Res = "\n\n"; flag[n]=2; return Res; } if (tok4.compareTo(TypeSt.uniqueProperty.name)==0) { //String ns = getShortName(tok3); Res = "\n\n"; flag[n]=2; return Res; } if (tok4.compareTo(TypeSt.transitiveProperty.name)==0) { //String ns = getShortName(tok3); Res = "\n\n"; flag[n]=2; return Res; } if (tok4.compareTo(TypeSt.unambigousProperty.name)==0) { //String ns = getShortName(tok3); Res = "\n\n"; flag[n]=2; return Res; } if ((tok4.compareTo(TypeSt.Restriction.name)==0)||(tok4.compareTo(TypeSt.Restrictionb.name)==0)) { //System.out.println("\n\n\n*************GOT RESTRICTION "+tok3+" \n\n\n"); // get Restriction name String name = tok3; // get OnProperty int j = getTok23(TypeSt.onProperty.name, tok3); if (j==-1) getTok23(TypeSt.onPropertyb.name, tok3); if (j!=-1) { //System.out.println("\n*************GOT ON PROPERtY "+tok3+" "+ O[j]+"\n"); String OnProp = O[j]; flag[j]=2; boolean bhasValue, btoClass, bhasClass,bc, bmax, bmin,bcq,bmaxq,bminq,bsubClass,bhasClassq; String shasValue, stoClass, shasClass,sc, smax, smin,scq,smaxq,sminq,ssubClass,shasClassq; shasValue=stoClass=shasClass=sc=smax=smin=scq=smaxq=sminq=ssubClass=shasClassq=""; bhasValue=false;btoClass=false;bhasClass=false;bc=false;bmax=false;bmin=false;bhasClassq=false; bcq=false;bmaxq=false;bminq=false;bsubClass=false; // get hasValue int k = getTok23(TypeSt.hasValue.name,tok3); if (k==-1) getTok23(TypeSt.hasValueb.name,tok3); if (k!=-1) { bhasValue=true; shasValue = O[k]; flag[k]=2; } k= getTok23(TypeSt.hasClass.name,tok3); if (k==-1) getTok23(TypeSt.hasClassb.name,tok3); if (k!=-1) { bhasClass=true; shasClass = O[k]; flag[k]=2; } k= getTok23(TypeSt.hasClassq.name,tok3); //if (k==-1) getTok23(TypeSt.hasClassb.name,tok3); if (k!=-1) { bhasClassq=true; shasClassq = O[k]; flag[k]=2; } k= getTok23(TypeSt.toClass.name,tok3); if (k==-1) getTok23(TypeSt.toClassb.name,tok3); if (k!=-1) { btoClass=true; stoClass = O[k]; flag[k]=2; } k= getTok23(TypeSt.cardinality.name,tok3); if (k==-1) getTok23(TypeSt.cardinalityb.name,tok3); if (k!=-1) { bc=true; sc = O[k]; flag[k]=2; } k= getTok23(TypeSt.maxCardinality.name,tok3); if (k==-1) getTok23(TypeSt.maxCardinalityb.name,tok3); if (k!=-1) { bmax=true; smax= O[k]; flag[k]=2; } k= getTok23(TypeSt.minCardinality.name,tok3); if (k==-1) getTok23(TypeSt.minCardinalityb.name,tok3); if (k!=-1) { bmin=true; smin= O[k]; flag[k]=2; } k= getTok23(TypeSt.cardinalityQ.name,tok3); if (k==-1) getTok23(TypeSt.cardinalityQb.name,tok3); if (k!=-1) { bcq=true; scq = O[k]; flag[k]=2; } k= getTok23(TypeSt.maxCardinalityQ.name,tok3); if (k==-1) getTok23(TypeSt.maxCardinalityQb.name,tok3); if (k!=-1) { bmaxq=true; smaxq= O[k]; flag[k]=2; } k= getTok23(TypeSt.minCardinalityQ.name,tok3); if (k==-1) getTok23(TypeSt.minCardinalityQb.name,tok3); if (k!=-1) { bminq=true; sminq= O[k]; flag[k]=2; } //get subclass of what int l= getTok24(TypeSt.subClass.name,tok3); if (l==-1) getTok24(TypeSt.subClassb.name,tok3); if (l!=-1) { bsubClass=true; ssubClass = V[l]; flag[l]=2; } //String shortName = getShortName(subOf); Res = " \n"; Res = Res + "\n"; Res = Res + "\t\n"; Res = Res + "\t\t\n"; if (bhasValue) Res = Res + "\t\t\n"; if (bhasClass) Res = Res + "\t\t\n"; if (bhasClassq) Res = Res + "\t\t\n"; if (btoClass) Res = Res + "\t\t\n"; if (bc) Res = Res + "\t\t"+sc+"\n"; if (bmax) Res = Res + "\t\t"+smax+"\n"; if (bmin) Res = Res + "\t\t"+smin+"\n"; if (bcq) Res = Res + "\t\t"+scq+"\n"; if (bmaxq) Res = Res + "\t\t"+smaxq+"\n"; if (bminq) Res = Res + "\t\t"+sminq+"\n"; Res = Res + "\t\n"; Res = Res + "\n"; Res = Res + "\n\n"; flag[n]=2; return Res; } return Res; } if (tok4.compareTo(TypeSt.Ontology.name)==0) { Res = "\n\n\n"; flag[n]=2; return Res; } if (tok4.compareTo(TypeSt.Class.name)==0) { //String ns = getShortName(tok3); Res = "\n\n"; flag[n]=2; return Res; } /* Is not a class, restriction, ontology or objectProperty, then it should be just an instantiation of a class */ String ns = getNameSpace(tok4); //String ns2 = getShortName(tok3); Res = "<"+ns+" rdf:about=\""+tok3+"\"/>\n\n"; flag[n]=2; return Res; }; /* (PropertyValue http://www.daml.org/2001/03/daml+oil#hasValue http://plan.mcs.drexel.edu/projects/legorobots/ontology/test.daml#genid3 http://plan.mcs.drexel.edu/projects/legorobots/ontology/test.daml#Turkey) */ if (tok2 == TypeSt.hasValue) { //Res = " \n\tdaml:hasValue " + tok4 + "/>\n\n"; return Res; } // (PropertyValue http://www.daml.org/2001/03/daml+oil#onProperty http://plan.mcs.drexel.edu/projects/legorobots/ontology/test.daml#genid3 // http://plan.mcs.drexel.edu/projects/legorobots/ontology/test.daml#meep) if (tok2 == TypeSt.onProperty) { //Res = " \n\tdaml:onProperty " + tok4 + "/>\n\n"; return Res; } //(PropertyValue http://www.daml.org/2001/03/daml+oil#subClassOf http://plan.mcs.drexel.edu/projects/legorobots/ontology/test.daml#Test5 // http://plan.mcs.drexel.edu/projects/legorobots/ontology/test.daml#genid3)*/ if (tok2 == TypeSt.subClass) { Res = " \n\t\n\n\n"; flag[n]=2; return Res; } // (PropertyValue http://www.w3.org/1999/02/22-rdf-syntax-ns#value urn:rdf:7e843c43c9430468b49d8f63df0b2138-21 "\"John Smith\"") if (tok2 == TypeSt.value) { //Res = " \n\tdaml:value " + tok4 + "/>\n\n"; return Res; } if (tok2 == TypeSt.comment) { Res = " \n\t " + tok4 + "\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.subPropertyOf) { //String ns = getNameSpace(tok4); Res = " \n\t\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.inverseOf) { //String ns = getNameSpace(tok4); Res = " \n\t\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.samePropertyAs) { //String ns = getNameSpace(tok4); Res = " \n\t\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.version) { Res = "\n\t"+tok4+"\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.label) { Res = " \n\t" +tok4+ "\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.disjointWith) { Res = " \n\t\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.disjointUnionOf) { Res = " \n\t\n"; Res=Res + GetList(tok4); Res =Res +"\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.intersectionOf) { Res = " \n\t\n"; Res=Res + GetList(tok4); Res =Res +"\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.unionOf) { Res = " \n\t\n"; Res=Res + GetList(tok4); Res =Res +"\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.oneOf) { Res = " \n\t\n"; Res=Res + GetList(tok4); Res =Res +"\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.disjoint) { Res = " \n\t\n"; Res=Res + GetList(tok4); Res =Res +"\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.sameClassAs) { Res = " \n\t\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.complementOf) { Res = " \n\t\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.equivalentTo) { Res = " \n\t\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.domain) { Res = " \n\t\n\n\n"; flag[n]=2; return Res; } if (tok2 == TypeSt.range) { Res = " \n\t\n\n\n"; flag[n]=2; return Res; } } return Res; } public TypeSt getType(String tok2) { TypeSt tipo=TypeSt.None; if (tok2.compareTo(TypeSt.subClass.name)==0) return TypeSt.subClass; if (tok2.compareTo(TypeSt.subClassb.name)==0) return TypeSt.subClass; if (tok2.compareTo(TypeSt.hasValue.name)==0) return TypeSt.hasValue; if (tok2.compareTo(TypeSt.hasValueb.name)==0) return TypeSt.hasValue; if (tok2.compareTo(TypeSt.onProperty.name)==0) return TypeSt.onProperty; if (tok2.compareTo(TypeSt.onPropertyb.name)==0) return TypeSt.onProperty; if (tok2.compareTo(TypeSt.type.name)==0) return TypeSt.type; if (tok2.compareTo(TypeSt.comment.name)==0) return TypeSt.comment; if (tok2.compareTo(TypeSt._import.name)==0) return TypeSt._import; if (tok2.compareTo(TypeSt._import2.name)==0) return TypeSt._import2; if (tok2.compareTo(TypeSt.value.name)==0) return TypeSt.value; if (tok2.compareTo(TypeSt.subPropertyOf.name)==0) return TypeSt.subPropertyOf; if (tok2.compareTo(TypeSt.subPropertyOfb.name)==0) return TypeSt.subPropertyOf; if (tok2.compareTo(TypeSt.version.name)==0) return TypeSt.version; if (tok2.compareTo(TypeSt.Literal.name)==0) return TypeSt.Literal; if (tok2.compareTo(TypeSt.Literalb.name)==0) return TypeSt.Literalb; if (tok2.compareTo(TypeSt.label.name)==0) return TypeSt.label; if (tok2.compareTo(TypeSt.disjointWith.name)==0) return TypeSt.disjointWith; if (tok2.compareTo(TypeSt.disjointUnionOf.name)==0) return TypeSt.disjointUnionOf; if (tok2.compareTo(TypeSt.sameClassAs.name)==0) return TypeSt.sameClassAs; if (tok2.compareTo(TypeSt.equivalentTo.name)==0) return TypeSt.equivalentTo; if (tok2.compareTo(TypeSt.domain.name)==0) return TypeSt.domain; if (tok2.compareTo(TypeSt.range.name)==0) return TypeSt.range; if (tok2.compareTo(TypeSt.Restriction.name)==0) return TypeSt.Restriction; if (tok2.compareTo(TypeSt.Restrictionb.name)==0) return TypeSt.Restriction; if (tok2.compareTo(TypeSt.objectProperty.name)==0) return TypeSt.objectProperty; if (tok2.compareTo(TypeSt.objectPropertyb.name)==0) return TypeSt.objectProperty; if (tok2.compareTo(TypeSt.uniqueProperty.name)==0) return TypeSt.uniqueProperty; if (tok2.compareTo(TypeSt.transitiveProperty.name)==0) return TypeSt.transitiveProperty; if (tok2.compareTo(TypeSt.unambigousProperty.name)==0) return TypeSt.unambigousProperty; if (tok2.compareTo(TypeSt.Ontology.name)==0) return TypeSt.Ontology; if (tok2.compareTo(TypeSt.Ontologyb.name)==0) return TypeSt.Ontology; if (tok2.compareTo(TypeSt.Class.name)==0) return TypeSt.Class; if (tok2.compareTo(TypeSt.Classb.name)==0) return TypeSt.Class; if (tok2.compareTo(TypeSt.hasClass.name)==0) return TypeSt.hasClass; if (tok2.compareTo(TypeSt.hasClassq.name)==0) return TypeSt.hasClassq; if (tok2.compareTo(TypeSt.hasClassb.name)==0) return TypeSt.hasClass; if (tok2.compareTo(TypeSt.toClass.name)==0) return TypeSt.toClass; if (tok2.compareTo(TypeSt.toClassb.name)==0) return TypeSt.toClass; if (tok2.compareTo(TypeSt.cardinality.name)==0) return TypeSt.cardinality; if (tok2.compareTo(TypeSt.cardinalityb.name)==0) return TypeSt.cardinality; if (tok2.compareTo(TypeSt.minCardinality.name)==0) return TypeSt.minCardinality; if (tok2.compareTo(TypeSt.minCardinalityb.name)==0) return TypeSt.minCardinality; if (tok2.compareTo(TypeSt.maxCardinality.name)==0) return TypeSt.maxCardinality; if (tok2.compareTo(TypeSt.maxCardinalityb.name)==0) return TypeSt.maxCardinality; if (tok2.compareTo(TypeSt.cardinalityQ.name)==0) return TypeSt.cardinalityQ; if (tok2.compareTo(TypeSt.cardinalityQb.name)==0) return TypeSt.cardinalityQ; if (tok2.compareTo(TypeSt.minCardinalityQ.name)==0) return TypeSt.minCardinalityQ; if (tok2.compareTo(TypeSt.minCardinalityQb.name)==0) return TypeSt.minCardinalityQ; if (tok2.compareTo(TypeSt.maxCardinalityQ.name)==0) return TypeSt.maxCardinalityQ; if (tok2.compareTo(TypeSt.maxCardinalityQb.name)==0) return TypeSt.maxCardinalityQ; if (tok2.compareTo(TypeSt.first.name)==0) return TypeSt.first; if (tok2.compareTo(TypeSt.rest.name)==0) return TypeSt.rest; if (tok2.compareTo(TypeSt.nil.name)==0) return TypeSt.nil; if (tok2.compareTo(TypeSt.intersectionOf.name)==0) return TypeSt.intersectionOf; if (tok2.compareTo(TypeSt.unionOf.name)==0) return TypeSt.unionOf; if (tok2.compareTo(TypeSt.oneOf.name)==0) return TypeSt.oneOf; if (tok2.compareTo(TypeSt.disjoint.name)==0) return TypeSt.disjoint; if (tok2.compareTo(TypeSt.complementOf.name)==0) return TypeSt.complementOf; if (tok2.compareTo(TypeSt.inverseOf.name)==0) return TypeSt.inverseOf; if (tok2.compareTo(TypeSt.samePropertyAs.name)==0) return TypeSt.samePropertyAs; return tipo; } public void GetToken(String tok1, String tok2,String tok3,String tok4 ) { //System.out.println("\n"+tok1+" "+tok2+" "+tok3+" "+tok4); if (tok1.compareTo("(PropertyValue")==0) { TypeSt subject = getType(tok2); String verb = tok3; String object = tok4; if (subject==TypeSt.None) { SP[numP] = tok2.trim(); VP[numP] = tok3.trim(); OP[numP] = tok4.trim(); numP = numP + 1; } else { String a=""; S[num]=subject; V[num]=tok3.trim(); O[num]=tok4.trim(); flag[num]=0; //System.out.println(V[num]); num = num +1; } //a = process(subject, verb, object); //ResFile = ResFile + a; //stem.out.println(tok2+" "+tok3+" "+tok4); } //else System.out.println("wrong token 1:"+tok1+" 2:"+tok2+" "+tok3+" "+tok4+"\n"); } public void GetTokens(String cadena) { st = new StringTokenizer(cadena); int i; String Tok1;String Tok2;String Tok3;String Tok4; i = 0;Tok1 = "";Tok2="";Tok3="";Tok4=""; while(st.hasMoreTokens()){ i = i +1; String tok =""; tok = st.nextToken(); if (i==1) Tok1 = tok; if (i==2) Tok2 = tok; if (i==3) Tok3 = tok; if (i==4) { Tok4 = Tok4 + " " + tok; int j = Tok4.indexOf(")"); if (j ==-1) { i =3; } else { Tok4 = Tok4.substring(0,j); } } //System.out.println(tok); if (i == 4) { //System.out.println("\n\n"+Tok1+Tok2+"\n"+Tok3+"\n"+Tok4); GetToken(Tok1,Tok2,Tok3,Tok4); i=0; Tok1="";Tok2="";Tok3="";Tok4=""; } } } }