<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>There is currently no throttling in place, though we will add something in the near future.</div><div><br></div><div>Paul</div><div><br></div><div><br>On Feb 18, 2014, at 9:52 AM, Darren Weber <<a href="mailto:dlweber@stanford.edu">dlweber@stanford.edu</a>> wrote:<br><br></div><blockquote type="cite"><div>
  
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  
  
    <br>
    To evaluate the REST overload issue, you might try sleep, i.e.<br>
    <br>
<a class="moz-txt-link-freetext" href="http://docs.oracle.com/javase/tutorial/essential/concurrency/sleep.html">http://docs.oracle.com/javase/tutorial/essential/concurrency/sleep.html</a><br>
    <br>
<a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/3342651/how-can-i-delay-a-java-program-for-a-few-seconds">http://stackoverflow.com/questions/3342651/how-can-i-delay-a-java-program-for-a-few-seconds</a><br>
    <br>
    If you throttle the client in this way, the REST service may not
    kick back some of your requests.  Although I haven't worked on the
    details, there may be code in the REST service to throttle excessive
    requests from a single user.  (Paul, could you comment on this?)<br>
    <br>
    -- Darren<br>
    <br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 2/18/14, 3:45 AM, Leyla Jael García
      Castro wrote:<br>
    </div>
    <blockquote cite="mid:CACLxDV78OmQak=mXnsb=yyAYN1VwjEbSLTOh2uw21Ejwf-=Kcw@mail.gmail.com" type="cite">
      <div dir="ltr">Hi Darren, 
        <div><br>
        </div>
        <div>The problematic text, with the same algorithm, works fine
          in a Windows machine, but it returns an API key error message
          in Linux, also in Mac. The Linux and Mac machines are both
          faster than the Windows one, so it could be related with the
          number of requests per second to the annotator with the same
          API key. As it work in Windows, I think the problem is not the
          API key but something else. Is it possible that this API key
          error is reported when some other error has been thrown? Is it
          possible to get the full error somehow? </div>
        <div><br>
        </div>
        <div>Regards,</div>
        <div>lj</div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Tue, Feb 18, 2014 at 12:15 AM,
          Darren Weber <span dir="ltr"><<a moz-do-not-send="true" href="mailto:dlweber@stanford.edu" target="_blank">dlweber@stanford.edu</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000"> <br>
              Hi Leyla,<br>
              <br>
              If you have a specific example text that is always
              failing, we can try to replicate it, using your parameters
              (other than API key).  If it's not easily replicated, it's
              not likely we can resolve it.  Have you tried the
              problematic text in the web UI?<span class="HOEnZb"><font color="#888888"><br>
                  <br>
                  -- Darren</font></span>
              <div>
                <div class="h5"><br>
                  <br>
                  <br>
                  <div>On 2/17/14, 12:00 PM, Leyla Jael García Castro
                    wrote:<br>
                  </div>
                  <blockquote type="cite">
                    <div dir="ltr">Hi Darren,
                      <div><br>
                      </div>
                      <div>Yes, my API key works fine with the URI <a moz-do-not-send="true" href="http://data.bioontology.org/ontologies?apikey=" target="_blank">http://data.bioontology.org/ontologies?apikey=</a>{YOUR_API_KEY},

                        I get a JSON file with a lot of information
                        (administeredBy, acronym, name, summaryOnly,
                        etc.).<br>
                      </div>
                      <div><br>
                      </div>
                      <div>The code that I sent before is used in a
                        loop. We have a text with several paragraphs,
                        all of the are sent to the annotator one by one.
                        With all the others paragraphs it works fine. I
                        have checked some other texts, and it seems to
                        fail always with one of the last paragraphs. It
                        makes me think that the error response is wrong,
                        the API key is working with other paragraphs,
                        there must be something else going on.</div>
                      <div><br>
                      </div>
                      <div>Thanks for your help,</div>
                      <div>lj</div>
                      <div class="gmail_extra"><br>
                        <div class="gmail_quote">On Mon, Feb 17, 2014 at
                          4:19 PM, Darren Weber <span dir="ltr"><<a moz-do-not-send="true" href="mailto:dlweber@stanford.edu" target="_blank">dlweber@stanford.edu</a>></span>
                          wrote:<br>
                          <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                            <div bgcolor="#FFFFFF" text="#000000">
                              <div> <br>
                                Hi Leyla,<br>
                                <br>
                                Can you login to the web site with that
                                API key?  Does it work on this URI<br>
                                <br>
                                <a moz-do-not-send="true" href="http://data.bioontology.org/ontologies?apikey=" target="_blank">http://data.bioontology.org/ontologies?apikey=</a>{YOUR_API_KEY}<br>
                                <br>
                                <br>
                                -- Darren<br>
                                <br>
                                <br>
                                <br>
                              </div>
                              <div>
                                <div>
                                  <div>On 2/16/14, 1:07 PM, Leyla Jael
                                    García Castro wrote:<br>
                                  </div>
                                  <blockquote type="cite">
                                    <div dir="ltr">Hi Paul, 
                                      <div><br>
                                      </div>
                                      <div>We just realized that the
                                        parameter "stopWords" should be
                                        "stop_words", but that was not
                                        the problem. Nor is the number
                                        of requests that we do. Just
                                        tried to send all the paragraphs
                                        at once and it did not work,same
                                        error about the API key. Would
                                        it help if I send you the file
                                        we are annotating? Is RDF/XML.</div>
                                      <div><br>
                                      </div>
                                      <div>Regards,</div>
                                      <div>lj</div>
                                    </div>
                                    <div class="gmail_extra"><br>
                                      <br>
                                      <div class="gmail_quote">On Sat,
                                        Feb 15, 2014 at 9:55 PM, Leyla
                                        Jael García Castro <span dir="ltr"><<a moz-do-not-send="true" href="mailto:leylajael@gmail.com" target="_blank">leylajael@gmail.com</a>></span>
                                        wrote:<br>
                                        <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                                          <div dir="ltr">Hi Paul, 
                                            <div><br>
                                            </div>
                                            <div>Here is the excerpt of
                                              the code that is calling
                                              the annotation. btw, I
                                              have been playing around
                                              with the text that is
                                              giving us troubles, for
                                              instance I moved it above
                                              other paragraphs that are
                                              correctly annotated. Then,
                                              it was another paragraph
                                              the one that gave us the
                                              error. Is there maybe a
                                              maximum API calls per
                                              second? Could be that why
                                              at some point the API key
                                              seems to be not valid any
                                              more? I tried to look for
                                              hidden chars but there was
                                              nothing special, just
                                              regular text with tabs and
                                              spaces.</div>
                                            <div>We also tried to
                                              replace the "+" added by
                                              the encoder instead of the
                                              spaces to "%20", and to
                                              spaces again, but  we got
                                              the same API key problem.</div>
                                            <div><br>
                                            </div>
                                            <div>String
                                              ontologiesToAnnotate =
