【问题标题】:Accessing pubmed abstracts using Entrez Utilities Web Service使用 Entrez Utilities Web Service 访问已发布的摘要
【发布时间】:2013-12-06 18:04:40
【问题描述】:

我使用 Entrez Utilities Web Service library 从我的 Java 应用程序访问 pubmed 文章(使用 pubmed 标识符)。 Renaudpostgithub 上发布了如何使用此工具的完整工作示例。在大多数情况下一切正常,但最近我发现了一个导致库崩溃的 pubmed id。

我使用的代码如下所示:

public PubmedArticleType searchById(Integer id) throws RemoteException {
    EUtilsServiceStub.ESearchRequest req = new EUtilsServiceStub.ESearchRequest();
    req.setDb("pubmed");
    req.setTerm(id+"[uid]");
    req.setEmail("gmail@gmail.com");
    req.setUsehistory("y");
    EUtilsServiceStub.ESearchResult res = service.run_eSearch(req);
    String webEnv = res.getWebEnv();
    String query_key = res.getQueryKey();

    EFetchPubmedServiceStub.EFetchRequest req2 = new EFetchPubmedServiceStub.EFetchRequest();
    req2.setWebEnv(webEnv);
    req2.setQuery_key(query_key);

    EFetchPubmedServiceStub.EFetchResult res2 = service2.run_eFetch(req2);
    for (int j = 0; j < res2.getPubmedArticleSet().getPubmedArticleSetChoice().length; j++) {

        PubmedArticleType art = res2.getPubmedArticleSet().getPubmedArticleSetChoice()[j].getPubmedArticle();
        if (art != null) {
            return art;
        }
    }
    return null;
}

当我使用 id = 22363258 调用此函数时,我得到的错误根本不包含任何信息:

org.apache.axis2.AxisFault
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub.fromOM(EFetchPubmedServiceStub.java)
    at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub.run_eFetch(EFetchPubmedServiceStub.java:189)
    at ch.epfl.bbp.uima.pubmed.PubmedSearch.searchById(PubmedSearch.java:130)
    at ch.epfl.bbp.uima.pubmed.PubmedSearchTest.testPubmedId(PubmedSearchTest.java:14)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.IllegalArgumentException
    at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$PubModel_type0$Factory.fromString(EFetchPubmedServiceStub.java:20118)
    at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$PubModel_type0$Factory.fromString(EFetchPubmedServiceStub.java:20129)
    at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$ArticleType$Factory.parse(EFetchPubmedServiceStub.java)
    at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$MedlineCitationType$Factory.parse(EFetchPubmedServiceStub.java:28780)
    at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$PubmedArticleType$Factory.parse(EFetchPubmedServiceStub.java:19147)
    at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$PubmedArticleSetChoiceE$Factory.parse(EFetchPubmedServiceStub.java)
    at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$PubmedArticleSet_type0$Factory.parse(EFetchPubmedServiceStub.java:56549)
    at gov.nih.nlm.ncbi.www.soap.eutils.EFetchPubmedServiceStub$EFetchResult$Factory.parse(EFetchPubmedServiceStub.java:50607)
    ... 27 more

所以,我有两个问题:

  • 是什么原因?我可以做些什么来解决它?
  • 是否有任何其他 java API 可以用来访问 pubmed 摘要?我知道我可以解析 html 页面,但我真的不想这样做,因为它带来的问题多于解决的问题......

【问题讨论】:

标签: java axis2 pubmed


【解决方案1】:

Here 是一个 RESTful API,允许从 pubmed db 中检索摘要和所有元信息。

检索我需要的所有数据的确切链接如下所示:http://www.ebi.ac.uk/europepmc/webservices/rest/search/resulttype=core&query=ext_id:22363258

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多