labelingsystem-server  Version 0.1.0.0
Retcat_LabelingSystem Class Reference

Static Public Member Functions

static Map< String, SuggestionItem > queryAll (String searchword) throws IOException, RepositoryException, MalformedQueryException, QueryEvaluationException, SesameSparqlException, ResourceNotAvailableException, ParseException, link.labeling.retcat.exceptions.ResourceNotAvailableException
 
static Map< String, SuggestionItem > queryVocab (String searchword, String vocabulary) throws IOException, RepositoryException, MalformedQueryException, QueryEvaluationException, SesameSparqlException, ResourceNotAvailableException, ParseException, link.labeling.retcat.exceptions.ResourceNotAvailableException
 
static JSONObject info (String url) throws IOException, RepositoryException, MalformedQueryException, QueryEvaluationException, SesameSparqlException, ResourceNotAvailableException, ParseException, RetcatException
 

Member Function Documentation

◆ info()

static JSONObject info ( String  url) throws IOException, RepositoryException, MalformedQueryException, QueryEvaluationException, SesameSparqlException, ResourceNotAvailableException, ParseException, RetcatException
static
327  {
328  try {
329  RDF rdf = new RDF();
330  String sparqlendpoint = ConfigProperties.getPropertyParam("api") + "/v1/sparql";
331  String sparql = "PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX ls: <http://labeling.link/docs/ls/core#> PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX dct: <http://purl.org/dc/terms/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> "
332  + "SELECT * { "
333  + "<" + url + "> ls:thumbnail ?prefLabel. "
334  + "<" + url + "> skos:inScheme ?scheme . "
335  + "?scheme ls:hasReleaseType ?releaseType . "
336  + "?scheme dc:title ?schemeTitle . "
337  + "OPTIONAL { ?Subject dct:creator ?creator . ?creator foaf:firstName ?firstName . ?creator foaf:lastName ?lastName . ?creator dct:publisher ?orcid . }"
338  + "OPTIONAL { <" + url + "> skos:scopeNote ?scopeNote . } "
339  + "OPTIONAL {<" + url + "> skos:broader ?BroaderPreferred . ?BroaderPreferred ls:thumbnail ?BroaderPreferredTerm. } "
340  + "OPTIONAL {<" + url + "> skos:narrower ?NarrowerPreferred . ?NarrowerPreferred ls:thumbnail ?NarrowerPreferredTerm . } "
341  + " }";
342  URL obj = new URL(sparqlendpoint);
343  HttpURLConnection con = (HttpURLConnection) obj.openConnection();
344  con.setRequestMethod("POST");
345  con.setRequestProperty("Accept", "application/sparql-results+json");
346  String urlParameters = "query=" + sparql;
347  byte[] bytes = urlParameters.getBytes(StandardCharsets.UTF_8);
348  urlParameters = new String(bytes, StandardCharsets.ISO_8859_1);
349  con.setDoOutput(true);
350  DataOutputStream wr = new DataOutputStream(con.getOutputStream());
351  wr.writeBytes(urlParameters);
352  wr.flush();
353  wr.close();
354  BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF8"));
355  String inputLine;
356  StringBuilder response = new StringBuilder();
357  while ((inputLine = in.readLine()) != null) {
358  response.append(inputLine);
359  }
360  in.close();
361  // init output
362  JSONObject jsonOut = new JSONObject();
363  // parse SPARQL results json
364  JSONObject jsonObject = (JSONObject) new JSONParser().parse(response.toString());
365  JSONObject resultsObject = (JSONObject) jsonObject.get("results");
366  JSONArray bindingsArray = (JSONArray) resultsObject.get("bindings");
367  // create unique list of ids
368  if (!bindingsArray.isEmpty()) {
369  for (Object element : bindingsArray) {
370  JSONObject tmpElement = (JSONObject) element;
371  JSONObject prefLabel = (JSONObject) tmpElement.get("prefLabel");
372  String labelValue = "";
373  String labelLang = "";
374  String stValue = "";
375  if (prefLabel != null) {
376  labelValue = (String) prefLabel.get("value");
377  labelLang = (String) prefLabel.get("xml:lang");
378  jsonOut.put("label", labelValue);
379  jsonOut.put("lang", labelLang);
380  } else {
381  jsonOut.put("label", "");
382  }
383  JSONObject releaseType = (JSONObject) tmpElement.get("releaseType");
384  stValue = (String) releaseType.get("value");
385  jsonOut.put("type", "ls");
386  jsonOut.put("releaseType", stValue.replace(rdf.getPrefixItem("ls:"), ""));
387  }
388  for (Object element : bindingsArray) {
389  JSONObject tmpElement = (JSONObject) element;
390  JSONObject scopeNote = (JSONObject) tmpElement.get("scopeNote");
391  String descValue = "";
392  if (scopeNote != null) {
393  descValue = (String) scopeNote.get("value");
394  }
395  jsonOut.put("description", descValue);
396  }
397  for (Object element : bindingsArray) {
398  JSONObject tmpElement = (JSONObject) element;
399  JSONObject scopeNote = (JSONObject) tmpElement.get("schemeTitle");
400  String descValue = (String) scopeNote.get("value");
401  jsonOut.put("scheme", descValue);
402  }
403  for (Object element : bindingsArray) {
404  JSONObject tmpElement = (JSONObject) element;
405  JSONObject orcid = (JSONObject) tmpElement.get("orcid");
406  String ordidValue = (String) orcid.get("value");
407  jsonOut.put("orcid", ordidValue);
408  }
409  String firstNameValue = "";
410  String lastNameValue = "";
411  for (Object element : bindingsArray) {
412  JSONObject tmpElement = (JSONObject) element;
413  JSONObject firstName = (JSONObject) tmpElement.get("firstName");
414  if (firstName != null) {
415  firstNameValue = (String) firstName.get("value");
416  }
417  }
418 
419  for (Object element : bindingsArray) {
420  JSONObject tmpElement = (JSONObject) element;
421  JSONObject lastName = (JSONObject) tmpElement.get("lastName");
422  if (lastName != null) {
423  lastNameValue = (String) lastName.get("value");
424  }
425  }
426  jsonOut.put("creator", firstNameValue + " " + lastNameValue);
427  HashMap<String, String> hmBroader = new HashMap();
428  for (Object element : bindingsArray) {
429  JSONObject tmpElement = (JSONObject) element;
430  JSONObject bpObj = (JSONObject) tmpElement.get("BroaderPreferred");
431  JSONObject bptObj = (JSONObject) tmpElement.get("BroaderPreferredTerm");
432  if (bpObj != null) {
433  String bp = (String) bpObj.get("value");
434  String bpt = (String) bptObj.get("value");
435  hmBroader.put(bpt, bp);
436  }
437  }
438  JSONArray tmpArrayBroader = new JSONArray();
439  Iterator itB = hmBroader.entrySet().iterator();
440  while (itB.hasNext()) {
441  Map.Entry pair = (Map.Entry) itB.next();
442  JSONObject tmpObject = new JSONObject();
443  tmpObject.put("label", pair.getKey());
444  tmpObject.put("uri", pair.getValue());
445  tmpArrayBroader.add(tmpObject);
446  itB.remove();
447  }
448  jsonOut.put("broaderTerms", tmpArrayBroader);
449  HashMap<String, String> hmNarrower = new HashMap();
450  for (Object element : bindingsArray) {
451  JSONObject tmpElement = (JSONObject) element;
452  JSONObject npObj = (JSONObject) tmpElement.get("NarrowerPreferred");
453  JSONObject nptObj = (JSONObject) tmpElement.get("NarrowerPreferredTerm");
454  if (npObj != null) {
455  String np = (String) npObj.get("value");
456  String npt = (String) nptObj.get("value");
457  hmNarrower.put(npt, np);
458  }
459  }
460  JSONArray tmpArrayNarrower = new JSONArray();
461  Iterator itN = hmNarrower.entrySet().iterator();
462  while (itN.hasNext()) {
463  Map.Entry pair = (Map.Entry) itN.next();
464  JSONObject tmpObject = new JSONObject();
465  tmpObject.put("label", pair.getKey());
466  tmpObject.put("uri", pair.getValue());
467  tmpArrayNarrower.add(tmpObject);
468  itN.remove();
469  }
470  jsonOut.put("narrowerTerms", tmpArrayNarrower);
471  // get retcat info
472  String type = "ls";
473  String quality = "";
474  String group = "";
475  for (RetcatItem item : LocalRetcatItems.getLocalCatalogue()) {
476  if (item.getType().equals(type)) {
477  quality = item.getQuality();
478  group = item.getGroup();
479  }
480  }
481  jsonOut.put("quality", quality);
482  jsonOut.put("group", group);
483  jsonOut.put("uri", url);
484  } else {
485  throw new ResourceNotAvailableException();
486  }
487  if (jsonOut.get("label") != null && !jsonOut.get("label").equals("")) {
488  return jsonOut;
489  } else {
490  throw new RetcatException("no label for this uri available");
491  }
492  } catch (Exception e) {
493  return new JSONObject();
494  }
495  }

