RdfToPojoLoader { public void loadResource(String resource, String graph, Loadable entity) throws RdfUtilsException { Map<Loadable, String> newEntities = new HashMap<>(); entity.resource(resource); source.triples(resource, graph, triple -> { Loadable newEntity = entity.load( triple.getPredicate(), triple.getObject()); if (newEntity != null) { newEntities.put(newEntity, triple.getObject().asString()); } }); for (Map.Entry<Loadable, String> entry : newEntities.entrySet()) { loadResource(entry.getValue(), graph, entry.getKey()); } } RdfToPojoLoader(BackendRdfSource source); void loadResource(String resource, String graph, Loadable entity); void loadResourceByReflection(String resource, String graph,
            Object entity, DescriptorFactory descriptorFactory);  }
@Test public void loadResource() throws RdfUtilsException { SimpleStore store = new SimpleStore(Arrays.asList( new SimpleTriple("resource", "title", new SimpleValue("TestObjectTitle", false)), new SimpleTriple("resource", "object", new SimpleValue("ref", true)), new SimpleTriple("ref", "title", new SimpleValue("InnerObject", false)) )); RdfToPojoLoader loader = new RdfToPojoLoader(store); TestObject testObject = new TestObject(); loader.loadResource("resource", "", testObject); Assert.assertEquals("resource", testObject.resource); Assert.assertEquals("TestObjectTitle", testObject.title); Assert.assertNotNull(testObject.object); Assert.assertEquals("ref", testObject.object.resource); Assert.assertEquals("InnerObject", testObject.object.title); }