Set<OntologyAxiomPair> axioms = new HashSet<>();
if (!DATATYPE.matches(tok)) {
throw new ExceptionBuilder().withKeyword(DATATYPE).build();
}
String subj = consumeToken();
OWLDatatype datatype = getOWLDatatype(subj);
axioms.add(new OntologyAxiomPair(defaultOntology, dataFactory
.getOWLDeclarationAxiom(datatype)));
while (true) {
String sect = peekToken();
if (EQUIVALENT_TO.matches(sect)) {
potentialKeywords.clear();
consumeToken();
Set<OWLOntology> onts = getOntologies();
Set<OWLDataRange> drs = parseDataRangeList();
for (OWLOntology ont : onts) {
assert ont != null;
for (OWLDataRange dr : drs) {
assert dr != null;
axioms.add(new OntologyAxiomPair(ont, dataFactory
.getOWLDatatypeDefinitionAxiom(datatype, dr)));
}
}
} else if (ANNOTATIONS.matches(sect)) {
potentialKeywords.clear();
axioms.addAll(parseAnnotations(datatype.getIRI()));
} else {
break;
}
}
return axioms;