Package org.apache.jena.atlas.web

Examples of org.apache.jena.atlas.web.TypedInputStream


            throw new IllegalArgumentException("URI to read from is null") ;
        if ( base == null )
            base = SysRIOT.chooseBaseIRI(uri) ;
        if ( hintLang == null )
            hintLang = RDFLanguages.filenameToLang(uri) ;
        TypedInputStream in = open(uri, context) ;
        if ( in == null )
            throw new RiotException("Not found: "+uri) ;
        process(sink, in, base, hintLang, context) ;
        IO.close(in) ;
    }
View Full Code Here


     * @param hintLang  Hint for the syntax
     * @param context   Content object to control reading process.
     */
    public static void parse(StreamRDF sink, InputStream in, String base, Lang hintLang, Context context)
    {
        process(sink, new TypedInputStream(in), base, hintLang, context) ;
    }
View Full Code Here

     * @param context   Content object to control reading process.
     */
    public static void parse(StreamRDF sink, TypedInputStream in, String base, Context context)
    {
        Lang hintLang = RDFLanguages.contentTypeToLang(in.getMediaType()) ;
        process(sink, new TypedInputStream(in), base, hintLang, context) ;
    }
View Full Code Here

     * @param streamManager
     * @return TypedInputStream
     */
    public static TypedInputStream open(String filenameOrURI, StreamManager streamManager)
    {
        TypedInputStream in = streamManager.open(filenameOrURI) ;
           
        if ( in == null )
        {
            if ( log.isDebugEnabled() )
                //log.debug("Found: "+filenameOrURI+" ("+loc.getName()+")") ;
View Full Code Here

        }
    }
   
    public void parseFile(String filename)
    {
        TypedInputStream in = null ;
        if ( filename.equals("-") ) {
            in = new TypedInputStream(System.in) ;
            parseFile("http://base/", "stdin", in) ;
        } else {
            try {
                in = RDFDataMgr.open(filename) ;
            } catch (Exception ex) {
View Full Code Here

   
    @Override
    public void read(Model model, String url)
    {
        // model.read(url)
        TypedInputStream in = StreamManager.get().open(url) ;
        if ( in == null )
            throw new NotFoundException(url) ;
        String contentType = in.getContentType() ;
       
        // Reading a URL, no hint language provided.
        // Use the URL structure as the hint.
        Lang lang = null ;
        if ( ! Lib.equal(contentType, WebContent.contentTypeTextPlain) )
View Full Code Here

    {
        String source = update.getSource() ;
        Node dest = update.getDest() ;
        try {
            // Read into temporary storage to protect against parse errors.
            TypedInputStream s = RDFDataMgr.open(source) ;
            Lang lang = RDFDataMgr.determineLang(source, s.getContentType(), null) ;
           
            if ( RDFLanguages.isTriples(lang) ) {
                // Triples
                Graph g = GraphFactory.createGraphMem() ;
                StreamRDF stream = StreamRDFLib.graph(g) ;
View Full Code Here

    }
   
    @Test public void locatorFile_05()
    {
        LocatorFile loc = new LocatorFile() ;
        TypedInputStream ts = loc.open(testingDir+"data.ttl") ;
        assertTrue("Not equal: "+WebContent.contentTypeTurtle+" != "+ts.getMediaType(),
                   WebContent.contentTypeTurtle.equalsIgnoreCase(ts.getContentType())) ;
    }
View Full Code Here

    // TriG
    // NQuads
   
    private static void open(String dataName, Context context)
    {
        TypedInputStream in =
            ( context != null ) ?
                 RDFDataMgr.open(dataName, context) :
                 RDFDataMgr.open(dataName) ;
        assertNotNull(in) ;
        IO.close(in) ;
View Full Code Here

    @Test public void read_24()   { jenaread("D-json", "RDF/JSON") ; }
   
    @Test public void read_30()
    {
        {
            TypedInputStream in = RDFDataMgr.open(filename("D-not-TTL.ttl") );
            Model m0 = ModelFactory.createDefaultModel() ;
            RDFDataMgr.read(m0, in, RDFLanguages.RDFXML) ;
        }

        TypedInputStream in1 = RDFDataMgr.open(filename("D-not-TTL.ttl") );
        Model m1 = ModelFactory.createDefaultModel() ;
        // Fails until integration with jena-core as hintlang gets lost.
        m1.read(in1, null, "RDF/XML") ;
    }
View Full Code Here

TOP

Related Classes of org.apache.jena.atlas.web.TypedInputStream

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.