Search in sources :

Example 1 with Fetcher

use of org.edamontology.pubfetcher.Fetcher in project edammap by edamontology.

the class UtilMain method run.

private static void run(UtilArgs args, Version version) throws IOException, ParseException, ReflectiveOperationException {
    List<PublicationIds> publicationIds = null;
    List<String> webpageUrls = null;
    List<String> docUrls = null;
    if (args.pubQuery != null)
        publicationIds = pubQuery(args.pubQuery, args.queryType, args.fetcherArgs);
    if (args.webQuery != null)
        webpageUrls = webQuery(args.webQuery, args.queryType, args.fetcherArgs);
    if (args.docQuery != null)
        docUrls = docQuery(args.docQuery, args.queryType, args.fetcherArgs);
    if (args.allQuery != null) {
        if (publicationIds == null)
            publicationIds = pubQuery(args.allQuery, args.queryType, args.fetcherArgs);
        else
            publicationIds.addAll(pubQuery(args.allQuery, args.queryType, args.fetcherArgs));
        if (webpageUrls == null)
            webpageUrls = webQuery(args.allQuery, args.queryType, args.fetcherArgs);
        else
            webpageUrls.addAll(webQuery(args.allQuery, args.queryType, args.fetcherArgs));
        if (docUrls == null)
            docUrls = docQuery(args.allQuery, args.queryType, args.fetcherArgs);
        else
            docUrls.addAll(docQuery(args.allQuery, args.queryType, args.fetcherArgs));
    }
    FetcherUtil.run(args.fetcherUtilArgs, new Fetcher(), args.fetcherArgs, publicationIds, webpageUrls, docUrls, version);
    Util.run(args, version);
}
Also used : PublicationIds(org.edamontology.pubfetcher.PublicationIds) Fetcher(org.edamontology.pubfetcher.Fetcher)

Example 2 with Fetcher

use of org.edamontology.pubfetcher.Fetcher in project edammap by edamontology.

the class PubMedApps method meshQuery.

private static void meshQuery(FetcherArgs fetcherArgs) throws IOException, ParseException, URISyntaxException {
    String meshQuery = new URI("https", "eutils.ncbi.nlm.nih.gov", "/entrez/eutils/esearch.fcgi", "db=pubmed&term=" + MESH_QUERY + "&retmax=1000000", null).toASCIIString();
    Set<String> pmids = new LinkedHashSet<>();
    Document doc = new Fetcher().getDoc(meshQuery, null, fetcherArgs);
    if (doc != null) {
        for (Element id : doc.getElementsByTag("Id")) {
            pmids.add(id.text());
        }
    }
    for (String pmid : pmids) {
        System.out.println(pmid + "\t\t");
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Element(org.jsoup.nodes.Element) Fetcher(org.edamontology.pubfetcher.Fetcher) Document(org.jsoup.nodes.Document) URI(java.net.URI)

Aggregations

Fetcher (org.edamontology.pubfetcher.Fetcher)2 URI (java.net.URI)1 LinkedHashSet (java.util.LinkedHashSet)1 PublicationIds (org.edamontology.pubfetcher.PublicationIds)1 Document (org.jsoup.nodes.Document)1 Element (org.jsoup.nodes.Element)1