Skip to content

Commit

Permalink
fix for encoding bug in related properties and remove descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
mardam committed Feb 2, 2016
1 parent 4148070 commit f79bff5
Showing 1 changed file with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private abstract class UsageRecord {
* The description of this item. If there isn't any English
* description available, the description is set to a hyphen.
*/
public String description;
// public String description;
}

/**
Expand Down Expand Up @@ -531,13 +531,13 @@ private Map<String, EntityDocument> getItemDocuments(
*/
private void setDescriptionToUsageRecord(TermedDocument termedDocument,
UsageRecord usageRecord) {
usageRecord.description = "-";
//usageRecord.description = "-";
if (termedDocument != null) {
MonolingualTextValue descriptionValue = termedDocument
.getDescriptions().get("en");
if (descriptionValue != null) {
usageRecord.description = descriptionValue
.getText();
//usageRecord.description = descriptionValue
// .getText();
}
}
}
Expand Down Expand Up @@ -586,9 +586,10 @@ private void setImageFileToClassRecord(ItemDocument itemDocument,
*/
private void writePropertyData() {
try (PrintStream out = new PrintStream(
ExampleHelpers.openExampleFileOuputStream("Properties.csv"))) {
ExampleHelpers.openExampleFileOuputStream("Properties.csv"),
true, "UTF-8")) {

out.println("Id" + ",Label" + ",Description" + ",URL"
out.println("Id" + ",Label" + ",URL"
+ ",Datatype" + ",Uses in statements"
+ ",Items with such statements"
+ ",Uses in statements with qualifiers"
Expand All @@ -615,9 +616,10 @@ private void writePropertyData() {
*/
private void writeClassData() {
try (PrintStream out = new PrintStream(
ExampleHelpers.openExampleFileOuputStream("Classes.csv"))) {
ExampleHelpers.openExampleFileOuputStream("Classes.csv"),
true, "UTF-8")) {

out.println("Id" + ",Label" + ",Description" + ",URL"
out.println("Id" + ",Label" + ",URL"
+ ",Image"
+ ",Number of direct instances"
+ ",Number of direct subclasses"
Expand Down Expand Up @@ -819,19 +821,18 @@ private void printPropertyRecord(PrintStream out,
private void printTerms(PrintStream out, UsageRecord usageRecord,
EntityIdValue entityIdValue) {

String description = "-";
String label;

if (usageRecord.description != null) {
description = csvStringEscape(usageRecord.description);
}
// if (usageRecord.description != null) {
// description = csvStringEscape(usageRecord.description);
// }

if (usageRecord.label == null) {
usageRecord.label = entityIdValue.getId();
}
label = csvStringEscape(usageRecord.label);
out.print(entityIdValue.getId() + "," + label + ","
+ description + "," + entityIdValue.getIri());
+ entityIdValue.getIri());
}

/**
Expand Down Expand Up @@ -893,7 +894,8 @@ public int compare(
}
// makeshift escaping for Miga:
out.print(getPropertyLabel(relatedProperty.left)
.replace("@", "@"));
.replace("@", "@")
.replace("\"", "\"\""));
count++;
}
out.print("\"");
Expand Down

0 comments on commit f79bff5

Please sign in to comment.