@@ -0,0 +1,1740 @@
+package org.dataone.annotator.matcher.esor;%0A%0Aimport java.io.InputStream;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport org.apache.commons.io.IOUtils;%0Aimport org.apache.commons.logging.Log;%0Aimport org.apache.commons.logging.LogFactory;%0Aimport org.apache.http.HttpResponse;%0Aimport org.apache.http.client.HttpClient;%0Aimport org.apache.http.client.methods.HttpGet;%0Aimport org.apache.http.impl.client.HttpClients;%0Aimport org.dataone.annotator.matcher.ConceptItem;%0Aimport org.dataone.annotator.matcher.ConceptMatcher;%0A%0Apublic class CosineService implements ConceptMatcher %7B%0A%0A%09private static Log log = LogFactory.getLog(CosineService.class);%0A%0A%09//the cosine server%0A%09private static final String REST_URL = %22https://esor.tw.rpi.edu/cosine/%22;%0A%0A%09%0A%09public CosineService() %7B%0A%09%7D%0A%0A%0A%09@Override%0A%09public List%3CConceptItem%3E getConcepts(String fullText, String unit, String context) throws Exception %7B%0A%09%09return null;%0A%09%7D%0A%0A%09@Override%0A%09public List%3CConceptItem%3E getConcepts(Map%3CString, String%3E queryItems) throws Exception %7B%0A%09%09return null;%0A%09%7D%0A%0A%09public static String lookupCosine(String id) throws Exception  %7B%0A%0A%09%09HttpClient client = HttpClients.createDefault();%0A%09%09String uriStr = REST_URL + id;%0A%09%09log.debug(%22uriStr=%22 + uriStr);%0A%0A%09%09// use post to handle potentially long parameter values%0A%09%09HttpGet method = new HttpGet(uriStr);%0A%09%09method.setHeader(%22Accept%22, %22*/*%22);%0A%09%09%0A%09%09HttpResponse response = client.execute(method);%0A%09%09int code = response.getStatusLine().getStatusCode();%0A%09%09if (2 != code / 100) %7B%0A%09%09%09%09throw new Exception(%22response code %22 + code + %22 for resource at %22 + uriStr);%0A%09%09%7D%0A%09%09InputStream body = response.getEntity().getContent();%0A%09%09String jsonStr = IOUtils.toString(body, %22UTF-8%22);%0A%09%09log.debug(%22jsonStr=%22 + jsonStr);%0A%0A%09%09return jsonStr;%0A%09%09%0A%09%09%0A%09%7D%0A%09%0A%09%0A%7D%0A

add cosine service