Skip to content

Commit

Permalink
Created method to test whether a media type is a RDF representation f…
Browse files Browse the repository at this point in the history
…ormat. See issue #5
  • Loading branch information
enridaga committed Oct 17, 2015
1 parent 79e0bff commit c43bc6b
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package uk.ac.open.kmi.basil.rest.core;

import javax.ws.rs.core.MediaType;

import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -34,9 +35,18 @@ public MediaType remove(Object key) {
throw new UnsupportedOperationException();
}
};

public final static boolean isRDF(MediaType type){
return (MoreMediaType.RDFJSON_TYPE.equals(type) || MoreMediaType.JSONLD_TYPE.equals(type) ||
MoreMediaType.RDFXML_TYPE.equals(type) || MoreMediaType.TEXT_TURTLE_TYPE.equals(type)
|| MoreMediaType.APPLICATION_TURTLE_TYPE.equals(type) ||
MoreMediaType.TEXT_X_NQUADS_TYPE.equals(type));
}

static {
extensions.put("txt", MediaType.TEXT_PLAIN_TYPE);
extensions.put("xml", MediaType.APPLICATION_XML_TYPE);
extensions.put("rdf", MoreMediaType.RDFXML_TYPE);
extensions.put("json", MediaType.APPLICATION_JSON_TYPE);
extensions.put("sparql-json", MoreMediaType.SPARQL_RESULTS_JSON_TYPE);
extensions.put("sparql-xml", MoreMediaType.SPARQL_RESULTS_XML_TYPE);
Expand Down

0 comments on commit c43bc6b

Please sign in to comment.