} else if (!docprop.containsKey(BELDocumentProperty.VERSION)) {
addError(new DocumentVersionException(lastDocumentPropertyLocation, 0));
} else {
if (documentStatementGroup.getStatements().isEmpty()) {
// statements are only contained in explicitly-defined statement groups
retval.doc = new BELDocument(BELDocumentHeader.create(docprop), adlist, nslist, statementGroups);
} else {
// statements are defined in the implicit document statement group and possibly child statement groups
documentStatementGroup.setChildStatementGroups(statementGroups);
retval.doc = new BELDocument(BELDocumentHeader.create(docprop), adlist, nslist, Arrays.asList(documentStatementGroup));
}
}
}