def processURIIOTypeSave(root): kdmanager = KnowledgeDomainManager() kd = kdmanager.getDomain() for child in root: if child.tag == "type": nType = URIIOType(None, "") for ch in child: if ch.tag == "name": nType.type = ch.text elif ch.tag == "property": prop = URIIOTypeProperty(ch.text) for c in ch: if c.tag == "type": prop.type = c.text nType.properties.append(prop) elif ch.tag == "parent": p = kd.typeManager.getType(ch.text) if p is not None: nType.parent = p elif ch.tag == "locked": if ch.text == "yes": nType.locked = True else: nType.locked = False kd.typeManager.saveType(nType) return kd.typeManager.getCriteria().asXML()
def __buildTypeDictionary__(self): dic = dict() type = URIIOType(None, "type") type.locked = True type.systemDefined = True dic["type"] = type idea = URIIOType(type,"idea") idea.locked = True idea.systemDefined = True dic["idea"] = idea workday = URIIOType(idea, "workday") dic["workday"] = workday obj = URIIOType(type, "object") obj.locked = True obj.systemDefined = True dic["object"] = obj dataSource = URIIOType(obj, "datasource") dataSource.addProperty("location") dic["datasource"] = dataSource datastore = URIIOType(dataSource, "datastore") dic["datastore"] = datastore link = URIIOType(dataSource, "link") dic["link"] = link person = URIIOType(obj, "person") dic["person"] = person person.addProperty("first name") person.addProperty("last name") person.addProperty("date of birth") employee = URIIOType(person, "employee") dic["employee"] = employee customer = URIIOType(person, "customer") dic["customer"] = customer return dic