}
private void roundTrip(@Nonnull OWLDocumentFormat ontologyFormat)
throws OWLOntologyCreationException, OWLOntologyStorageException {
OWLOntologyManager man = OWLManager.createOWLOntologyManager();
OWLOntology ont = man.createOntology();
man.addAxiom(ont, rule);
StringDocumentTarget documentTarget = new StringDocumentTarget();
man.saveOntology(ont, ontologyFormat, documentTarget);
OWLOntologyManager man2 = OWLManager.createOWLOntologyManager();
OWLOntology ont2 = man2
.loadOntologyFromOntologyDocument(new StringDocumentSource(
documentTarget.toString(),
OWLOntologyDocumentSourceBase
.getNextDocumentIRI("string:ontology"),
ontologyFormat, null));
Set<SWRLRule> rules = ont2.getAxioms(AxiomType.SWRL_RULE);
assertThat(rules.size(), is(1));
SWRLRule parsedRule = rules.iterator().next();
assertThat(parsedRule, is(equalTo(rule)));
List<SWRLAtom> originalBody = new ArrayList<>(body);
List<SWRLAtom> parsedBody = new ArrayList<>(parsedRule.getBody());