InfExtract3::InfExtract3(Data *d,FsXml *fs,std::vector<Node*> nodes,bool v) { weights=vector<double>(nodes.size(),0.0); weights2=vector<double>(nodes.size(),0.0); counts=0; data=d; verbose=v; streampos fpos; if(verbose) cout<<"Creating average coincidence..."<<endl; fpos=fs->gotoLineContaining("<Iteration>"); int counts=0; while(!fs->eof() && fpos>=0) { if(fpos>0) state=new State(data,fs,vector<double>(1.0),1.0,BETAMOD_CONST,2.0); vector<double> tmp=getSplits(state,nodes,true);//**** vector<double> tmp2=getSplits(state,nodes,false);//**** for(unsigned int c1=0;c1<tmp.size();c1++) { weights[c1]+=tmp[c1]; weights2[c1]+=tmp2[c1];} counts++; delete(state); fpos=fs->gotoNextLineContaining("<Iteration>"); } for(unsigned int c1=0;c1<nodes.size();c1++) if(nodes[c1]->getFather()!=NULL){ if(nodes[c1]->inTree() || nodes[c1]->getFather()->inTree()){ nodes[c1]->assignCertainty(weights[c1]/(double)counts,true); // nodes[c1]->assignCertainty(weights2[c1]/(double)counts,false); // NOTE THe weights2 is not functioning correctly. } } if(verbose) cout<<"Finished creating mean distance matrix."<<endl; }
void TBox :: buildDAG ( void ) { nNominalReferences = 0; // init concept indexing nC = 1; // start with 1 to make index 0 an indicator of "not processed" ConceptMap.push_back(NULL); // make fresh concept and datatype concept2dag(pTemp); DLTree* freshDT = DTCenter.getFreshDataType(); addDataExprToHeap ( static_cast<TDataEntry*>(freshDT->Element().getNE()) ); deleteTree(freshDT); for ( c_const_iterator pc = c_begin(); pc != c_end(); ++pc ) concept2dag(*pc); for ( i_const_iterator pi = i_begin(); pi != i_end(); ++pi ) concept2dag(*pi); // init heads of simple rules for ( TSimpleRules::iterator q = SimpleRules.begin(), q_end = SimpleRules.end(); q < q_end; ++q ) (*q)->bpHead = tree2dag((*q)->tHead); // builds Roles range and domain initRangeDomain(ORM); initRangeDomain(DRM); // build all splits for ( TSplitVars::iterator s = getSplits()->begin(), s_end = getSplits()->end(); s != s_end; ++s ) split2dag(*s); RoleMaster::iterator p, p_end; // build all GCIs DLTree* GCI = Axioms.getGCI(); // add special domains to the GCIs if ( likely(useSpecialDomains) ) for ( p = ORM.begin(), p_end = ORM.end(); p < p_end; ++p ) if ( !(*p)->isSynonym() && (*p)->hasSpecialDomain() ) GCI = createSNFAnd ( GCI, clone((*p)->getTSpecialDomain()) ); // take chains that lead to Bot role into account if ( !ORM.getBotRole()->isSimple() ) GCI = createSNFAnd ( GCI, new DLTree ( TLexeme(FORALL), createRole(ORM.getBotRole()), createBottom() ) ); T_G = tree2dag(GCI); deleteTree(GCI); // mark GCI flags GCIs.setGCI(T_G != bpTOP); GCIs.setReflexive(ORM.hasReflexiveRoles()); // builds functional labels for roles for ( p = ORM.begin(), p_end = ORM.end(); p < p_end; ++p ) if ( !(*p)->isSynonym() && (*p)->isTopFunc() ) (*p)->setFunctional ( atmost2dag ( 1, *p, bpTOP ) ); for ( p = DRM.begin(), p_end = DRM.end(); p < p_end; ++p ) if ( !(*p)->isSynonym() && (*p)->isTopFunc() ) (*p)->setFunctional ( atmost2dag ( 1, *p, bpTOP ) ); // check the type of the ontology if ( nNominalReferences > 0 ) { unsigned int nInd = i_end() - i_begin(); if ( nInd > 100 && nNominalReferences > nInd ) isLikeWINE = true; } // here DAG is complete; set its final size DLHeap.setFinalSize(); }