Search in sources :

Example 1 with CrossRef

use of org.jabref.logic.importer.fetcher.CrossRef in project jabref by JabRef.

the class WebFetchers method getIdBasedFetchers.

public static List<IdBasedFetcher> getIdBasedFetchers(ImportFormatPreferences importFormatPreferences) {
    ArrayList<IdBasedFetcher> list = new ArrayList<>();
    list.add(new ArXiv(importFormatPreferences));
    list.add(new AstrophysicsDataSystem(importFormatPreferences));
    list.add(new IsbnFetcher(importFormatPreferences));
    list.add(new DiVA(importFormatPreferences));
    list.add(new DoiFetcher(importFormatPreferences));
    list.add(new MedlineFetcher());
    list.add(new TitleFetcher(importFormatPreferences));
    list.add(new MathSciNet(importFormatPreferences));
    list.add(new CrossRef());
    list.add(new LibraryOfCongress());
    list.sort(Comparator.comparing(WebFetcher::getName));
    return list;
}
Also used : DoiFetcher(org.jabref.logic.importer.fetcher.DoiFetcher) MedlineFetcher(org.jabref.logic.importer.fetcher.MedlineFetcher) ArrayList(java.util.ArrayList) AstrophysicsDataSystem(org.jabref.logic.importer.fetcher.AstrophysicsDataSystem) LibraryOfCongress(org.jabref.logic.importer.fetcher.LibraryOfCongress) DiVA(org.jabref.logic.importer.fetcher.DiVA) IsbnFetcher(org.jabref.logic.importer.fetcher.IsbnFetcher) MathSciNet(org.jabref.logic.importer.fetcher.MathSciNet) CrossRef(org.jabref.logic.importer.fetcher.CrossRef) TitleFetcher(org.jabref.logic.importer.fetcher.TitleFetcher) ArXiv(org.jabref.logic.importer.fetcher.ArXiv)

Example 2 with CrossRef

use of org.jabref.logic.importer.fetcher.CrossRef in project jabref by JabRef.

the class WebFetchers method getIdFetchers.

public static List<IdFetcher> getIdFetchers(ImportFormatPreferences importFormatPreferences) {
    ArrayList<IdFetcher> list = new ArrayList<>();
    list.add(new CrossRef());
    list.add(new ArXiv(importFormatPreferences));
    list.sort(Comparator.comparing(WebFetcher::getName));
    return list;
}
Also used : ArrayList(java.util.ArrayList) CrossRef(org.jabref.logic.importer.fetcher.CrossRef) ArXiv(org.jabref.logic.importer.fetcher.ArXiv)

Example 3 with CrossRef

use of org.jabref.logic.importer.fetcher.CrossRef in project jabref by JabRef.

the class WebFetchers method getSearchBasedFetchers.

public static List<SearchBasedFetcher> getSearchBasedFetchers(ImportFormatPreferences importFormatPreferences) {
    ArrayList<SearchBasedFetcher> list = new ArrayList<>();
    list.add(new ArXiv(importFormatPreferences));
    list.add(new GvkFetcher());
    list.add(new MedlineFetcher());
    list.add(new AstrophysicsDataSystem(importFormatPreferences));
    list.add(new MathSciNet(importFormatPreferences));
    list.add(new zbMATH(importFormatPreferences));
    list.add(new GoogleScholar(importFormatPreferences));
    list.add(new DBLPFetcher(importFormatPreferences));
    list.add(new CrossRef());
    list.sort(Comparator.comparing(WebFetcher::getName));
    return list;
}
Also used : MedlineFetcher(org.jabref.logic.importer.fetcher.MedlineFetcher) GoogleScholar(org.jabref.logic.importer.fetcher.GoogleScholar) MathSciNet(org.jabref.logic.importer.fetcher.MathSciNet) ArrayList(java.util.ArrayList) org.jabref.logic.importer.fetcher.zbMATH(org.jabref.logic.importer.fetcher.zbMATH) DBLPFetcher(org.jabref.logic.importer.fetcher.DBLPFetcher) CrossRef(org.jabref.logic.importer.fetcher.CrossRef) AstrophysicsDataSystem(org.jabref.logic.importer.fetcher.AstrophysicsDataSystem) ArXiv(org.jabref.logic.importer.fetcher.ArXiv) GvkFetcher(org.jabref.logic.importer.fetcher.GvkFetcher)

Example 4 with CrossRef

use of org.jabref.logic.importer.fetcher.CrossRef in project jabref by JabRef.

the class WebFetchers method getEntryBasedFetchers.

public static List<EntryBasedFetcher> getEntryBasedFetchers(ImportFormatPreferences importFormatPreferences) {
    ArrayList<EntryBasedFetcher> list = new ArrayList<>();
    list.add(new AstrophysicsDataSystem(importFormatPreferences));
    list.add(new DoiFetcher(importFormatPreferences));
    list.add(new MathSciNet(importFormatPreferences));
    list.add(new CrossRef());
    list.sort(Comparator.comparing(WebFetcher::getName));
    return list;
}
Also used : DoiFetcher(org.jabref.logic.importer.fetcher.DoiFetcher) MathSciNet(org.jabref.logic.importer.fetcher.MathSciNet) ArrayList(java.util.ArrayList) CrossRef(org.jabref.logic.importer.fetcher.CrossRef) AstrophysicsDataSystem(org.jabref.logic.importer.fetcher.AstrophysicsDataSystem)

