Java Code Examples for info.aduna.lang.FileFormat

The following examples show how to use info.aduna.lang.FileFormat. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private FileFormatServiceRegistry<? extends FileFormat, ?> getRegistryInstance(SparqlQueryType queryType) {
		case TUPLE_QUERY: return TupleQueryResultWriterRegistry.getInstance();
		case GRAPH_QUERY: return RDFWriterRegistry.getInstance();
		case BOOLEAN_QUERY: return BooleanQueryResultWriterRegistry.getInstance();
	return null;
Example 2
Source Project: database   Source File:    License: GNU General Public License v2.0 3 votes vote down vote up
 * Return a set of accept header values annotated with quality scores.
 * @param formats
 *            The set of formats which can be accepted.
 * @param preferredFormat
 *            The preferred format (optional).
 * @return The list of accept header values with quality scores.
public static <T extends FileFormat> List<String> getAcceptParams(
        final Iterable<T> formats,
        final T preferredFormat) {
    final List<String> acceptParams = new LinkedList<String>();

    for (T format : formats) {
        // Determine a q-value that reflects the user specified preference
        int qValue = defaultQValue;

        if (preferredFormat != null && !preferredFormat.equals(format)) {
            // Prefer specified format over other formats
            qValue -= 2;

        for (String mimeType : format.getMIMETypes()) {

            // Default is the bare mime type
            String acceptParam = mimeType;

            if (qValue < 10) {
                // Annotate with the factional quality score.
                acceptParam += ";q=0." + qValue;



    return acceptParams;