All pastes #617700 Raw Edit

Someone

public text v1 · immutable
·published 2007-07-13 13:12 UTC
rendered paste body
	public void testBinaryStorage() throws SwecrException, FileNotFoundException {

		IIdService idService = (IIdService) fRepository.getService(IIdService.class);
		ITripleService tripleService = (ITripleService) fRepository.getService(ITripleService.class);

		IId graphId = idService.getRdfId(namespace + "graphOne");
		IId subjectId = idService.getRdfId(namespace + "FeebaseTypeEditor");
		IId predicateId = idService.getRdfId(namespace + "content");

		// ValueFactory valueFactory =
		IValueFactory valueFactory = (IValueFactory) fRepository.getService(IValueFactory.class);

		File imageFile = new File("/home/sebastocha/tmp/freebase_type_editor_film.png");
		BufferedInputStream input = new BufferedInputStream(new FileInputStream(imageFile));
		IValue value = valueFactory.newBinaryValue(input, "image/png");

		tripleService.addStatement(graphId, subjectId, predicateId, value);
	}