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

Ray Fergerson ray.fergerson at stanford.edu
Thu Oct 24 14:55:54 PDT 2013


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
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
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] On Behalf Of
Celeste, Michael
Sent: Friday, October 18, 2013 3:22 AM
To: 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/093192de/attachment-0001.html>


More information about the bioontology-support mailing list