Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLOntologyManager.applyChanges()


        // Changes needed for removal will be prepared
        for (OWLNamedIndividual ind : o.getIndividualsInSignature()) {
            ind.accept(remover);
        }
        // Now apply the changes
        m.applyChanges(remover.getChanges());
        int size = o.getIndividualsInSignature().size();
        assertTrue(previousNumberOfIndividuals + " supposed to be larger than "
                + size, previousNumberOfIndividuals > size);
    }
View Full Code Here


        // be applied to remove all of the individuals that we have visited from
        // the pizza ontology. Notice that "batch" deletes can essentially be
        // performed - we simply visit all of the classes, properties and
        // individuals that we want to remove and then apply ALL of the changes
        // after using the entity remover to collect them
        man.applyChanges(remover.getChanges());
        // System.out.println("Number of individuals: "
        // + ont.getIndividualsInSignature().size());
        // At this point, if we wanted to reuse the entity remover, we would
        // have to reset it
        remover.reset();
View Full Code Here

                .getOWLImportsDeclaration(IRI.create(ontologyByVersion))));
        changes.add(new AddImport(ontology2, factory
                .getOWLImportsDeclaration(IRI.create(ontologyByName))));
        changes.add(new AddImport(ontology2, factory
                .getOWLImportsDeclaration(IRI.create(ontologyByOtherPath))));
        manager.applyChanges(changes);
        manager.saveOntology(ontology1, IRI.create(importsBothNameAndVersion));
        manager.saveOntology(ontology2, IRI.create(importsBothNameAndOther));
        // when
        OWLOntology o1 = m.loadOntology(IRI.create(importsBothNameAndVersion));
        OWLOntology o2 = m1.loadOntology(IRI.create(importsBothNameAndOther));
View Full Code Here

            for (String scopeID : attachedScopes) {
                IRI physIRI = IRI.create(scopePrefix + scopeID);
                changes.add(new AddImport(target, df.getOWLImportsDeclaration(physIRI)));
            }
            // Commit
            ontologyManager.applyChanges(changes);
        }
    }

    @Override
    public void clearScopes() {
View Full Code Here

            OWLNamedIndividual iScope = __factory.getOWLNamedIndividual(IRI.create(scope
                    .getDefaultNamespace() + scope.getID()));
            OWLAxiom ax = __factory.getOWLClassAssertionAxiom(cScope, iScope);
            additions.add(new AddAxiom(ont, ax));
        }
        mgr.applyChanges(additions);

        return ont;
    }

}
View Full Code Here

                spc = getCoreSpace();
                if (spc != null && spc.listManagedOntologies().size() > 0) {
                    IRI spaceIri = IRI.create(universalPrefix + spc.getID());
                    additions.add(new AddImport(ont, df.getOWLImportsDeclaration(spaceIri)));
                }
                mgr.applyChanges(additions);
            }
        } catch (OWLOntologyCreationException e) {
            log.error("Failed to generate an OWL form of scope " + getID(), e);
            ont = null;
        }
View Full Code Here

                for (OWLOntologyID ontologyId : managedOntologies) {
                    // XXX some day the versionIRI will be the only physical reference for the ontology
                    IRI physIRI = IRI.create(base + OntologyUtils.encode(ontologyId));
                    changes.add(new AddImport(root, df.getOWLImportsDeclaration(physIRI)));
                }
                ontologyManager.applyChanges(changes);
            }

        }
        log.debug("OWL export of {} completed in {} ms.", getID(), System.currentTimeMillis() - before);
View Full Code Here

            for (String id : sessionManager.getRegisteredSessionIDs()) {
                IRI sessionid = IRI.create(sessionManager.getDefaultNamespace() + sessionManager.getID() + "/" + id);
                OWLNamedIndividual ind = df.getOWLNamedIndividual(sessionid);
                changes.add(new AddAxiom(o, df.getOWLClassAssertionAxiom(cSession, ind)));
            }
            ontMgr.applyChanges(changes);
        } catch (OWLOntologyCreationException e) {
            throw new WebApplicationException(e, INTERNAL_SERVER_ERROR);
        }
        ResponseBuilder rb = Response.ok(o);
        MediaType mediaType = MediaTypeUtil.getAcceptableMediaType(headers, null);
View Full Code Here

    {
      for (OWLAxiom ax : ontology.getAxioms()) {
        changes.add(new AddAxiom(merged, ax));
      }
    }
    newManager.applyChanges(changes);
    return newManager;
  }


  private void printStats(OWLOntologyManager manager) {
View Full Code Here

        OWLNamedIndividual iSes = __factory.getOWLNamedIndividual(IRI.create(session.getID()));
        additions.add(new AddAxiom(ont, __factory.getOWLClassAssertionAxiom(cSession, iSes)));
        OWLDatatype anyURI = __factory.getOWLDatatype(IRI.create("http://www.w3.org/2001/XMLSchema#anyURI"));
        OWLLiteral hasIdValue = __factory.getOWLTypedLiteral(session.getID().toString(), anyURI);
        additions.add(new AddAxiom(ont, __factory.getOWLDataPropertyAssertionAxiom(hasId, iSes, hasIdValue)));
        mgr.applyChanges(additions);

        StringDocumentTarget tgt = new StringDocumentTarget();
        try {
            mgr.saveOntology(ont, new RDFXMLOntologyFormat(), tgt);
            return ont;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.