// Path: src/main/java/org/linkeddatafragments/datasource/IFragmentRequestProcessor.java
// public interface IFragmentRequestProcessor extends Closeable
// {
// 
//     /**
//      *
//      * @param request
//      * @return
//      * @throws IllegalArgumentException
//      */
//     ILinkedDataFragment createRequestedFragment(
//             final ILinkedDataFragmentRequest request )
//                     throws IllegalArgumentException;
// }
// 
// Path: src/main/java/org/linkeddatafragments/fragments/ILinkedDataFragment.java
// public interface ILinkedDataFragment extends Closeable
// {
//     /**
//      * Returns an iterator over the RDF data of this fragment (possibly only
//      * partial if the data is paged, as indicated by {@link #isPageOnly()}).
//      * @return 
//      */
//     StmtIterator getTriples();
// 
//     /**
//      * Returns true if {@link #getTriples()} returns a page of data only.
//      * In this case, {@link #getPageNumber()} can be used to obtain the
//      * corresponding page number.
//      * @return 
//      */
//     boolean isPageOnly();
// 
//     /**
//      * Returns the number of the page of data returned by {@link #getTriples()}
//      * if the data is paged (that is, if {@link #isPageOnly()} returns true).
//      *
//      * If the data is not paged, this method throws an exception.
//      *
//      * @return 
//      * @throws UnsupportedOperationException
//      *         If the data of this fragment is not paged. 
//      */
//     long getPageNumber() throws UnsupportedOperationException;
// 
//     /**
//      * Returns true if {@link #getTriples()} returns a page of data only and
//      * this is the last page of the fragment.
//      *
//      * If the data is not paged (i.e., if {@link #isPageOnly()} returns false),
//      * this method throws an exception.
//      *
//      * @return 
//      * @throws UnsupportedOperationException
//      *         If the data of this fragment is not paged. 
//      */
//     boolean isLastPage() throws UnsupportedOperationException;
// 
//     /**
//      * Returns the maximum number of triples per page if {@link #getTriples()}
//      * returns a page of data only (that is, if {@link #isPageOnly()} returns
//      * true).
//      *
//      * If the data is not paged, this method throws an exception.
//      *
//      * @return 
//      * @throws UnsupportedOperationException
//      *         If the data of this fragment is not paged. 
//      */
//     long getMaxPageSize() throws UnsupportedOperationException;
// 
//     /**
//      * Returns an iterator over the metadata of this fragment.
//      * @return 
//      */
//     StmtIterator getMetadata();
// 
//     /**
//      * Returns an iterator over an RDF description of the controls associated
//      * with this fragment.
//      * @return 
//      */
//     StmtIterator getControls();
// }
// 
// Path: src/main/java/org/linkeddatafragments/fragments/tpf/ITriplePatternFragment.java
// public interface ITriplePatternFragment extends ILinkedDataFragment {
//     /**
//      * Gets the total number of triples in the fragment (can be an estimate).
//      * @return the total number of triples
//      */
//     public long getTotalSize();
// }


