本文整理汇总了Java中org.jbibtex.BibTeXEntry类的典型用法代码示例。如果您正苦于以下问题:Java BibTeXEntry类的具体用法?Java BibTeXEntry怎么用?Java BibTeXEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BibTeXEntry类属于org.jbibtex包,在下文中一共展示了BibTeXEntry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: downloadAllPapers
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
/**
*
* @throws IOException
* @throws ParseException
* @throws InvalidPaperIdException
*/
public void downloadAllPapers() throws IOException, ParseException, InvalidPaperIdException {
System.out.printf(
"\nDownloading %d papers from %s respository to %s\n",
getEntriesCollection().size(), repository, downloadDir);
System.out.printf("Origin BibTeX file: %s\n\n", bibFileName);
int i = 0;
for (BibTeXEntry bibEntry : getEntriesCollection()) {
i++;
Paper paper = repository.getPaperInstance(this, bibEntry);
paper.setOrderInsideBibTexFile(i);
try {
System.out.println(paper);
paper.downloadAndIfSuccessfulSetLocalFileNameAndUrl();
} catch (PaperNotAvailableForDownloadException ex) {
System.out.println("Paper " + paper.getTitle() + ". " + ex.getLocalizedMessage());
}
}
this.saveChangesInBibTexFile();
}
开发者ID:manoelcampos,项目名称:BibTeXPaperDownloader,代码行数:26,代码来源:BibTexPapersDownloader.java
示例2: updateDocument
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
private void updateDocument(Document document, BibTeXEntry entry) {
if (document.getMonth() != null && !document.getMonth().isEmpty()) {
entry.addField(KEY_MONTH, new StringValue(document.getMonth(), Style.QUOTED));
}
if (document.getAbstract() != null && !document.getAbstract().isEmpty()) {
entry.addField(KEY_ABSTRACT, new StringValue(document.getAbstract(), Style.BRACED));
}
if (document.getCites() > 0) {
entry.addField(KEY_CITES, new StringValue(Integer.toString(document.getCites()), Style.BRACED));
}
if (document.getFile() != null && !document.getFile().isEmpty()) {
entry.addField(KEY_FILE, new StringValue(document.getFile(), Style.BRACED));
}
if (!document.getAuthors().isEmpty()) {
entry.addField(KEY_AUTHOR, new StringValue(document.getUnparsedAuthors(), Style.BRACED));
}
if (!document.getTaxonomy().getDimensions().isEmpty()) {
entry.addField(KEY_CLASSES,
new StringValue(serializeTaxonomy(document.getTaxonomy().getDimensions()), Style.BRACED));
}
}
开发者ID:sebastiangoetz,项目名称:slr-toolkit,代码行数:27,代码来源:BibtexResourceImpl.java
示例3: main
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
/**
* Helper tool to convert bibtex to {@link Reference} annotations. Reads
* from stdin, writes to stdout.
*
* @param args
* not used
* @throws IOException
* @throws ParseException
*/
public static void main(String[] args) throws IOException, ParseException {
System.out.println("Enter bibtex record(s), followed by ctrl-d: ");
final Reader reader = new InputStreamReader(System.in);
final BibTeXParser parser = new BibTeXParser();
final BibTeXDatabase database = parser.parse(reader);
System.out.println();
for (final BibTeXEntry entry : database.getEntries().values()) {
final Reference r = MockReference.makeReference(entry);
System.out.println(StandardFormatters.REFERENCE_ANNOTATION.format(r));
}
}
开发者ID:openimaj,项目名称:openimaj,代码行数:25,代码来源:BibtexToReference.java
示例4: getBibTeX
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
private String getBibTeX(KnownColormap colormap)
{
List<String> entries = Lists.newArrayList();
for (String ref : colormap.getReferences())
{
BibTeXEntry entry = database.resolveEntry(new Key(ref));
if (entry != null)
{
entries.add(getField(entry, BibTeXEntry.KEY_TITLE));
entries.add(getField(entry, BibTeXEntry.KEY_AUTHOR));
entries.add(getField(entry, BibTeXEntry.KEY_YEAR));
entries.add(getField(entry, BibTeXEntry.KEY_HOWPUBLISHED));
entries.add("");
}
else
{
logger.warn("Invalid BibTeX reference " + ref);
}
}
String refs = Joiner.on("<br/>").skipNulls().join(entries);
return refs;
}
开发者ID:igd-iva,项目名称:colormap-explorer,代码行数:24,代码来源:ConfigPanel.java
示例5: bibEntryToCSLItemData
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
/**
* Converts the {@link BibEntry} into {@link CSLItemData}.
*/
private static CSLItemData bibEntryToCSLItemData(BibEntry bibEntry) {
String citeKey = bibEntry.getCiteKeyOptional().orElse("");
BibTeXEntry bibTeXEntry = new BibTeXEntry(new Key(bibEntry.getType()), new Key(citeKey));
// Not every field is already generated into latex free fields
HTMLChars latexToHtmlConverter = new HTMLChars();
RemoveNewlinesFormatter removeNewlinesFormatter = new RemoveNewlinesFormatter();
for (String key : bibEntry.getFieldMap().keySet()) {
bibEntry.getField(key)
.map(removeNewlinesFormatter::format)
.map(latexToHtmlConverter::format)
.ifPresent(value -> bibTeXEntry.addField(new Key(key), new DigitStringValue(value)));
}
return BIBTEX_CONVERTER.toItemData(bibTeXEntry);
}
开发者ID:JabRef,项目名称:jabref,代码行数:19,代码来源:CSLAdapter.java
示例6: singleEntryWithDateRange
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
/**
* Tests if a bibliography entry with a date range can be converted
* @throws Exception if something goes wrong
*/
@Test
public void singleEntryWithDateRange() throws Exception {
BibTeXDatabase db = loadUnixDatabase();
BibTeXEntry e = db.resolveEntry(new Key("Lycklama:1978:UTSb"));
BibTeXConverter conv = new BibTeXConverter();
CSLItemData cid = conv.toItemData(e);
assertEquals("Lycklama:1978:UTSb", cid.getId());
assertEquals(CSLType.ARTICLE_JOURNAL, cid.getType());
assertEquals(1, cid.getAuthor().length);
assertEquals("Lycklama", cid.getAuthor()[0].getFamily());
assertEquals("H.", cid.getAuthor()[0].getGiven());
assertEquals("The Bell System Technical Journal", cid.getCollectionTitle());
assertEquals("The Bell System Technical Journal", cid.getContainerTitle());
assertEquals("57", cid.getVolume());
assertEquals("6", cid.getIssue());
assertEquals("6", cid.getNumber());
assertEquals("15", cid.getNumberOfPages());
assertEquals("2087-2101", cid.getPage());
assertEquals("2087", cid.getPageFirst());
assertEquals("UNIX Time-Sharing System: UNIX on a Microprocessor", cid.getTitle());
assertArrayEquals(new int[][] { new int[] { 1978, 7 }, new int[] { 1978, 8 } }, cid.getIssued().getDateParts());
}
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:29,代码来源:BibTeXConverterTest.java
示例7: putResult
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
public static void putResult(ScrapStatus status, String identifier, BibTeXEntry entry, List<List<BibTeXEntry>> results, File outputDirectory) {
System.out.println(" " + status.name());
System.out.print("\n");
results.get(status.ordinal()).add(entry);
// write BibTeX file
final File statusDirectory = status.getStatusDirectory(outputDirectory);
final File bibout = new File(
statusDirectory.getAbsolutePath(),
identifier + ".bib"
);
System.out.println(" writing BibTeX file to: " + bibout + "...");
writeBibTeXEntry(entry, bibout);
}
开发者ID:limstepf,项目名称:pdfdbscrap,代码行数:15,代码来源:Main.java
示例8: writeBibTexEntries
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
public static void writeBibTexEntries(ScrapStatus status, List<BibTeXEntry> entries, File file, File directory) {
final String filename = getBibTeXFilename(file, status);
final File dbfile = new File(
directory.getAbsolutePath(),
filename
);
System.out.println(String.format(
"writing %s BibTeX database (%d entries) to: %s...",
status.name(),
entries.size(),
dbfile
));
writeBibTeXEntries(entries, dbfile);
}
开发者ID:limstepf,项目名称:pdfdbscrap,代码行数:15,代码来源:Main.java
示例9: writeBibTeXEntries
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
public static void writeBibTeXEntries(List<BibTeXEntry> entries, File file) {
final BibTeXDatabase database = new BibTeXDatabase();
for (BibTeXEntry entry : entries) {
database.addObject(entry);
}
writeBibTeXDatabase(database, file);
}
开发者ID:limstepf,项目名称:pdfdbscrap,代码行数:8,代码来源:Main.java
示例10: Paper
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
public Paper(final PaperRepository sourceRepository,
final BibTexPapersDownloader bibtex,
final BibTeXEntry paperBibTeXEntry){
this.repository = sourceRepository;
this.bibTeXEntry = paperBibTeXEntry;
this.bibtex = bibtex;
}
开发者ID:manoelcampos,项目名称:BibTeXPaperDownloader,代码行数:8,代码来源:Paper.java
示例11: getPaperInstance
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
@Override
public Paper getPaperInstance(final BibTexPapersDownloader bibtex, final BibTeXEntry bibEntry) {
Paper paper = new Paper(this, bibtex, bibEntry);
paper.setId(bibEntry.getKey().toString());
paper.setTitle(bibEntry.getField(BibTeXEntry.KEY_TITLE).toUserString());
paper.setDoi(bibEntry.getField(BibTeXEntry.KEY_DOI).toUserString());
paper.setYear(Integer.parseInt(bibEntry.getField(BibTeXEntry.KEY_YEAR).toUserString()));
return paper;
}
开发者ID:manoelcampos,项目名称:BibTeXPaperDownloader,代码行数:10,代码来源:AbstractPaperRepository.java
示例12: getField
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
private String getField(BibTeXEntry entry, Key key)
{
Value field = entry.getField(key);
if (field == null)
return null;
String left = key.toString();
left = Character.toUpperCase(left.charAt(0)) + left.substring(1);
left = "<b>" + left + ":</b> ";
// remove capitalization-preserving brackets { }
String userString = field.toUserString();
if (userString.startsWith("{") && userString.endsWith("}"))
{
userString = userString.substring(1, userString.length() - 2);
}
userString = userString.replaceAll("\\\\\"\\{u\\}", "�"); // matches \"{u}
userString = userString.replaceAll("\\{\\\\\"u\\}", "�"); // matches {\"u}
userString = userString.replaceAll("\\\\\"\\{a\\}", "�"); // matches \"{a}
userString = userString.replaceAll("\\{\\\\\"a\\}", "�"); // matches {\"a}
userString = userString.replaceAll("\\\\\"\\{o\\}", "�"); // matches \"{o}
userString = userString.replaceAll("\\{\\\\\"o\\}", "�"); // matches {\"o}
return left + userString;
}
开发者ID:igd-iva,项目名称:colormap-explorer,代码行数:29,代码来源:ConfigPanel.java
示例13: toItemData
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
/**
* Converts the given database to a map of CSL citation items
* @param db the database
* @return a map consisting of citation keys and citation items
*/
public Map<String, CSLItemData> toItemData(BibTeXDatabase db) {
Map<String, CSLItemData> result = new HashMap<>();
for (Map.Entry<Key, BibTeXEntry> e : db.getEntries().entrySet()) {
result.put(e.getKey().getValue(), toItemData(e.getValue()));
}
return result;
}
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:13,代码来源:BibTeXConverter.java
示例14: singleEntry
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
/**
* Tests if a single bibliography entry can be converted
* @throws Exception if something goes wrong
*/
@Test
public void singleEntry() throws Exception {
BibTeXDatabase db = loadUnixDatabase();
BibTeXEntry e = db.resolveEntry(new Key("Ritchie:1974:UTS"));
BibTeXConverter conv = new BibTeXConverter();
CSLItemData cid = conv.toItemData(e);
assertEquals("Ritchie:1974:UTS", cid.getId());
assertEquals(CSLType.ARTICLE_JOURNAL, cid.getType());
assertEquals(2, cid.getAuthor().length);
assertEquals("Ritchie", cid.getAuthor()[0].getFamily());
assertEquals("Dennis W.", cid.getAuthor()[0].getGiven());
assertEquals("Thompson", cid.getAuthor()[1].getFamily());
assertEquals("Ken", cid.getAuthor()[1].getGiven());
assertEquals("Communications of the Association for Computing Machinery", cid.getCollectionTitle());
assertEquals("Communications of the Association for Computing Machinery", cid.getContainerTitle());
assertEquals("17", cid.getVolume());
assertEquals("7", cid.getIssue());
assertEquals("7", cid.getNumber());
assertEquals("11", cid.getNumberOfPages());
assertEquals("365-375", cid.getPage());
assertEquals("365", cid.getPageFirst());
assertEquals("The UNIX Time-Sharing System", cid.getTitle());
assertArrayEquals(new int[][] { new int[] { 1974, 7 } }, cid.getIssued().getDateParts());
}
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:31,代码来源:BibTeXConverterTest.java
示例15: carriageReturnInTitle
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
/**
* Test if a BibTeX entry whose title contains a CR character (\r) can
* be converted correctly.
*/
@Test
public void carriageReturnInTitle() {
BibTeXEntry e = new BibTeXEntry(new Key("article"), new Key("a"));
e.addField(new Key("title"), new StringValue(
"syst\\`emes\r\ndiff\\'erentiels", StringValue.Style.QUOTED));
BibTeXConverter conv = new BibTeXConverter();
CSLItemData i = conv.toItemData(e);
assertEquals("systèmes différentiels", i.getTitle());
}
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:14,代码来源:BibTeXConverterTest.java
示例16: writeBibTeXEntry
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
public static void writeBibTeXEntry(BibTeXEntry entry, File file) {
writeBibTeXEntries(Arrays.asList(entry), file);
}
开发者ID:limstepf,项目名称:pdfdbscrap,代码行数:4,代码来源:Main.java
示例17: getUrl
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
public String getUrl() {
return bibTeXEntry.getField(BibTeXEntry.KEY_URL).toUserString();
}
开发者ID:manoelcampos,项目名称:BibTeXPaperDownloader,代码行数:4,代码来源:Paper.java
示例18: getEntriesCollection
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
private Collection<BibTeXEntry> getEntriesCollection() {
return database.getEntries().values();
}
开发者ID:manoelcampos,项目名称:BibTeXPaperDownloader,代码行数:4,代码来源:BibTexPapersDownloader.java
示例19: safeGetField
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
private String safeGetField(BibTeXEntry entry, Key key) {
if (entry.getField(key) != null) {
return entry.getField(key).toUserString();
}
return "";
}
开发者ID:sebastiangoetz,项目名称:slr-toolkit,代码行数:7,代码来源:BibtexResourceImpl.java
示例20: MockReference
import org.jbibtex.BibTeXEntry; //导入依赖的package包/类
/**
* Construct from a BibTeXEntry
* @param entry the BibTeXEntry
*/
public MockReference(BibTeXEntry entry) {
type = ReferenceType.getReferenceType(entry.getType().getValue());
Map<Key, Value> fields = entry.getFields();
for (Entry<Key, Value> e : fields.entrySet()) {
String ks = e.getKey().getValue();
Value v = e.getValue();
if (ks.equalsIgnoreCase("author"))
author = ((StringValue) v).getString().split(" and ");
else if (ks.equalsIgnoreCase("title"))
title = ((StringValue) v).getString();
else if (ks.equalsIgnoreCase("year"))
year = ((StringValue) v).getString();
else if (ks.equalsIgnoreCase("journal"))
journal = ((StringValue) v).getString();
else if (ks.equalsIgnoreCase("booktitle"))
booktitle = ((StringValue) v).getString();
else if (ks.equalsIgnoreCase("pages"))
pages = ((StringValue) v).getString().split(",|-|--");
else if (ks.equalsIgnoreCase("chapter"))
chapter = ((StringValue) v).getString();
else if (ks.equalsIgnoreCase("edition"))
edition = ((StringValue) v).getString();
else if (ks.equalsIgnoreCase("url"))
url = ((StringValue) v).getString();
else if (ks.equalsIgnoreCase("note"))
note = ((StringValue) v).getString();
else if (ks.equalsIgnoreCase("editor"))
editor = ((StringValue) v).getString().split(" and ");
else if (ks.equalsIgnoreCase("institution"))
institution = ((StringValue) v).getString();
else if (ks.equalsIgnoreCase("month"))
month = ((StringValue) v).getString();
else if (ks.equalsIgnoreCase("number"))
number = ((StringValue) v).getString();
else if (ks.equalsIgnoreCase("organization"))
organization = ((StringValue) v).getString();
else if (ks.equalsIgnoreCase("publisher"))
publisher = ((StringValue) v).getString();
else if (ks.equalsIgnoreCase("school"))
school = ((StringValue) v).getString();
else if (ks.equalsIgnoreCase("series"))
series = ((StringValue) v).getString();
else if (ks.equalsIgnoreCase("volume"))
volume = ((StringValue) v).getString();
else {
List<String> data = new ArrayList<String>();
data.addAll(Arrays.asList(customData));
if (v instanceof StringValue) {
data.add(ks);
data.add(((StringValue)v).getString());
}
customData = data.toArray(customData);
}
}
}
开发者ID:openimaj,项目名称:openimaj,代码行数:64,代码来源:MockReference.java
注:本文中的org.jbibtex.BibTeXEntry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论