Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLOntologyChange


        OWLOntology ontology = manager.createOntology();
        OWLOntologyID ontologyID = ontology.getOntologyID();
        AddAxiomData addAxiomData = new AddAxiomData(mockAxiom);
        OWLOntologyChangeRecord changeRecord = new OWLOntologyChangeRecord(
                ontologyID, addAxiomData);
        OWLOntologyChange change = changeRecord.createOntologyChange(manager);
        assertNotNull(change);
        assertEquals(change.getOntology().getOntologyID(), ontologyID);
        assertEquals(mockAxiom, change.getAxiom());
    }
View Full Code Here


                } else {
                    con = ontologyManager.getOWLDataFactory().getOWLLiteral(
                            shortForm);
                }
                if (ontology.containsEntityInSignature(ent)) {
                    OWLOntologyChange chg = new AddAxiom(ont, ontologyManager
                            .getOWLDataFactory()
                            .getOWLAnnotationAssertionAxiom(
                                    ontologyManager.getOWLDataFactory()
                                            .getOWLAnnotationProperty(
                                                    annotationIRI),
View Full Code Here

                    con = ontologyManager.getOWLDataFactory().getOWLLiteral(shortForm, languageTag);
                } else {
                    con = ontologyManager.getOWLDataFactory().getOWLLiteral(shortForm);
                }
                if (ontology.containsEntityInSignature(ent)) {
                    OWLOntologyChange chg = new AddAxiom(ont,
                            ontologyManager.getOWLDataFactory().getOWLAnnotationAssertionAxiom(ontologyManager.getOWLDataFactory().getOWLAnnotationProperty(annotationIRI), ent.getIRI(), con));
                    changes.add(chg);
                }
            }
        }
View Full Code Here

    public void shouldGenerateAddAxiom() {
        Set<OntologyAxiomPair> from = Collections.emptySet();
        Set<OntologyAxiomPair> to = Collections.singleton(pair);
        List<OWLOntologyChange> changes = generator.generateChanges(from, to);
        assertThat(changes, hasSize(1));
        OWLOntologyChange change = changes.get(0);
        assertThat(change.getOntology(), is(equalTo(ont)));
        assertThat(change.getAxiom(), is(equalTo(ax)));
        assertThat(change.isAddAxiom(), is(true));
    }
View Full Code Here

        Set<OntologyAxiomPair> from = Collections.singleton(pair);
        Set<OntologyAxiomPair> to = Collections.emptySet();
        OntologyAxiomPairChangeGenerator generator = new OntologyAxiomPairChangeGenerator();
        List<OWLOntologyChange> changes = generator.generateChanges(from, to);
        assertThat(changes, hasSize(1));
        OWLOntologyChange change = changes.get(0);
        assertThat(change.getOntology(), is(equalTo(ont)));
        assertThat(change.getAxiom(), is(equalTo(ax)));
        assertThat(change.isRemoveAxiom(), is(true));
    }
View Full Code Here

    public void shouldGenerateRemoveThenAdd() {
        Set<OntologyAxiomPair> from = Collections.singleton(pairA);
        Set<OntologyAxiomPair> to = Collections.singleton(pairB);
        List<OWLOntologyChange> changes = generator.generateChanges(from, to);
        assertThat(changes, hasSize(2));
        OWLOntologyChange change0 = changes.get(0);
        assertThat(change0.isRemoveAxiom(), is(true));
        assertThat(change0.getAxiom(), is(equalTo(ax)));
        assertThat(change0.getOntology(), is(equalTo(ontA)));


        OWLOntologyChange change1 = changes.get(1);
        assertThat(change1.isAddAxiom(), is(true));
        assertThat(change1.getAxiom(), is(equalTo(ax)));
        assertThat(change1.getOntology(), is(equalTo(ontB)));
    }
View Full Code Here

   *            add - true - add; false - delete
   */
  public static void updateOntology(OWLOntology ontology, Collection<? extends OWLAxiom> axioms, boolean add) {
    List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>();
    for( OWLAxiom axiom : axioms ) {
      OWLOntologyChange change = add
        ? new AddAxiom( ontology, axiom )
        : new RemoveAxiom( ontology, axiom );
      changes.add( change );
    }
    manager.applyChanges( changes );
View Full Code Here

 
  public static List<OWLOntologyChange> createChanges(OWLOntology ontology,
      Collection<? extends OWLAxiom> axioms, boolean add) {
    List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>();
    for( OWLAxiom axiom : axioms ) {
      OWLOntologyChange change = add
        ? new AddAxiom( ontology, axiom )
        : new RemoveAxiom( ontology, axiom );
      changes.add( change );
    }
View Full Code Here

   *            add - true - add; false - delete
   */
  public static void updateOntology(OWLOntology ontology, Collection<? extends OWLAxiom> axioms, boolean add) {
    List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>();
    for( OWLAxiom axiom : axioms ) {
      OWLOntologyChange change = add
        ? new AddAxiom( ontology, axiom )
        : new RemoveAxiom( ontology, axiom );
      changes.add( change );
    }
    manager.applyChanges( changes );
View Full Code Here

            IRI versionIri = id.getVersionIRI();
            if (versionIri == null) {
                log.info("    No OWL version IRI Found . Will set to own ID. ");
                versionIri = IRI.create(getNamespace() + getID());
                OWLOntologyID newId = new OWLOntologyID(ontologyIRI, versionIri);
                OWLOntologyChange change = new SetOntologyID(ontology, newId);
                ontology.getOWLOntologyManager().applyChange(change);
                log.info("    Set OWL version IRI : {} . ", versionIri);
            } else log.info("    Found OWL version IRI {} . Will not claim ownership. ", versionIri);
        }
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.model.OWLOntologyChange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.