class ExplorableDatasetRest {

    private Optional<Ontology> getOntology(Model model, Value value) {
        Optional<Resource> recordId = getObjectOf(model, value, DatasetRecord.linksToRecord_IRI);
        Optional<Resource> branchId = getObjectOf(model, value, DatasetRecord.linksToBranch_IRI);
        Optional<Resource> commitId = getObjectOf(model, value, DatasetRecord.linksToCommit_IRI);
        if (recordId.isPresent() && branchId.isPresent() && commitId.isPresent()) {
            return ontologyManager.retrieveOntology(recordId.get(), branchId.get(), commitId.get());
        }
        return Optional.empty();
    }

}