• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java QueryResultParseException类的典型用法和代码示例

java 1次浏览

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

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

示例1: before

点赞 3

import org.openrdf.query.resultio.QueryResultParseException; //导入依赖的package包/类
@Before
public void before()
		throws RepositoryException, IOException, RDFParseException,
		       MalformedQueryException, QueryResultParseException,
			   QueryResultHandlerException {
	repo = new SailRepository(new MemoryStore());
	repo.initialize();
	conn = repo.getConnection();
	vf = conn.getValueFactory();
	conn.add(getResource(data), "file://", RDFFormat.TURTLE);
	SPARQLResultsXMLParserFactory factory =
			new SPARQLResultsXMLParserFactory();
	parser = factory.getParser();
	parser.setValueFactory(vf);
	List<Rule> rules;
	rules = Rules.fromOntology(getResource(data));
	QueryRewriter rewriter = new QueryRewriter(conn, rules);
	query = (TupleQuery) rewriter.rewrite(QueryLanguage.SPARQL, queryString);
	nonInfQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
	System.out.println("== QUERY (" + this.name + ") ==");
	System.out.println(nonInfQuery);
	System.out.println("== REWRITTEN QUERY (" + this.name + ") ==");
	System.out.println(query);
}
 

开发者ID:lszeremeta,
项目名称:neo4j-sparql-extension-yars,
代码行数:25,
代码来源:SPARQLInferenceTest.java

示例2: runQuery

点赞 3

import org.openrdf.query.resultio.QueryResultParseException; //导入依赖的package包/类
private QueryResult runQuery()
		throws IOException, QueryEvaluationException,
		       QueryResultParseException, TupleQueryResultHandlerException,
			   QueryResultHandlerException {
	TestResultHandler noninf = new TestResultHandler();
	TestResultHandler actual = new TestResultHandler();
	TestResultHandler expect = new TestResultHandler();
	parser.setQueryResultHandler(expect);
	parser.parseQueryResult(getResource(expected));
	nonInfQuery.evaluate(noninf);
	query.evaluate(actual);
	Multiset<BindingSet> noninfset = noninf.getSolutions();
	Multiset<BindingSet> expectset = expect.getSolutions();
	Multiset<BindingSet> actualset = actual.getSolutions();
	return new QueryResult(expectset, actualset, noninfset);
}
 

开发者ID:lszeremeta,
项目名称:neo4j-sparql-extension-yars,
代码行数:17,
代码来源:SPARQLInferenceTest.java

示例3: testQuery

点赞 3

import org.openrdf.query.resultio.QueryResultParseException; //导入依赖的package包/类
public static void testQuery(String queryFile, String resultsFile, boolean orderOn)
    throws IOException, MalformedQueryException, QueryEvaluationException,
    TupleQueryResultHandlerException, URISyntaxException, QueryResultParseException,
    UnsupportedQueryResultFormatException {
  ByteArrayOutputStream resultsStream = new ByteArrayOutputStream();
  String query =
      FileUtils.readFileToString(new File(Utils.class.getResource(prefixesFile).toURI())) + "\n"
          + FileUtils.readFileToString(new File(Utils.class.getResource(queryFile).toURI()));

  // Pose the query
  strabon.query(query, Format.XML, strabon.getSailRepoConnection(), resultsStream);

  // Check if the results of the query are the expected
  compareResults(queryFile, orderOn, QueryResultIO.parse(
      Utils.class.getResourceAsStream(resultsFile), TupleQueryResultFormat.SPARQL),
      QueryResultIO.parse((new ByteArrayInputStream(resultsStream.toByteArray())),
          TupleQueryResultFormat.SPARQL));
}
 

开发者ID:esarbanis,
项目名称:strabon,
代码行数:19,
代码来源:Utils.java

示例4: subset

点赞 2

import org.openrdf.query.resultio.QueryResultParseException; //导入依赖的package包/类
@Test
public void subset()
		throws QueryEvaluationException, TupleQueryResultHandlerException,
		       IOException, QueryResultParseException,
			   QueryResultHandlerException {
	QueryResult q = this.runQuery();
	assertTrue(
		q.getNonInferred() + " should be a subset of " + q.getActual(),
		Multisets.containsOccurrences(
			q.getActual(),
			q.getNonInferred()
		));
}
 

开发者ID:lszeremeta,
项目名称:neo4j-sparql-extension-yars,
代码行数:14,
代码来源:SPARQLInferenceTest.java

示例5: parse

点赞 2

import org.openrdf.query.resultio.QueryResultParseException; //导入依赖的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


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)