Skip to content

Commit

Permalink
Improve JSON-LD outputs for empty files
Browse files Browse the repository at this point in the history
  • Loading branch information
lszeremeta committed Apr 6, 2021
1 parent 184af4c commit f8b9498
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main/java/pl/edu/uwb/ii/sdfeater/File.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void parse(Molecule molecule, SDFEater.Format format, SDFEater.Subject subject)
switch (format) {
// JSON-LD with HTML
case jsonldhtml:
System.out.println("<!DOCTYPE html>\n" +
output_str.append("<!DOCTYPE html>\n" +
"<html lang=\"en\">\n" +
" <head>\n" +
" <title>Example Document</title>\n" +
Expand Down Expand Up @@ -109,10 +109,10 @@ void parse(Molecule molecule, SDFEater.Format format, SDFEater.Subject subject)
" },\n" +
" \"https://schema.org/temporal\": " + Year.now().toString() + ",\n" +
" \"https://schema.org/url\": \"https://github.com/lszeremeta/SDFEater\"\n" +
" },");
" },\n");
break;
case jsonld:
System.out.println(
output_str.append(
"{\n" +
" \"@graph\" : [\n" +
" {\n" +
Expand Down Expand Up @@ -141,7 +141,7 @@ void parse(Molecule molecule, SDFEater.Format format, SDFEater.Subject subject)
" },\n" +
" \"https://schema.org/temporal\": " + Year.now().toString() + ",\n" +
" \"https://schema.org/url\": \"https://github.com/lszeremeta/SDFEater\"\n" +
" },");
" },\n");
break;
// RDFa
case rdfa:
Expand Down Expand Up @@ -389,8 +389,7 @@ void parse(Molecule molecule, SDFEater.Format format, SDFEater.Subject subject)
break;
case jsonld:
output_str.setLength(output_str.length() - 2);
System.out.println(output_str);
System.out.println(" ],\n" +
output_str.append("\n ],\n" +
" \"@context\" : {\n" +
" \"identifier\" : {\n" +
" \"@id\" : \"https://schema.org/identifier\"\n" +
Expand Down Expand Up @@ -440,12 +439,12 @@ void parse(Molecule molecule, SDFEater.Format format, SDFEater.Subject subject)
" \"schema\" : \"https://schema.org/\"\n" +
" }\n" +
"}");
System.out.print(output_str);
break;
// JSON-LD with HTML
case jsonldhtml:
output_str.setLength(output_str.length() - 2);
System.out.println(output_str);
System.out.println(" ],\n" +
output_str.append("\n ],\n" +
" \"@context\" : {\n" +
" \"identifier\" : {\n" +
" \"@id\" : \"https://schema.org/identifier\"\n" +
Expand Down Expand Up @@ -498,6 +497,7 @@ void parse(Molecule molecule, SDFEater.Format format, SDFEater.Subject subject)
" </script>\n" +
" </head>\n" +
"</html>");
System.out.print(output_str);
break;
case rdfxml:
jenaModel.write(System.out, "RDF/XML");
Expand Down

0 comments on commit f8b9498

Please sign in to comment.