Package org.apache.jena.riot.system

Examples of org.apache.jena.riot.system.StreamRDF


        String filename = "data.ttl" ;

        // This is the heart of N-triples printing ... outoput is heavily buffered
        // so the FilterSinkRDF called flush at the end of parsing.
        Sink<Triple> output = new SinkTripleOutput(System.out, null, SyntaxLabels.createNodeToLabel()) ;
        StreamRDF filtered = new FilterSinkRDF(output, FOAF.name, FOAF.knows) ;
       
        // Call the parsing process.
        RDFDataMgr.parse(filtered, filename) ;
    }
View Full Code Here


            @Override
            public void flush() {}
            String formatNode(Node n) { return FmtUtils.stringForNode(n, sCxt) ; }
        } ;

        StreamRDF dest = StreamRDFLib.sinkQuads(sink) ;
        LangRIOT parser = RiotReader.createParser(tokenizer, language, null, dest) ;
        // Don't resolve IRIs.  Do checking.
        parser.setProfile(RiotLib.profile(null, false, true, errorHandler)) ;
        return parser ;
    }
View Full Code Here

            try {
                Graph g = GraphFactory.createDefaultGraph() ;
                HttpEntity entity = response.getEntity() ;
                MediaType mt = MediaType.create(response.getFirstHeader(HttpNames.hContentType).getValue()) ;
                mt.getCharset() ;
                StreamRDF dest = StreamRDFLib.graph(g) ;
                InputStream in = entity.getContent() ;
                LangRIOT parser = createParser(in, baseIRI, dest) ;
                parser.parse() ;
                in.close() ;
                this.graph = g ;
View Full Code Here

   
    // ** Worker.
    private static void readUtil(Graph graph, String uri, int limit)
    {
        Lang lang = RDFLanguages.filenameToLang(uri, RDFLanguages.RDFXML) ;
        StreamRDF sink = StreamRDFLib.graph(graph) ;
        sink = new SinkRDFLimited(sink, limit) ;

        InputStream input = Fuseki.webStreamManager.open(uri) ;
        RDFDataMgr.parse(sink, input, uri, lang, null) ;
    }
View Full Code Here

    private void processFile(String filename, Sink<Quad> qsink)
    {
        Lang lang = filename.equals("-") ? RDFLanguages.NQUADS : RDFLanguages.filenameToLang(filename, RDFLanguages.NQUADS) ;
        String baseURI = IRILib.filenameToIRI(filename) ;
        StreamRDF sink = StreamRDFLib.sinkQuads(qsink) ;
       
        if ( RDFLanguages.isTriples(lang) )
        {
            InputStream in = IO.openFile(filename) ;
            sink = StreamRDFLib.extendTriplesToQuads(sink) ;
View Full Code Here

     * @param sink      Where to send the triples from the parser.
     * @see     RDFDataMgr#read
     */
    public static void parseTriples(String filename, Lang lang, String baseIRI, Sink<Triple> sink)
    {
        StreamRDF dest = StreamRDFLib.sinkTriples(sink) ;
        parseTriples(filename, lang, baseIRI, dest) ;
    }
View Full Code Here

     * @param sink      Where to send the triples from the parser.
     * @see             RDFDataMgr#read
     */ 
    public static void parseTriples(InputStream in, Lang lang, String baseIRI, Sink<Triple> sink)
    {
        StreamRDF dest = StreamRDFLib.sinkTriples(sink) ;
        parseTriples(in, lang, baseIRI, dest) ;
    }
View Full Code Here

     * @param sink      Where to send the quads from the parser.
     * @see             RDFDataMgr#read
     */
    public static void parseQuads(String filename, Lang lang, String baseIRI, Sink<Quad> sink)
    {
        StreamRDF dest = StreamRDFLib.sinkQuads(sink) ;
        parseQuads(filename, lang, baseIRI, dest) ;
    }
View Full Code Here

     * @param sink      Where to send the quads from the parser.
     * @see              RDFDataMgr#read
     */
    public static void parseQuads(InputStream in, Lang lang, String baseIRI, Sink<Quad> sink)
    {
        StreamRDF dest = StreamRDFLib.sinkQuads(sink) ;
        parseQuads(in, lang, baseIRI, dest) ;
    }
View Full Code Here

     * @param context   Content object to control reading process.
     * @throws RiotNotFoundException if the location is not found - the model is unchanged.
     */
    public static void read(Graph graph, String uri, String base, Lang hintLang, Context context)
    {
        StreamRDF dest = StreamRDFLib.graph(graph) ;
        parse(dest, uri, base, hintLang, context) ;
    }
View Full Code Here

TOP

Related Classes of org.apache.jena.riot.system.StreamRDF

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.