"MDDB,MEDLINEPLUS,suicideo,MO,NCIT,NDDF,OMIM,FMA,ICD10,PW,PO,GO,MEDDRA,CHEBI,NDFRT,OBI,SNOMEDCT,SYMP,MESH";<br>
                                            </div>
                                            <div>String annotatorURL = "<a moz-do-not-send="true" href="http://data.bioontology.org/annotator" target="_blank">http://data.bioontology.org/annotator</a>";</div>
                                            <div>String stopwords =
                                              "a,able,about,above,abst,accordance,according,accordingly,across,act";
                                              //and some others</div>
                                            <div><br>
                                            </div>
                                            <div>
                                              <div>        try {        <span style="white-space:pre-wrap"> </span></div>
                                              <div>        <span style="white-space:pre-wrap">
                                                </span>paragraph =
                                                paragraph.replaceAll("[^\\p{Alpha}\\p{Z}\\p{P}\\p{N}]",
                                                "_");        <span style="white-space:pre-wrap">
                                                </span></div>
                                              <div>        <span style="white-space:pre-wrap">
                                                </span>paragraph =
                                                URLEncoder.encode(paragraph,
Publication2RDF.UTF_ENCODING);</div>
                                              <div>        <span style="white-space:pre-wrap">
                                                </span>System.out.println("TO


                                                ANNOT: " + urlContext +
                                                "\n" + paragraph);</div>
                                              <div>           
                                                HttpClient client = new
                                                HttpClient();</div>
                                              <div>           
                                                client.getParams().setParameter(HttpMethodParams.USER_AGENT,
                                                "Annotator Client
                                                Scientific
                                                Publications");  //Set
                                                this string for your
                                                application </div>
                                              <div>            </div>
                                              <div>           
                                                PostMethod method = new
PostMethod(annotatorURL);</div>
                                              <div>            </div>
                                              <div>            //
                                                Configure the form
                                                parameters</div>
                                              <div>           
                                                method.addParameter("stopWords",stopWords);</div>
                                              <div>           
                                                method.addParameter("minimum_match_length","3");</div>
                                              <div>           
                                                method.addParameter("ontologies",
                                                ontologiesToAnnotate);  
                                                         </div>
                                              <div>           
                                                method.addParameter("text",
                                                paragraph);</div>
                                              <div>           
                                                method.addParameter("format",
                                                "xml"); //Options are
                                                'text', 'xml',
                                                'tabDelimited'   </div>
                                              <div>           
                                                method.addParameter("apikey",
                                                Config.getNCBOAPIKey());</div>
                                              <div><br>
                                              </div>
                                              <div>            //
                                                Execute the POST method</div>
                                              <div>            int
                                                statusCode =
                                                client.executeMethod(method);</div>
                                              <div>            </div>
                                              <div>            if(
                                                statusCode != -1 ) {</div>
                                              <div>                try {</div>
                                            </div>
                                            <div><span style="white-space:pre-wrap">
                                              </span>              
                                               InputStream temporal  =
                                              method.getResponseBodyAsStream();<br>
                                            </div>
                                            <div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>              
                                                 //testing, we want to
                                                see the response and if
                                                it is ok we want to
                                                process it so we need it
                                                twice<span style="white-space:pre-wrap">
                                                </span>                </div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>              
                                                 ByteArrayOutputStream
                                                baos = new
                                                ByteArrayOutputStream();</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>              
                                                 byte[] buf = new
                                                byte[1024];</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>              
                                                 int n = 0;</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>              
                                                 while ((n =
                                                temporal.read(buf))
                                                >= 0) {</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>                
                                                   baos.write(buf, 0,
                                                n);</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>                }</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>              
                                                 byte[] content =
                                                baos.toByteArray();</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>              
                                                 InputStream
                                                annotatedParagraph = new
ByteArrayInputStream(content);<span style="white-space:pre-wrap"> </span>  <span style="white-space:pre-wrap"> </span>                              </div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>              
                                                 if (annotatedParagraph
                                                != null) {<span style="white-space:pre-wrap">
                                                </span>                <span style="white-space:pre-wrap"> </span></div>
                                              <div> <span style="white-space:pre-wrap">
                                                </span>                <span style="white-space:pre-wrap"> </span>//Reader reader = new
                                                StringReader(annotatedParagraph);</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span>JAXBContext jc =
JAXBContext.newInstance("ws.biotea.ld2rdf.util.ncbo.annotator.jaxb.newgenerated");</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span>Unmarshaller unmarshaller =
                                                jc.createUnmarshaller();</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span>AnnotationCollection xml;</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span>Object obj = new Object();</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span>try {<span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span></div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span>obj =
                                                unmarshaller.unmarshal(annotatedParagraph);</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span>if (obj instanceof Empty) {</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span>return true; //no annotations were
                                                found but everything was
                                                ok with the response</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span>}</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span>xml = (AnnotationCollection)obj;
                                                //otherwise,
                                                AnnotationCollection
                                                should be the
                                                unmarshalled object</div>
                                              <div> <span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span>} catch (Exception e) {</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span>InputStream temp = new
                                                ByteArrayInputStream(content);</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span>String line;</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>    <span style="white-space:pre-wrap">
                                                </span>              
                                                 BufferedReader reader =
                                                new BufferedReader(new
                                                InputStreamReader(temp,
                                                "UTF-8"));</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>    <span style="white-space:pre-wrap">
                                                </span>              
                                                 while ((line =
                                                reader.readLine()) !=
                                                null) {</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>    <span style="white-space:pre-wrap">
                                                </span>                <span style="white-space:pre-wrap"> </span>System.out.println(line);</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>    <span style="white-space:pre-wrap">
                                                </span>                }</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>    <span style="white-space:pre-wrap">
                                                </span>              
                                                 reader.close();</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>    <span style="white-space:pre-wrap">
                                                </span>              
                                                 System.out.println(paragraph);</div>
                                              <div>            <span style="white-space:pre-wrap">
                                                </span>logger.fatal("-
                                                FATAL DTD ERROR
                                                ANNOTATOR - NCBO
                                                annotations for " +
                                                this.documentId + "(" +
                                                urlContext + ") cannot
                                                be unmarshalled: " +
                                                e.getMessage() + " -
                                                class: " +
                                                obj.getClass());</div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span>return false;<span style="white-space:pre-wrap">
                                                </span></div>
                                              <div><span style="white-space:pre-wrap">
                                                </span>            <span style="white-space:pre-wrap"> </span>}</div>
                                            </div>
                                            <div>[...]</div>
                                            <div><br>
                                            </div>
                                            <div>then I just start
                                              processing the response.
                                              If you need, I can send
                                              you the actual java class,
                                              but I am afraid that it
                                              depends on some other
                                              libraries, jaxb, etc. so
                                              unless I share you the
                                              whole project it would not
                                              work. Please let me know
                                              should you need any
                                              further information.</div>
                                            <div><br>
                                            </div>
                                            <div>Regards,</div>
                                            <div>lj</div>
                                            <div><br>
                                            </div>
                                          </div>
                                          <div>
                                            <div>
                                              <div class="gmail_extra"><br>
                                                <br>
                                                <div class="gmail_quote">On
                                                  Fri, Feb 14, 2014 at
                                                  11:11 PM, Paul R
                                                  Alexander <span dir="ltr"><<a moz-do-not-send="true" href="mailto:palexander@stanford.edu" target="_blank">palexander@stanford.edu</a>></span>
                                                  wrote:<br>
                                                  <blockquote class="gmail_quote" style="margin:0px
                                                    0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                                                    <div style="word-wrap:break-word">How

                                                      is the call being
                                                      invoked? Can you
                                                      share the code
                                                      that is actually
                                                      doing the call?
                                                      <div> <br>
                                                      </div>
                                                      <div>Thanks,</div>
                                                      <div>Paul</div>
                                                      <div><br>
                                                      </div>
                                                      <div><br>
                                                        <div>
                                                          <div>
                                                          <div>
                                                          <div>On Feb
                                                          14, 2014, at
                                                          1:20 PM, Leyla
                                                          Jael García
                                                          Castro <<a moz-do-not-send="true" href="mailto:leylajael@gmail.com" target="_blank">leylajael@gmail.com</a>>


                                                          wrote:</div>
                                                          <br>
                                                          </div>
                                                          </div>
                                                          <blockquote type="cite">
                                                          <div>
                                                          <div>
                                                          <div dir="ltr">
                                                          <div class="gmail_extra">Hi

                                                          all, </div>
                                                          <div class="gmail_extra"><br>
                                                          </div>
                                                          <div class="gmail_extra">I
                                                          am using the
                                                          Annotator
                                                          service
                                                          successfully
                                                          on Windows
                                                          but, what the
                                                          odds, the same
                                                          code with the
                                                          same text is
                                                          not working on
                                                          Linux.</div>
                                                          <div class="gmail_extra"><br>
                                                          </div>
                                                          <div class="gmail_extra">This

                                                          is the text
                                                          after URL
                                                          enconding:</div>
                                                          <div class="gmail_extra"><br>
                                                          </div>
                                                          <div class="gmail_extra">
                                                          <div class="gmail_extra">This+analysis+evidence+that+there+is+a+large+difference+in+efficiency+of+the+tested+methods+and+that+care+has+to+be+taken+when+deciding+which+method+to+be+used+for+the+analysis+of+missing+covariates+in+nonlinear+mixed+effects+modelling.</div>
                                                          <div class="gmail_extra"><br>
                                                          </div>
                                                          <div class="gmail_extra">And

                                                          this is the
                                                          response we
                                                          are getting:</div>
                                                          <div class="gmail_extra"><br>
                                                          </div>
                                                          <div class="gmail_extra"><?xml


                                                          version="1.0"
encoding="UTF-8"?></div>
                                                          <div class="gmail_extra"><hash></div>
                                                          <div class="gmail_extra"> 
<status>401</status></div>
                                                          <div class="gmail_extra"> 
                                                          <error>You

                                                          must provide a
                                                          valid API Key.
                                                          Your API Key
                                                          can be
                                                          obtained by
                                                          logging in at
                                                          <a moz-do-not-send="true" href="http://bioportal.bioontology.org/account" target="_blank">http://bioportal.bioontology.org/account</a></error></div>
                                                          <div class="gmail_extra"></hash></div>
                                                          <div class="gmail_extra"><br>
                                                          </div>
                                                          <div class="gmail_extra">Any


                                                          suggestions?
                                                          This is really
                                                          puzzle me.</div>
                                                          <div class="gmail_extra"><br>
                                                          </div>
                                                          <div class="gmail_extra">Best


                                                          regards,</div>
                                                          <div class="gmail_extra">lj</div>
                                                          <div><br>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
_______________________________________________<br>
                                                          bioontology-support

                                                          mailing list<br>
                                                          <a moz-do-not-send="true" href="mailto:bioontology-support@lists.stanford.edu" target="_blank">bioontology-support@lists.stanford.edu</a><br>
                                                          <a moz-do-not-send="true" href="https://mailman.stanford.edu/mailman/listinfo/bioontology-support" target="_blank">https://mailman.stanford.edu/mailman/listinfo/bioontology-support</a><br>
                                                          </blockquote>
                                                        </div>
                                                        <br>
                                                      </div>
                                                    </div>
                                                  </blockquote>
                                                </div>
                                                <br>
                                              </div>
                                            </div>
                                          </div>
                                        </blockquote>
                                      </div>
                                      <br>
                                    </div>
                                    <br>
                                    <fieldset></fieldset>
                                    <br>
                                    <pre>_______________________________________________
bioontology-support mailing list
<a moz-do-not-send="true" href="mailto:bioontology-support@lists.stanford.edu" target="_blank">bioontology-support@lists.stanford.edu</a>
<a moz-do-not-send="true" href="https://mailman.stanford.edu/mailman/listinfo/bioontology-support" target="_blank">https://mailman.stanford.edu/mailman/listinfo/bioontology-support</a>
</pre>
                                  </blockquote>
                                  <br>
                                </div>
                              </div>
                            </div>
                          </blockquote>
                        </div>
                        <br>
                      </div>
                    </div>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  

</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>bioontology-support mailing list</span><br><span><a href="mailto:bioontology-support@lists.stanford.edu">bioontology-support@lists.stanford.edu</a></span><br><span><a href="https://mailman.stanford.edu/mailman/listinfo/bioontology-support">https://mailman.stanford.edu/mailman/listinfo/bioontology-support</a></span><br></div></blockquote></body></html>