Skip to content

Commit

Permalink
Added usageNote reference when it exists.
Browse files Browse the repository at this point in the history
Minor improvements. 
Final alpha version.
  • Loading branch information
NuriaGarcia committed Mar 3, 2015
1 parent 4f688c5 commit a518eb5
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 6 deletions.
49 changes: 46 additions & 3 deletions src/com/expertsystem/lab/lov/LOVConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,64 @@ public List<ResultsListItem> parseTerms(JSONObject json){
//Comment
String comment = "";
if(!highlight.isNull("http://www.w3.org/2000/01/rdf-schema#comment")){
comment = highlight.getJSONArray("http://www.w3.org/2000/01/rdf-schema#comment").get(0).toString();
JSONArray array_comment = highlight.getJSONArray("http://www.w3.org/2000/01/rdf-schema#comment");
for(int j=0; j<array_comment.length(); j++){
comment += array_comment.getString(j) + "<br>";
}
//comment = highlight.getJSONArray("http://www.w3.org/2000/01/rdf-schema#comment").get(0).toString();
//comment = comment.replaceAll("\"", " ");
//comment = comment.replace('"', '\"');
//System.out.println(comment);
}

if(!highlight.isNull("http://www.w3.org/2000/01/rdf-schema#comment@en")){
JSONArray array_comment = highlight.getJSONArray("http://www.w3.org/2000/01/rdf-schema#comment@en");
for(int j=0; j<array_comment.length(); j++){
comment += array_comment.getString(j) + "<br>";
}
//comment = highlight.getJSONArray("http://www.w3.org/2000/01/rdf-schema#comment@en").get(0).toString();
//comment = comment.replaceAll("\"", " ");
//comment = comment.replace('"', '\"');
//System.out.println(comment);
}

//Label
String label = "";
if(!highlight.isNull("http://www.w3.org/2000/01/rdf-schema#label")){
label = highlight.getJSONArray("http://www.w3.org/2000/01/rdf-schema#label").get(0).toString();
JSONArray array_label = highlight.getJSONArray("http://www.w3.org/2000/01/rdf-schema#label");
for(int j=0; j<array_label.length(); j++){
label += array_label.getString(j) + "<br>";
}
//label = highlight.getJSONArray("http://www.w3.org/2000/01/rdf-schema#label").get(0).toString();
//System.out.println(label);
}

ResultsListItem item = new ResultsListItem(local_name, prefix, uri, ocurrences, datasets, comment, label, score);
if(!highlight.isNull("http://www.w3.org/2000/01/rdf-schema#label@en")){
JSONArray array_label = highlight.getJSONArray("http://www.w3.org/2000/01/rdf-schema#label@en");
for(int j=0; j<array_label.length(); j++){
label += array_label.getString(j) + "<br>";
}
//label = highlight.getJSONArray("http://www.w3.org/2000/01/rdf-schema#label@en").get(0).toString();
//System.out.println(label);
}

//UsageNote
String usageNote = "";
if(!highlight.isNull("http://purl.org/vocab/vann/usageNote")){
JSONArray array_usageNote = highlight.getJSONArray("http://purl.org/vocab/vann/usageNote");
for(int j=0; j<array_usageNote.length(); j++){
usageNote += array_usageNote.getString(j) + "<br>";
}
}

if(!highlight.isNull("http://purl.org/vocab/vann/usageNote@en")){
JSONArray array_usageNote = highlight.getJSONArray("http://purl.org/vocab/vann/usageNote@en");
for(int j=0; j<array_usageNote.length(); j++){
usageNote += array_usageNote.getString(j) + "<br>";
}
}

ResultsListItem item = new ResultsListItem(local_name, prefix, uri, ocurrences, datasets, comment, label, usageNote, score);
results.add(item);
}
}
Expand Down
13 changes: 12 additions & 1 deletion src/com/expertsystem/lab/lov/ResultsListItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class ResultsListItem implements MListItem {
private String num_datasets;
private String comment;
private String label;
private String usageNote;
private double confidence;

public ResultsListItem(String name){
Expand All @@ -21,18 +22,20 @@ public ResultsListItem(String name){
this.num_datasets = "0";
this.comment = "";
this.label = "";
this.usageNote = "";
this.confidence = 0.0;
}

public ResultsListItem(String name, String prefix, String url_vocab, String num_ocurrences, String num_datasets,
String comment, String label, double confidence){
String comment, String label, String usageNote, double confidence){
this.name = name;
this.prefix = prefix;
this.url_vocab = url_vocab;
this.num_ocurrences = num_ocurrences;
this.num_datasets = num_datasets;
this.comment = comment;
this.label = label;
this.usageNote = usageNote;
this.confidence = confidence;
}

Expand Down Expand Up @@ -90,6 +93,14 @@ public String getLabel() {

public void setLabel(String label) {
this.label = label;
}

public String getUsageNote() {
return usageNote;
}

public void setUsageNote(String usageNote) {
this.usageNote = usageNote;
}

public double getConfidence() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,15 @@ public Component getListCellRendererComponent(JList list, Object value,
text += "<a href='" + item.getUrl_vocab() + "'>" + item.getUrl_vocab() + "</a> <br>";

if(!item.getComment().equals("")){
text += "<font color='green'> rdfs:comment </font>" + item.getComment() + "<br>";
text += "<font color='green'> rdfs:comment </font>" + item.getComment();
}

if(!item.getLabel().equals("")){
text += "<font color='green'> rdfs:label </font>" + item.getLabel() + "<br>";
text += "<font color='green'> rdfs:label </font>" + item.getLabel();
}

if(!item.getUsageNote().equals("")){
text += "<font color='green'> http://purl.org/vocab/vann/usageNote </font>" + item.getUsageNote();
}

text += "<font color='green'> localName </font>" + item.getName();
Expand Down

0 comments on commit a518eb5

Please sign in to comment.