Search in sources :

Example 1 with RDFReader

use of org.apache.jena.rdf.model.RDFReader in project jena by apache.

the class ExceptionTests method testExceptionWarning.

public void testExceptionWarning() {
    try {
        Model m = ModelFactory.createDefaultModel();
        RDFReader rdr = m.getReader();
        rdr.setErrorHandler(this);
        rdr.read(m, "file:testing/arp/qname-in-ID/bug74_0.rdf");
        fail("Warning did not throw exception with non-standard handler");
    } catch (JenaException e) {
    }
}
Also used : JenaException(org.apache.jena.shared.JenaException) Model(org.apache.jena.rdf.model.Model) RDFReader(org.apache.jena.rdf.model.RDFReader)

Example 2 with RDFReader

use of org.apache.jena.rdf.model.RDFReader in project jena by apache.

the class ExceptionTests method testExceptionError.

public void testExceptionError() {
    try {
        Model m = ModelFactory.createDefaultModel();
        RDFReader rdr = m.getReader();
        rdr.setErrorHandler(this);
        rdr.read(m, "file:testing/wg/rdfms-abouteach/error002.rdf");
        fail("Error did not throw exception with non-standard handler");
    } catch (JenaException e) {
    }
}
Also used : JenaException(org.apache.jena.shared.JenaException) Model(org.apache.jena.rdf.model.Model) RDFReader(org.apache.jena.rdf.model.RDFReader)

Example 3 with RDFReader

use of org.apache.jena.rdf.model.RDFReader in project jena by apache.

the class ExceptionTests method testDefaultPromotedError.

public void testDefaultPromotedError() {
    RDFDefaultErrorHandler.silent = true;
    try {
        Model m = ModelFactory.createDefaultModel();
        RDFReader rdr = m.getReader();
        rdr.setProperty("ERR_BAD_RDF_ATTRIBUTE", "EM_FATAL");
        rdr.read(m, "file:testing/wg/rdfms-abouteach/error002.rdf");
        fail("Promoted error did not throw exception");
    } catch (JenaException e) {
    //		System.err.println(e.getMessage());
    } finally {
        RDFDefaultErrorHandler.silent = false;
    }
}
Also used : JenaException(org.apache.jena.shared.JenaException) Model(org.apache.jena.rdf.model.Model) RDFReader(org.apache.jena.rdf.model.RDFReader)

Example 4 with RDFReader

use of org.apache.jena.rdf.model.RDFReader in project jena by apache.

the class MoreTests method testLatin1.

public void testLatin1() throws IOException {
    Model m = createMemModel();
    RDFReader rdr = m.getReader();
    InputStream r = new FileInputStream("testing/arp/i18n/latin1.rdf");
    rdr.setErrorHandler(this);
    expected = new int[] { WARN_NONCANONICAL_IANA_NAME };
    rdr.read(m, r, "http://example.org/");
    checkExpected();
}
Also used : Model(org.apache.jena.rdf.model.Model) RDFReader(org.apache.jena.rdf.model.RDFReader)

Example 5 with RDFReader

use of org.apache.jena.rdf.model.RDFReader in project jena by apache.

the class MoreTests method testARPMacArabic.

public void testARPMacArabic() throws IOException {
    Model m = createMemModel();
    RDFReader rdr = m.getReader();
    InputStream r = new FileInputStream("testing/arp/i18n/arabic-macarabic.rdf");
    rdr.setErrorHandler(this);
    expected = new int[] { WARN_UNSUPPORTED_ENCODING, WARN_NON_IANA_ENCODING };
    expected[Charset.isSupported("MacArabic") ? 0 : 1] = 0;
    //		 Only one of the warnings is expected, which depends on Java version
    rdr.read(m, r, "http://example.org/");
    checkExpected();
}
Also used : Model(org.apache.jena.rdf.model.Model) RDFReader(org.apache.jena.rdf.model.RDFReader)

Aggregations

RDFReader (org.apache.jena.rdf.model.RDFReader)34 Model (org.apache.jena.rdf.model.Model)30 JenaException (org.apache.jena.shared.JenaException)8 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)2 SAX2Model (org.apache.jena.rdfxml.xmlinput.SAX2Model)2 StringReader (java.io.StringReader)1 IRIFactory (org.apache.jena.iri.IRIFactory)1 TurtleParseException (org.apache.jena.n3.turtle.TurtleParseException)1 TurtleReader (org.apache.jena.n3.turtle.TurtleReader)1 RDFWriter (org.apache.jena.rdf.model.RDFWriter)1 RecordingModelListener (org.apache.jena.rdf.model.test.helpers.RecordingModelListener)1 RDFEHArray (org.apache.jena.rdfxml.xmlinput.SAX2RDFTest.RDFEHArray)1 BadURIException (org.apache.jena.shared.BadURIException)1 ConfigException (org.apache.jena.shared.ConfigException)1 InvalidPropertyURIException (org.apache.jena.shared.InvalidPropertyURIException)1 NoReaderForLangException (org.apache.jena.shared.NoReaderForLangException)1 SAXParser (org.apache.xerces.parsers.SAXParser)1 InputSource (org.xml.sax.InputSource)1 SAXParseException (org.xml.sax.SAXParseException)1