Package org.apache.jena.riot

Examples of org.apache.jena.riot.Lang


      actualContentType = contentType;
    }

    // Try to select language appropriately here based on the model content
    // type
    Lang lang = WebContent.contentTypeToLang(actualContentType);
    if (!RDFLanguages.isTriples(lang))
      throw new QueryException("Endpoint <" + endpointURL +
          "> returned Content Type: " + actualContentType
          + " which is not a supported RDF graph syntax");
    RDFDataMgr.read(model, in, lang);
View Full Code Here


     * @throws SyntaxNotSupportedException
     *             When the Syntax could not be resolved to a {@link Lang}.
     */
    public static Lang getJenaLang(Syntax syntax) throws SyntaxNotSupportedException {
        for (String mimeType : syntax.getMimeTypes()) {
            Lang lang = RDFLanguages.contentTypeToLang(mimeType);
            if (lang != null) {
                return lang;
            }
        }
        throw new SyntaxNotSupportedException("This version of Jena seems to have no "
View Full Code Here

   
    if (syntax == null) {
      throw new NullPointerException("syntax may not be null");
    }
   
    Lang jenaLang = getJenaLang(syntax);

//    if (RDFLanguages.isTriples(jenaLang)) {
//      /*
//       * NB: Writing a ModelSet to a triple serialization loses the
//       * context of any quads if present.
View Full Code Here

            // TODO
        }

        boolean allTriples = true ;
        for ( String url : urls ) {
            Lang lang = RDFLanguages.filenameToLang(url, RDFLanguages.NQUADS) ;
            if ( lang != null && RDFLanguages.isQuads(lang) ) {
                allTriples = false ;
                break ;
            }
        }

        if ( allTriples && graphName == null ) {
            loadDefaultGraph(urls) ;
            return ;
        }

        if ( graphName == null ) {
            loadQuads(urls) ;
            return ;
        }

        // graphName != null
        if ( !allTriples ) {
            for ( String url : urls ) {
                Lang lang = RDFLanguages.filenameToLang(url, RDFLanguages.NQUADS) ;
                if ( lang == null )
                    // Does not happen due to default above.
                    cmdError("File suffix not recognized: " + url) ;
                if ( lang != null && !RDFLanguages.isTriples(lang) )
                    cmdError("Can only load triples into a named model: " + url) ;
View Full Code Here

            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) )
            lang = RDFLanguages.contentTypeToLang(contentType) ;
       
        if ( lang == null )
            lang = RDFLanguages.filenameToLang(url) ;
View Full Code Here

    @Override
    public RDFReader getReader(String langname)
    {
        // If RDF/XML, then return an ARP
       
        Lang lang = RDFLanguages.nameToLang(langname) ;
        if ( RDFLanguages.RDFXML.equals(lang) )
            return new RDFReaderRIOT_ARP() ;
        return new RDFReaderRIOT(langname) ;
    }
View Full Code Here

            return modLangParse.getLang() ;
       
        if ( contentType != null && ! WebContent.matchContentType(WebContent.ctTextPlain, contentType) )
            return RDFLanguages.contentTypeToLang(contentType) ;

        Lang lang =  RDFLanguages.filenameToLang(filename) ;
        if ( lang == null )
            lang = dftLang ;
        return lang ;
    }
View Full Code Here

        String mappedURI = mapURI(filenameOrURI) ;

        if ( log.isDebugEnabled() && !mappedURI.equals(filenameOrURI) )
            log.debug("Map: " + filenameOrURI + " => " + mappedURI) ;

        Lang lang =
            syntax != null
            ? RDFLanguages.nameToLang(syntax)
            : RDFLanguages.resourceNameToLang(mappedURI, Lang.RDFXML) ;
           
        RDFDataMgr.read(model, mappedURI, baseURI, lang);
View Full Code Here

    /** Load into a graph */
    private static void loadTriples$(BulkStreamRDF dest, List<String> urls) {
        dest.startBulk() ;
        for ( String url : urls ) {
            loadLogger.info("Load: " + url + " -- " + Utils.nowAsString()) ;
            Lang lang = RDFLanguages.filenameToLang(url, Lang.NTRIPLES) ;
            RDFDataMgr.parse(dest, url, lang) ;
        }
        dest.finishBulk() ;
    }
View Full Code Here

    /** Load quads into a dataset */
    private static void loadQuads$(BulkStreamRDF dest, List<String> urls) {
        dest.startBulk() ;
        for ( String url : urls ) {
            loadLogger.info("Load: " + url + " -- " + Utils.nowAsString()) ;
            Lang lang = RDFLanguages.filenameToLang(url, Lang.NQUADS) ;
            RDFDataMgr.parse(dest, url, lang) ;
        }
        dest.finishBulk() ;
    }
View Full Code Here

TOP

Related Classes of org.apache.jena.riot.Lang

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.