#NEWLINE# def createFact( self , conceptQname , attributes = None , text = None , parent = None , afterSibling = None , beforeSibling = None , validate = True ) : #NEWLINE# #INDENT# "Creates new fact, as in formula output instance creation, and validates into object model\n        \n        :param conceptQname: QNames of concept\n        :type conceptQname: QName\n        :param attributes: Tuple of name, value, or tuples of name, value tuples (name,value) or ((name,value)[,(name,value...)]), where name is either QName or clark-notation name string\n        :param text: Text content of fact (will be converted to xpath compatible str by FunctionXS.xsString)\n        :type text: object\n        :param parent: lxml element in instance to append as child of\n        :type parent: ModelObject\n        :param beforeSibling: lxml element in instance to insert new concept before\n        :type beforeSibling: ModelObject\n        :param afterSibling: lxml element in instance to insert new concept after\n        :type afterSibling: ModelObject\n        :param validate: specify False to block XML Validation (required when constructing a tuple which is invalid until after it's contents are created)\n        :type validate: boolean\n        :returns: ModelFact -- New fact object\n        " #NEWLINE# if ( parent is None ) : #NEWLINE# #INDENT# parent = self . modelDocument . xmlRootElement #NEWLINE# #UNINDENT# self . makeelementParentModelObject = parent #NEWLINE# newFact = XmlUtil . addChild ( parent , conceptQname , attributes = attributes , text = text , afterSibling = afterSibling , beforeSibling = beforeSibling ) #NEWLINE# global ModelFact #NEWLINE# if ( ModelFact is None ) : #NEWLINE# #INDENT# from arelle.ModelInstanceObject import ModelFact #NEWLINE# #UNINDENT# if hasattr ( self , '_factsByQname' ) : #NEWLINE# #INDENT# self . _factsByQname [ newFact . qname ] . add ( newFact ) #NEWLINE# #UNINDENT# if ( not isinstance ( newFact , ModelFact ) ) : #NEWLINE# #INDENT# return newFact #NEWLINE# #UNINDENT# del self . makeelementParentModelObject #NEWLINE# if validate : #NEWLINE# #INDENT# XmlValidate . validate ( self , newFact ) #NEWLINE# #UNINDENT# self . modelDocument . factDiscover ( newFact , parentElement = parent ) #NEWLINE# if ( ( not newFact . isNil ) and hasattr ( self , '_nonNilFactsInInstance' ) ) : #NEWLINE# #INDENT# self . _nonNilFactsInInstance . add ( newFact ) #NEWLINE# #UNINDENT# if ( newFact . concept is not None ) : #NEWLINE# #INDENT# if hasattr ( self , '_factsByDatatype' ) : #NEWLINE# #INDENT# del self . _factsByDatatype #NEWLINE# #UNINDENT# if hasattr ( self , '_factsByPeriodType' ) : #NEWLINE# #INDENT# self . _factsByPeriodType [ newFact . concept . periodType ] . add ( newFact ) #NEWLINE# #UNINDENT# if hasattr ( self , '_factsByDimQname' ) : #NEWLINE# #INDENT# del self . _factsByDimQname #NEWLINE# #UNINDENT# #UNINDENT# self . setIsModified ( ) #NEWLINE# return newFact