Exemplo n.º 1
0
  /** Removes all triples which have something to do with the given namespace */
  public static Model removeNamespace(String ns, Model m) throws ModelException {

    Model res = m.duplicate();
    for (Enumeration en = m.duplicate().elements(); en.hasMoreElements(); ) {

      Statement t = (Statement) en.nextElement();
      if (t.subject().toString().startsWith(ns)
          || t.predicate().toString().startsWith(ns)
          || t.object().toString().startsWith(ns)) {
        //      System.err.println("REMOVING TRIPLE: " + t);
        res.remove(t);
      }
    }
    return res;
  }