Package kpi.asoiu.dao

Examples of kpi.asoiu.dao.SimpleDAO


        StringBuffer text = new StringBuffer();
        for (Sentence sentence : sentences) {
            text.append(sentence.getText());
        }
        article.setText(text.toString());
        SimpleDAO simpleDAO = DAOFactory.getDao();
        article.setId(simpleDAO.addObjects(article));
        Map<String, SubjectsEntity> subjectsEntityMap = new HashMap<String, SubjectsEntity>();
        Map<String, Double> subjectsMap = calculateSubjectFrequency();
        for (String word : subjectsMap.keySet()) {
            SubjectsEntity subjectsEntity = new SubjectsEntity();
            subjectsEntity.setFreq(subjectsMap.get(word).floatValue());
            subjectsEntity.setWord(word);
            subjectsEntity.setArticle(article);
            subjectsEntityMap.put(word, subjectsEntity);
            subjectsEntity.setId(simpleDAO.addObjects(subjectsEntity));
        }

        article.setSubjects(new ArrayList<SubjectsEntity>(subjectsEntityMap.values()));
        List<TripletEntity> tripletEntities = new ArrayList<TripletEntity>();
        for (Triplet triplet : tree.keySet()) {
            TripletEntity tripletEntity = createEntityFromTriplet(triplet, subjectsEntityMap);
            tripletEntities.add(tripletEntity);
            tripletEntities.addAll(treeToList(tripletEntity, tree.get(triplet), subjectsEntityMap));
        }
        for (TripletEntity tripletEntity : tripletEntities) {
            tripletEntity.setId(simpleDAO.addObjects(tripletEntity));
        }
        article.setTriplets(tripletEntities);
        simpleDAO.updateObject(article);
    }
View Full Code Here


    public static RuleDao getRuleDAO() {
        return new RuleDao();
    }

    public static SimpleDAO getDao() {
        return new SimpleDAO();
    }
View Full Code Here

TOP

Related Classes of kpi.asoiu.dao.SimpleDAO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.