当前位置: 首页>>代码示例>>Java>>正文


Java QueryResultIO.createParser方法代码示例

本文整理汇总了Java中org.openrdf.query.resultio.QueryResultIO.createParser方法的典型用法代码示例。如果您正苦于以下问题:Java QueryResultIO.createParser方法的具体用法?Java QueryResultIO.createParser怎么用?Java QueryResultIO.createParser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openrdf.query.resultio.QueryResultIO的用法示例。


在下文中一共展示了QueryResultIO.createParser方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newSparqlBooleanReader

import org.openrdf.query.resultio.QueryResultIO; //导入方法依赖的package包/类
public static BooleanQueryResultParser newSparqlBooleanReader(
        final BooleanQueryResultFormat format) {

    final BooleanQueryResultParser parser = QueryResultIO.createParser(format);
    parser.setValueFactory(Data.getValueFactory());

    return parser;
}
 
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:9,代码来源:RDFUtil.java

示例2: testGraphQuery

import org.openrdf.query.resultio.QueryResultIO; //导入方法依赖的package包/类
/**
 * test get Graph Query.
 * @throws Exception The test would fails if Exception occurs
 */
@Test
public void testGraphQuery() throws Exception {
	//insert some statments first
	for (final String tripleAsString : _data) {
		final Statement triple = parseNX(tripleAsString).iterator().next();
		TRIPLE_STORE.addData(triple);
	}
	//test Graph Query
	String queryString = "SELECT ?x ?y WHERE { ?x ?p ?y } ";
	String uri = BASE_URI + Protocol.REPOSITORIES + "/" + REPO_ID;
	File tmp = WebTestUtils.tmpFile();
	final ServletOutputStream servletOutputStream = new StubServletOutputStream(tmp);
	final HttpServletRequest request = mockHttpRequest(uri, METHOD_POST);
	when(request.getContentType()).thenReturn(MIMETYPE_WWW_FORM);
	when(request.getParameter(Protocol.QUERY_LANGUAGE_PARAM_NAME)).thenReturn(QueryLanguage.SPARQL.toString());
	when(request.getParameter(Protocol.QUERY_PARAM_NAME)).thenReturn(queryString);
	when(request.getParameter(Protocol.ACCEPT_PARAM_NAME)).thenReturn("application/x-binary-rdf-results-table");
	Vector<String> vec = new Vector<String>();
	when(request.getParameterNames()).thenReturn(vec.elements());
	when(request.getCharacterEncoding()).thenReturn(UTF_8);
	final HttpServletResponse response = mock(HttpServletResponse.class);
	when(response.getOutputStream()).thenReturn(servletOutputStream);


	_classUnderTest.service(request, response);
	
	Set<TupleQueryResultFormat> tqrFormats = TupleQueryResultParserRegistry.getInstance().getKeys();
	TupleQueryResultFormat format = TupleQueryResultFormat.matchMIMEType("application/x-binary-rdf-results-table", tqrFormats);
	TupleQueryResultParser parser = QueryResultIO.createParser(format, valueFactory);
	FileInputStream in = new FileInputStream(tmp);
	BackgroundTupleResult tRes = new BackgroundTupleResult(parser, in, null);
	parser.setQueryResultHandler(tRes);
	parser.parseQueryResult(in);
	assertTrue(tRes.hasNext());
	verify(response).setStatus(HttpServletResponse.SC_OK);

	servletOutputStream.close();
}
 
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:43,代码来源:SesameHTTPRepositoryTest.java

示例3: parse

import org.openrdf.query.resultio.QueryResultIO; //导入方法依赖的package包/类
private void parse(InputStream in, TupleQueryResultFormat format, QueryResultHandler handler, ValueFactory valueFactory) throws IOException, QueryResultParseException, QueryResultHandlerException, UnsupportedQueryResultFormatException {
    QueryResultParser parser = QueryResultIO.createParser(format);
    parser.setValueFactory(valueFactory);
    parser.setQueryResultHandler(handler);
    parser.parseQueryResult(in);
}
 
开发者ID:redlink-gmbh,项目名称:redlink-java-sdk,代码行数:7,代码来源:RedLinkDataImpl.java

示例4: sendTupleQuery

import org.openrdf.query.resultio.QueryResultIO; //导入方法依赖的package包/类
/**
 * TupleQuery
 *
 * @param queryString
 * @param bindings
 * @param start
 * @param pageLength
 * @param includeInferred
 * @param baseURI
 * @return
 * @throws RepositoryException
 * @throws MalformedQueryException
 * @throws UnauthorizedException
 * @throws QueryInterruptedException
 */
public TupleQueryResult sendTupleQuery(String queryString,SPARQLQueryBindingSet bindings, long start, long pageLength, boolean includeInferred, String baseURI) throws RepositoryException, MalformedQueryException,
		QueryInterruptedException {
	InputStream stream = null;
	try {
		stream = getClient().performSPARQLQuery(queryString, bindings, start, pageLength, this.tx, includeInferred, baseURI);
	} catch (JsonProcessingException e) {
		logger.error(e.getLocalizedMessage());
		throw new MarkLogicSesameException("Issue processing json.");
	}
	TupleQueryResultParser parser = QueryResultIO.createParser(format, getValueFactory());
	MarkLogicBackgroundTupleResult tRes = new MarkLogicBackgroundTupleResult(parser,stream);
	execute(tRes);
	return tRes;
}
 
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:30,代码来源:MarkLogicClient.java

示例5: newSparqlTupleParser

import org.openrdf.query.resultio.QueryResultIO; //导入方法依赖的package包/类
public static TupleQueryResultParser newSparqlTupleParser(final TupleQueryResultFormat format) {

        final TupleQueryResultParser parser = QueryResultIO.createParser(format);
        parser.setValueFactory(CompactValueFactory.getInstance());

        return parser;
    }
 
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:8,代码来源:RDFUtil.java


注:本文中的org.openrdf.query.resultio.QueryResultIO.createParser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。