本文整理了Java中pl.edu.icm.model.bwmeta.y.YElement.getCategoryRefs()
方法的一些代码示例,展示了YElement.getCategoryRefs()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YElement.getCategoryRefs()
方法的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YElement
类名称:YElement
方法名:getCategoryRefs
暂无
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
private static void updateYElementCategoryRefWithZblCategoryRefs(YElement ye, YElement zblye) {
for (YCategoryRef r : zblye.getCategoryRefs())
if (!ye.getCategoryRefs().contains(r))
ye.addCategoryRef(r);
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
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
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-process-common
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;
}
代码示例来源:origin: pl.edu.icm.synat/synat-sdk-sample-services
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);
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
@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;
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
@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());
}
代码示例来源:origin: pl.edu.icm.synat/synat-process-common
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);
}
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
@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;
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
@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();
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
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); } }
*/
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
/**
* 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()));
}
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
/**
* 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()));
}
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
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);
}
}
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
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;
}
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
private List<Classification> getClassification(YElement element) {
List<YCategoryRef> refs = element.getCategoryRefs();
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
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);
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
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);
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
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);
代码示例来源:origin: pl.edu.icm.synat/synat-process-common
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;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
for(YCategoryRef r : zblye.getCategoryRefs()){
ya.addAttribute(new YAttribute(r.getClassification(), r.getCode()));
内容来源于网络,如有侵权,请联系作者删除!