function getTranlationEntryByArabicEntryKeyword($arStr)
{
    global $CUSTOM_TRANSLATION_TABLE_EN_AR, $TABLE_LOADED;
    if (!$TABLE_LOADED) {
        return false;
    }
    $translationKey = search2DArrayForValue($CUSTOM_TRANSLATION_TABLE_EN_AR, $arStr);
    return $CUSTOM_TRANSLATION_TABLE_EN_AR[$translationKey];
}
function ontologyToD3TreemapFlat($MODEL_QA_ONTOLOGY, $minFreq = 0)
{
    global $lang;
    $treeRootObj = array();
    $treeRootObj["name"] = "قرآن";
    $treeRootObj["children"] = array();
    $currentArr =& $treeRootObj["children"];
    /** SHOULD BE ZERO BASED FOR D3 TO WORK - o.target.weight = NULL**/
    $nodeSerialNumber = 0;
    $qaOntologyConceptsIterator = getAPCIterator("ALL\\/MODEL_QA_ONTOLOGY\\/CONCEPTS\\/.*");
    foreach ($qaOntologyConceptsIterator as $conceptsCursor) {
        $conceptNameID = getEntryKeyFromAPCKey($conceptsCursor['key']);
        $conceptArr = $conceptsCursor['value'];
        $conceptLabelAR = $conceptArr['label_ar'];
        $conceptLabelEN = $conceptArr['label_en'];
        $conceptFrequency = $conceptArr['frequency'];
        $conceptWeight = $conceptArr['weight'];
        if ($conceptFrequency < $minFreq) {
            continue;
        }
        $conceptNameClean = convertConceptIDtoGraphLabel($conceptNameID);
        /*= array("id"=>$nodeSerialNumber++,"word"=>$conceptLabelAR,
        		"size"=>$conceptWeight,"x"=>rand($startLocationXMin,$startLocationXMax),
        		"y"=>rand($startLocationYMin,$startLocationYMax));*/
        $currentArr[] = array("name" => $conceptNameClean, "size" => $conceptWeight, "children" => array());
    }
    $ONTOLOGY_RELATIONS = getModelEntryFromMemory("ALL", "MODEL_QA_ONTOLOGY", "RELATIONS", "");
    foreach ($ONTOLOGY_RELATIONS as $index => $relArr) {
        $subject = $relArr['SUBJECT'];
        $verbAR = $relArr['VERB'];
        $verbEN = $relArr['VERB_TRANSLATION_EN'];
        $verbUthmani = $relArr['VERB_UTHMANI'];
        $relFreq = $relArr['FREQUENCY'];
        $object = $relArr['OBJECT'];
        //$treeRootObj[$subject]["children"][]["name"]=$object;
        $objectConceptArr = getModelEntryFromMemory("ALL", "MODEL_QA_ONTOLOGY", "CONCEPTS", $object);
        //$objectConceptArr = $MODEL_QA_ONTOLOGY['CONCEPTS'][$object];
        $index = search2DArrayForValue($currentArr, $subject);
        $isObjectIncludedBefore = search2DArrayForValue($currentArr[$index]["children"], $object);
        if ($isObjectIncludedBefore === false) {
            //$currentArr[$index]["children"][] = array("name"=>$object,"size"=>$objectConceptArr['frequency'],"children"=>array());
        }
    }
    return $treeRootObj;
}