Package com.hp.hpl.jena.rdf.model

Examples of com.hp.hpl.jena.rdf.model.RDFReader


    if (r.getEncoding().startsWith("UTF")) {
      // see above for warning message.
      return;
    }
    Model m = createMemModel();
    RDFReader rdr = m.getReader();
   
    rdr.setErrorHandler(this);
    expected = new int[] { WARN_ENCODING_MISMATCH, ERR_ENCODING_MISMATCH };
    rdr.read(m, r, "http://example.org/");

    checkExpected();
  }
View Full Code Here


  }

  public void testNullBaseParamOK() throws IOException {
    Model m = createMemModel();
    Model m1 = createMemModel();
    RDFReader rdr = m.getReader();
    FileInputStream fin = new FileInputStream(
        "testing/wg/rdfms-identity-anon-resources/test001.rdf");

    rdr.setErrorHandler(this);
    expected = new int[] {};
    rdr.read(m, fin, "http://example.org/");
    fin.close();
    fin = new FileInputStream(
        "testing/wg/rdfms-identity-anon-resources/test001.rdf");
    rdr.read(m1, fin, null);
    fin.close();
    assertTrue("Base URI should have no effect.", m.isIsomorphicWith(m1));
    checkExpected();
  }
View Full Code Here

        assertTrue("Dan Bri nested XML Base.", m.isIsomorphicWith(m1));
    }

  public void testNullBaseParamError() throws IOException {
    Model m = createMemModel();
    RDFReader rdr = m.getReader();
    FileInputStream fin = new FileInputStream(
        "testing/wg/rdfms-difference-between-ID-and-about/test1.rdf");
    rdr.setErrorHandler(this);
    expected = new int[] { ERR_RESOLVING_URI_AGAINST_NULL_BASE, WARN_RELATIVE_URI};
    rdr.read(m, fin, null);
    fin.close();
    checkExpected();
  }
View Full Code Here

  }

  public void testEmptyBaseParamOK() throws IOException {
    Model m = createMemModel();
    Model m1 = createMemModel();
    RDFReader rdr = m.getReader();
    FileInputStream fin = new FileInputStream(
        "testing/wg/rdfms-identity-anon-resources/test001.rdf");

    rdr.setErrorHandler(this);
    expected = new int[] {};
    rdr.read(m, fin, "http://example.org/");
    fin.close();
    fin = new FileInputStream(
        "testing/wg/rdfms-identity-anon-resources/test001.rdf");
    rdr.read(m1, fin, "");
    fin.close();
    assertTrue("Empty base URI should have no effect.[" + m1.toString()
        + "]", m.isIsomorphicWith(m1));
    checkExpected();
  }
View Full Code Here

    checkExpected();
  }

  public void testEmptyBaseParamError() throws IOException {
    Model m = createMemModel();
    RDFReader rdr = m.getReader();
    FileInputStream fin = new FileInputStream(
        "testing/wg/rdfms-difference-between-ID-and-about/test1.rdf");
    rdr.setErrorHandler(this);
    expected = new int[] { WARN_RESOLVING_URI_AGAINST_EMPTY_BASE};
    rdr.read(m, fin, "");
    fin.close();
    Model m1 = createMemModel();
    m1.createResource("#foo").addProperty(RDF.value, "abc");
    assertTrue("Empty base URI should produce relative URI.["
        + m.toString() + "]", m.isIsomorphicWith(m1));
View Full Code Here

    checkExpected();
  }

    public void testBadBaseParamError() throws IOException {
        Model m = createMemModel();
        RDFReader rdr = m.getReader();
        FileInputStream fin = new FileInputStream(
                "testing/wg/rdfms-difference-between-ID-and-about/test1.rdf");
        rdr.setErrorHandler(this);
        expected = new int[] { WARN_MALFORMED_URI,
                WARN_MALFORMED_URI,
//        WARN_RELATIVE_URI, ERR_RESOLVING_AGAINST_MALFORMED_BASE};
               ERR_RESOLVING_AGAINST_MALFORMED_BASE};
        rdr.read(m, fin, "http://jjc^3.org/demo.mp3");
        fin.close();
        Model m1 = createMemModel();
        assertTrue("Bad base URI should produce no URIs in model.["
                + m.toString() + "]", m.isIsomorphicWith(m1));
        checkExpected();
View Full Code Here

    }
   
    public void testBadBaseParamOK() throws IOException {
        Model m = createMemModel();
        Model m1 = createMemModel();
        RDFReader rdr = m.getReader();
        FileInputStream fin = new FileInputStream(
                "testing/wg/rdfms-identity-anon-resources/test001.rdf");

        rdr.setErrorHandler(this);
        expected = new int[] { WARN_MALFORMED_URI };
        rdr.read(m, fin, "http://jjc^3.org/demo.mp3");
        fin.close();
        fin = new FileInputStream(
                "testing/wg/rdfms-identity-anon-resources/test001.rdf");
        rdr.read(m1, fin, "");
        fin.close();
        assertTrue("Bad base URI should have no effect on model.[" + m1.toString()
                + "]", m.isIsomorphicWith(m1));
        checkExpected();
    }
