Source:
<code>public void runJob() { String depositUri = getDepositPID().getURI(); log.debug("Creating record for deposit {}", depositUri); Model dModel = getReadOnlyModel(); Map<String, String> status = getDepositStatus(); Resource deposit = dModel.getResource(depositUri); Resource aipObjResc = makeDepositRecord(deposit, status); Model aipModel = aipObjResc.getModel(); PremisLogger premisDepositLogger = getPremisLogger(getDepositPID()); premisDepositLogger.buildEvent(Premis.Ingestion) .addEventDetail("ingested as PID: {0}. {1}", getDepositPID().getPid(), aipObjResc.getProperty(DcElements.title).getObject().toString()) .addSoftwareAgent(SoftwareAgent.depositService.getFullname()) .addAuthorizingAgent(DepositField.depositorName.name()) .write(); DepositRecord depositRecord; try { depositRecord = repository.createDepositRecord(getDepositPID(), aipModel) .addPremisEvents(premisDepositLogger.getEvents()); List<String> manifestURIs = getDepositStatusFactory().getManifestURIs(getDepositUUID()); for (String manifestPath : manifestURIs) { URI uri = new URI(manifestPath); depositRecord.addManifest(new File(uri), "text/plain"); } Bag depositBag = dModel.getBag(getDepositPID().getRepositoryPath()); List<Resource> children = new ArrayList<Resource>(); DepositGraphUtils.walkObjectsDepthFirst(depositBag, children); Model triples = ModelFactory.createDefaultModel(); List<Statement> relations = new ArrayList<Statement>(); for (Resource child : children) { <START> relations.add(triples.createStatement(depositRecord.getResource(), <END> Cdr.hasIngestedObject, child.getURI())); } triples.add(relations); repository.createRelationships(getDepositPID(), triples); } catch (IOException | FedoraException | URISyntaxException e) { failJob(e, "Failed to ingest deposit record {0}", getDepositPID()); } }</code><technical_language>I need intermediate relations array here. Prior this loop suggest a triples.createResource(depositUri) loop add resource</technical_language>

Target:
public void runJob() { PID depositPID = getDepositPID(); String depositUri = depositPID.getURI(); log.debug("Creating record for deposit {}", depositUri); Model dModel = getReadOnlyModel(); Map<String, String> status = getDepositStatus(); Resource deposit = dModel.getResource(depositUri); Resource aipObjResc = makeDepositRecord(deposit, status); Model aipModel = aipObjResc.getModel(); PremisLogger premisDepositLogger = getPremisLogger(depositPID); premisDepositLogger.buildEvent(Premis.Ingestion) .addEventDetail("ingested as PID: {0}. {1}", depositPID.getPid(), aipObjResc.getProperty(DcElements.title).getObject().toString()) .addSoftwareAgent(SoftwareAgent.depositService.getFullname()) .addAuthorizingAgent(DepositField.depositorName.name()) .write(); DepositRecord depositRecord; try { depositRecord = repository.createDepositRecord(depositPID, aipModel) .addPremisEvents(premisDepositLogger.getEvents()); List<String> manifestURIs = getDepositStatusFactory().getManifestURIs(getDepositUUID()); for (String manifestPath : manifestURIs) { URI uri = new URI(manifestPath); depositRecord.addManifest(new File(uri), "text/plain"); } Bag depositBag = dModel.getBag(depositPID.getRepositoryPath()); List<Resource> children = new ArrayList<Resource>(); DepositGraphUtils.walkObjectsDepthFirst(depositBag, children); depositRecord.addIngestedObjects(depositPID, children); } catch (IOException | FedoraException | URISyntaxException e) { failJob(e, "Failed to ingest deposit record {0}", depositPID); } }