Example 5 with CrossRef

use of org.jabref.logic.importer.fetcher.CrossRef in project jabref by JabRef.

the class CrossrefFetcherEvaluator method main.

public static void main(String[] args) throws IOException, InterruptedException {
    Globals.prefs = JabRefPreferences.getInstance();
    try (FileReader reader = new FileReader(args[0])) {
        BibtexParser parser = new BibtexParser(Globals.prefs.getImportFormatPreferences());
        ParserResult result = parser.parse(reader);
        BibDatabase db = result.getDatabase();
        List<BibEntry> entries = db.getEntries();
        AtomicInteger dois = new AtomicInteger();
        AtomicInteger doiFound = new AtomicInteger();
        AtomicInteger doiNew = new AtomicInteger();
        AtomicInteger doiIdentical = new AtomicInteger();
        int total = entries.size();
        CountDownLatch countDownLatch = new CountDownLatch(total);
        ExecutorService executorService = Executors.newFixedThreadPool(5);
        for (BibEntry entry : entries) {
            executorService.execute(new Runnable() {

                @Override
                public void run() {
                    Optional<DOI> origDOI = entry.getField(FieldName.DOI).flatMap(DOI::parse);
                    if (origDOI.isPresent()) {
                        dois.incrementAndGet();
                        try {
                            Optional<DOI> crossrefDOI = new CrossRef().findIdentifier(entry);
                            if (crossrefDOI.isPresent()) {
                                doiFound.incrementAndGet();
                                if (origDOI.get().getDOI().equalsIgnoreCase(crossrefDOI.get().getDOI())) {
                                    doiIdentical.incrementAndGet();
                                } else {
                                    System.out.println("DOI not identical for : " + entry);
                                }
                            } else {
                                System.out.println("DOI not found for: " + entry);
                            }
                        } catch (FetcherException e) {
                            e.printStackTrace();
                        }
                    } else {
                        try {
                            Optional<DOI> crossrefDOI = new CrossRef().findIdentifier(entry);
                            if (crossrefDOI.isPresent()) {
                                System.out.println("New DOI found for: " + entry);
                                doiNew.incrementAndGet();
                            }
                        } catch (FetcherException e) {
                            e.printStackTrace();
                        }
                    }
                    countDownLatch.countDown();
                }
            });
        }
        countDownLatch.await();
        System.out.println("---------------------------------");
        System.out.println("Total DB size: " + total);
        System.out.println("Total DOIs: " + dois);
        System.out.println("DOIs found: " + doiFound);
        System.out.println("DOIs identical: " + doiIdentical);
        System.out.println("New DOIs found: " + doiNew);
        executorService.shutdown();
    }
}
Also used : BibEntry(org.jabref.model.entry.BibEntry) Optional(java.util.Optional) BibtexParser(org.jabref.logic.importer.fileformat.BibtexParser) CountDownLatch(java.util.concurrent.CountDownLatch) ParserResult(org.jabref.logic.importer.ParserResult) FetcherException(org.jabref.logic.importer.FetcherException) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ExecutorService(java.util.concurrent.ExecutorService) FileReader(java.io.FileReader) CrossRef(org.jabref.logic.importer.fetcher.CrossRef) BibDatabase(org.jabref.model.database.BibDatabase)

Aggregations

CrossRef (org.jabref.logic.importer.fetcher.CrossRef)5 ArrayList (java.util.ArrayList)4 ArXiv (org.jabref.logic.importer.fetcher.ArXiv)3 AstrophysicsDataSystem (org.jabref.logic.importer.fetcher.AstrophysicsDataSystem)3 MathSciNet (org.jabref.logic.importer.fetcher.MathSciNet)3 DoiFetcher (org.jabref.logic.importer.fetcher.DoiFetcher)2 MedlineFetcher (org.jabref.logic.importer.fetcher.MedlineFetcher)2 FileReader (java.io.FileReader)1 Optional (java.util.Optional)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ExecutorService (java.util.concurrent.ExecutorService)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 FetcherException (org.jabref.logic.importer.FetcherException)1 ParserResult (org.jabref.logic.importer.ParserResult)1 DBLPFetcher (org.jabref.logic.importer.fetcher.DBLPFetcher)1 DiVA (org.jabref.logic.importer.fetcher.DiVA)1 GoogleScholar (org.jabref.logic.importer.fetcher.GoogleScholar)1 GvkFetcher (org.jabref.logic.importer.fetcher.GvkFetcher)1 IsbnFetcher (org.jabref.logic.importer.fetcher.IsbnFetcher)1 LibraryOfCongress (org.jabref.logic.importer.fetcher.LibraryOfCongress)1