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

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


                   + "]", m.isIsomorphicWith(m1));
        checkExpected();
    }
    public void testRelativeBaseParamError() throws IOException {
        Model m = createMemModel();
        RDFReader rdr = m.getReader();
        try (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/");
        }
        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();
        try (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/");
        }

        try (FileInputStream fin = new FileInputStream("testing/wg/rdfms-identity-anon-resources/test001.rdf")) {
            rdr.read(m1, fin, "");
        }
        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();
        try (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");
        }
        try (FileInputStream fin = new FileInputStream("testing/wg/rdfms-identity-anon-resources/test001.rdf")) {
            rdr.read(m1, fin, "");
        }
        assertTrue("Bad base URI should have no effect.[" + m1.toString()+ "]",
                   m.isIsomorphicWith(m1));
        checkExpected();
    }
View Full Code Here

  {
        Model model = ModelFactory.createDefaultModel() ;
      IRIFactory f = ARPOptions.getIRIFactoryGlobal() ;
      try {
          ARPOptions.setIRIFactoryGlobal(IRIFactory.iriImplementation()) ;
          RDFReader r =  model.getReader("RDF/XML") ;
            expected = new int[] { WARN_MALFORMED_URI , WARN_MALFORMED_URI };
          r.setErrorHandler(this);
          r.read(model, new StringReader(RDF_TEXT), "http://example/") ;
      } finally { ARPOptions.setIRIFactoryGlobal(f) ; }
        checkExpected() ;
  }         
View Full Code Here

  }         

    public void testIRIRules_2a()
    {
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader r =  model.getReader("RDF/XML") ;
        r.setErrorHandler(this);
        expected = new int[] { };
        model.read(new StringReader(RDF_TEXT), "http://example/") ;
        checkExpected() ;
    }          
View Full Code Here

    }          
 
    public void testIRIRules_3()
    {
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader r =  model.getReader("RDF/XML") ;
        r.setErrorHandler(this);
        expected = new int[] { WARN_MALFORMED_URI , WARN_MALFORMED_URI };
        r.setProperty("iri-rules", "strict") ;
        r.read(model, new StringReader(RDF_TEXT), "http://example/") ;
        checkExpected() ;
    }          
View Full Code Here

    }          

    public void testIRIRules_4()
    {
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader r =  model.getReader("RDF/XML") ;
        r.setProperty("iri-rules", "strict") ;
        r.setProperty( "WARN_MALFORMED_URI", ARPErrorNumbers.EM_ERROR) ;
        r.setErrorHandler(this);
        expected = new int[] { WARN_MALFORMED_URI , WARN_MALFORMED_URI };   // Errors actually continue.
        r.read(model, new StringReader(RDF_TEXT), "http://example/") ;
        checkExpected() ;
    }
View Full Code Here

    /**
     * Test to ensure that the reader is set.
     */
    public void testGetNTripleReader() {
        final RDFReader reader = model.getReader("N-TRIPLE") ;
        Assert.assertNotNull(reader) ;
    }
View Full Code Here

            // that's what we expect
        }

        try {
            model.setReaderClassName("foobar", com.hp.hpl.jena.rdf.arp.JenaReader.class.getName()) ;
            final RDFReader reader = model.getReader("foobar") ;
            Assert.assertTrue("Wrong reader type", reader instanceof com.hp.hpl.jena.rdf.arp.JenaReader) ;
        }
        finally {
            // unset the reader
            model.setReaderClassName("foobar", "") ;
View Full Code Here

    String filebase = "testing/regression/testWriterAndReader/";
    if (showProgress)
      System.out.println("Beginning " + test);
    Random random = new Random(seed);

        RDFReader rdfRdr = m1.getReader( rwLang );
    RDFWriter rdfWtr = m1.getWriter( rwLang );

    setWriterOptionsAndHandlers( wopName, wopVal, rdfRdr, rdfWtr );
    for (int variationIndex = 0; variationIndex < variationMax; variationIndex++)
      testVariation( filebase, random, rdfRdr, rdfWtr );
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.