public void generateSubsciptionFiles(String endpoint, String graph,
	    String directory) {

	URL url = getClass().getResource(File.separator);
	String dir = url.getPath() + directory;

	Repository myRepository = new HTTPRepository(endpoint, "store");

	try {
	    myRepository.initialize();
	    RepositoryConnection con = myRepository.getConnection();

	    String suppliers_query = "PREFIX sc:<http://www.xybermotive.com/ontology/>\n"
		    + "select distinct ?uri ?name FROM <subnot-test> {\n"
		    + "?uri a sc:Supplier . ?uri sc:name ?name }";

	    TupleQuery tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL,
		    suppliers_query);

	    TupleQueryResult result = tupleQuery.evaluate();
	    try {
		while (result.hasNext()) { // iterate over the result
		    BindingSet bindingSet = result.next();
		    Value name = bindingSet.getValue("name");

		    // String uri_base_name =
		    // uri.stringValue().replace("http://www.xybermotive.com/supplier/",
		    // "");

		    String uri = name.stringValue().replace(" ", " ");
		    String filename = dir + File.separator
			    + "received_order_from_" + uri + ".ttl";
		    LOGGER.info("Creating file " + filename);
		    String q = received_order_from.replace("REPLACE_URI",
			    "received_order_from_" + uri).replace(
			    "REPLACE_NAME", name.stringValue());
		    FileUtils.writeStringToFile(new File(filename), namespaces
			    + q + notifier);
		}
	    } finally {
		result.close();
	    }

	    String products_query = "PREFIX sc:<http://www.xybermotive.com/ontology/>\n"
		    + "select distinct ?uri ?name FROM <subnot-test> {\n"
		    + "?uri a sc:Product . ?uri sc:name ?name }";

	    tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL,
		    products_query);

	    result = tupleQuery.evaluate();
	    try {
		while (result.hasNext()) { // iterate over the result
		    BindingSet bindingSet = result.next();
		    Value name = bindingSet.getValue("name");

		    // String uri_base_name =
		    // uri.stringValue().replace("http://www.xybermotive.com/product/",
		    // "");

		    String uri = name.stringValue().replace(" ", " ");

		    LOGGER.info("Creating file " + dir + File.separator
			    + "received_product_" + uri);
		    String q = received_product.replace("REPLACE_URI",
			    "received_product_" + uri).replace("REPLACE_NAME",
			    name.stringValue());
		    FileUtils.writeStringToFile(new File(dir + File.separator
			    + "received_shipping_" + uri + ".ttl"), namespaces
			    + q + notifier);

		    LOGGER.info("Creating file " + dir + File.separator
			    + "product_arrived_late_" + uri);
		    q = product_arrived_late.replace("REPLACE_URI",
			    "product_arrived_late_" + uri).replace(
			    "REPLACE_NAME", name.stringValue());
		    FileUtils.writeStringToFile(new File(dir + File.separator
			    + "product_arrived_late_" + uri + ".ttl"),
			    namespaces + q + notifier);

		    LOGGER.info("Creating file " + dir + File.separator
			    + "new_supplier_product_" + uri);
		    q = new_supplier_product.replace("REPLACE_URI",
			    "new_supplier_product_" + uri).replace(
			    "REPLACE_NAME", name.stringValue());
		    FileUtils.writeStringToFile(new File(dir + File.separator
			    + "new_supplier_product_" + uri + ".ttl"),
			    namespaces + q + notifier);

		}
	    } finally {
		result.close();
	    }

	} catch (Exception e) {
	    LOGGER.error("couldnt create queries", e);
	}
    }