org.apache.jena.riot.Lang.getHeaderString()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中org.apache.jena.riot.Lang.getHeaderString()方法的一些代码示例,展示了Lang.getHeaderString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lang.getHeaderString()方法的具体详情如下:
包路径:org.apache.jena.riot.Lang
类名称:Lang
方法名:getHeaderString

Lang.getHeaderString介绍

[英]As an HTTP Content-Type field value
[中]

代码示例

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

/** @deprecated Use {@linkplain Lang#getHeaderString()} */
@Deprecated
public static String mapLangToContentType(Lang lang) { return lang.getHeaderString() ; }

代码示例来源:origin: apache/jena

/** Return our "canonical" name for a Content Type.
 * This should be the standard one, no X-*
 */
public static String contentTypeCanonical(String contentType)
{ 
  Lang lang = RDFLanguages.contentTypeToLang(contentType) ;
  if ( lang == null )
    return null ;
  return lang.getHeaderString() ;
  //return mapLangToContentType.get(lang) ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

/** Return our "canonical" name for a Content Type.
 * This should be the standard one, no X-*
 */
public static String contentTypeCanonical(String contentType)
{ 
  Lang lang = RDFLanguages.contentTypeToLang(contentType) ;
  if ( lang == null )
    return null ;
  return lang.getHeaderString() ;
  //return mapLangToContentType.get(lang) ;
}

代码示例来源:origin: apache/jena

/** Fuseki settings */
private static RDFConnectionRemoteBuilder setupForFuseki(RDFConnectionRemoteBuilder builder) {
  String ctRDFThrift = Lang.RDFTHRIFT.getContentType().getContentType();
  String acceptHeaderSPARQL = String.join("," 
            , ResultSetLang.SPARQLResultSetThrift.getHeaderString()
            , ResultSetLang.SPARQLResultSetJSON.getHeaderString()+";q=0.9"
            , Lang.RDFTHRIFT.getHeaderString());
  return 
    builder
      .quadsFormat(RDFFormat.RDF_THRIFT)
      .triplesFormat(RDFFormat.RDF_THRIFT)
      .acceptHeaderGraph(ctRDFThrift)
      .acceptHeaderDataset(ctRDFThrift)
      .acceptHeaderSelectQuery(ResultSetLang.SPARQLResultSetThrift.getHeaderString())
      .acceptHeaderAskQuery(ResultSetLang.SPARQLResultSetJSON.getHeaderString())
      .acceptHeaderQuery(acceptHeaderSPARQL)
      .parseCheckSPARQL(false)
      // Create object of this class.
      .creator((b)->fusekiMaker(b));
}

代码示例来源:origin: vivo-project/Vitro

/**
 *
 * @param servletConfig
 * @throws ServletException
 */
@Override
public void init(ServletConfig servletConfig) throws ServletException {
  try {
    // load the configuration
    File configFile = getConfigFile(servletConfig);
    config = new ConfigReader(new FileReader(configFile));
    // register data source types
    for ( Entry<String,IDataSourceType> typeEntry : config.getDataSourceTypes().entrySet() ) {
      DataSourceTypesRegistry.register( typeEntry.getKey(),
                       typeEntry.getValue() );
    }
    // register data sources
    for (Entry<String, JsonNode> dataSource : config.getDataSources().entrySet()) {
      dataSources.put(dataSource.getKey(), DataSourceFactory.create(dataSource.getValue()));
    }
    // register content types
    MIMEParse.register("text/html");
    MIMEParse.register(Lang.TTL.getHeaderString());
    MIMEParse.register(Lang.JSONLD.getHeaderString());
    MIMEParse.register(Lang.NTRIPLES.getHeaderString());
    MIMEParse.register(Lang.RDFXML.getHeaderString());
  } catch (Exception e) {
    throw new ServletException(e);
  }
}

代码示例来源:origin: org.apache.jena/jena-rdfconnection

/** Fuseki settings */
private static RDFConnectionRemoteBuilder setupForFuseki(RDFConnectionRemoteBuilder builder) {
  String ctRDFThrift = Lang.RDFTHRIFT.getContentType().getContentType();
  String acceptHeaderSPARQL = String.join("," 
            , ResultSetLang.SPARQLResultSetThrift.getHeaderString()
            , ResultSetLang.SPARQLResultSetJSON.getHeaderString()+";q=0.9"
            , Lang.RDFTHRIFT.getHeaderString());
  return 
    builder
      .quadsFormat(RDFFormat.RDF_THRIFT)
      .triplesFormat(RDFFormat.RDF_THRIFT)
      .acceptHeaderGraph(ctRDFThrift)
      .acceptHeaderDataset(ctRDFThrift)
      .acceptHeaderSelectQuery(ResultSetLang.SPARQLResultSetThrift.getHeaderString())
      .acceptHeaderAskQuery(ResultSetLang.SPARQLResultSetJSON.getHeaderString())
      .acceptHeaderQuery(acceptHeaderSPARQL)
      .parseCheckSPARQL(false)
      // Create object of this class.
      .creator((b)->fusekiMaker(b));
}

代码示例来源:origin: spaziocodice/SolRDF

@Override
  public void doWrite(
      final NamedList response, 
      final Writer writer, 
      final String contentType) {
    final Boolean askResult = response.getBooleanArg(Names.QUERY_RESULT);
    if (WebContent.contentTypeTextCSV.equals(contentType) || WebContent.contentTypeTextPlain.equals(contentType)) {
      ResultSetFormatter.outputAsCSV(new WriterOutputStream(writer, CharacterSet.UTF_8), askResult);
    } else if (WebContent.contentTypeTextTSV.equals(contentType)) {
      ResultSetFormatter.outputAsTSV(new WriterOutputStream(writer, CharacterSet.UTF_8), askResult);
    } else if (ResultSetLang.SPARQLResultSetXML.getHeaderString().equals(contentType)) {
      ResultSetFormatter.outputAsXML(new WriterOutputStream(writer, CharacterSet.UTF_8), askResult);
    } else if (ResultSetLang.SPARQLResultSetJSON.getHeaderString().equals(contentType)) {
      ResultSetFormatter.outputAsJSON(new WriterOutputStream(writer, CharacterSet.UTF_8), askResult);
    } 
  }
});

代码示例来源:origin: vivo-project/Vitro

MIMEParse.register(Lang.TTL.getHeaderString());
MIMEParse.register(Lang.JSONLD.getHeaderString());
MIMEParse.register(Lang.NTRIPLES.getHeaderString());
MIMEParse.register(Lang.RDFXML.getHeaderString());

相关文章