import com.google.gson.JsonObject;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import org.junit.Assert;
import org.junit.Test;
import org.linkeddatafragments.datasource.IDataSource;
import org.linkeddatafragments.datasource.IFragmentRequestProcessor;
import org.linkeddatafragments.fragments.ILinkedDataFragment;
import org.linkeddatafragments.fragments.tpf.ITriplePatternElement;
import org.linkeddatafragments.fragments.tpf.ITriplePatternFragment;
import org.linkeddatafragments.fragments.tpf.ITriplePatternFragmentRequest;
import org.linkeddatafragments.fragments.tpf.TriplePatternFragmentRequestImpl;
import org.linkeddatafragments.util.TriplePatternElementParser;

     */
    public static JsonObject createConfig(String title, String desc, String type) {
        JsonObject config = new JsonObject();
        config.addProperty("title", title);
        config.addProperty("description", desc);
        config.addProperty("type", type);

        return config;
    }


    /**
     * Test total size of empty TPF
     *
     */
    @Test
    public void testEmpty() {
        final TriplePatternElementParser<ConstantTermType,NamedVarType,AnonVarType> tpeParser =
                                               getTriplePatternElementParser();

        final ITriplePatternFragmentRequest<ConstantTermType,NamedVarType,AnonVarType> request =
                new TriplePatternFragmentRequestImpl<ConstantTermType,NamedVarType,AnonVarType>(
                        "http://example.org/f", // fragmentURL
                        "http://example.org/",  // datasetURL,
                        true, // pageNumberWasRequested,
                        1L, //pageNumber,
                        tpeParser.parseIntoTriplePatternElement("http://nothing.ldf.org"), // subject,
                        tpeParser.parseIntoTriplePatternElement(null), // predicate,
                        tpeParser.parseIntoTriplePatternElement(null) ); //object


// Path: src/main/java/org/linkeddatafragments/datasource/IFragmentRequestProcessor.java
// public interface IFragmentRequestProcessor extends Closeable
// {
// 
//     /**
//      *
//      * @param request
//      * @return
//      * @throws IllegalArgumentException
//      */
//     ILinkedDataFragment createRequestedFragment(
//             final ILinkedDataFragmentRequest request )
//                     throws IllegalArgumentException;
// }
// 
// Path: src/main/java/org/linkeddatafragments/fragments/ILinkedDataFragment.java
// public interface ILinkedDataFragment extends Closeable
// {
//     /**
//      * Returns an iterator over the RDF data of this fragment (possibly only
//      * partial if the data is paged, as indicated by {@link #isPageOnly()}).
//      * @return 
//      */
//     StmtIterator getTriples();
// 
//     /**
//      * Returns true if {@link #getTriples()} returns a page of data only.
//      * In this case, {@link #getPageNumber()} can be used to obtain the
//      * corresponding page number.
//      * @return 
//      */
//     boolean isPageOnly();
// 
//     /**
//      * Returns the number of the page of data returned by {@link #getTriples()}
//      * if the data is paged (that is, if {@link #isPageOnly()} returns true).
//      *
//      * If the data is not paged, this method throws an exception.
//      *
//      * @return 
//      * @throws UnsupportedOperationException
//      *         If the data of this fragment is not paged. 
//      */
//     long getPageNumber() throws UnsupportedOperationException;
// 
//     /**
//      * Returns true if {@link #getTriples()} returns a page of data only and
//      * this is the last page of the fragment.
//      *
//      * If the data is not paged (i.e., if {@link #isPageOnly()} returns false),
//      * this method throws an exception.
//      *
//      * @return 
//      * @throws UnsupportedOperationException
//      *         If the data of this fragment is not paged. 
//      */
//     boolean isLastPage() throws UnsupportedOperationException;
// 
//     /**
//      * Returns the maximum number of triples per page if {@link #getTriples()}
//      * returns a page of data only (that is, if {@link #isPageOnly()} returns
//      * true).
//      *
//      * If the data is not paged, this method throws an exception.
//      *
//      * @return 
//      * @throws UnsupportedOperationException
//      *         If the data of this fragment is not paged. 
//      */
//     long getMaxPageSize() throws UnsupportedOperationException;
// 
//     /**
//      * Returns an iterator over the metadata of this fragment.
//      * @return 
//      */
//     StmtIterator getMetadata();
// 
//     /**
//      * Returns an iterator over an RDF description of the controls associated
//      * with this fragment.
//      * @return 
//      */
//     StmtIterator getControls();
// }
// 
// Path: src/main/java/org/linkeddatafragments/fragments/tpf/ITriplePatternFragment.java
// public interface ITriplePatternFragment extends ILinkedDataFragment {
//     /**
//      * Gets the total number of triples in the fragment (can be an estimate).
//      * @return the total number of triples
//      */
//     public long getTotalSize();
// }


// Path: src/test/java/org/linkeddatafragments/test/datasource/DataSourceTest.java
import com.google.gson.JsonObject;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import org.junit.Assert;
import org.junit.Test;
import org.linkeddatafragments.datasource.IDataSource;
import org.linkeddatafragments.datasource.IFragmentRequestProcessor;
import org.linkeddatafragments.fragments.ILinkedDataFragment;
import org.linkeddatafragments.fragments.tpf.ITriplePatternElement;
import org.linkeddatafragments.fragments.tpf.ITriplePatternFragment;
import org.linkeddatafragments.fragments.tpf.ITriplePatternFragmentRequest;
import org.linkeddatafragments.fragments.tpf.TriplePatternFragmentRequestImpl;
import org.linkeddatafragments.util.TriplePatternElementParser;

     */
    public static JsonObject createConfig(String title, String desc, String type) {
        JsonObject config = new JsonObject();
        config.addProperty("title", title);
        config.addProperty("description", desc);
        config.addProperty("type", type);

        return config;
    }


    /**
     * Test total size of empty TPF
     *
     */
    @Test
    public void testEmpty() {
        final TriplePatternElementParser<ConstantTermType,NamedVarType,AnonVarType> tpeParser =
                                               getTriplePatternElementParser();

        final ITriplePatternFragmentRequest<ConstantTermType,NamedVarType,AnonVarType> request =
                new TriplePatternFragmentRequestImpl<ConstantTermType,NamedVarType,AnonVarType>(
                        "http://example.org/f", // fragmentURL
                        "http://example.org/",  // datasetURL,
                        true, // pageNumberWasRequested,
                        1L, //pageNumber,
                        tpeParser.parseIntoTriplePatternElement("http://nothing.ldf.org"), // subject,
                        tpeParser.parseIntoTriplePatternElement(null), // predicate,
                        tpeParser.parseIntoTriplePatternElement(null) ); //object


        final IFragmentRequestProcessor proc = getDatasource().getRequestProcessor();
