Skip to content

Commit

Permalink
refactor: Add support for retrieving triples in Markdown format
Browse files Browse the repository at this point in the history
This commit adds a new endpoint to the SPARQLRestAPI class for retrieving triples in Markdown format. The new endpoint is accessible via a GET request and accepts the same parameters as the existing endpoints. The response will be formatted as Markdown, allowing users to easily view and analyze the triples. This feature enhances the flexibility and usability of the API.
  • Loading branch information
remiceres committed Jul 9, 2024
1 parent e741e2f commit defc82b
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class SPARQLRestAPI implements ResultFormatDef, URLParam {
static final String SPARQL_RESULTS_JSON = ResultFormat.SPARQL_RESULTS_JSON;
static final String SPARQL_RESULTS_CSV = ResultFormat.SPARQL_RESULTS_CSV;
static final String SPARQL_RESULTS_TSV = ResultFormat.SPARQL_RESULTS_TSV;
static final String SPARQL_RESULTS_MD = ResultFormat.SPARQL_RESULTS_MD;
static final String SPARQL_QUERY = ResultFormat.SPARQL_QUERY;

static final String XML = ResultFormat.XML;
Expand Down Expand Up @@ -525,6 +526,23 @@ public Response getTriplesTSVForGet(@jakarta.ws.rs.core.Context HttpServletReque
return myGetResult(request, name, oper, uri, param, mode, query, access, defaut, named, TSV_FORMAT);
}

@GET
@Produces(SPARQL_RESULTS_MD)
public Response getTriplesMDForGet(@jakarta.ws.rs.core.Context HttpServletRequest request,
@PathParam("name") String name,
@PathParam("oper") String oper,
@QueryParam("query") String query,
@QueryParam("access") String access,
@QueryParam("default-graph-uri") List<String> defaut,
@QueryParam("named-graph-uri") List<String> named,
@QueryParam("param") List<String> param,
@QueryParam("mode") List<String> mode,
@QueryParam("uri") List<String> uri) {

logger.info("getTriplesMDForGet");
return myGetResult(request, name, oper, uri, param, mode, query, access, defaut, named, MARKDOWN_FORMAT);
}

// ----------------------------------------------------
// SPARQL QUERY - DESCRIBE and CONSTRUCT with HTTP GET
// ----------------------------------------------------
Expand Down

0 comments on commit defc82b

Please sign in to comment.