diff --git a/api/src/main/java/edu/cornell/mannlib/semservices/service/impl/AgrovocService.java b/api/src/main/java/edu/cornell/mannlib/semservices/service/impl/AgrovocService.java index 945e16b9..e6ebe67a 100644 --- a/api/src/main/java/edu/cornell/mannlib/semservices/service/impl/AgrovocService.java +++ b/api/src/main/java/edu/cornell/mannlib/semservices/service/impl/AgrovocService.java @@ -63,7 +63,7 @@ public class AgrovocService implements ExternalConceptService { protected final String conceptSkosMosURL = conceptSkosMosBase + "data?"; @Override public List getConcepts(String term) throws Exception { - List conceptList = new ArrayList(); + List conceptList = new ArrayList<>(); //For the RDF webservices mechanism, utilize the following /* @@ -86,7 +86,7 @@ public class AgrovocService implements ExternalConceptService { return conceptList; int conceptCounter = 0; - HashSet encounteredURI = new HashSet(); + HashSet encounteredURI = new HashSet<>(); // Loop through each of these URIs and load using the SKOSManager for (String conceptUri : conceptUris) { @@ -185,7 +185,7 @@ public class AgrovocService implements ExternalConceptService { public List getConceptsByURIWithSparql(String uri) throws Exception { // deprecating this method...just return an empty list - List conceptList = new ArrayList(); + List conceptList = new ArrayList<>(); return conceptList; } @@ -227,7 +227,7 @@ public class AgrovocService implements ExternalConceptService { // When utilizing the getTermExpansion method, will get a list of URIs back // and not just one URI protected List getConceptURIsListFromRDF(String rdf) { - List conceptUris = new ArrayList(); + List conceptUris = new ArrayList<>(); try { Document doc = XMLUtils.parse(rdf); NodeList nodes = doc.getElementsByTagName("skos:Concept"); @@ -262,21 +262,21 @@ public class AgrovocService implements ExternalConceptService { + "> rdfs:comment ?description . \n" + "FILTER (LANG(?description)='en' ) \n" + "}"; // System.out.println(qs); - List resultList = new ArrayList(); + List resultList = new ArrayList<>(); QueryExecution qexec = null; try { Query query = QueryFactory.create(qs); qexec = QueryExecutionFactory.sparqlService(this.dbpedia_endpoint, query); qexec.setTimeout(5000, TimeUnit.MILLISECONDS); - resultList = new ArrayList(); + resultList = new ArrayList<>(); ResultSet resultSet = qexec.execSelect(); int resultSetSize = 0; while (resultSet.hasNext()) { resultSetSize++; QuerySolution solution = resultSet.nextSolution(); Iterator varnames = solution.varNames(); - HashMap hm = new HashMap(); + HashMap hm = new HashMap<>(); while (varnames.hasNext()) { String name = (String) varnames.next(); RDFNode rdfnode = solution.get(name); @@ -374,7 +374,7 @@ public class AgrovocService implements ExternalConceptService { //JSON-LD array private List getConceptURIsListFromSkosMosResult(String results) { - List conceptURIs = new ArrayList(); + List conceptURIs = new ArrayList<>(); ObjectNode json = (ObjectNode) JacksonUtils.parseJson(results); //Format should be: { ..."results":["uri":uri...] if (json.has("results")) {