Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[bioontology-support] Java/Jena example 500 error

Celeste, Michael michael.celeste at pfizer.com
Thu Oct 24 15:10:06 PDT 2013


Here's an example of one from this url: http://bioportal.bioontology.org/ontologies/NDDF

Here's the link with the API key: http://data.bioontology.org/ontologies/NDDF/submissions/1/download?apikey=81ac8eba-12ca-4b94-a80f-82e4cfd2291a

Michael

From: Ray Fergerson [mailto:ray.fergerson at stanford.edu]
Sent: Thursday, October 24, 2013 6:09 PM
To: Celeste, Michael; support at bioontology.org
Cc: Manuel Salvadores
Subject: RE: [bioontology-support] Java/Jena example 500 error

Sorry but I am still a bit lost. What keys are you referring to that are associated with the ontology download links? Where do you see these links? Are they in some sample code that we provide?

Ray

From: Celeste, Michael [mailto:michael.celeste at pfizer.com]
Sent: Thursday, October 24, 2013 2:58 PM
To: Ray Fergerson; support at bioontology.org<mailto:support at bioontology.org>
Cc: Manuel Salvadores
Subject: RE: [bioontology-support] Java/Jena example 500 error

Yes, there are keys associated to the ontology download links. If I use one of those then I get data using the sample java programs.

Michael

From: Ray Fergerson [mailto:ray.fergerson at stanford.edu]
Sent: Thursday, October 24, 2013 5:56 PM
To: Celeste, Michael; support at bioontology.org<mailto:support at bioontology.org>
Cc: Manuel Salvadores
Subject: RE: [bioontology-support] Java/Jena example 500 error

Why do you say this? If you use someone else's api key does it work?

Ray

From: Celeste, Michael [mailto:michael.celeste at pfizer.com]
Sent: Thursday, October 24, 2013 2:51 PM
To: Ray Fergerson; support at bioontology.org<mailto:support at bioontology.org>
Cc: Manuel Salvadores
Subject: RE: [bioontology-support] Java/Jena example 500 error

Ok, thank you for your reply.

I actually think it's my API key that is the problem:  81ac8eba-12ca-4b94-a80f-82e4cfd2291a

Michael

From: Ray Fergerson [mailto:ray.fergerson at stanford.edu]
Sent: Thursday, October 24, 2013 5:47 PM
To: Celeste, Michael; support at bioontology.org<mailto:support at bioontology.org>
Cc: Manuel Salvadores
Subject: RE: [bioontology-support] Java/Jena example 500 error

Our expert on this is half-way around the world this week. He should be able to respond next week.

Ray

From: bioontology-support-bounces at lists.stanford.edu<mailto:bioontology-support-bounces at lists.stanford.edu> [mailto:bioontology-support-bounces at lists.stanford.edu] On Behalf Of Celeste, Michael
Sent: Friday, October 18, 2013 3:22 AM
To: support at bioontology.org<mailto:support at bioontology.org>
Subject: [bioontology-support] Java/Jena example 500 error

Hello,

I am trying to run the java file using Jena below after supplying my apikey but I keep getting an HTTP 500 error. I also tried adding a query parameter but get the same error.

Thanks,
Michael

package businessdevelopment;

import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.rdf.model.Literal;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP;

/**
* This is an example built on top of the Jena ARQ library.
* See: http://jena.sourceforge.net/ARQ/documentation.html
*/
public class JenaARQTest {

        private String service = null;
        private String apikey = null;

        public JenaARQTest(String service, String apikey) {
                this.service = service;
                this.apikey = apikey;
        }
        public ResultSet executeQuery(String queryString) throws Exception {
                 Query query = QueryFactory.create(queryString) ;

                 QueryEngineHTTP qexec = QueryExecutionFactory.createServiceRequest(this.service, query);
                 qexec.addParam("apikey", this.apikey);
                 //qexec.addParam("query", queryString);
                 ResultSet results = qexec.execSelect() ;
                 return results;

        }
        public static void main(String[] args) throws Exception {
                String sparqlService = "http://sparql.bioontology.org/sparql";
                String apikey = "81ac8eba-12ca-4b94-a80f-82e4cfd2291a";

                /*
                 * More query examples here:
                 * http://sparql.bioontology.org/examples
                 */
                String query = "PREFIX omv: <http://omv.ontoware.org/2005/05/ontology#<http://omv.ontoware.org/2005/05/ontology>> " +
                                           "SELECT ?ont ?name ?acr " +
                                           "WHERE { ?ont a omv:Ontology; " +
                                           "omv:acronym ?acr; " +
                                           "omv:name ?name . " +
                                           "}";
                try {
                JenaARQTest test = new JenaARQTest(sparqlService,apikey);
                ResultSet results = test.executeQuery(query);
                    for ( ; results.hasNext() ; ) {
                      QuerySolution soln = results.nextSolution() ;
                      RDFNode ontUri = soln.get("ont") ;
                      Literal name = soln.getLiteral("name") ;
                      Literal acr = soln.getLiteral("acr") ;
                      System.out.println(ontUri + " ---- " + name + " ---- " + acr);
                    }
                }
                catch(Exception e) {
                  System.out.println(e);
                }
        }
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/bioontology-support/attachments/20131024/788dd308/attachment-0001.html>


More information about the bioontology-support mailing list