robot-core/src/test/java/org/obolibrary/robot/OntologyHelperTest.java
@Test
  public void testOntologyAnnotations() throws IOException {
    IOHelper ioHelper = new IOHelper();

    OWLOntology simple = loadOntology("/simple.owl");
    assertEquals(0, simple.getAnnotations().size());

    // Add plain literal
    OntologyHelper.addOntologyAnnotation(
        simple, ioHelper.createIRI(base + "foo"), IOHelper.createLiteral("FOO"));
    assertEquals(1, simple.getAnnotations().size());

    OWLAnnotation annotation = simple.getAnnotations().iterator().next();
    assertEquals(base + "foo", annotation.getProperty().getIRI().toString());
    assertEquals("FOO", OntologyHelper.getValue(annotation.getValue()));

    OntologyHelper.removeOntologyAnnotations(simple);
    assertEquals(0, simple.getAnnotations().size());
  }
/**
   * Test adding and removing annotations from and ontology.
   *
   * @throws IOException on file problem
   */
Test adding and removing annotations from and ontology.
@throws IOException on file problem
Test adding and removing annotations from and ontology . @throws IOException on file problem
@Test
  public void testOntologyAnnotations() throws IOException {
    IOHelper ioHelper = new IOHelper();
    OWLOntology simple = loadOntology("/simple.owl");
    assertEquals(0, simple.getAnnotations().size());
    OntologyHelper.addOntologyAnnotation(
        simple, ioHelper.createIRI(base + "foo"), IOHelper.createLiteral("FOO"));
    assertEquals(1, simple.getAnnotations().size());
    OWLAnnotation annotation = simple.getAnnotations().iterator().next();
    assertEquals(base + "foo", annotation.getProperty().getIRI().toString());
    assertEquals("FOO", OntologyHelper.getValue(annotation.getValue()));
    OntologyHelper.removeOntologyAnnotations(simple);
    assertEquals(0, simple.getAnnotations().size());
  }
@ Test public void testOntologyAnnotations ( ) throws IOException { IOHelper ioHelper = new IOHelper ( ) ; OWLOntology simple = loadOntology ( "/simple.owl" ) ; assertEquals ( 0 , simple . getAnnotations ( ) . size ( ) ) ; OntologyHelper . addOntologyAnnotation ( simple , ioHelper . createIRI ( base + "foo" ) , IOHelper . createLiteral ( "FOO" ) ) ; assertEquals ( 1 , simple . getAnnotations ( ) . size ( ) ) ; OWLAnnotation annotation = simple . getAnnotations ( ) . iterator ( ) . next ( ) ; assertEquals ( base + "foo" , annotation . getProperty ( ) . getIRI ( ) . toString ( ) ) ; assertEquals ( "FOO" , OntologyHelper . getValue ( annotation . getValue ( ) ) ) ; OntologyHelper . removeOntologyAnnotations ( simple ) ; assertEquals ( 0 , simple . getAnnotations ( ) . size ( ) ) ; }
Test adding and removing annotations from and ontology.
Test adding and removing annotations from and ontology .
// Add plain literal