Package org.ontoware.rdf2go.model

Examples of org.ontoware.rdf2go.model.Model.readFrom()


    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    InputStream in = cl.getResourceAsStream(resourceName);
    Model model = RDF2Go.getModelFactory().createModel();
    model.open();
    try {
      model.readFrom(in);
    } catch (ModelRuntimeException e) {
      throw new RuntimeException(e);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
View Full Code Here


      fis = new FileInputStream(f);

      Syntax syntax = Syntax.forFileName(filename);
   
      try {
        m.readFrom(fis, syntax);
      } catch (ModelRuntimeException e) {
        throw new RuntimeException(e);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
View Full Code Here

    // has elements
    // finally close the model and find out if it truly is closed
    InputStream foafStream = TestData.getFoafAsStream();
    Assert.assertNotNull(foafStream);
    Assert.assertEquals(0, model.size());
    model.readFrom(foafStream);
    Assert.assertTrue(model.size() > 0);
    model.close();
    Assert.assertFalse(model.isOpen());
  }
 
View Full Code Here

      ModelRuntimeException {
    Model result = factory.createModel();
    result.open();
    InputStream in = getFoafAsStream();
    try {
      result.readFrom(in);
    } finally {
      in.close();
    }
    return result;
  }
View Full Code Here

      ModelRuntimeException {
    Model result = factory.createModel();
    result.open();
    InputStream in = getICALAsStream();
    try {
      result.readFrom(in);
    } finally {
      in.close();
    }
    return result;
  }
View Full Code Here

  public static Model stringToModel(String string, Syntax syntax) {
    Model m = RDF2Go.getModelFactory().createModel();
    m.open();
    StringReader s = new StringReader(string);
    try {
      m.readFrom(s, syntax);
      return m;
    } catch(Exception e) {
      throw new ModelRuntimeException(e);
    } finally {
      s.close();
View Full Code Here

  public static Model loadFoaf(ModelFactory factory) throws IOException, ModelRuntimeException {
    Model result = factory.createModel();
    result.open();
    InputStream in = getFoafAsStream();
    try {
      result.readFrom(in);
    } finally {
      in.close();
    }
    return result;
  }
View Full Code Here

  public static Model loadICAL(ModelFactory factory) throws IOException, ModelRuntimeException {
    Model result = factory.createModel();
    result.open();
    InputStream in = getICALAsStream();
    try {
      result.readFrom(in);
    } finally {
      in.close();
    }
    return result;
  }
View Full Code Here

    m.open();
    FileReader fr = null;
    FileWriter fw = null;
    try {
      fr = new FileReader(in);
      m.readFrom(fr, inSyntax);
      fw = new FileWriter(out);
      m.writeTo(fw, outSyntax);
     
    } catch(ModelRuntimeException e) {
      throw new RuntimeException(e);
View Full Code Here

  public static Model loadFromFile(File in, Syntax inSyntax) throws ModelRuntimeException,
          IOException {
    Model model = RDF2Go.getModelFactory().createModel();
    model.open();
    FileInputStream fin = new FileInputStream(in);
    model.readFrom(fin, inSyntax);
    return model;
  }
 
  /**
   * Convenience method to load data from file in in syntax inSyntax and write
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.