} $relationsArr = $relationsArrCopy; foreach ($finalConcepts as $concept => $coneptArr) { $conceptNameEn = $coneptArr['EXTRA']['TRANSLATION_EN']; $conceptNameAr = $concept; $conceptType = $coneptArr['CONCEPT_TYPE']; ////////// FIX ENGLISH TRANSLATION, SINCE WORD-TO-WORD FILE DOES NOT GIVE ////////// PROPER ONTOLOGY TRANSLATIONS FOR THE VALUES IN THE LOOKUP TABLE if (isset($TRANSLATION_FIXER_LOOKUP_TABLE[$conceptNameAr])) { $finalConcepts[$concept]['EXTRA']['TRANSLATION_EN'] = $TRANSLATION_FIXER_LOOKUP_TABLE[$conceptNameAr]; //echoN($finalConcepts[$concept]['TRANSLATION_EN']); } ///////////////////////////////////////// //ECHOn("___ $conceptNameAr | $conceptNameEn"); // FIX CONCEPT TYPE FOR ANY CONCEPT WITH EXCLUDED RELATIONS if ($conceptNameAr != $thing_class_name_ar && $conceptType == "T-BOX" && !conceptHasSubclasses($relationsArr, $conceptNameAr)) { $finalConcepts[$concept]['CONCEPT_TYPE'] = 'A-BOX'; } } echoN("Concepts after PP:" . count($finalConcepts)); //exit; //preprint_r($relationsArr);exit; file_put_contents("{$ONTOLOGY_EXTRACTION_FOLDER}/temp.final.concepts.stage8", serialize($finalConcepts)); file_put_contents("{$ONTOLOGY_EXTRACTION_FOLDER}/temp.final.relations", serialize($relationsArr)); } //////////// COPY/FI FILIZE FINAL CONCEPTS ///////////////////////////// persistTranslationTable(); $finalConcepts = unserialize(file_get_contents("{$ONTOLOGY_EXTRACTION_FOLDER}/temp.final.concepts.stage8")); file_put_contents("{$ONTOLOGY_EXTRACTION_FOLDER}/temp.final.concepts.final", serialize($finalConcepts)); //////////////////////////////////////////////////////////////////////// if ($GENERATE_OWL_FILE) {
//$graphNodesJSON = json_encode($graphObj['nodes']); //$graphLinksJSON = json_encode($graphObj['links']); //echoN($treeRootNodeJSON); //echoN($graphNodesJSON); //echoN($graphLinksJSON); //exit; $qaRelationsArr = getModelEntryFromMemory("ALL", "MODEL_QA_ONTOLOGY", "RELATIONS", ""); $filteredClusteredArr = array(); $index = 0; foreach ($clusteredArr as $index => $clusterArrItem) { $conceptName = strtolower(convertConceptIDtoGraphLabel($clusterArrItem['word'])); //$conceptNameAR = $MODEL_QA_ONTOLOGY['CONCEPTS_EN_AR_NAME_MAP'][$conceptName]; $conceptNameAR = getModelEntryFromMemory("ALL", "MODEL_QA_ONTOLOGY", "CONCEPTS_EN_AR_NAME_MAP", $conceptName); // if not in index (then not qurana or word in quran) // and does not have subclasses // then ignore if (!wordOrPhraseIsInIndex($lang, $conceptName) && !conceptHasSubclasses($qaRelationsArr, $conceptNameAR)) { //echoN($conceptName); continue; } $index++; $filteredClusteredArr[] = $clusterArrItem; } //preprint_r($clusteredArr); //echoN(count($clusteredArr)); $clusteredArrJSON = json_encode($filteredClusteredArr); ?> <div id='exploration-area'>