References LocalRetcatItems.getLocalCatalogue(), and ConfigProperties.getPropertyParam().

Referenced by RetcatResource.getInfoLabelingSystem(), RetcatResource.getQueryResultsLabelingSystem(), and RetcatResource.getQueryResultsLabelingSystemVocabulary().

◆ queryAll()

static Map<String, SuggestionItem> queryAll ( String  searchword) throws IOException, RepositoryException, MalformedQueryException, QueryEvaluationException, SesameSparqlException, ResourceNotAvailableException, ParseException, link.labeling.retcat.exceptions.ResourceNotAvailableException
static
33  {
34  String url = ConfigProperties.getPropertyParam("api") + "/v1/sparql";
35  String sparql = "PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX ls: <http://labeling.link/docs/ls/core#> PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX dct: <http://purl.org/dc/terms/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> "
36  + "SELECT ?Subject ?prefLabel ?scopeNote ?BroaderPreferredTerm ?BroaderPreferred ?NarrowerPreferredTerm ?NarrowerPreferred ?schemeTitle ?firstName ?lastName ?orcid WHERE { "
37  + "?Subject skos:inScheme ?scheme . "
38  + "?scheme dc:title ?schemeTitle . "
39  + "OPTIONAL { ?Subject dct:creator ?creator . ?creator foaf:firstName ?firstName . ?creator foaf:lastName ?lastName . ?creator dct:publisher ?orcid . }"
40  + "?Subject ls:thumbnail ?prefLabel . "
41  + "OPTIONAL {?Subject skos:prefLabel ?pl . } "
42  + "?scheme ls:hasReleaseType ls:Public . "
43  + "OPTIONAL { ?Subject skos:scopeNote ?scopeNote . } "
44  + "OPTIONAL {?Subject skos:broader ?BroaderPreferred . ?BroaderPreferred ls:thumbnail ?BroaderPreferredTerm.} "
45  + "OPTIONAL {?Subject skos:narrower ?NarrowerPreferred . ?NarrowerPreferred ls:thumbnail ?NarrowerPreferredTerm .} "
46  + "FILTER(regex(?pl, '" + searchword + "', 'i') || regex(?scopeNote, '" + searchword + "', 'i') || regex(?prefLabel, '" + searchword + "', 'i')) "
47  + "}";
48  URL obj = new URL(url);
49  HttpURLConnection con = (HttpURLConnection) obj.openConnection();
50  con.setRequestMethod("GET");
51  con.setRequestProperty("Accept", "application/sparql-results+json");
52  String urlParameters = "query=" + sparql;
53  con.setDoOutput(true);
54  DataOutputStream wr = new DataOutputStream(con.getOutputStream());
55  BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(wr, "UTF-8"));
56  writer.write(urlParameters);
57  writer.close();
58  wr.close();
59  BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF8"));
60  String inputLine;
61  StringBuilder response = new StringBuilder();
62  while ((inputLine = in.readLine()) != null) {
63  response.append(inputLine);
64  }
65  in.close();
66  // init output
67  JSONArray outArray = new JSONArray();
68  // parse SPARQL results json
69  JSONObject jsonObject = (JSONObject) new JSONParser().parse(response.toString());
70  JSONObject resultsObject = (JSONObject) jsonObject.get("results");
71  JSONArray bindingsArray = (JSONArray) resultsObject.get("bindings");
72  // create unique list of ids
73  HashSet<String> uris = new HashSet<String>();
74  for (Object element : bindingsArray) {
75  JSONObject tmpElement = (JSONObject) element;
76  JSONObject subject = (JSONObject) tmpElement.get("Subject");
77  String subjectValue = (String) subject.get("value");
78  uris.add(subjectValue);
79  }
80  // create list of autosuggest objects
81  Map<String, SuggestionItem> autosuggests = new HashMap<String, SuggestionItem>();
82  for (String element : uris) {
83  autosuggests.put(element, new SuggestionItem(element));
84  }
85  // fill objects
86  for (Object element : bindingsArray) {
87  JSONObject tmpElement = (JSONObject) element;
88  // get Subject
89  JSONObject subject = (JSONObject) tmpElement.get("Subject");
90  String subjectValue = (String) subject.get("value");
91  // for every subject value get object from list and write values in it
92  SuggestionItem tmpAutosuggest = autosuggests.get(subjectValue);
93  // get Label
94  JSONObject labelObject = (JSONObject) tmpElement.get("prefLabel");
95  if (labelObject != null) {
96  String labelValue = (String) labelObject.get("value");
97  String labelLang = (String) labelObject.get("xml:lang");
98  tmpAutosuggest.setLabel(labelValue);
99  tmpAutosuggest.setLanguage(labelLang);
100  }
101  // get Scheme
102  JSONObject schemeObject = (JSONObject) tmpElement.get("schemeTitle");
103  String schemeValue = (String) schemeObject.get("value");
104  String schemeLang = (String) schemeObject.get("xml:lang");
105  tmpAutosuggest.setSchemeTitle(schemeValue);
106  // get ORCID
107  JSONObject oridObject = (JSONObject) tmpElement.get("orcid");
108  if (oridObject != null) {
109  String oridValue = (String) oridObject.get("value");
110  tmpAutosuggest.setOrcid(oridValue);
111  }
112  // get name
113  JSONObject firstNameObject = (JSONObject) tmpElement.get("firstName");
114  JSONObject lastNameObject = (JSONObject) tmpElement.get("lastName");
115  if (firstNameObject != null && lastNameObject != null) {
116  String firstNameValue = (String) firstNameObject.get("value");
117  String lastNameValue = (String) lastNameObject.get("value");
118  tmpAutosuggest.setCreator(firstNameValue + " " + lastNameValue);
119  }
120  // get scopeNote
121  JSONObject scopeNoteObject = (JSONObject) tmpElement.get("scopeNote");
122  if (scopeNoteObject != null) {
123  String scopeNoteValue = (String) scopeNoteObject.get("value");
124  String scopeNoteLang = (String) scopeNoteObject.get("xml:lang");
125  tmpAutosuggest.setDescription(scopeNoteValue);
126  }
127  // get broader
128  String broaderVL = "";
129  String broaderURI = "";
130  JSONObject broaderObject = (JSONObject) tmpElement.get("BroaderPreferredTerm");
131  if (broaderObject != null) {
132  String broaderValue = (String) broaderObject.get("value");
133  String broaderLang = (String) broaderObject.get("xml:lang");
134  broaderVL = broaderValue.replace("<", "").replace(">", "");
135  }
136  JSONObject broaderURIObject = (JSONObject) tmpElement.get("BroaderPreferred");
137  if (broaderURIObject != null) {
138  broaderURI = (String) broaderURIObject.get("value");
139  }
140  if (!broaderURI.equals("")) {
141  HashMap<String, String> hstmpBroader = new HashMap<String, String>();
142  hstmpBroader.put(broaderURI, broaderVL);
143  tmpAutosuggest.setBroaderTerm(hstmpBroader);
144  }
145  // get narrower
146  String narrowerVL = "";
147  String narrowerURI = "";
148  JSONObject narrowerObject = (JSONObject) tmpElement.get("NarrowerPreferredTerm");
149  if (narrowerObject != null) {
150  String narrowerValue = (String) narrowerObject.get("value");
151  String narrowerLang = (String) narrowerObject.get("xml:lang");
152  narrowerVL = narrowerValue.replace("<", "").replace(">", "");
153  }
154  JSONObject narrowerURIObject = (JSONObject) tmpElement.get("NarrowerPreferred");
155  if (narrowerURIObject != null) {
156  narrowerURI = (String) narrowerURIObject.get("value");
157  }
158  if (!narrowerURI.equals("")) {
159  HashMap<String, String> hstmpNarrower = new HashMap<String, String>();
160  hstmpNarrower.put(narrowerURI, narrowerVL);
161  tmpAutosuggest.setNarrowerTerm(hstmpNarrower);
162  }
163  // get retcat info
164  String type = "ls";
165  String quality = "";
166  String group = "";
167  for (RetcatItem item : LocalRetcatItems.getLocalCatalogue()) {
168  if (item.getType().equals(type)) {
169  quality = item.getQuality();
170  group = item.getGroup();
171  }
172  }
173  tmpAutosuggest.setType(type);
174  tmpAutosuggest.setQuality(quality);
175  tmpAutosuggest.setGroup(group);
176  }
177  return autosuggests;
178  }

