Example #1
0
  /** tries to determine the file name from getSourceURI */
  public static void saveModel(Model m, RDFSerializer s)
      throws FileNotFoundException, IOException, ModelException, SerializationException {

    // URI to filename
    URL url = null;
    try {
      url = new URL(m.getSourceURI());
    } catch (Exception any) {
      throw new ModelException("RDFUtil: cannot determine model file name: " + m.getSourceURI());
    }
    if ("file".equals(url.getProtocol()))
      saveModel(m, url.getFile().replace('/', File.separatorChar), s);
    else
      throw new ModelException("RDFUtil: cannot save to non-file model URI: " + m.getSourceURI());
  }