package de.unibonn.iai.eis.diachron.qualitymetrics.utilities;

import java.util.ArrayList;
import java.util.List;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.sparql.core.Quad;

public class TestLoader {

	protected List<Quad> streamingQuads = new ArrayList<Quad>();
	protected Model m;
	
	/**
	 * Loads a sample dataset which can be used to test metrics
	 */
	public void loadDataSet() {
		
		String filename = this.getClass().getClassLoader().getResource("testdumps/160114.ttl").toExternalForm();
		//String filename = this.getClass().getClassLoader().getResource("testdumps/chembl-rdf-void.ttl").toExternalForm();
		
		m = ModelFactory.createDefaultModel();
		m.read(filename, "TTL");
		
		
		StmtIterator si = m.listStatements();
		while(si.hasNext()){
			this.streamingQuads.add(new Quad(null, si.next().asTriple()));
		}
	}
	
	public Model getM() {
		return m;
	}

	/**
	 * Returns a list of triples from the loaded dataset. This can be used 
	 * to simulate the streaming of triples
	 * @return list of Triples
	 */
	public List<Quad> getStreamingQuads(){
		return this.streamingQuads;
	}	
}

@@ -390,29 +390,8 @@
 );%0D%0A
-%09protected Model m;%0D%0A
 %09%0D%0A%09
@@ -730,16 +730,22 @@
 %0D%0A%09%09%0D%0A%09%09
+Model 
 m = Mode
@@ -808,20 +808,16 @@
 );%0D%0A%09%09%0D%0A
-%09%09%0D%0A
 %09%09StmtIt
@@ -956,51 +956,8 @@
 %0A%09%0D%0A
-%09public Model getM() %7B%0D%0A%09%09return m;%0D%0A%09%7D%0D%0A%0D%0A
 %09/**

Revert "Changed Model Variable m to protected. Used corresponding getters. changes made because dataset needed for calculating amount of triples."