本文整理汇总了Java中org.apache.jena.sparql.engine.http.QueryEngineHTTP.setModelContentType方法的典型用法代码示例。如果您正苦于以下问题:Java QueryEngineHTTP.setModelContentType方法的具体用法?Java QueryEngineHTTP.setModelContentType怎么用?Java QueryEngineHTTP.setModelContentType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jena.sparql.engine.http.QueryEngineHTTP
的用法示例。
在下文中一共展示了QueryEngineHTTP.setModelContentType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sparql
import org.apache.jena.sparql.engine.http.QueryEngineHTTP; //导入方法依赖的package包/类
public String sparql(String subject) {
// First query takes the most specific class from a given resource.
String ontology_service = endpoint;
String endpointsSparql = "select ?label where {<" + subject
+ "> <http://www.w3.org/2000/01/rdf-schema#label> ?label FILTER (lang(?label) = 'en')} LIMIT 100";
Query sparqlQuery = QueryFactory.create(endpointsSparql, Syntax.syntaxARQ);
QueryEngineHTTP qexec = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(ontology_service, sparqlQuery);
qexec.setModelContentType(WebContent.contentTypeRDFXML);
ResultSet results = qexec.execSelect();
String property = null;
while (results.hasNext()) {
QuerySolution qs = results.next();
property = qs.getLiteral("?label").getLexicalForm();
}
return property;
}
示例2: customizeRequest
import org.apache.jena.sparql.engine.http.QueryEngineHTTP; //导入方法依赖的package包/类
@Override
protected void customizeRequest(QueryExecution qe) {
super.customizeRequest(qe);
if (qe instanceof QueryEngineHTTP) {
QueryEngineHTTP remote = (QueryEngineHTTP) qe;
T options = this.getOptions();
remote.setSelectContentType(options.getResultsSelectFormat());
remote.setAskContentType(options.getResultsAskFormat());
remote.setModelContentType(options.getResultsGraphFormat());
remote.setAllowDeflate(options.getAllowCompression());
remote.setAllowGZip(options.getAllowCompression());
}
}