AxiomAdapter { OWLAxiom toOwlDataPropertyAssertionAxiom(Axiom<?> axiom) { final OWLDataProperty dataProperty = dataFactory .getOWLDataProperty(IRI.create(axiom.getAssertion().getIdentifier())); final OWLLiteral dataValue = OwlapiUtils.createOWLLiteralFromValue(axiom.getValue().getValue(), OwlapiUtils.getAssertionLanguage(axiom.getAssertion())); return dataFactory .getOWLDataPropertyAssertionAxiom(dataProperty, toOWLIndividual(axiom.getSubject()), dataValue); } AxiomAdapter(OWLDataFactory dataFactory); OWLAxiom toOwlObjectPropertyAssertionAxiom(Axiom<?> axiom); Axiom<V> createAxiom(NamedResource subject, Assertion assertion, V value);  }
@Test void toOwlDataPropertyAxiomUsesLanguageTagSpecifiedInAssertion() { final Axiom<String> ax = new AxiomImpl<>(NamedResource.create(INDIVIDUAL), Assertion.createDataPropertyAssertion(PROPERTY, "cs", false), new Value<>("cestina")); final OWLAxiom axiom = adapter.toOwlDataPropertyAssertionAxiom(ax); final OWLDataPropertyAssertionAxiom dpAxiom = (OWLDataPropertyAssertionAxiom) axiom; final OWLLiteral literal = dpAxiom.getObject(); assertEquals(ax.getValue().getValue(), literal.getLiteral()); assertEquals("cs", literal.getLang()); }
@Test void toOwlDataPropertyAxiomCreatesSimpleLiteralWhenLanguageIsNotSpecifiedInAssertion() { final Axiom<String> ax = new AxiomImpl<>(NamedResource.create(INDIVIDUAL), Assertion.createDataPropertyAssertion(PROPERTY, false), new Value<>("english")); final OWLAxiom axiom = adapter.toOwlDataPropertyAssertionAxiom(ax); final OWLDataPropertyAssertionAxiom dpAxiom = (OWLDataPropertyAssertionAxiom) axiom; final OWLLiteral literal = dpAxiom.getObject(); assertEquals(ax.getValue().getValue(), literal.getLiteral()); assertFalse(literal.hasLang()); }