]> gerrit.simantics Code Review - simantics/interop.git/blob - org.simantics.xml.sax/src/org/simantics/xml/sax/OntologyGenerator.java
Add ComplexTpye inheritance to SimpleType or literal type when necessary
[simantics/interop.git] / org.simantics.xml.sax / src / org / simantics / xml / sax / OntologyGenerator.java
1 package org.simantics.xml.sax;
2
3 import java.io.FileNotFoundException;
4 import java.io.PrintWriter;
5 import java.io.StringWriter;
6 import java.util.LinkedHashSet;
7 import java.util.List;
8 import java.util.Set;
9
10 import javax.xml.namespace.QName;
11
12 import org.simantics.utils.datastructures.BijectionMap;
13 import org.simantics.xml.sax.SchemaConversionBase.Inheritance;
14 import org.simantics.xml.sax.SchemaConversionBase.RefType;
15 import org.simantics.xml.sax.SchemaObject.ObjectType;
16 import org.simantics.xml.sax.configuration.AttributeComposition;
17 import org.simantics.xml.sax.configuration.IDReference;
18 import org.w3._2001.xmlschema.Annotated;
19 import org.w3._2001.xmlschema.Attribute;
20 import org.w3._2001.xmlschema.AttributeGroup;
21 import org.w3._2001.xmlschema.Element;
22 import org.w3._2001.xmlschema.LocalComplexType;
23 import org.w3._2001.xmlschema.LocalSimpleType;
24 import org.w3._2001.xmlschema.NamedAttributeGroup;
25 import org.w3._2001.xmlschema.NamedGroup;
26 import org.w3._2001.xmlschema.Schema;
27 import org.w3._2001.xmlschema.SimpleType;
28
29 //public class OntologyGenerator extends SchemaConversionBase {
30 public class OntologyGenerator implements SchemaConversionComponent {
31         SchemaConversionBase base;
32         
33         public OntologyGenerator(SchemaConverter converter, SchemaConversionBase base) {
34                 this.base = base;
35                 this.converter = converter;
36                 this.schema = base.schema;
37                 this.ontologyUri = base.ontologyURI;
38                 this.className = base.className;                
39         }
40
41         String ontRoot = "ONT.";
42         String commentTag = "//";
43         
44         Schema schema;
45         String ontologyUri;
46         String className;
47         
48         SchemaConverter converter;
49         
50         PrintWriter writer = null;
51         
52         public void createOntology() throws FileNotFoundException {
53                 StringWriter stringWriter = null;
54                 if (converter.getOntologyFile() == null) {
55                         stringWriter = new StringWriter();
56                         writer = new PrintWriter(stringWriter);
57                 } else {
58                         writer = new PrintWriter(converter.getOntologyFile());
59                 }
60         
61                 handle();
62                 
63                 writer.flush();
64                 writer.close();
65                 if (stringWriter != null)
66                         System.out.println(stringWriter.toString());
67         }
68         
69         protected void handle() {
70                 ontRoot = converter.shortName;
71
72                 for (String s : converter.getHeader()) {
73                         writer.println(commentTag + " " + s);   
74                 }
75                 writer.println();
76                 writer.println("L0 = <http://www.simantics.org/Layer0-1.1>");
77                 writer.println("XML = <http://www.simantics.org/XML-1.0>");
78                 writer.println();
79                 if (converter.isPrimary()) {
80                 writer.println(ontRoot + " = <" + ontologyUri +"> : L0.Ontology");
81                 writer.println("   @L0.new");
82                 writer.println("   L0.HasResourceClass \"" + className +"\"");
83                 } else {
84                 writer.println(ontRoot + " = <" + ontologyUri +">");
85                 }
86                 writer.println();
87                 writer.println();
88                 
89                 ontRoot += ".";
90                 writer.println(ontRoot+"SimpleTypes : L0.Library");
91                 writer.println(ontRoot+"ComplexTypes : L0.Library");
92                 writer.println(ontRoot+"AttributeGroups : L0.Library");
93                 writer.println();
94                 writer.println(commentTag + " Interpreted from schema");
95                 writer.println();
96                         
97                 base.handle(this);
98         }
99                 
100         protected String getType(QName qtype, String rel) {
101                 String ontType = base.getL0TypeFromPrimitiveType(qtype);
102                 if (ontType != null)
103                         return ontType;
104                 else {
105                         if (base.isComplexTypeRef(qtype.getLocalPart()))
106                                 return getName(base.getComplexType(qtype), rel);
107                         else if (base.isSimpleTypeRef(qtype.getLocalPart()))
108                                 return getName(base.getSimpleType(qtype), rel);
109                         else if (base.isElementRef(qtype.getLocalPart()))
110                                 return getName(base.getElement(qtype), rel);
111                 }
112                 throw new RuntimeException("Reference to unknown type " + qtype.getLocalPart());
113         }
114         
115         public String getSimpleTypePrefix() {
116                 return "SimpleTypes.";
117         }
118         
119         public String getComplexTypePrefix() {
120                 return "ComplexTypes.";
121         }
122         
123         public String getAttributeGroupPrefix() {
124                 return "AttributeGroups.";
125         }
126         
127         public String handleChoice(SchemaObject parent, SchemaElement indicator, java.util.List<SchemaElement> elements, String name) {
128                 boolean single = true;
129                 for (SchemaElement e : elements) {
130                         if (e.getRestriction().many()) {
131                                 single = false;
132                                 break;
133                         }
134                 }
135                 String relationName = getName(parent)+".has"+name;
136                 writer.print(relationName);
137                 writer.print(" <R XML.hasElement");
138                 writer.println();
139                 
140                 if (!single) {
141                         String elementListType = getName(parent) + "." + name + "_List";
142                         writer.println(elementListType + " <T XML.ElementList");
143                         writer.println(relationName + "_List <R XML.hasElementList : L0.FunctionalRelation");
144                         writer.println("   --> " + elementListType);
145                 }
146                 
147                 return relationName;
148         };
149         
150         
151         
152         @Override
153         public void handleIndicator(SchemaObject parent, SchemaElement indicator, SchemaElement element, String refName, RefType refType, String baseRelationName) {
154                 if (refType != RefType.Element) {
155                         QName referenceType = null;
156                         if (refType == RefType.Type) {
157                                 referenceType = element.getElement().getType();
158                                 //refName = element.getElement().getName()
159                                 SchemaObject eObj = base.getElement(element.getElement());//base.elements.get(element.getElement());
160                                 if (refName == null)
161                                         refName = eObj.getName();
162                         } else {
163                                 referenceType = element.getElement().getRef();
164                                 if (refName == null)
165                                         refName = referenceType.getLocalPart();
166                         }
167                         String type = base.getL0TypeFromPrimitiveType(referenceType);
168                         SchemaObject obj = null;
169                         if (type == null) {
170                                 obj = base.getWithName(referenceType);
171                                 writer.print(getName(parent)+".has"+refName + " <R XML.hasElement <R " +  getName(obj,"has"));
172                                 if (baseRelationName != null) writer.print(" <R " + baseRelationName);
173                                 writer.println();
174                         } else {
175                                 writer.print(getName(parent)+".has"+refName + " <R XML.hasElement");
176                                 if (baseRelationName != null) writer.print(" <R " + baseRelationName);
177                                 writer.println();
178                                 writer.println("   --> " + getType(referenceType, ""));
179                         }
180                         
181                         if (base.useElementList(parent, indicator,element, refType == RefType.Reference, refName, referenceType)) {
182                                 
183                                 if (type == null) {
184                                         writer.println(getName(parent)+"."+refName + "List <T XML.ElementList");
185                                         writer.println(getName(parent)+".has"+refName + "_List <R " +  getName(obj,"has")+"_List : L0.FunctionalRelation");
186                                 } else {
187                                         writer.println(getName(parent)+"."+refName + "_List <T XML.ElementList");
188                                         writer.println(getName(parent)+".has"+refName + "_List <R XML.hasElementList : L0.FunctionalRelation"); 
189                                 }
190                         }
191                 } else {
192                         Element attrs = element.getElement();
193                         SchemaObject obj = base.getWithObj(parent, attrs);
194                         if (refName == null)
195                                 refName = obj.getName();
196                         
197                         writer.print(getName(parent)+".has"+refName + " <R " + getName(obj,"has"));
198                         if (baseRelationName != null) writer.print(" <R " + baseRelationName);
199                         writer.println();
200                         writer.println("   --> " + getName(obj));
201                         if (base.useElementList(parent, indicator,element, false, refName, new QName(obj.getName()))) {
202                                 writer.println(getName(parent)+"."+refName + "_List <T XML.ElementList");
203                                 writer.println(getName(parent)+".has"+refName + "_List <R " +  getName(obj,"has")+"_List : L0.FunctionalRelation");
204                         }
205                 }
206                 
207         }
208         
209         @Override
210         public void handleIndicator(SchemaObject parent, SchemaElement indicator, SchemaElement any) {
211                 
212         }
213         
214         @Override
215         public void handle(SchemaObject parent, NamedGroup attribute) {
216                 // TODO Auto-generated method stub
217                 
218         }
219                 
220         @Override
221         public void handle(SchemaObject parent, Attribute attribute) {
222                 String name = attribute.getName();
223                 QName primitiveType = attribute.getType();
224                 LocalSimpleType simpleType = attribute.getSimpleType();
225                 QName ref = attribute.getRef();
226                 
227                 String relationName;
228                 String relationType;
229                 if (name != null) {
230                         relationName = ontRoot+"has"+name;
231                         if (parent != null)
232                                 relationName = getName(parent)+".has"+name;
233                         relationType = "XML.hasAttribute";
234                 }
235                 else if (ref != null && parent != null) {
236                         relationName = getName(parent)+".has"+ref.getLocalPart();
237                         relationType = ontRoot+"has"+ref.getLocalPart();
238                 } else {
239                         throw new RuntimeException();
240                 }
241                 boolean id = false;
242                 String ontType = null;
243                 if (primitiveType != null) {
244                         ontType = base.getL0TypeFromPrimitiveType(primitiveType);
245                         if (ontType != null) {
246                                 id = base.getTypeEntry(primitiveType).id;
247                                 if (id)
248                                         relationType = "XML.hasID";
249                         } else {
250                                 
251                         }
252                 } else if (simpleType != null){
253 //                      Restriction restriction = simpleType.getRestriction();
254 //                      if (restriction == null || simpleType.getUnion() != null || simpleType.getName() != null || simpleType.getId() != null)
255 //                              throw new RuntimeException();
256 //                      QName base = restriction.getBase();
257                         QName base = this.base.getSimpleTypeBase(simpleType);
258                         
259                         
260                         ontType = this.base.getL0TypeFromPrimitiveType(base);
261                         
262 //                      for (Object facetWrap : restriction.getFacets()) {
263 //                              JAXBElement<?> element = (JAXBElement<?>)facetWrap;
264 //                              QName elementName = element.getName();
265 //                              Facet facet = (Facet)element.getValue();        
266 //                      }
267                 }
268                         
269                 
270                 
271                 writer.println(relationName+ " <R " + relationType + ": L0.FunctionalRelation");
272                 if (id) {
273                         // no need to add range restriction
274                 } else if (ontType != null) {
275                         writer.println("   --> " + ontType);
276                 } else if (primitiveType != null) {
277                         writer.println("   <R " + getType(primitiveType, "has"));
278                 }
279         }
280         
281         @Override
282         public void handleAttributes(SchemaObject simpleTypeObj) {
283 //              SchemaObject parent = simpleTypeObj.getParent();
284 //              SimpleType simpleType = simpleTypeObj.getSimpleType();
285 //              Restriction restriction = simpleType.getRestriction();
286 //              QName base = restriction.getBase();
287 //              String ontType = getL0TypeFromPrimitiveType(base);
288         }
289         
290         @Override
291         public void handle(SchemaObject parent, AttributeGroup attributeGroup) {
292                 if (parent == null) {
293                         NamedAttributeGroup group = (NamedAttributeGroup)attributeGroup;
294                         writer.println(ontRoot+getAttributeGroupPrefix()+group.getName()+ " <T XML.AttributeGroup");
295                         SchemaObject obj = new SchemaObject(parent,attributeGroup);
296                         for (Annotated annotated : group.getAttributeOrAttributeGroup()) {
297                                 if (annotated instanceof Attribute) {
298                                         //handle(getAttributeGroupPrefix()+group.getName(),(Attribute)annotated);
299                                         handle(obj,(Attribute)annotated);
300                                 } else if (annotated instanceof AttributeGroup) {
301                                         handle(obj,(AttributeGroup)annotated);
302                                         //throw new RuntimeException("Cannot handle nested attribute groups");
303                                 }
304                         }
305                 } else {
306                         writer.println(getName(parent) +" L0.Inherits " + ontRoot + getAttributeGroupPrefix() + attributeGroup.getRef().getLocalPart());
307                 }
308                 
309         }
310         
311         @Override
312         public void handleAttributeComposition(SchemaObject parent, AttributeComposition composition, BijectionMap<org.simantics.xml.sax.configuration.Attribute, Annotated> attributes) {
313                 Attribute compositionAttribute = new Attribute();
314                 compositionAttribute.setName(composition.getName());
315                 QName type = new QName(SchemaConversionBase.CONVERSION_NS, composition.getType());
316                 compositionAttribute.setType(type);
317                 handle(parent, compositionAttribute);
318         }
319         
320         @Override
321         public void handleSimpleType(SchemaObject parent, SchemaObject simpleTypeObj) {
322                 SimpleType simpleType = simpleTypeObj.getSimpleType();
323                 String name = simpleType.getName();
324                 
325                 org.w3._2001.xmlschema.List list = simpleType.getList();
326                 if (list != null) {
327                         // TODO : process restriction in lists
328                         String relationName = getName(simpleTypeObj, "has");
329                         writer.println(relationName+ " <R XML.hasAttribute : L0.FunctionalRelation");
330                         
331                         String ontType = base.getL0Type(new QName(SchemaConversionBase.SCHEMA_NS, "string"));
332                         writer.println("   --> " + ontType);
333                 } else {
334                         QName base = this.base.getSimpleTypeBase(simpleType);
335                         writer.println(getName(simpleTypeObj) + " <T " + getType(base, ""));
336                         
337                         String relationName = getName(simpleTypeObj, "has");
338                         
339                         writer.println(relationName+ " : L0.FunctionalRelation");
340                         writer.println("   --> " + getName(simpleTypeObj));
341                         
342 //                      Restriction restriction = simpleType.getRestriction();
343 //                      if (restriction != null) {
344 //                              
345 //                              QName base = restriction.getBase();
346 //                              String ontType = getL0Type(base);
347 //                              writer.println("   --> " + ontType);
348 //                      } else if (simpleType.getId() != null) {
349 //                              throw new RuntimeException(simpleType.getName() + " restriction error");
350 //                      } else if (simpleType.getUnion() != null) {
351 //                              Union union = simpleType.getUnion();
352 //                              String ontType = null;
353 //                              if (union.getMemberTypes().size() > 0) {
354 //                                      for (QName type : union.getMemberTypes()) {
355 //                                              String sType = null;
356 //                                              TypeEntry entry = getTypeEntry(type);
357 //                                              if (entry == null) {
358 //                                                      SchemaObject obj = simpleTypeName.get(type.getLocalPart());
359 //                                                      Inheritance inheritance = new Inheritance("");
360 //                                                      getAtomicTypeInheritance(type, obj, inheritance);
361 //                                                      sType = inheritance.atomicType.l0Type;
362 //                                              } else {
363 //                                                      sType = entry.l0Type;
364 //                                              }
365 //                                              if (ontType == null)
366 //                                                      ontType = sType;
367 //                                              else if (!ontType.equals(sType))
368 //                                                      throw new RuntimeException(simpleType.getName() + " union has incompatible member types");
369 //                                      }
370 //                              } else {
371 //                                      if (union.getSimpleType().size() == 0)
372 //                                              throw new RuntimeException(simpleType.getName() + " union error");
373 //                                      for (SimpleType s : union.getSimpleType()) {
374 //                                              if (restriction == null)
375 //                                                      restriction = s.getRestriction();
376 //                                              else  {
377 //                                                      Restriction r = s.getRestriction();
378 //                                                      if (!r.getBase().equals(restriction.getBase()))
379 //                                                              throw new RuntimeException(simpleType.getName() + " union has incompatible restriction bases");
380 //                                              }
381 //                                      }
382 //                                      QName base = restriction.getBase();
383 //                                      ontType = getL0Type(base);
384 //                              }
385 //                              writer.println("   --> " + ontType);
386 //                      } else {
387 //                              throw new RuntimeException(simpleType.getName() + " restriction error");
388 //                      }
389                         
390                 }
391         }
392         
393         @Override
394         public void handleComplexType(SchemaObject topLevelComplexType) {
395                 String name = getName(topLevelComplexType);
396 //              if (topLevelComplexType.getName().equals("Reference"))
397 //                      System.out.println();
398                 
399 //              String baseType = "XML.ComplexType";
400 //
401 //              QName base = getComplexTypeBase(topLevelComplexType.getComplexType());
402 //              if (base != null) {
403 //                      baseType = getType(base);
404 //              }
405 //              base = getSimpleTypeBase(topLevelComplexType.getSimpleType());
406 //              if (base != null) {
407 //                      baseType = getType(base);
408 //              }
409                 Inheritance inheritance = base.getInheritance(topLevelComplexType);
410                 
411 //              writer.println(name+ " <T "+baseType);
412                 
413                 // Type definition
414                 if (inheritance.additionalClass != null) {
415                 writer.println(name+ " <T " + inheritance.baseClass + " <T " + inheritance.additionalClass);
416             } else if (inheritance.atomicType != null){
417             writer.println(name+ " <T " + inheritance.baseClass + " <T " + inheritance.atomicType.l0Type);
418             } else {
419                 writer.println(name+ " <T " + inheritance.baseClass);
420                 }
421                 writer.println(name + "_List <T XML.ElementList");
422                 
423                 // Access relations
424                 String relationName = getName(topLevelComplexType,"has");
425                 writer.println(relationName+ " <R XML.hasComplexType");
426                 writer.println("   --> " + name);
427                 writer.println(relationName+ "_List <R XML.hasElementList");
428                 writer.println("   --> " + name + "_List");
429                 writer.println();
430                 
431                 // Attributes 
432 //              if (!baseType.equals(inheritance.baseClass))
433 //                      System.out.println();
434                 //super.handleComplexType(topLevelComplexType);
435                 base.handleComplexTypeAttributes(topLevelComplexType);
436                 base.handleComplexTypeExtension(topLevelComplexType);
437                 base.handleExtensionAttributes(topLevelComplexType);
438                 writer.println();
439         }
440         
441         @Override
442         public void handleElement(SchemaObject elementObj) {
443                 Element element = elementObj.getElement();
444                 String name = getName(elementObj);//element.getName();
445                 
446                 if ("Text".equals(name))
447                         System.out.println();
448                 
449                 String type = "XML.Element";
450                 Set<String> types = new LinkedHashSet<String>();
451                 if (element.getType() != null) {
452                         types.add(getType(element.getType(), ""));
453                 }
454                 QName base = this.base.getElementBase(element);
455                 if (base != null) {
456                         if (base.getNamespaceURI().equals(SchemaConversionBase.SCHEMA_NS)) {
457                                 String l0Type = this.base.getL0Type(base);
458                                 if (l0Type == null)
459                                         throw new RuntimeException("Cannot get L0 type for " + base.getLocalPart());
460                                 types.add(l0Type);
461                         } else if (this.base.isElementRef(base.getLocalPart()))
462                                 types.add(ontRoot+base.getLocalPart());
463                         else
464                                 types.add(ontRoot+getComplexTypePrefix()+base.getLocalPart());
465                 }
466                 QName substitution = element.getSubstitutionGroup();
467                 if (substitution != null) {
468                         if (this.base.isElementRef(substitution.getLocalPart()))
469                                 types.add(ontRoot+substitution.getLocalPart());
470                         else
471                                 types.add( ontRoot+getComplexTypePrefix()+substitution.getLocalPart());
472                 }
473                 for (String t : types) {
474                         type += " <T " + t;
475                 }
476
477                 String relationName =  getName(elementObj,"has");//ontRoot+"has"+name;
478 //              if (elementObj.getParent() != null) {
479 //                      //relationName = ontRoot+getComplexTypePrefix()+"has"+name.substring(getComplexTypePrefix().length());
480 //                      relationName = ontRoot+getName(elementObj.getParent()) + "has"+element.getName();
481 //              }
482                 writer.println(relationName+ " <R XML.hasElement");
483                 writer.println(relationName+ "_List <R XML.hasElementList");
484                 
485                 writer.println(name+ " <T "+type);
486                 
487                 LocalComplexType complexType = element.getComplexType();
488                 LocalSimpleType simpleType = element.getSimpleType();
489                 
490                 if (complexType != null) {
491                         SchemaObject complexTypeObj = this.base.getComplexType(complexType);
492                         this.base.handleElementComplexTypeAttributes(complexTypeObj);
493                         this.base.handleComplexTypeExtension(complexTypeObj);
494                 } else if (simpleType != null) {
495                         SchemaObject simpleTypeObj = this.base.getSimpleType(simpleType);
496                         this.base.handleElementSimpleTypeAttributes(simpleTypeObj);
497                 }
498                 
499                 List<IDReference> references = this.base.getIDReferences(element);
500         
501                 for (IDReference ref : references) {
502                         writer.println(name+"."+ref.getReference().getName()+ " <R XML.hasReference");
503                 }
504                 
505                 writer.println();
506         }
507         
508         @Override
509         public String getBaseClass(ObjectType type) {
510                 if (type == ObjectType.ELEMENT)
511                         return "XML.Element";
512                 if (type == ObjectType.COMPLEX_TYPE)
513                         return "XML.ComplexType";
514                 throw new RuntimeException("ObjectType " + type + " has no base class");
515         }
516         
517         @Override
518         public String getName(SchemaObject obj) {
519                 if (obj.getParent() == null) {
520                         switch (obj.getType()) {
521                         case COMPLEX_TYPE:
522                                 return ontRoot+getComplexTypePrefix()+obj.getName();
523                         case ELEMENT:
524                                 return ontRoot+obj.getName();
525                         case ATTRIBUTE_GROUP:
526                                 return ontRoot+getAttributeGroupPrefix()+obj.getName();
527                         case SIMPLE_TYPE:
528                                 return ontRoot+getSimpleTypePrefix()+obj.getName();
529                         }
530                 } else {
531                         SchemaObject o = obj;
532                         SchemaObject prev = null;
533                         String name = "";
534                         while (o != null){
535                                 if (o.getName() != null)
536                                         name = o.getName()+"."+name;
537                                 prev = o;
538                                 o = o.getParent();
539                         }
540                         name = name.substring(0, name.length()-1);
541                         switch (prev.getType()) {
542                         case COMPLEX_TYPE:
543                                 return ontRoot+getComplexTypePrefix()+name;
544                         case ELEMENT:
545                                 return ontRoot+name;
546                         case ATTRIBUTE_GROUP:
547                                 return ontRoot+getAttributeGroupPrefix()+name;
548                         case SIMPLE_TYPE:
549                                 return ontRoot+getSimpleTypePrefix()+name;
550                         }
551                 }
552                 throw new RuntimeException();
553                 
554         }
555         
556         public String getName(SchemaObject parent, SchemaElement e, String rel) {
557                 QName ref = e.getElement().getRef();
558                 if (ref != null) {
559                         return converter.getShortName(ref.getNamespaceURI()) + rel + ref.getLocalPart();
560                 }
561                 else {
562                         return getName(parent, "") + "." + rel + e.getElement().getName();
563                 }
564         }
565         
566         public String getName(SchemaObject obj, String rel) {
567                 if (obj.getParent() == null) {
568                         switch (obj.getType()) {
569                         case COMPLEX_TYPE:
570                                 return ontRoot+getComplexTypePrefix()+rel+obj.getName();
571                         case ELEMENT:
572                                 return ontRoot+rel+obj.getName();
573                         case ATTRIBUTE_GROUP:
574                                 return ontRoot+getAttributeGroupPrefix()+rel+obj.getName();
575                         case SIMPLE_TYPE:
576                                 return ontRoot+getSimpleTypePrefix()+rel+obj.getName();
577                         }
578                 } else {
579                         SchemaObject o = obj;
580                         SchemaObject prev = null;
581                         String name = "";
582                         while (o != null){
583                                 if (o.getName() != null)
584                                         name = o.getName()+"."+name;
585                                 prev = o;
586                                 o = o.getParent();
587                         }
588                         name = name.substring(0, name.length()-1);
589                         switch (prev.getType()) {
590                         case COMPLEX_TYPE:
591                                 return ontRoot+getComplexTypePrefix()+rel+name;
592                         case ELEMENT:
593                                 return ontRoot+rel+name;
594                         case ATTRIBUTE_GROUP:
595                                 return ontRoot+getAttributeGroupPrefix()+rel+name;
596                         case SIMPLE_TYPE:
597                                 return ontRoot+getSimpleTypePrefix()+rel+name;
598                         }
599                 }
600                 throw new RuntimeException();
601                 
602         }
603         
604         
605 }