Package org.openjena.riot.system

Examples of org.openjena.riot.system.JenaWriterRdfJson


    private void testJenaWriterRdfJson()
    {
      Model results = FileManager.get().loadModel(output) ;

        RDFWriter writer = new JenaWriterRdfJson() ;
        ByteArrayOutputStream baos = new ByteArrayOutputStream() ;
        writer.write(results, baos, baseIRI) ;

        InputStream in = new ByteArrayInputStream(baos.toByteArray()) ;
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader reader = new JenaReaderRdfJson() ;
        try {
            if ( baseIRI != null )
            {
                Reader r = PeekReader.makeUTF8(in) ;
                reader.read(model, r, baseIRI) ;
            }
            else
                reader.read(model, in, null)

            boolean b = model.isIsomorphicWith(results) ;
            if ( !b )
            {
              write ( model, results ) ;
                System.out.println("---- Parsed");
                // model.write(System.out, "RDF/JSON") ;
                writer.write(model, System.out, baseIRI) ; // for now, until the plumbing with Jena gets released. See JENA-135
                System.out.println("---- Expected");
                // results.write(System.out, "RDF/JSON") ;
                writer.write(results, System.out, baseIRI) ;
                System.out.println("--------");
            }
           
            assertTrue("Models not isomorphic", b) ;
        } catch (RiotParseException ex)
View Full Code Here


    }

    private void write (Model parsed, Model expected)
    {
      // This is temporary, until the plumbing with Jena gets released (or ARQ depends on the jena-core SNAPSHOT). See: JENA-135
      RDFWriter writer = new JenaWriterRdfJson() ;
        System.out.println("---- Parsed");
        // parsed.write(System.out, "RDF/JSON") ;
        writer.write(parsed, System.out, baseIRI) ;
        System.out.println("---- Expected");
        // expected.write(System.out, "RDF/JSON") ;
        writer.write(expected, System.out, baseIRI) ;
        System.out.println("--------");
    }
View Full Code Here

    private void testJenaWriterRdfJson()
    {
      Model results = FileManager.get().loadModel(output) ;

        RDFWriter writer = new JenaWriterRdfJson() ;
        ByteArrayOutputStream baos = new ByteArrayOutputStream() ;
        writer.write(results, baos, baseIRI) ;

        // Parse the JSON back to make sure we always write valid JSON
        JSON.parse(new ByteArrayInputStream(baos.toByteArray())) ;

        InputStream in = new ByteArrayInputStream(baos.toByteArray()) ;
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader reader = new JenaReaderRdfJson() ;
        try {
            if ( baseIRI != null )
            {
                Reader r = PeekReader.makeUTF8(in) ;
                reader.read(model, r, baseIRI) ;
            }
            else
                reader.read(model, in, null)

            boolean b = model.isIsomorphicWith(results) ;
            if ( !b )
            {
              write ( model, results ) ;
                System.out.println("---- Parsed");
                // model.write(System.out, "RDF/JSON") ;
                writer.write(model, System.out, baseIRI) ; // for now, until the plumbing with Jena gets released. See JENA-135
                System.out.println("---- Expected");
                // results.write(System.out, "RDF/JSON") ;
                writer.write(results, System.out, baseIRI) ;
                System.out.println("--------");
            }
           
            assertTrue("Models not isomorphic", b) ;
        } catch (RiotParseException ex)
View Full Code Here

    }

    private void write (Model parsed, Model expected)
    {
      // This is temporary, until the plumbing with Jena gets released (or ARQ depends on the jena-core SNAPSHOT). See: JENA-135
      RDFWriter writer = new JenaWriterRdfJson() ;
        System.out.println("---- Parsed");
        // parsed.write(System.out, "RDF/JSON") ;
        writer.write(parsed, System.out, baseIRI) ;
        System.out.println("---- Expected");
        // expected.write(System.out, "RDF/JSON") ;
        writer.write(expected, System.out, baseIRI) ;
        System.out.println("--------");
    }
View Full Code Here

TOP

Related Classes of org.openjena.riot.system.JenaWriterRdfJson

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.