View Full Code Here

                + "]", m.isIsomorphicWith(m1));
        checkExpected();
    }
    public void testRelativeBaseParamError() throws IOException {
        Model m = createMemModel();
        RDFReader rdr = m.getReader();
        FileInputStream fin = new FileInputStream(
                "testing/wg/rdfms-difference-between-ID-and-about/test1.rdf");
        rdr.setErrorHandler(this);
        expected = new int[] { WARN_RELATIVE_URI, WARN_RELATIVE_URI,  ERR_RESOLVING_AGAINST_RELATIVE_BASE, };
        rdr.setProperty("ERR_RESOLVING_AGAINST_RELATIVE_BASE","EM_WARNING");
        rdr.read(m, fin, "foo/");
        fin.close();
        Model m1 = createMemModel();
        m1.createResource("foo/#foo").addProperty(RDF.value, "abc");
        assertTrue("Relative base URI should produce relative URIs in model (when error suppressed).["
                + m.toString() + "]", m.isIsomorphicWith(m1));
View Full Code Here

    }
   
    public void testRelativeBaseParamOK() throws IOException {
        Model m = createMemModel();
        Model m1 = createMemModel();
        RDFReader rdr = m.getReader();
        FileInputStream fin = new FileInputStream(
                "testing/wg/rdfms-identity-anon-resources/test001.rdf");

        rdr.setErrorHandler(this);
        expected = new int[] { WARN_RELATIVE_URI };
        rdr.read(m, fin, "foo/");
        fin.close();
        fin = new FileInputStream(
                "testing/wg/rdfms-identity-anon-resources/test001.rdf");
        rdr.read(m1, fin, "");
        fin.close();
        assertTrue("Bad base URI should have no effect on model.[" + m1.toString()
                + "]", m.isIsomorphicWith(m1));
        checkExpected();
    }
View Full Code Here

    }

    public void testBaseTruncation() throws IOException {
        Model m = createMemModel();
        Model m1 = createMemModel();
        RDFReader rdr = m.getReader();
        FileInputStream fin = new FileInputStream(
                "testing/wg/rdfms-identity-anon-resources/test001.rdf");

        rdr.setErrorHandler(this);
        expected = new int[] { WARN_MALFORMED_URI, WARN_RELATIVE_URI };
        rdr.read(m, fin, "ht#tp://jjc3.org/demo.mp3#frag");
        fin.close();
        fin = new FileInputStream(
                "testing/wg/rdfms-identity-anon-resources/test001.rdf");
        rdr.read(m1, fin, "");
        fin.close();
        assertTrue("Bad base URI should have no effect.[" + m1.toString()
                + "]", m.isIsomorphicWith(m1));
        checkExpected();
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.rdf.model.RDFReader

Copyright © 2018 www.massapicom. 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.