Package org.openjena.riot.lang

Examples of org.openjena.riot.lang.LangRIOT


                   
                    String base = "http://example/upload-base/" ;
                    // We read into a in-memory graph, then (if successful) update the dataset.
                    // This isolates errors.
                    Sink<Triple> sink = new SinkTriplesToGraph(graphTmp) ;
                    LangRIOT parser = RiotReader.createParserTriples(stream, lang, base, sink) ;
                    parser.getProfile().setHandler(errorHandler) ;
                    try {
                        parser.parse() ;
                    }
                    catch (RiotException ex) { errorBadRequest("Parse error: "+ex.getMessage()) ; }
                    finally { sink.close() ; }
                   
                    tripleCount = graphTmp.size() ;
View Full Code Here


    private static DatasetGraph parse(HttpActionREST action, Lang lang, String base, InputStream input)
    {
        Graph graphTmp = GraphFactory.createGraphMem() ;
        Sink<Triple> sink = new SinkTriplesToGraph(graphTmp) ;
        LangRIOT parser = RiotReader.createParserTriples(input, lang, base, sink) ;
        parser.getProfile().setHandler(errorHandler) ;
        try {
            parser.parse() ;
        }
        catch (RiotException ex) { errorBadRequest("Parse error: "+ex.getMessage()) ; }
        finally { sink.close() ; }
        DatasetGraph dsgTmp = DatasetGraphFactory.create(graphTmp) ;
       
View Full Code Here

                                       + item.getName() + " detected.");
                    // Process the input stream
                    response.setContentType("text/plain") ;

                    Sink<Triple> sink = new SinkTripleOutput(response.getOutputStream()) ;
                    LangRIOT parser = RiotReader.createParserTurtle(stream, null, sink) ;
                    parser.parse() ;
                   
                    response.getOutputStream().println("----------------------") ;
                }
            }
        } catch (Exception ex)
View Full Code Here

                HttpEntity entity = response.getEntity() ;
                MediaType mt = MediaType.create(response.getFirstHeader(HttpNames.hContentType).getValue()) ;
                mt.getCharset() ;
                Sink<Triple> sink = new SinkTriplesToGraph(g) ;
                InputStream in = entity.getContent() ;
                LangRIOT parser = createParser(in, baseIRI, sink) ;
                parser.parse() ;
                in.close() ;
                this.graph = g ;
            } catch (IOException ex) { IO.exception(ex) ; }
        }
View Full Code Here

   
    private static DatasetGraph infer(String input, String vocabulary) {
      Dataset dataset = DatasetFactory.createMem();
        Sink<Quad> sink = new SinkQuadsToDataset(dataset.asDatasetGraph());
        sink = InfFactory.infQuads(sink, FileManager.get().loadModel(vocabulary));
        LangRIOT parser = RiotReader.createParserQuads(IO.openFile(input), Lang.NQUADS, null, sink) ;
        parser.parse() ;       

      return dataset.asDatasetGraph();
    }
View Full Code Here

TOP

Related Classes of org.openjena.riot.lang.LangRIOT

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.