public void write() {
		try {
			docWriter.startRDF();
		} catch (RDFHandlerException e) {
			log.error("Failed to start writing document");
			return;
		}

		handleNamespaces();

		try {
			RepositoryConnection con = repo.getConnection();
			try {
				RepositoryResult<Statement> statementIterator = con
						.getStatements(null, null, null, true);

				while (statementIterator.hasNext()) {
					Statement s = statementIterator.next();
					try {
						docWriter.handleStatement(s);
					} catch (RDFHandlerException e) {
						// TODO Auto-generated catch block
						log.error("Unable to handle statement:\n" + s);
						e.printStackTrace();
					}
				}
			} finally {
				con.close();
			}
		} catch (RepositoryException e) {
			log.error("Could not iterate over all statements in repository");
			e.printStackTrace();
		}

		try {
			docWriter.endRDF();
			writer.close();
		} catch (IOException e) {
			log.error("Failed to stop writing document");
		} catch (RDFHandlerException e) {
			log.error("Failed to write document");
		}

	}