Skip to content

Commit

Permalink
Add class comments with link to specification
Browse files Browse the repository at this point in the history
  • Loading branch information
nck-mlcnv committed Aug 30, 2024
1 parent a72d3ab commit c23b9e4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@

/**
* SAX Parser for SPARQL JSON Results.
* For correct SPARQL JSON Results it returns the number of solutions, bound values and the names of the variables.
* For correct SPARQL JSON results, it returns the number of solutions, bound values and the names of the variables.
* For malformed results it may or may not fail. For malformed JSON it fails if the underlying json.simple.parser fails.
* <p>
* Specification: <a href="https://www.w3.org/TR/sparql11-results-json/">https://www.w3.org/TR/sparql11-results-json/</a>
*/
@LanguageProcessor.ContentType("application/sparql-results+json")
public class SaxSparqlJsonResultCountingParser extends LanguageProcessor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@

/**
* SAX Parser for SPARQL XML Results.
* For correct SPARQL XML Results it returns the number of solutions, bound values and the names of the variables.
* For correct SPARQL XML Results it returns the number of solutions, bound values, the names of the variables and links.
* Fails for malformed SPARQL XML Results.
* <p>
* Specification: <a href="https://www.w3.org/TR/rdf-sparql-XMLres/">https://www.w3.org/TR/rdf-sparql-XMLres/</a>
*/
@LanguageProcessor.ContentType("application/sparql-results+xml")
public class SaxSparqlXmlResultCountingParser extends LanguageProcessor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
import java.nio.charset.StandardCharsets;
import java.util.List;

/**
* CSV Parser for SPARQL CSV Results.
* For correct SPARQL CSV results, it returns the number of solutions, bound values and the names of the variables.
* <p>
* Specification: <a href="https://www.w3.org/TR/sparql11-results-csv-tsv/">https://www.w3.org/TR/sparql11-results-csv-tsv/</a>
*/
@LanguageProcessor.ContentType("text/csv")
public class SparqlCsvResultCountingParser extends LanguageProcessor {

Expand All @@ -34,7 +40,7 @@ public LanguageProcessingData process(InputStream inputStream, long hash) {
while ((line = csvReader.readNext()) != null) {
solutions++;
for (String value : line) {
if (!value.isEmpty()) boundValues++;
if (!value.isEmpty()) boundValues++; // empty string values and empty cells are not differentiated
}
}
return new ResultCountData(hash, solutions, boundValues, variables, null, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
import java.nio.charset.StandardCharsets;
import java.util.List;


/**
* TSV Parser for SPARQL TSV Results.
* For correct SPARQL TSV results, it returns the number of solutions, bound values and the names of the variables.
* <p>
* Specification: <a href="https://www.w3.org/TR/sparql11-results-csv-tsv/">https://www.w3.org/TR/sparql11-results-csv-tsv/</a>
*/
@LanguageProcessor.ContentType("text/tab-separated-values")
public class SparqlTsvResultCountingParser extends LanguageProcessor {

Expand Down

0 comments on commit c23b9e4

Please sign in to comment.