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

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


//        Normalizer.  isNormalized(
//                "\u0bcd\u0ba4\u0bbf\u0baf\u0bbe"
//                ,Normalizer.NFC,0);
       
      Model m = createMemModel();
      RDFReader rdr = m.getReader();
      FileInputStream r = new FileInputStream(
          "testing/arp/i18n/icubugtwo.rdf");
      rdr.setErrorHandler(this);
      expected = new int[] { WARN_STRING_NOT_NORMAL_FORM_C };
      rdr.read(m, r, "http://example.org/");
      r.close();
      checkExpected();
   
    }
View Full Code Here


    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

   
    @Override
    public void runTest()
    {
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader t = new TurtleReader() ;
        try {
            if ( baseIRI != null )
                t.read(model, FileManager.get().open(input), baseIRI) ;
            else
                t.read(model, input)
            // "http://www.w3.org/2001/sw/DataAccess/df1/tests/rdfq-results.ttl"

            String syntax = FileUtils.guessLang(output, FileUtils.langNTriple) ;
           
            Model results = FileManager.get().loadModel(output, syntax);
View Full Code Here

    Model m = ModelFactory.createDefaultModel();
    Model m2 = ModelFactory.createDefaultModel();
    InputStream in = new FileInputStream(
        "testing/wg/rdfms-xmllang/test004.rdf");
    RDFEHArray eh = new RDFEHArray();
    RDFReader w = m.getReader();
    w.setErrorHandler(eh);
    w.read(m, in, "http://example.org/");
    in.close();
    in = new FileInputStream("testing/wg/rdfms-xmllang/test003.rdf");

    RDFEHArray eh2 = new RDFEHArray();
View Full Code Here

        return new TestSuite(TestTurtleReader.class, "Basic Turtle tests") ;
    }
   
    public void test0()
    {
        RDFReader r = ModelFactory.createDefaultModel().getReader("Turtle") ;
        assertNotNull(r) ;
    }
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.