private static void updateYElementCategoryRefWithZblCategoryRefs(YElement ye, YElement zblye) { for (YCategoryRef r : zblye.getCategoryRefs()) if (!ye.getCategoryRefs().contains(r)) ye.addCategoryRef(r); }
private void updateStats(YElement yelement) { List<String> mscRefsList = extractMscRefs(yelement.getCategoryRefs()); if (mscRefsList.size() == 0) { return; } for (String msc: mscRefsList) { if (!occurrences.containsKey(msc)) { occurrences.put(msc, new ArrayList<Integer>()); } occurrences.get(msc).add(documentCounter); //Remember that category occurred } }
private boolean hasClassification(final YElement element, final String... classifcations) { for (final YCategoryRef yCategoryRef : element.getCategoryRefs()) { if (ArrayUtils.contains(classifcations, yCategoryRef.getClassification())) { return true; } } return false; }
private void saveDocumentWithElement(DocumentRepository repository, Document document, YElement element) { // document.setMetadata(element); System.out.println("Element "+element.getId()+" classified: "+element.getCategoryRefs()); // repository.storeDocument(document, ImporterConstants.EVENT_TAG_TRIGGERED_BY_IMPORTER_PROCESS); }
@Override public List<String> fetchDisciplineIds(YElement yElement) { List<String> disciplinesIds = new ArrayList<String>(); for (YCategoryRef category : yElement.getCategoryRefs()) { if (category != null && DISCIPLINES.equals(category.getClassification())) { disciplinesIds.add(category.getCode()); } } return disciplinesIds; }
@Override public String constructFieldValue(List<YElement> yelements) { List<YElement> articles = YElementsParsingToolbox .filterYElementsOfStructureLevel(yelements, YConstants.EXT_LEVEL_JOURNAL_ARTICLE); if (articles.size() == 0) { return null; } if (articles.size() > 1) { log.error("More than one article found in package of yelements!"); } YElement article = articles.get(0); return selectContributors(article.getCategoryRefs()); }
private void changeCategoryRef(YElement element, YElement elementWithCode, final String from, final String to , final Map<String, String> rootCategories) { for (final YCategoryRef yCategoryRefWithCode : elementWithCode.getCategoryRefs()) { if (null != yCategoryRefWithCode && from.equals(yCategoryRefWithCode.getClassification())) { chengeCategoryRef(element, to, rootCategories, yCategoryRefWithCode); } } }
@Override public List<YElement> process(EnrichedPayload<YElement>[] input, ProcessContext ctx) throws Exception { List<YElement> selected = new ArrayList<YElement>(); for (EnrichedPayload<YElement> e: input) { YElement yelement = e.getObject(); List<YCategoryRef> refs = yelement.getCategoryRefs(); //check if MSc classification is available: if yes then select for (YCategoryRef ref: refs) { if (ref.getClassification().equals(YConstants.EXT_CLASSIFICATION_MSC)) { selected.add(yelement); break; } } } log.info("Selected {} out of {}. ", selected.size(), input.length); return selected; }
@Override public String constructFieldValue(List<YElement> yelements) { List<YElement> articles = YElementsParsingToolbox .filterYElementsOfStructureLevel(yelements, YConstants.EXT_LEVEL_JOURNAL_ARTICLE); if (articles.size() == 0) { return null; } if (articles.size() > 1) { log.error("More than one article found in package of yelements!"); } YElement article = articles.get(0); //System.out.println("[MscCategoriesFieldConstructor] article.getCategoryRefs().size() = "+article.getCategoryRefs().size()); List<YCategoryRef> mscRefs = filterMscCatRefs(article.getCategoryRefs()); StringBuilder cc = new StringBuilder(); for (YCategoryRef ref: mscRefs) { cc.append(ref.getCode()); cc.append(YElementToZentralBlattConverter.SUGGESTED_MULTIVALUE_FIELD_SEPARATOR); } return cc.toString(); }
private void updateStats(YElement yelement) { List<YCategoryRef> mscRefs = extractMscRefs(yelement.getCategoryRefs()); if (mscRefs.size() == 0) { return; } log.info("analyzing next yelement = [{}]", yelement); for (int i = 0; i < mscRefs.size(); ++i) { for (int j = i; j < mscRefs.size(); ++j) { String msc1 = mscRefs.get(i).getCode(); String msc2 = mscRefs.get(j).getCode(); Integer previousValue = cooccurrence.get(msc1, msc2, 0); // System.out.println("Incrementing ["+msc1+", "+msc2+"] from "+previousValue+" to "+(previousValue+1)); cooccurrence.set(msc1, msc2, (previousValue + 1)); } } /* * for (YCategoryRef msc1 : mscRefs) { for (YCategoryRef msc2 : mscRefs) * { Integer previousValue = cooccurrence.get(msc1.getCode(), * msc2.getCode(), 0); cooccurrence.set(msc1.getCode(), msc2.getCode(), * previousValue + 1); } } */ }
/** * accomplished */ private void proceedCategoryRefs() { if(!in_item.getCategoryRefs().isEmpty()){ for(YCategoryRef ycr : in_item.getCategoryRefs()){ if(YConstants.EXT_CLASSIFICATION_CEJSH.equals(ycr.getClassification())) paos_doc.add(new PredicateAndObject(RelConstants.RL_CATEGORY_CEJSH, ycr.getCode().toString())); else if(YConstants.EXT_CLASSIFICATION_CLC.equals(ycr.getClassification())) paos_doc.add(new PredicateAndObject(RelConstants.RL_CATEGORY_CLC, ycr.getCode().toString())); else if(YConstants.EXT_CLASSIFICATION_JEL.equals(ycr.getClassification())) paos_doc.add(new PredicateAndObject(RelConstants.RL_CATEGORY_JEL, ycr.getCode().toString())); else if(YConstants.EXT_CLASSIFICATION_MSC.equals(ycr.getClassification())) paos_doc.add(new PredicateAndObject(RelConstants.RL_CATEGORY_MSC, ycr.getCode().toString())); else if(YConstants.EXT_CLASSIFICATION_PACS.equals(ycr.getClassification())) paos_doc.add(new PredicateAndObject(RelConstants.RL_CATEGORY_PACS, ycr.getCode().toString())); else if(YConstants.EXT_CLASSIFICATION_QICS.equals(ycr.getClassification())) paos_doc.add(new PredicateAndObject(RelConstants.RL_CATEGORY_QICS, ycr.getCode().toString())); else if(YConstants.EXT_CLASSIFICATION_ZDM.equals(ycr.getClassification())) paos_doc.add(new PredicateAndObject(RelConstants.RL_CATEGORY_ZDM, ycr.getCode().toString())); } } }
/** * accomplished */ private void proceedCategoryRefs() { if(!in_item.getCategoryRefs().isEmpty()){ for(YCategoryRef ycr : in_item.getCategoryRefs()){ if(YConstants.EXT_CLASSIFICATION_CEJSH.equals(ycr.getClassification())) paos_doc.add(new PredicateAndObject(RelConstants.RL_CATEGORY_CEJSH, ycr.getCode().toString())); else if(YConstants.EXT_CLASSIFICATION_CLC.equals(ycr.getClassification())) paos_doc.add(new PredicateAndObject(RelConstants.RL_CATEGORY_CLC, ycr.getCode().toString())); else if(YConstants.EXT_CLASSIFICATION_JEL.equals(ycr.getClassification())) paos_doc.add(new PredicateAndObject(RelConstants.RL_CATEGORY_JEL, ycr.getCode().toString())); else if(YConstants.EXT_CLASSIFICATION_MSC.equals(ycr.getClassification())) paos_doc.add(new PredicateAndObject(RelConstants.RL_CATEGORY_MSC, ycr.getCode().toString())); else if(YConstants.EXT_CLASSIFICATION_PACS.equals(ycr.getClassification())) paos_doc.add(new PredicateAndObject(RelConstants.RL_CATEGORY_PACS, ycr.getCode().toString())); else if(YConstants.EXT_CLASSIFICATION_QICS.equals(ycr.getClassification())) paos_doc.add(new PredicateAndObject(RelConstants.RL_CATEGORY_QICS, ycr.getCode().toString())); else if(YConstants.EXT_CLASSIFICATION_ZDM.equals(ycr.getClassification())) paos_doc.add(new PredicateAndObject(RelConstants.RL_CATEGORY_ZDM, ycr.getCode().toString())); } } }
private void updateStats(YElement yelement) { List<String> mscRefs = extractMscRefs(yelement.getCategoryRefs()); List<String> fingerprints = extractAuthorsFingerprints(yelement.getContributors()); if (mscRefs.size() == 0 || fingerprints.size() == 0) { return; } log.info("analyzing next yelement = [{}]", yelement); //kazdemu autorowi dodajemy jedno wystapienie w danej klasie //kazdej klasie dodajemy jedno wystapienie danego autora for (String authorFingerprint: fingerprints) { for (String mscRef: mscRefs) { increment(authorsInClass, mscRef, authorFingerprint); increment(classesOfAuthor, authorFingerprint, mscRef); } } }
public static boolean sanitizeCategoryRefs(YElement article) { if (article == null || article.getCategoryRefs().isEmpty()) return false; boolean warning = false; List<YCategoryRef> cleanRefs = new ArrayList<YCategoryRef>(); for (YCategoryRef ref : article.getCategoryRefs()) { if (ref == null || ref.getCode() == null || ref.getCode().trim().isEmpty()) continue; ref.setCode(ref.getCode().trim()); List<YCategoryRef> refs = sanitizeCategoryRef(ref); warning = warning || isChanged(ref, refs); cleanRefs.addAll(refs); } article.setCategoryRefs(cleanRefs); if (!warning) return false; YAttribute attr = article.getOneAttribute(Warnings.WARNINGS); if (attr == null) { attr = new YAttribute(Warnings.WARNINGS, (String) null); article.addAttribute(attr); } if (attr.getOneAttribute(Warnings.WARNINGS_CHECK_CATEGORY_REFS) == null) attr.addAttribute(Warnings.WARNINGS_CHECK_CATEGORY_REFS, ""); return true; }
private List<Classification> getClassification(YElement element) { List<YCategoryRef> refs = element.getCategoryRefs();
public static void updateYRelationWithZblClassificationCodes(YRelation relye, YElement zblye) { YAttribute ya; ya = new YAttribute(YConstants.TG_CATEGORY, ""); for (YCategoryRef r : zblye.getCategoryRefs()) { ya.addAttribute(new YAttribute(r.getClassification(), r.getCode())); } relye.addAttribute(ya); }
private static void enhanceArticleElement(YElement ye, List<YElement> zblyel) { for(YElement zblye : zblyel){ for(YCategoryRef r : zblye.getCategoryRefs()) if(!ye.getCategoryRefs().contains(r)) ye.addCategoryRef(r);
private static void enhanceArticleElement(YElement ye, List<YElement> zblyel) { for(YElement zblye : zblyel){ for(YCategoryRef r : zblye.getCategoryRefs()) if(!ye.getCategoryRefs().contains(r)) ye.addCategoryRef(r);
private boolean addMetadataIfNeeded(HarvestingResult harvestingResult, YElement element) { boolean metadataModified = false; if (shouldAbstractBeAdded(harvestingResult, element)) { Node htmlNode = new Node(BaseYModelUtils.XHTML_NAMESPACE, BaseYModelUtils.HTML_TAG); htmlNode.addPart(new Leaf(StringUtils.trim(harvestingResult.getDesciption()))); YRichText richText = new YRichText(Arrays.asList(htmlNode)); YDescription newAbstract = new YDescription(YLanguage.Undetermined, richText, DescriptionTypes.DS_ABSTRACT); element.addDescription(newAbstract); metadataModified = true; } if (shouldImpactFactorBeAdded(harvestingResult, element)) { element.addAttribute(new YAttribute(YModelUtils.IMPACT_FACTOR, harvestingResult.getImpactFactor().toEngineeringString())); metadataModified = true; } if (shouldFrequencyBeAdded(harvestingResult, element)) { element.addAttribute(new YAttribute(YModelUtils.FREQUENCY, harvestingResult.getFrequency())); metadataModified = true; } List<YCategoryRef> refs = element.getCategoryRefs(); if (shouldCategoryRefsBeAdded(harvestingResult, refs)) { refs.addAll(harvestingResult.getCategories()); metadataModified = true; } if (shouldTitlesBeAdded(harvestingResult, element)) { metadataModified |= addTitleHistory(harvestingResult.getOtherTitles(), element); } return metadataModified; }
for(YCategoryRef r : zblye.getCategoryRefs()){ ya.addAttribute(new YAttribute(r.getClassification(), r.getCode()));