Example #1
0
 public OntModel applyRenamings() {
   OntModel result = ModelFactory.createMem();
   Graph graph = result.getGraph();
   Iterator it = model.getGraph().find(Triple.ANY);
   while (it.hasNext()) {
     Triple t = (Triple) it.next();
     Node s = t.getSubject().isURI() ? rename(t.getSubject()) : null;
     Node o = t.getObject().isURI() ? rename(t.getObject()) : null;
     if (s != null || o != null)
       t =
           Triple.create(
               s != null ? s : t.getSubject(), t.getPredicate(), o != null ? o : t.getObject());
     graph.add(t);
   }
   return result;
 }
Example #2
0
 public NamespaceChanger(OntModel model, String namespace) {
   this.model = model;
   this.namespace = namespace;
   this.replace = model.getValidOntology().getURI();
   this.replaceNS = replace + "#";
 }