@Test public void map_withGraphsAndClasses_appliesGraphsToEveryClass() throws Exception { EvaluateExpression evaluator = null; SimpleValueFactory f = SimpleValueFactory.getInstance(); IRI subjectIRI = f.createIRI("http: when(subjectGenerator.apply(evaluator)) .thenReturn(ImmutableList.of(subjectIRI)); Set<IRI> graphs = ImmutableSet.of( f.createIRI("http: f.createIRI("http: f.createIRI("http: f.createIRI("http: ); Set<TermGenerator<IRI>> graphGenerators = graphs.stream() .map(graphIri -> { @SuppressWarnings("unchecked") TermGenerator<IRI> generator = (TermGenerator<IRI>) mock(TermGenerator.class); when(generator.apply(evaluator)).thenReturn(ImmutableList.of(graphIri)); return generator; }) .collect(ImmutableCollectors.toImmutableSet()); Set<IRI> expectedClasses = ImmutableSet.of( f.createIRI("http: f.createIRI("http: f.createIRI("http: ); Model model = new ModelBuilder().build(); SubjectMapper s = new SubjectMapper(subjectGenerator, graphGenerators, expectedClasses, ImmutableSet.of()); s.map(model, evaluator); expectedClasses.forEach(iri -> graphs.forEach(graph -> Assert.assertTrue(model.contains(subjectIRI, RDF.TYPE, iri, graph))) ); }
Optional<Resource> map(Model model, EvaluateExpression evaluate) { LOG.debug("Determining subjects ..."); List<Resource> subject = generator.apply(evaluate); LOG.debug("Determined subjects {}", subject); return subject.stream().findFirst().map(s -> mapSubject(s, model, evaluate)); }
SubjectMapper { Optional<Resource> map(Model model, EvaluateExpression evaluate) { LOG.debug("Determining subjects ..."); List<Resource> subject = generator.apply(evaluate); LOG.debug("Determined subjects {}", subject); return subject.stream().findFirst().map(s -> mapSubject(s, model, evaluate)); } }
SubjectMapper { Optional<Resource> map(Model model, EvaluateExpression evaluate) { LOG.debug("Determining subjects ..."); List<Resource> subject = generator.apply(evaluate); LOG.debug("Determined subjects {}", subject); return subject.stream().findFirst().map(s -> mapSubject(s, model, evaluate)); } SubjectMapper(
		TermGenerator<Resource> generator,
		Set<TermGenerator<IRI>> graphGenerators,
		Set<IRI> classes,
		Set<PredicateObjectMapper> predicateObjectMappers
	); }
SubjectMapper { Optional<Resource> map(Model model, EvaluateExpression evaluate) { LOG.debug("Determining subjects ..."); List<Resource> subject = generator.apply(evaluate); LOG.debug("Determined subjects {}", subject); return subject.stream().findFirst().map(s -> mapSubject(s, model, evaluate)); } SubjectMapper(
		TermGenerator<Resource> generator,
		Set<TermGenerator<IRI>> graphGenerators,
		Set<IRI> classes,
		Set<PredicateObjectMapper> predicateObjectMappers
	);  }
SubjectMapper { Optional<Resource> map(Model model, EvaluateExpression evaluate) { LOG.debug("Determining subjects ..."); List<Resource> subject = generator.apply(evaluate); LOG.debug("Determined subjects {}", subject); return subject.stream().findFirst().map(s -> mapSubject(s, model, evaluate)); } SubjectMapper(
		TermGenerator<Resource> generator,
		Set<TermGenerator<IRI>> graphGenerators,
		Set<IRI> classes,
		Set<PredicateObjectMapper> predicateObjectMappers
	);   }