def get_or_create_fact_term(iobject_family_name,<EOL>fact_term_name,<EOL>fact_term_attribute,<EOL>iobject_type_name,<EOL>iobject_type_namespace_uri,<EOL>fact_dt_name=DINGOS_DEFAULT_FACT_DATATYPE,<EOL>fact_dt_namespace_name=None,<EOL>fact_dt_kind=FactDataType.UNKNOWN_KIND,<EOL>fact_dt_namespace_uri=DINGOS_NAMESPACE_URI,<EOL>dingos_class_map=dingos_class_map<EOL>):
if not fact_term_attribute:<EOL><INDENT>fact_term_attribute = '<STR_LIT>'<EOL><DEDENT>iobject_family, created = dingos_class_map['<STR_LIT>'].objects.get_or_create(name=iobject_family_name)<EOL>fact_dt_namespace, created = dingos_class_map['<STR_LIT>'].objects.get_or_create(uri=fact_dt_namespace_uri)<EOL>iobject_type_namespace, created = dingos_class_map['<STR_LIT>'].objects.get_or_create(uri=iobject_type_namespace_uri)<EOL>if created and fact_dt_namespace_name:<EOL><INDENT>fact_dt_namespace.name = fact_dt_namespace_name<EOL>fact_dt_namespace.save()<EOL><DEDENT>fact_dt, created = dingos_class_map['<STR_LIT>'].objects.get_or_create(name=fact_dt_name,<EOL>namespace=fact_dt_namespace)<EOL>if created:<EOL><INDENT>fact_dt.kind = fact_dt_kind<EOL>fact_dt.save()<EOL><DEDENT>iobject_type, created = dingos_class_map['<STR_LIT>'].objects.get_or_create(name=iobject_type_name,<EOL>iobject_family=iobject_family,<EOL>namespace=iobject_type_namespace)<EOL>fact_term, created = dingos_class_map['<STR_LIT>'].objects.get_or_create(term=fact_term_name,<EOL>attribute=fact_term_attribute)<EOL>fact_term_2_type, dummy = dingos_class_map['<STR_LIT>'].objects.get_or_create(fact_term=fact_term,<EOL>iobject_type=iobject_type,<EOL>)<EOL>fact_term_2_type.fact_data_types.add(fact_dt)<EOL>fact_term_2_type.save()<EOL>return fact_term, created<EOL>
Get or create a fact term.