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


Java TupleQueryResultHandlerException类代码示例

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


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

示例1: runQuery

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

示例2: explain

import org.openrdf.query.TupleQueryResultHandlerException; //导入依赖的package包/类
public void explain(String queryString) 
		throws TupleQueryResultHandlerException, QueryEvaluationException, 
		UnsupportedQueryResultFormatException, IOException{
	TupleQueryResult aResult = this.client
			.getAConn().select(queryString).execute();
	ArrayList<Set<IRI>> graphIds = new ArrayList<Set<IRI>>();
	while(aResult.hasNext()){
		Value s = aResult.next().getValue("s");
		Iterable<Proof> proofs = this.client.getAConn()
				.explain(Values.statement(Values.iri(s.toString()), 
				Values.iri
				("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), 
				Values.iri
				("http://swat.cse.lehigh.edu/onto/univ-bench.owl#Person")))
				.computeNamedGraphs()
				.proofs();
		Iterator<Proof> proof_itr = proofs.iterator();
		while(proof_itr.hasNext()) {
			Proof aProof = proof_itr.next();
			getGraphIDs(aProof, graphIds);
		}
	}
	this.update(graphIds);
}
 
开发者ID:raymondino,项目名称:SequentialStreamReasoningArchitecture,代码行数:25,代码来源:StardogCache.java

示例3: testStrdfIntersection

import org.openrdf.query.TupleQueryResultHandlerException; //导入依赖的package包/类
@Test
public void testStrdfIntersection() throws MalformedQueryException, QueryEvaluationException,
    TupleQueryResultHandlerException, IOException {
  String query =
      prefixes
          + "SELECT DISTINCT ( strdf:intersection(?g, \"POLYGON((5 3, 10 3, 10 8, 5 8, 5 3));http://www.opengis.net/def/crs/EPSG/0/4326\"^^strdf:WKT) AS ?ret ) \n"
          + "WHERE { \n" + " ?s ex:id ?id . \n" + " ?s ex:geometry ?g . \n"
          + " FILTER( str(?id) = \"Z\"^^xsd:string ) . \n" + "}";

  @SuppressWarnings("unchecked")
  ArrayList<String> bindings =
      (ArrayList<String>) strabon.query(query, strabon.getSailRepoConnection());

  assertEquals(1, bindings.size());
  assertTrue(-1 < bindings
      .indexOf(
          "[ret=\"POLYGON ((10 3, 5 3, 5 8, 10 8, 10 3));http://www.opengis.net/def/crs/EPSG/0/4326\"^^<http://strdf.di.uoa.gr/ontology#WKT>]"));
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:19,代码来源:SpatialTests.java

示例4: testStrdfBoundary

import org.openrdf.query.TupleQueryResultHandlerException; //导入依赖的package包/类
@Test
public void testStrdfBoundary() throws MalformedQueryException, QueryEvaluationException,
    TupleQueryResultHandlerException, IOException {
  String query =
      prefixes + "SELECT DISTINCT ( strdf:boundary(?g) AS ?ret ) \n" + "WHERE { \n"
          + " ?s ex:id ?id . \n" + " ?s ex:geometry ?g . \n"
          + " FILTER( str(?id) = \"C\"^^xsd:string ) . \n" + "}";

  @SuppressWarnings("unchecked")
  ArrayList<String> bindings =
      (ArrayList<String>) strabon.query(query, strabon.getSailRepoConnection());

  assertEquals(1, bindings.size());
  assertTrue(-1 < bindings
      .indexOf("[ret=\"LINESTRING (8 1, 9 1, 9 2, 8 2, 8 1);http://www.opengis.net/def/crs/EPSG/0/4326\"^^<http://strdf.di.uoa.gr/ontology#WKT>]"));
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:17,代码来源:SpatialTests.java

示例5: testUnionWithCommonObject

import org.openrdf.query.TupleQueryResultHandlerException; //导入依赖的package包/类
@Test
public void testUnionWithCommonObject() throws MalformedQueryException, RepositoryException,
    QueryEvaluationException, TupleQueryResultHandlerException, IOException {
  String queryString =
      prefixes + "SELECT ?title \n"
          + "WHERE  { { ?book dc10:title  ?title } UNION { ?book dc11:title  ?title } } \n";

  @SuppressWarnings("unchecked")
  ArrayList<String> results =
      (ArrayList<String>) strabon.query(queryString, strabon.getSailRepoConnection());
  assertEquals(6, results.size());
  assertTrue(-1 < results.indexOf("[title=\"SPARQL Query Language Tutorial\"]"));
  assertTrue(-1 < results.indexOf("[title=\"SPARQL\"]"));
  assertTrue(-1 < results.indexOf("[title=\"SPARQL Tutorial\"]"));
  assertTrue(-1 < results.indexOf("[title=\"The Semantic Web\"]"));
  assertTrue(-1 < results.indexOf("[title=\"SPARQL Protocol Tutorial\"]"));
  assertTrue(-1 < results.indexOf("[title=\"SPARQL (updated)\"]"));
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:19,代码来源:SPARQL11Tests.java

示例6: testStrdfDistance

import org.openrdf.query.TupleQueryResultHandlerException; //导入依赖的package包/类
@Test
public void testStrdfDistance() throws MalformedQueryException, QueryEvaluationException,
    TupleQueryResultHandlerException, IOException {
  String query =
      prefixes
          + "SELECT DISTINCT ( strdf:distance(?g, \"POINT( 10 1 )\"^^strdf:WKT) AS ?ret ) \n"
          + "WHERE { \n" + " ?s ex:id ?id . \n" + " ?s ex:geometry ?g . \n"
          + " FILTER( str(?id) = \"C\"^^xsd:string ) . \n" + "}";

  @SuppressWarnings("unchecked")
  ArrayList<String> bindings =
      (ArrayList<String>) strabon.query(query, strabon.getSailRepoConnection());

  assertEquals(1, bindings.size());
  assertTrue(-1 < bindings.indexOf("[ret=\"1.0\"^^<http://www.w3.org/2001/XMLSchema#double>]"));
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:17,代码来源:SpatialTests.java

示例7: endQueryResult

import org.openrdf.query.TupleQueryResultHandlerException; //导入依赖的package包/类
@Override
public void endQueryResult() throws TupleQueryResultHandlerException {
  try {
    fjson.writeFeatureCollection(sfCollection, out);
    out.write("\n".getBytes(Charset.defaultCharset()));

    // write a warning when there are no features in the answer
    if (nfeatures < nresults) {
      logger
          .warn(
              "[Strabon.GeoJSONWriter] No spatial binding found in the result, hence the result is empty eventhough query evaluation produced {} results. GeoJSON requires that at least one binding maps to a geometry.",
              nresults);

    }
  } catch (IOException e) {
    throw new TupleQueryResultHandlerException(e);
  }
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:19,代码来源:stSPARQLResultsGeoJSONWriter.java

示例8: testGeofRcc8Tppi

import org.openrdf.query.TupleQueryResultHandlerException; //导入依赖的package包/类
@Test
public void testGeofRcc8Tppi() throws MalformedQueryException, QueryEvaluationException,
    TupleQueryResultHandlerException, IOException {
  String query =
      prefixes + "SELECT DISTINCT ?id1 ?id2 \n" + "WHERE { \n" + " ?s1 ex:id ?id1 . \n"
          + " ?s2 ex:id ?id2 . \n" + " FILTER( str(?id1) != str(?id2) ) . \n"
          + " ?s2 ex:geometry ?g2 . \n" + " ?s1 ex:geometry ?g1 . \n"
          + " FILTER( geof:rcc8tppi(?g1, ?g2 )) . \n" + "}";

  @SuppressWarnings("unchecked")
  ArrayList<String> bindings =
      (ArrayList<String>) strabon.query(query, strabon.getSailRepoConnection());
  assertEquals(1, bindings.size());
  assertTrue(-1 < bindings
      .indexOf("[id2=\"F\"^^<http://www.w3.org/2001/XMLSchema#string>;id1=\"Z\"^^<http://www.w3.org/2001/XMLSchema#string>]"));
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:17,代码来源:SpatialTests.java

示例9: testGeofEhContains

import org.openrdf.query.TupleQueryResultHandlerException; //导入依赖的package包/类
@Test
public void testGeofEhContains() throws MalformedQueryException, QueryEvaluationException,
    TupleQueryResultHandlerException, IOException {
  String query =
      prefixes + "SELECT DISTINCT ?id1 ?id2 \n" + "WHERE { \n" + " ?s1 ex:id ?id1 . \n"
          + " ?s2 ex:id ?id2 . \n" + " FILTER( str(?id1) != str(?id2) ) . \n"
          + " ?s2 ex:geometry ?g2 . \n" + " ?s1 ex:geometry ?g1 . \n"
          + " FILTER( geof:ehContains(?g1, ?g2 )) . \n" + "}";

  @SuppressWarnings("unchecked")
  ArrayList<String> bindings =
      (ArrayList<String>) strabon.query(query, strabon.getSailRepoConnection());
  assertEquals(1, bindings.size());
  assertTrue(-1 < bindings
      .indexOf(
          "[id2=\"E\"^^<http://www.w3.org/2001/XMLSchema#string>;id1=\"Z\"^^<http://www.w3.org/2001/XMLSchema#string>]"));
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:18,代码来源:SpatialTests.java

示例10: testStrdfEnvelopeBuffer

import org.openrdf.query.TupleQueryResultHandlerException; //导入依赖的package包/类
@Test
public void testStrdfEnvelopeBuffer() throws MalformedQueryException, QueryEvaluationException,
    TupleQueryResultHandlerException, IOException {
  String query =
      prefixes
          + "SELECT DISTINCT ( strdf:envelope(strdf:buffer(?g, \"0.5\"^^xsd:float)) AS ?ret ) \n"
          +
          // "SELECT DISTINCT ?g (strdf:buffer(?g, \"0.5\"^^xsd:float) as ?buf) ( strdf:envelope(strdf:buffer(?g, \"0.5\"^^xsd:float)) AS ?ret ) \n"+
          "WHERE { \n" + " ?s ex:id ?id . \n" + " ?s ex:geometry ?g . \n"
          + " FILTER( str(?id) = \"C\"^^xsd:string ) . \n" + "}";

  @SuppressWarnings("unchecked")
  ArrayList<String> bindings =
      (ArrayList<String>) strabon.query(query, strabon.getSailRepoConnection());

  assertEquals(1, bindings.size());

  if (-1 < bindings
      .indexOf("[ret=\"POLYGON ((7.5 0.5, 7.5 2.5, 9.5 2.5, 9.5 0.5, 7.5 0.5));http://www.opengis.net/def/crs/EPSG/0/4326\"^^<http://strdf.di.uoa.gr/ontology#WKT>]")
      || -1 < bindings
          .indexOf("[ret=\"POLYGON ((7.542893218813453 0.5428932188134517, 9.457106781186548 0.5428932188134517, 9.457106781186548 2.4571067811865483, 7.542893218813453 2.4571067811865483, 7.542893218813453 0.5428932188134517));http://www.opengis.net/def/crs/EPSG/0/4326\"^^<http://strdf.di.uoa.gr/ontology#WKT>]"))
    assertTrue(true);
  else
    fail();
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:26,代码来源:SpatialTests.java

示例11: testGeofEhInside

import org.openrdf.query.TupleQueryResultHandlerException; //导入依赖的package包/类
@Test
public void testGeofEhInside() throws MalformedQueryException, QueryEvaluationException,
    TupleQueryResultHandlerException, IOException {
  String query =
      prefixes + "SELECT DISTINCT ?id1 ?id2 \n" + "WHERE { \n" + " ?s1 ex:id ?id1 . \n"
          + " ?s2 ex:id ?id2 . \n" + " FILTER( str(?id1) != str(?id2) ) . \n"
          + " ?s2 ex:geometry ?g2 . \n" + " ?s1 ex:geometry ?g1 . \n"
          + " FILTER( geof:ehInside(?g1, ?g2 )) . \n" + "}";

  @SuppressWarnings("unchecked")
  ArrayList<String> bindings =
      (ArrayList<String>) strabon.query(query, strabon.getSailRepoConnection());
  assertEquals(1, bindings.size());
  assertTrue(-1 < bindings
      .indexOf(
          "[id2=\"Z\"^^<http://www.w3.org/2001/XMLSchema#string>;id1=\"E\"^^<http://www.w3.org/2001/XMLSchema#string>]"));
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:18,代码来源:SpatialTests.java

示例12: testGeofRcc8Ec

import org.openrdf.query.TupleQueryResultHandlerException; //导入依赖的package包/类
@Test
public void testGeofRcc8Ec() throws MalformedQueryException, QueryEvaluationException,
    TupleQueryResultHandlerException, IOException {
  String query =
      prefixes + "SELECT DISTINCT ?id1 ?id2 \n" + "WHERE { \n" + " ?s1 ex:id ?id1 . \n"
          + " ?s2 ex:id ?id2 . \n" + " FILTER( str(?id1) != str(?id2) ) . \n"
          + " ?s2 ex:geometry ?g2 . \n" + " ?s1 ex:geometry ?g1 . \n"
          + " FILTER( geof:rcc8po(?g1, ?g2 )) . \n" + "}";

  @SuppressWarnings("unchecked")
  ArrayList<String> bindings =
      (ArrayList<String>) strabon.query(query, strabon.getSailRepoConnection());
  assertEquals(2, bindings.size());
  assertTrue(-1 < bindings
      .indexOf("[id2=\"B\"^^<http://www.w3.org/2001/XMLSchema#string>;id1=\"Z\"^^<http://www.w3.org/2001/XMLSchema#string>]"));
  assertTrue(-1 < bindings
      .indexOf("[id2=\"Z\"^^<http://www.w3.org/2001/XMLSchema#string>;id1=\"B\"^^<http://www.w3.org/2001/XMLSchema#string>]"));
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:19,代码来源:SpatialTests.java

示例13: testGeofEhCovers

import org.openrdf.query.TupleQueryResultHandlerException; //导入依赖的package包/类
@Test
public void testGeofEhCovers() throws MalformedQueryException, QueryEvaluationException,
    TupleQueryResultHandlerException, IOException {
  String query =
      prefixes + "SELECT DISTINCT ?id1 ?id2 \n" + "WHERE { \n" + " ?s1 ex:id ?id1 . \n"
          + " ?s2 ex:id ?id2 . \n" + " FILTER( str(?id1) != str(?id2) ) . \n"
          + " ?s2 ex:geometry ?g2 . \n" + " ?s1 ex:geometry ?g1 . \n"
          + " FILTER( geof:ehCovers(?g1, ?g2 )) . \n" + "}";

  @SuppressWarnings("unchecked")
  ArrayList<String> bindings =
      (ArrayList<String>) strabon.query(query, strabon.getSailRepoConnection());
  assertEquals(1, bindings.size());
  assertTrue(-1 < bindings
      .indexOf("[id2=\"F\"^^<http://www.w3.org/2001/XMLSchema#string>;id1=\"Z\"^^<http://www.w3.org/2001/XMLSchema#string>]"));
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:17,代码来源:SpatialTests.java

示例14: testStrdfCrosses

import org.openrdf.query.TupleQueryResultHandlerException; //导入依赖的package包/类
@Test
public void testStrdfCrosses() throws MalformedQueryException, QueryEvaluationException,
    TupleQueryResultHandlerException, IOException {
  String query =
      prefixes + "SELECT DISTINCT ?id1 ?id2 \n" + "WHERE { \n" + " ?s1 ex:id ?id1 . \n"
          + " ?s2 ex:id ?id2 . \n" + " FILTER( str(?id1) != str(?id2) ) . \n"
          + " ?s2 ex:geometry ?g2 . \n" + " ?s1 ex:geometry ?g1 . \n"
          + " FILTER( strdf:crosses(?g1, ?g2 )) . \n" + "}";

  @SuppressWarnings("unchecked")
  ArrayList<String> bindings =
      (ArrayList<String>) strabon.query(query, strabon.getSailRepoConnection());
  assertEquals(2, bindings.size());
  assertTrue(-1 < bindings
      .indexOf(
          "[id2=\"L1\"^^<http://www.w3.org/2001/XMLSchema#string>;id1=\"L2\"^^<http://www.w3.org/2001/XMLSchema#string>]"));
  assertTrue(-1 < bindings
      .indexOf(
          "[id2=\"L2\"^^<http://www.w3.org/2001/XMLSchema#string>;id1=\"L1\"^^<http://www.w3.org/2001/XMLSchema#string>]"));
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:21,代码来源:SpatialTests.java

示例15: testUnionWithDifferentObject

import org.openrdf.query.TupleQueryResultHandlerException; //导入依赖的package包/类
@Test
public void testUnionWithDifferentObject() throws MalformedQueryException, RepositoryException,
    QueryEvaluationException, TupleQueryResultHandlerException, IOException {
  String queryString =
      prefixes + "SELECT ?x ?y \n"
          + "WHERE  { { ?book dc10:title  ?x } UNION { ?book dc11:title  ?y } } \n";

  @SuppressWarnings("unchecked")
  ArrayList<String> results =
      (ArrayList<String>) strabon.query(queryString, strabon.getSailRepoConnection());
  assertEquals(6, results.size());
  assertTrue(-1 < results.indexOf("[x=\"SPARQL Query Language Tutorial\"]"));
  assertTrue(-1 < results.indexOf("[x=\"SPARQL\"]"));
  assertTrue(-1 < results.indexOf("[y=\"SPARQL Tutorial\"]"));
  assertTrue(-1 < results.indexOf("[y=\"The Semantic Web\"]"));
  assertTrue(-1 < results.indexOf("[y=\"SPARQL Protocol Tutorial\"]"));
  assertTrue(-1 < results.indexOf("[y=\"SPARQL (updated)\"]"));
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:19,代码来源:SPARQL11Tests.java


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