All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.linkeddatafragments.views.LinkedDataFragmentWriterFactory Maven / Gradle / Ivy

The newest version!
package org.linkeddatafragments.views;

import org.linkeddatafragments.datasource.IDataSource;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * A factory for {@link ILinkedDataFragmentWriter}s.
 *
 * @author Miel Vander Sande
 */
public class LinkedDataFragmentWriterFactory {

    private final static String HTML = "text/html";

    /**
     * Creates {@link ILinkedDataFragmentWriter} for a given mimeType
     *
     * @param prefixes Configured prefixes to be used in serialization
     * @param datasources Configured datasources
     * @param mimeType mimeType to create writer for
     * @return created writer
     * @throws IOException
     */
    public static ILinkedDataFragmentWriter create(Map  prefixes, HashMap datasources, String mimeType) throws IOException {
        switch (mimeType) {
            case HTML:
                return new HtmlTriplePatternFragmentWriterImpl(prefixes, datasources);
            default:
                return new RdfWriterImpl(prefixes, datasources, mimeType);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy