OwlapiUtils { public static boolean doesLanguageMatch(OWLLiteral literal, Assertion assertion) { assert literal != null; assert assertion != null; return !assertion.hasLanguage() || literal.getLang().isEmpty() || literal.getLang().equals(assertion.getLanguage()); } private  OwlapiUtils(); static OWLLiteral createOWLLiteralFromValue(Object value, String lang); static Object owlLiteralToValue(final OWLLiteral literal); static boolean doesLanguageMatch(OWLLiteral literal, Assertion assertion); static String getAssertionLanguage(Assertion assertion); static OWLNamedIndividual getIndividual(NamedResource subject, OWLDataFactory dataFactory); static boolean isIndividualIri(Object value);  }
@Test void doesLanguageMatchForAssertionReturnsTrueWhenLanguageTagMatches() { final OWLLiteral literal = dataFactory.getOWLLiteral("test", LANG); final Assertion assertion = Assertion.createPropertyAssertion(Generator.generateUri(), LANG, false); assertTrue(OwlapiUtils.doesLanguageMatch(literal, assertion)); }
@Test void doesLanguageMatchForAssertionReturnsFalseWhenLanguageTagDoesNotMatch() { final OWLLiteral literal = dataFactory.getOWLLiteral("test", LANG); final Assertion assertion = Assertion.createPropertyAssertion(Generator.generateUri(), "cs", false); assertFalse(OwlapiUtils.doesLanguageMatch(literal, assertion)); }
@Test void doesLanguageMatchForAssertionsReturnsTrueWhenLanguageIsNotSpecifiedOnAssertion() { final OWLLiteral literal = dataFactory.getOWLLiteral("test", LANG); final Assertion assertion = Assertion.createPropertyAssertion(Generator.generateUri(), false); assertTrue(OwlapiUtils.doesLanguageMatch(literal, assertion)); }
@Test void doesLanguageMatchForAssertionReturnsTrueWhenLiteralHasNoLanguageTag() { final OWLLiteral literal = dataFactory.getOWLLiteral("test"); final Assertion assertion = Assertion.createPropertyAssertion(Generator.generateUri(), LANG, false); assertTrue(OwlapiUtils.doesLanguageMatch(literal, assertion)); }
@Test void doesLanguageMatchForAssertionReturnsTrueForNonStringLiteral() { final OWLLiteral literal = dataFactory.getOWLLiteral(117); final Assertion assertion = Assertion.createPropertyAssertion(Generator.generateUri(), LANG, false); assertTrue(OwlapiUtils.doesLanguageMatch(literal, assertion)); }