References LocalRetcatItems.getLocalCatalogue(), and ConfigProperties.getPropertyParam().

Referenced by RetcatResource.getQueryResultsLabelingSystem().

◆ queryVocab()

static Map<String, SuggestionItem> queryVocab ( String  searchword,
String  vocabulary 
) throws IOException, RepositoryException, MalformedQueryException, QueryEvaluationException, SesameSparqlException, ResourceNotAvailableException, ParseException, link.labeling.retcat.exceptions.ResourceNotAvailableException
static
180  {
181  String url = ConfigProperties.getPropertyParam("api") + "/v1/sparql";
182  String sparql = "PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX ls: <http://labeling.link/docs/ls/core#> PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX dct: <http://purl.org/dc/terms/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> "
183  + "SELECT ?Subject ?prefLabel ?scopeNote ?BroaderPreferredTerm ?BroaderPreferred ?NarrowerPreferredTerm ?NarrowerPreferred ?schemeTitle ?firstName ?lastName ?orcid WHERE { "
184  + "?Subject skos:inScheme ?scheme . "
185  + "?scheme dc:title ?schemeTitle . "
186  + "OPTIONAL { ?Subject dct:creator ?creator . ?creator foaf:firstName ?firstName . ?creator foaf:lastName ?lastName . ?creator dct:publisher ?orcid . }"
187  + "?Subject ls:thumbnail ?prefLabel . "
188  + "OPTIONAL {?Subject skos:prefLabel ?pl . } "
189  + "OPTIONAL { ?Subject skos:scopeNote ?scopeNote . } "
190  + "OPTIONAL {?Subject skos:broader ?BroaderPreferred . ?BroaderPreferred ls:thumbnail ?BroaderPreferredTerm.} "
191  + "OPTIONAL {?Subject skos:narrower ?NarrowerPreferred . ?NarrowerPreferred ls:thumbnail ?NarrowerPreferredTerm .} "
192  + "FILTER(regex(?pl, '" + searchword + "', 'i') || regex(?scopeNote, '" + searchword + "', 'i') || regex(?prefLabel, '" + searchword + "', 'i')) "
193  + "FILTER(?scheme=<http://" + ConfigProperties.getPropertyParam("host") + "/item/vocabulary/" + vocabulary + ">) "
194  + "}";
195  URL obj = new URL(url);
196  HttpURLConnection con = (HttpURLConnection) obj.openConnection();
197  con.setRequestMethod("GET");
198  con.setRequestProperty("Accept", "application/sparql-results+json");
199  String urlParameters = "query=" + sparql;
200  byte[] bytes = urlParameters.getBytes(StandardCharsets.UTF_8);
201  urlParameters = new String(bytes, StandardCharsets.ISO_8859_1);
202  con.setDoOutput(true);
203  DataOutputStream wr = new DataOutputStream(con.getOutputStream());
204  wr.writeBytes(urlParameters);
205  wr.flush();
206  wr.close();
207  BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF8"));
208  String inputLine;
209  StringBuilder response = new StringBuilder();
210  while ((inputLine = in.readLine()) != null) {
211  response.append(inputLine);
212  }
213  in.close();
214  // init output
215  JSONObject jsonOut = new JSONObject();
216  JSONArray outArray = new JSONArray();
217  // parse SPARQL results json
218  JSONObject jsonObject = (JSONObject) new JSONParser().parse(response.toString());
219  JSONObject resultsObject = (JSONObject) jsonObject.get("results");
220  JSONArray bindingsArray = (JSONArray) resultsObject.get("bindings");
221  // create unique list of ids
222  HashSet<String> uris = new HashSet<String>();
223  for (Object element : bindingsArray) {
224  JSONObject tmpElement = (JSONObject) element;
225  JSONObject subject = (JSONObject) tmpElement.get("Subject");
226  String subjectValue = (String) subject.get("value");
227  uris.add(subjectValue);
228  }
229  // create list of autosuggest objects
230  Map<String, SuggestionItem> autosuggests = new HashMap<String, SuggestionItem>();
231  for (String element : uris) {
232  autosuggests.put(element, new SuggestionItem(element));
233  }
234  // fill objects
235  for (Object element : bindingsArray) {
236  JSONObject tmpElement = (JSONObject) element;
237  // get Subject
238  JSONObject subject = (JSONObject) tmpElement.get("Subject");
239  String subjectValue = (String) subject.get("value");
240  // for every subject value get object from list and write values in it
241  SuggestionItem tmpAutosuggest = autosuggests.get(subjectValue);
242  // get Label
243  JSONObject labelObject = (JSONObject) tmpElement.get("prefLabel");
244  String labelValue = (String) labelObject.get("value");
245  String labelLang = (String) labelObject.get("xml:lang");
246  tmpAutosuggest.setLabel(labelValue);
247  tmpAutosuggest.setLanguage(labelLang);
248  // get Scheme
249  JSONObject schemeObject = (JSONObject) tmpElement.get("schemeTitle");
250  String schemeValue = (String) schemeObject.get("value");
251  String schemeLang = (String) schemeObject.get("xml:lang");
252  tmpAutosuggest.setSchemeTitle(schemeValue);
253  // get ORCID
254  JSONObject oridObject = (JSONObject) tmpElement.get("orcid");
255  if (oridObject != null) {
256  String oridValue = (String) oridObject.get("value");
257  tmpAutosuggest.setOrcid(oridValue);
258  }
259  // get name
260  JSONObject firstNameObject = (JSONObject) tmpElement.get("firstName");
261  JSONObject lastNameObject = (JSONObject) tmpElement.get("lastName");
262  if (firstNameObject != null && lastNameObject != null) {
263  String firstNameValue = (String) firstNameObject.get("value");
264  String lastNameValue = (String) lastNameObject.get("value");
265  tmpAutosuggest.setCreator(firstNameValue + " " + lastNameValue);
266  }
267  // get scopeNote
268  JSONObject scopeNoteObject = (JSONObject) tmpElement.get("scopeNote");
269  if (scopeNoteObject != null) {
270  String scopeNoteValue = (String) scopeNoteObject.get("value");
271  String scopeNoteLang = (String) scopeNoteObject.get("xml:lang");
272  tmpAutosuggest.setDescription(scopeNoteValue);
273  }
274  // get broader
275  String broaderVL = "";
276  String broaderURI = "";
277  JSONObject broaderObject = (JSONObject) tmpElement.get("BroaderPreferredTerm");
278  if (broaderObject != null) {
279  String broaderValue = (String) broaderObject.get("value");
280  String broaderLang = (String) broaderObject.get("xml:lang");
281  broaderVL = broaderValue.replace("<", "").replace(">", "");
282  }
283  JSONObject broaderURIObject = (JSONObject) tmpElement.get("BroaderPreferred");
284  if (broaderURIObject != null) {
285  broaderURI = (String) broaderURIObject.get("value");
286  }
287  if (!broaderURI.equals("")) {
288  HashMap<String, String> hstmpBroader = new HashMap<String, String>();
289  hstmpBroader.put(broaderURI, broaderVL);
290  tmpAutosuggest.setBroaderTerm(hstmpBroader);
291  }
292  // get narrower
293  String narrowerVL = "";
294  String narrowerURI = "";
295  JSONObject narrowerObject = (JSONObject) tmpElement.get("NarrowerPreferredTerm");
296  if (narrowerObject != null) {
297  String narrowerValue = (String) narrowerObject.get("value");
298  String narrowerLang = (String) narrowerObject.get("xml:lang");
299  narrowerVL = narrowerValue.replace("<", "").replace(">", "");
300  }
301  JSONObject narrowerURIObject = (JSONObject) tmpElement.get("NarrowerPreferred");
302  if (narrowerURIObject != null) {
303  narrowerURI = (String) narrowerURIObject.get("value");
304  }
305  if (!narrowerURI.equals("")) {
306  HashMap<String, String> hstmpNarrower = new HashMap<String, String>();
307  hstmpNarrower.put(narrowerURI, narrowerVL);
308  tmpAutosuggest.setNarrowerTerm(hstmpNarrower);
309  }
310  // get retcat info
311  String type = "ls";
312  String quality = "";
313  String group = "";
314  for (RetcatItem item : LocalRetcatItems.getLocalCatalogue()) {
315  if (item.getType().equals(type)) {
316  quality = item.getQuality();
317  group = item.getGroup();
318  }
319  }
320  tmpAutosuggest.setType(type);
321  tmpAutosuggest.setQuality(quality);
322  tmpAutosuggest.setGroup(group);
323  }
324  return autosuggests;
325  }

References LocalRetcatItems.getLocalCatalogue(), and ConfigProperties.getPropertyParam().

Referenced by RetcatResource.getQueryResultsLabelingSystemVocabulary().

rdf
Definition: RDF.java:1
Exception