### Question:
HistoryLogService { public URI createLogForContext(URI contextGraph) { TripleStore tripleStore = resourceStore.getTripleStore(); URI logGraph = resourceStore.createGraph(DUHO.ContextLog); URI metadataGraph = tripleStore.getOrCreateMetadataGraph(logGraph); Model metadata = RDF2Go.getModelFactory().createModel().open(); metadata.addAll(tripleStore.getModel(contextGraph).iterator()); metadata.removeStatements(Variable.ANY, NAO.hasDataGraph, Variable.ANY); metadata.removeStatements(Variable.ANY, NAO.isDataGraphFor, Variable.ANY); tripleStore.addAll(logGraph, metadata.iterator()); tripleStore.addStatement(metadataGraph, logGraph, DUHO.timestamp, DateUtil.currentDateTimeAsLiteral()); broadcastManager.sendBroadcast(new Event(resourceStore.getName(), Event.ACTION_GRAPH_ADD, logGraph)); return logGraph; } HistoryLogService(ResourceStore resourceStore); void cleanup(URI type, Calendar from); URI createLogForContext(URI contextGraph); URI createLogForPrivacyPreference(PrivacyPreference privacyPref);  }### Answer:
@Test public void testCreateLogForContext() throws ResourceExistsException { URI liveContext = new URIImpl("urn:live-context"); Environment environment = modelFactory.getDCONFactory().createEnvironment(); URI temperatureUri = new URIImpl("urn:temperature:123"); environment.setCurrentTemperature(temperatureUri); resourceStore.createGraph(liveContext); resourceStore.create(liveContext, environment); URI logUri = historyLogService.createLogForContext(liveContext); URI metadataUri = tripleStore.getOrCreateMetadataGraph(logUri); assertTrue(tripleStore.containsStatements(metadataUri, logUri, RDF.type, DUHO.ContextLog)); assertTrue(tripleStore.containsStatements(metadataUri, logUri, DUHO.timestamp, Variable.ANY)); assertFalse(tripleStore.containsStatements(logUri, liveContext, Variable.ANY, Variable.ANY)); assertTrue(tripleStore.containsStatements(logUri, environment.asResource(), RDF.type, DCON.Environment)); assertTrue(tripleStore.containsStatements(logUri, environment.asResource(), DCON.currentTemperature, temperatureUri)); assertFalse(tripleStore.containsStatements(logUri, Variable.ANY, NAO.hasDataGraph, Variable.ANY)); assertFalse(tripleStore.containsStatements(logUri, Variable.ANY, NAO.isDataGraphFor, Variable.ANY)); }