public YElement processArticleInBook(Element ameta, Element reflist, YElement parent, NlmIdGenerator idGenerator) { YElement article = initArticleinBookElement(ameta, parent,idGenerator); updater.updateElementIds(ameta, article, "article-id"); //bwmeta updater.updateElementExtLinks(ameta, article); updater.updateElementContentLinks(ameta, article); // content links updater.updateElementAuthors(ameta, article); // contributors updater.updateProvider(ameta, article); updater.updateElementPubdate(ameta, article); // pubdate updater.updateWithKwdGroups(ameta, article); // keywords updater.updateElementPages(ameta, article, NlmToYConstants.EXT_HIERARCHY_MBOOK_ARTICLE);//pages articleUpdater.updateArticleRefs(reflist, article); return article; }
public static YElement processBookElement(Element bmeta, final String hierarchy, YElement parent, final String level, Element reflist, final boolean bookNoArticle, NlmIdGenerator idGenerator) { return delegate.processBookElement(bmeta, hierarchy, parent, level, reflist, bookNoArticle, idGenerator); }
/** * Creates an element in the hierarchy specified by the <code>hierarchy</code> property. * * @param level level for the element in the hierarchy * @param name name to use as the canonical name of the element * @param parent parent for the element in the hierarchy * @param id eudml id * @return the created element */ public YElement element(String level, YName name, YElement parent, String id) { return element(getDefaultHierarchy(), level, name, parent, id); }
public YElement processBookPartElement(Element jbookPart, YElement parent, NlmIdGenerator idGenerator) { Element bpmeta = JDOMHelper.optDescendant(jbookPart, "book-part-meta"); YName bookPartName = y.canonicalName(YLanguage.Undetermined, JDOMHelper.getTextTrim(JDOMHelper.optDescendant(bpmeta, "title-group", "title"))); Element eudmlIdEl = JDOMHelper.getChildWithGivenAttributeValue(jbookPart, "book-part-id", "pub-id-type", "eudml-id"); String eudmlId=eudmlIdEl==null?null:eudmlIdEl.getValue(); String id=idGenerator.getBookPartId(eudmlId, bookPartName.getText(), parent); YElement bookPart = factory.element(HierarchyWithLevelIds.EXT_HIERARCHY_BOOK, NlmToYConstants.EXT_LEVEL_BOOK_BOOKPART, bookPartName, parent, id); updater.updateElementIds(bpmeta, bookPart, "book-part-id"); updater.updateElementContentLinks(bpmeta, bookPart); updater.updateElementPages(bpmeta, bookPart, HierarchyWithLevelIds.EXT_HIERARCHY_BOOK);//pages updatePartType(jbookPart, bookPart); return bookPart; }
/** * Extracts all important metadata of the document and its references * from its content. * * @param nlm the document in NLM format * @return an object storing all needed metadata * @throws TransformationException * @throws FileNotFoundException */ public DocSimpleMetadata readFromNLMFile(String nlm) throws TransformationException { NlmToYTransformer transformer = new NlmToYTransformer(); return yExportablesToMetadata(transformer.read(nlm)); }
/** * Processes <code>journal-meta</code> metadata creating a journal element. * * @param jmeta * the metadata element to extract journal info from * @param parent * parent element for the created element * @return the created journal element */ private YElement processJournal(org.jdom.Element jmeta, org.jdom.Element ameta, YElement parent) { YElement journal = initJournalElement(jmeta, parent); updateJournalIssns(jmeta, journal); updateJournalZblFingerprint(jmeta, journal); updateJournalAids(jmeta, journal); updater.updateElementPublisher(jmeta, journal); updater.updateProvider(ameta, journal); updateJournalIds(journal); return journal; }
@Override public List<YExportable> read(String string, Object... hints) throws TransformationException { configureGenerator(); return super.read(string, hints); }
private static NlmBookProcessor createProcessor() { YObjects y = new YObjects("[unknown]"); EudmlYElementFactory factory = new EudmlYElementFactory(); UpdateElement updater = new UpdateElement(y); UpdateArticle articleUpdater = new UpdateArticle(y); return new NlmBookProcessor(y, factory, updater, articleUpdater); }
private void updateCategoryRefs(YElement article, org.jdom.Element kg, String type) { List<org.jdom.Element> ks = JDOMHelper.getChildren(kg, "kwd"); for (org.jdom.Element k : ks) { String codeText = JDOMHelper.textOfElement(k).toText(); for (String code : findAllCategoryCodes(codeText, type)) { YCategoryRef ref = new YCategoryRef(type, code); article.addCategoryRef(ref); } } }
private void fillBookParts(List<YExportable> es, List<Element> bookParts, YElement book){ for (Element jbookPart : bookParts) { YElement bookPart = bookProcessor.processBookPartElement(jbookPart, book,getIdGenerator()); es.add(bookPart); } }
/** * Creates an element in the hierarchy specified by the <code>hierarchy</code> property. * * @param level level for the element in the hierarchy * @param name name to use as the canonical name of the element * @param parent parent for the element in the hierarchy * @param id eudml id * @return the created element */ public YElement element(String level, YName name, YElement parent, String id) { return eudmlFactory.element(level, name, parent, id); }
/** * Mbook is eudml only so we expect to have eudml id * @param mbmeta nlm book element * @param hierarchy hierachy to set * @param level to set * @param idGenerator - generator for ids * @return generated yelement */ public static YElement processMBookElement(Element mbmeta, final String hierarchy, final String level, NlmIdGenerator idGenerator) { return delegate.processMBookElement(mbmeta, hierarchy, level, idGenerator); }
private void configureGenerator() { super.setIdGenerator(idGenerator);; }
public static YElement processArticleInBook(Element ameta, Element reflist, YElement parent, NlmIdGenerator idGenerator) { return delegate.processArticleInBook(ameta, reflist, parent, idGenerator); }
public static YElement processBookPartElement(Element jbookPart, YElement parent, NlmIdGenerator idGenerator) { return delegate.processBookPartElement(jbookPart, parent, idGenerator); }
public static void updateArticleInBookWithBookMeta(Element bmeta, final YElement article) { delegate.updateArticleInBookWithBookMeta(bmeta, article); }
/** * @param hierarchy the hierarchy identifier for the created elements */ public void setHierarchy(String hierarchy) { super.setHierarchy(hierarchy); this.eudmlFactory = new EudmlYElementFactory(hierarchy); }
/** * Processes <code>article-meta</code> and <code>ref-list</code> metadata * creating an article element. * * @param ameta * the metadata element to extract article info from * @param reflist * the metadata element to extract citations info from * @param parent * parent element for the created element * @return the created article element */ private YElement processArticle(org.jdom.Element ameta, org.jdom.Element reflist, YElement parent) { YElement article = initArticleElement(ameta, parent); updater.updateElementIds(ameta, article, "article-id"); updater.updateElementExtLinks(ameta, article); updater.updateElementContentLinks(ameta, article); // content links updater.updateElementAuthors(ameta, article); // contributors updater.updateProvider(ameta, article); updater.updateElementPubdate(ameta, article); // pubdate updater.updateWithKwdGroups(ameta, article); // keywords updater.updateElementPages(ameta, article, EXT_HIERARCHY_JOURNAL); articleUpdater.updateArticleRefs(reflist, article); return article; }
@Override public List<YExportable> read(Reader reader, Object... hints) throws TransformationException { configureGenerator(); return super.read(reader, hints); }
public NlmToYTransformer() { this.y = new YObjects("[unknown2]"); this.factory = new EudmlYElementFactory(HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL); this.updater = new UpdateElement(y); this.articleUpdater = new UpdateArticle(y); this.bookProcessor = new NlmBookProcessor(y, factory, updater, articleUpdater); }