@Override
 protected final OWLOntology createOntology() {
   OWLOntology ont = getOWLOntology("Ont");
   axioms.clear();
   axioms.addAll(createAxioms());
   getManager().addAxioms(ont, axioms);
   for (OWLEntity entity : ont.getSignature()) {
     if (!entity.isBuiltIn()) {
       if (!ont.isDeclared(entity, true)) {
         getManager().addAxiom(ont, getFactory().getOWLDeclarationAxiom(entity));
       }
     }
   }
   return ont;
 }
Exemplo n.º 2
0
  public KuabaRepository copy(KuabaRepository kr, String url, File destination) {
    IRI iri;
    if (url == null) iri = IRI.generateDocumentIRI();
    else iri = IRI.create(url);

    try {
      OWLOntology model = (OWLOntology) kr.getModel();
      OWLOntology inst = manager.createOntology(iri);

      OntologyMigrator migrator = new OntologyMigrator(manager, model, inst);
      migrator.performMigration();

      EntityFindAndReplaceURIRenamer renamer =
          new EntityFindAndReplaceURIRenamer(
              manager,
              inst.getSignature(false),
              Collections.singleton(inst),
              model.getOntologyID().getOntologyIRI().toString(),
              iri.toString());

      if (renamer.hasErrors()) System.err.println("ERRO durante a cópia - rename");

      manager.applyChanges(renamer.getChanges());

      KuabaRepository repo = new OwlApiKuabaRepository(inst, manager.getOWLDataFactory());
      repoMap.put(inst.getOntologyID().getOntologyIRI(), repo);
      fileMap.put(repo, destination);

      return repo;

    } catch (OWLOntologyCreationException ex) {
      System.err.println("ERRO em copy");
      Logger.getLogger(OwlApiFileGateway.class.getName()).log(Level.SEVERE, null, ex);
    }

    return null;
  }
 @Override
 public Set<OWLEntity> getObjects(OWLOntology ontology) {
   return ontology.getSignature();
 }