org.eclipse.rdf4j.query.impl.EmptyBindingSet Java Examples
The following examples show how to use
org.eclipse.rdf4j.query.impl.EmptyBindingSet.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoggingTupleQueryResultHandler.java From semagrow with Apache License 2.0 | 6 votes |
@Override public void startQueryResult(List<String> list) throws TupleQueryResultHandlerException { count = 0; start = System.currentTimeMillis(); if (handle != null) { queryLogRecord = createMetadata(SimpleValueFactory.getInstance().createIRI(endpoint.toString()), query, EmptyBindingSet.getInstance(), list); try { handle = mat.saveResult(); } catch (QueryEvaluationException e) { logger.error("Error while creating a materialization handle", e); } handle.startQueryResult(list); } super.startQueryResult(list); }
Example #2
Source File: TBSSSourceSelectionOriginal.java From CostFed with GNU Affero General Public License v3.0 | 6 votes |
@Override public Void call() throws Exception { try { TripleSource t = endpoint.getTripleSource(); RepositoryConnection conn = endpoint.getConn(); boolean hasResults = t.hasStatements(stmt, conn, EmptyBindingSet.getInstance()); CacheEntry entry = CacheUtils.createCacheEntry(endpoint, hasResults); sourceSelection.cache.updateEntry( new SubQuery(stmt), entry); if (hasResults) sourceSelection.addSource(stmt, new StatementSource(endpoint.getId(), StatementSourceType.REMOTE)); return null; } catch (Exception e) { throw new OptimizationException("Error checking results for endpoint " + endpoint.getId() + ": " + e.getMessage(), e); } }
Example #3
Source File: TBSSSourceSelection.java From CostFed with GNU Affero General Public License v3.0 | 6 votes |
@Override public Void call() throws Exception { try { TripleSource t = endpoint.getTripleSource(); RepositoryConnection conn = endpoint.getConn(); boolean hasResults = t.hasStatements(stmt, conn, EmptyBindingSet.getInstance()); CacheEntry entry = CacheUtils.createCacheEntry(endpoint, hasResults); sourceSelection.cache.updateEntry( new SubQuery(stmt), entry); if (hasResults) sourceSelection.addSource(stmt, new StatementSource(endpoint.getId(), StatementSourceType.REMOTE)); return null; } catch (Exception e) { throw new OptimizationException("Error checking results for endpoint " + endpoint.getId() + ": " + e.getMessage(), e); } }
Example #4
Source File: HibiscusSourceSelection.java From CostFed with GNU Affero General Public License v3.0 | 6 votes |
@Override public CloseableIteration<BindingSet, QueryEvaluationException> call() throws Exception { try { TripleSource t = endpoint.getTripleSource(); RepositoryConnection conn = endpoint.getConn(); boolean hasResults = t.hasStatements(stmt, conn, EmptyBindingSet.getInstance()); CacheEntry entry = CacheUtils.createCacheEntry(endpoint, hasResults); sourceSelection.cache.updateEntry( new SubQuery(stmt), entry); if (hasResults) sourceSelection.addSource(stmt, new StatementSource(endpoint.getId(), StatementSourceType.REMOTE)); return null; } catch (Exception e) { throw new OptimizationException("Error checking results for endpoint " + endpoint.getId() + ": " + e.getMessage(), e); } }
Example #5
Source File: FedSumSourceSelection.java From CostFed with GNU Affero General Public License v3.0 | 6 votes |
@Override public CloseableIteration<BindingSet, QueryEvaluationException> call() throws Exception { try { TripleSource t = endpoint.getTripleSource(); RepositoryConnection conn = endpoint.getConn(); boolean hasResults = t.hasStatements(stmt, conn, EmptyBindingSet.getInstance()); CacheEntry entry = CacheUtils.createCacheEntry(endpoint, hasResults); sourceSelection.cache.updateEntry( new SubQuery(stmt), entry); if (hasResults) sourceSelection.addSource(stmt, new StatementSource(endpoint.getId(), StatementSourceType.REMOTE)); return null; } catch (Exception e) { throw new OptimizationException("Error checking results for endpoint " + endpoint.getId() + ": " + e.getMessage(), e); } }
Example #6
Source File: DefaultSourceSelection.java From CostFed with GNU Affero General Public License v3.0 | 6 votes |
@Override public CloseableIteration<BindingSet, QueryEvaluationException> call() { try { TripleSource t = endpoint.getTripleSource(); RepositoryConnection conn = endpoint.getConn(); boolean hasResults = t.hasStatements(stmt, conn, EmptyBindingSet.getInstance()); DefaultSourceSelection sourceSelection = control.sourceSelection; CacheEntry entry = CacheUtils.createCacheEntry(endpoint, hasResults); sourceSelection.cache.updateEntry( new SubQuery(stmt), entry); if (hasResults) sourceSelection.addSource(stmt, new StatementSource(endpoint.getId(), StatementSourceType.REMOTE)); return null; } catch (Exception e) { this.control.toss(e); throw new OptimizationException("Error checking results for endpoint " + endpoint.getId() + ": " + e.getMessage(), e); } }
Example #7
Source File: FederationEvalStrategy.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Evaluate a SERVICE using vectored evaluation, taking the provided bindings as input. * * See {@link ControlledWorkerBoundJoin} and {@link FedXConfig#getEnableServiceAsBoundJoin()} * * @param service * @param bindings * @return the result iteration * @throws QueryEvaluationException */ public CloseableIteration<BindingSet, QueryEvaluationException> evaluateService(FedXService service, final List<BindingSet> bindings) throws QueryEvaluationException { Var serviceRef = service.getService().getServiceRef(); String serviceUri; if (serviceRef.hasValue()) { serviceUri = serviceRef.getValue().stringValue(); } else { return new ServiceJoinIterator(new CollectionIteration<>(bindings), service.getService(), EmptyBindingSet.getInstance(), this); } // use vectored evaluation FederatedService fs = getService(serviceUri); if (fs instanceof RepositoryFederatedService) { // set the bound join block size to 0 => leave block size up to FedX engine ((RepositoryFederatedService) fs).setBoundJoinBlockSize(0); } return fs.evaluate(service.getService(), new CollectionIteration<>(bindings), service.getService().getBaseURI()); }
Example #8
Source File: SparqlTripleSource.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public boolean hasStatements(Resource subj, IRI pred, Value obj, QueryInfo queryInfo, Resource... contexts) throws RepositoryException { if (!useASKQueries) { StatementPattern st = new StatementPattern(new Var("s", subj), new Var("p", pred), new Var("o", obj)); Dataset dataset = FedXUtil.toDataset(contexts); try { return hasStatements(st, EmptyBindingSet.getInstance(), queryInfo, dataset); } catch (Exception e) { throw new RepositoryException(e); } } return super.hasStatements(subj, pred, obj, queryInfo, contexts); }
Example #9
Source File: SourceSelection.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public CloseableIteration<BindingSet, QueryEvaluationException> performTask() throws Exception { try { TripleSource t = endpoint.getTripleSource(); boolean hasResults = false; hasResults = t.hasStatements(stmt, EmptyBindingSet.getInstance(), queryInfo, queryInfo.getDataset()); SourceSelection sourceSelection = control.sourceSelection; sourceSelection.cache.updateInformation(new SubQuery(stmt, queryInfo.getDataset()), endpoint, hasResults); if (hasResults) { sourceSelection.addSource(stmt, new StatementSource(endpoint.getId(), StatementSourceType.REMOTE)); } return null; } catch (Exception e) { throw new OptimizationException( "Error checking results for endpoint " + endpoint.getId() + ": " + e.getMessage(), e); } }
Example #10
Source File: DistanceQuerySpecTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void testReplaceQueryPatternsWithEmptyResults() { final String expectedQueryPlan = "Projection\n" + " ProjectionElemList\n" + " ProjectionElem \"toUri\"\n" + " ProjectionElem \"to\"\n" + " EmptySet\n"; final ParsedQuery query = parseQuery(QUERY); final List<SearchQueryEvaluator> queries = new ArrayList<>(); new DistanceQuerySpecBuilder(new SearchIndexImpl()) .process(query.getTupleExpr(), EmptyBindingSet.getInstance(), queries); assertEquals(1, queries.size()); final DistanceQuerySpec querySpec = (DistanceQuerySpec) queries.get(0); querySpec.replaceQueryPatternsWithResults(new BindingSetAssignment()); String result = querySpec.getParentQueryModelNode().getParentNode().toString().replaceAll("\r\n|\r", "\n"); assertEquals(expectedQueryPlan, result); }
Example #11
Source File: QuerySpecTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void testReplaceQueryPatternsWithNonEmptyResults() { final String expectedQueryPlan = "Join\n" + " Join\n" + " SingletonSet\n" + " SingletonSet\n" + " BindingSetAssignment ([[searchR=urn:1]])\n"; final ParsedQuery query = parseQuery(QUERY); final List<SearchQueryEvaluator> queries = new ArrayList<>(); new QuerySpecBuilder(true) .process(query.getTupleExpr(), EmptyBindingSet.getInstance(), queries); assertEquals(1, queries.size()); QuerySpec querySpec = (QuerySpec) queries.get(0); BindingSetAssignment bsa = new BindingSetAssignment(); bsa.setBindingSets(createBindingSet("searchR", "urn:1")); querySpec.replaceQueryPatternsWithResults(bsa); String result = querySpec.getParentQueryModelNode().getParentNode().toString().replaceAll("\r\n|\r", "\n"); assertEquals(expectedQueryPlan, result); }
Example #12
Source File: GeoRelationQuerySpecTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void testReplaceQueryPatternsWithEmptyResults() { final String expectedQueryPlan = "Projection\n" + " ProjectionElemList\n" + " ProjectionElem \"matchUri\"\n" + " ProjectionElem \"match\"\n" + " EmptySet\n"; final ParsedQuery query = parseQuery(QUERY); final List<SearchQueryEvaluator> queries = new ArrayList<>(); new GeoRelationQuerySpecBuilder(new SearchIndexImpl()) .process(query.getTupleExpr(), EmptyBindingSet.getInstance(), queries); assertEquals(1, queries.size()); final GeoRelationQuerySpec querySpec = (GeoRelationQuerySpec) queries.get(0); BindingSetAssignment bsa = new BindingSetAssignment(); querySpec.replaceQueryPatternsWithResults(bsa); String result = querySpec.getParentQueryModelNode().getParentNode().toString().replaceAll("\r\n|\r", "\n"); assertEquals(expectedQueryPlan, result); }
Example #13
Source File: DirectTypeHierarchyInferencer.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void evaluateIntoStatements(ParsedGraphQuery query, Collection<Statement> statements) throws SailException, RDFHandlerException, QueryEvaluationException { try (CloseableIteration<? extends BindingSet, QueryEvaluationException> bindingsIter = getWrappedConnection() .evaluate(query.getTupleExpr(), null, EmptyBindingSet.getInstance(), true)) { ValueFactory vf = getValueFactory(); while (bindingsIter.hasNext()) { BindingSet bindings = bindingsIter.next(); Value subj = bindings.getValue("subject"); Value pred = bindings.getValue("predicate"); Value obj = bindings.getValue("object"); if (subj instanceof Resource && pred instanceof IRI && obj != null) { statements.add(vf.createStatement((Resource) subj, (IRI) pred, obj)); } } } }
Example #14
Source File: RDFQueryLogParser.java From semagrow with Apache License 2.0 | 6 votes |
private QueryLogRecord parseQueryRecord(Resource qr, Model model) { Optional<IRI> optionalEndpoint = Models.objectIRI(model.filter(qr, QFR.ENDPOINT, null)); Optional<IRI> optionalResults = Models.objectIRI(model.filter(qr, QFR.RESULTFILE, null)); Date startTime = parseDate(Models.objectLiteral(model.filter(qr, QFR.START, null)).get(), model); Date endTime = parseDate(Models.objectLiteral(model.filter(qr, QFR.END, null)).get(), model); long cardinality = parseCardinality(Models.objectLiteral(model.filter(qr, QFR.CARDINALITY, null)).get(), model); String expr = parseQuery(Models.object(model.filter(qr, QFR.QUERY, null)).get(), model).toString(); QueryLogRecord r = new QueryLogRecordImpl(null, optionalEndpoint.get(), expr , EmptyBindingSet.getInstance(), Collections.<String>emptyList()); //r.setDuration(startTime, endTime); r.setCardinality(cardinality); r.setDuration(startTime.getTime(), endTime.getTime()); r.setResults(optionalResults.get()); return r; }
Example #15
Source File: RDFQueryLogWriter.java From semagrow with Apache License 2.0 | 6 votes |
private Value createQueryRecord(QueryLogRecord qr) throws QueryLogException { Resource record = vf.createIRI("urn:" + UUID.randomUUID().toString()); createStatement(record, RDF.TYPE, QFR.QUERYRECORD); // createStatement(record, QFR.SESSION, qr.getSession().getSessionId().toURI()); createStatement(record, QFR.ENDPOINT, qr.getEndpoint()); createStatement(record, QFR.RESULTFILE, qr.getResults()); createStatement(record, QFR.CARDINALITY, vf.createLiteral(qr.getCardinality())); createStatement(record, QFR.START, vf.createLiteral(qr.getStartTime())); createStatement(record, QFR.END, vf.createLiteral(qr.getEndTime())); createStatement(record, QFR.DURATION, vf.createLiteral(qr.getDuration())); createStatement(record, QFR.QUERY, createTupleExpr(qr.getQuery(), EmptyBindingSet.getInstance())); return record; }
Example #16
Source File: HashJoinIterationTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void testLeftJoin() throws QueryEvaluationException { BindingSetAssignment left = new BindingSetAssignment(); { QueryBindingSet leftb = new QueryBindingSet(); leftb.addBinding("a", vf.createLiteral("1")); leftb.addBinding("i", vf.createLiteral("x")); left.setBindingSets(Arrays.<BindingSet>asList(leftb)); } BindingSetAssignment right = new BindingSetAssignment(); { QueryBindingSet rightb = new QueryBindingSet(); rightb.addBinding("b", vf.createLiteral("2")); rightb.addBinding("i", vf.createLiteral("y")); right.setBindingSets(Arrays.<BindingSet>asList(rightb)); } HashJoinIteration iter = new HashJoinIteration(evaluator, left, right, EmptyBindingSet.getInstance(), true); BindingSet actual = iter.next(); assertEquals("1", actual.getValue("a").stringValue()); assertEquals("x", actual.getValue("i").stringValue()); assertFalse(actual.hasBinding("b")); }
Example #17
Source File: HashJoinIterationTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void testInnerJoin() throws QueryEvaluationException { BindingSetAssignment left = new BindingSetAssignment(); { QueryBindingSet leftb = new QueryBindingSet(); leftb.addBinding("a", vf.createLiteral("1")); leftb.addBinding("i", vf.createLiteral("x")); left.setBindingSets(Arrays.<BindingSet>asList(leftb)); } BindingSetAssignment right = new BindingSetAssignment(); { QueryBindingSet rightb = new QueryBindingSet(); rightb.addBinding("b", vf.createLiteral("2")); rightb.addBinding("i", vf.createLiteral("x")); right.setBindingSets(Arrays.<BindingSet>asList(rightb)); } HashJoinIteration iter = new HashJoinIteration(evaluator, left, right, EmptyBindingSet.getInstance(), false); BindingSet actual = iter.next(); assertEquals("1", actual.getValue("a").stringValue()); assertEquals("2", actual.getValue("b").stringValue()); assertEquals("x", actual.getValue("i").stringValue()); }
Example #18
Source File: HashJoinIterationTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void testCartesianJoin() throws QueryEvaluationException { BindingSetAssignment left = new BindingSetAssignment(); { QueryBindingSet leftb = new QueryBindingSet(); leftb.addBinding("a", vf.createLiteral("1")); left.setBindingSets(Arrays.<BindingSet>asList(leftb)); } BindingSetAssignment right = new BindingSetAssignment(); { QueryBindingSet rightb = new QueryBindingSet(); rightb.addBinding("b", vf.createLiteral("2")); right.setBindingSets(Arrays.<BindingSet>asList(rightb)); } HashJoinIteration iter = new HashJoinIteration(evaluator, left, right, EmptyBindingSet.getInstance(), false); BindingSet actual = iter.next(); assertEquals("1", actual.getValue("a").stringValue()); assertEquals("2", actual.getValue("b").stringValue()); }
Example #19
Source File: EvaluationStrategyWithRDFStarTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void testMatchAllUnbound() { // case check all unbound try (CloseableIteration<BindingSet, QueryEvaluationException> iter = strategy.evaluate(tripleRefNode, new EmptyBindingSet())) { ArrayList<BindingSet> expected = new ArrayList<>(); triples.forEach(t -> { expected.add(fromTriple(t)); }); ArrayList<BindingSet> received = new ArrayList<>(); while (iter.hasNext()) { received.add(iter.next()); } assertTrue("all expected must be received", received.containsAll(expected)); assertTrue("all received must be expected", expected.containsAll(received)); } }
Example #20
Source File: CustomGraphQueryInferencer.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void evaluateIntoStatements(ParsedGraphQuery query, Collection<Statement> statements) throws SailException, RDFHandlerException, QueryEvaluationException { try (CloseableIteration<? extends BindingSet, QueryEvaluationException> bindingsIter = getWrappedConnection() .evaluate(query.getTupleExpr(), null, EmptyBindingSet.getInstance(), true)) { ValueFactory factory = getValueFactory(); while (bindingsIter.hasNext()) { BindingSet bindings = bindingsIter.next(); Value subj = bindings.getValue("subject"); Value pred = bindings.getValue("predicate"); Value obj = bindings.getValue("object"); if (subj instanceof Resource && pred instanceof IRI && obj != null) { statements.add(factory.createStatement((Resource) subj, (IRI) pred, obj)); } } } }
Example #21
Source File: QuerySpecTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void testReplaceQueryPatternsWithEmptyResults() { final String expectedQueryPlan = "Join\n" + " Join\n" + " SingletonSet\n" + " SingletonSet\n" + " EmptySet\n"; final ParsedQuery query = parseQuery(QUERY); final List<SearchQueryEvaluator> queries = new ArrayList<>(); new QuerySpecBuilder(true) .process(query.getTupleExpr(), EmptyBindingSet.getInstance(), queries); assertEquals(1, queries.size()); QuerySpec querySpec = (QuerySpec) queries.get(0); BindingSetAssignment bsa = new BindingSetAssignment(); querySpec.replaceQueryPatternsWithResults(bsa); String result = querySpec.getParentQueryModelNode().getParentNode().toString().replaceAll("\r\n|\r", "\n"); assertEquals(expectedQueryPlan, result); }
Example #22
Source File: QueryResultsTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testEmptyQueryResult3() throws QueryEvaluationException { tqr1.append(EmptyBindingSet.getInstance()); tqr3.append(EmptyBindingSet.getInstance()); assertTrue(QueryResults.equals(tqr3, tqr1)); }
Example #23
Source File: RepositoryFederatedService.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @param inputBindings * @throws QueryEvaluationException */ public BatchingServiceIteration(CloseableIteration<BindingSet, QueryEvaluationException> inputBindings, int blockSize, Service service) throws QueryEvaluationException { super(inputBindings, null, EmptyBindingSet.getInstance()); this.blockSize = blockSize; this.service = service; run(); }
Example #24
Source File: GroupIteratorTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testSumNotZero() throws QueryEvaluationException { Group group = new Group(NONEMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("sum", new Sum(new Var("a")))); GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance()); assertThat(gi.next().getBinding("sum").getValue()).isEqualTo(vf.createLiteral("45", XMLSchema.INTEGER)); }
Example #25
Source File: GroupIteratorTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testCountNotZero() throws QueryEvaluationException { Group group = new Group(NONEMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("count", new Count(new Var("a")))); GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance()); assertThat(gi.next().getBinding("count").getValue()).isEqualTo(vf.createLiteral("9", XMLSchema.INTEGER)); }
Example #26
Source File: ConstantOptimizerTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testAndOptimization() throws RDF4JException { String query = "prefix ex: <ex:>" + "select ?a ?b ?c\n" + "where {\n" + " bind((?a && ?b) as ?c) \n" + "}"; ParsedQuery pq = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, null); TupleExpr original = pq.getTupleExpr(); final AlgebraFinder finder = new AlgebraFinder(); original.visit(finder); assertTrue(finder.logicalAndfound); // reset for re-use on optimized query finder.reset(); QueryBindingSet constants = new QueryBindingSet(); constants.addBinding("a", BooleanLiteral.TRUE); constants.addBinding("b", BooleanLiteral.FALSE); EvaluationStrategy strategy = new StrictEvaluationStrategy(new EmptyTripleSource(), null); TupleExpr optimized = optimize(pq.getTupleExpr().clone(), constants, strategy); optimized.visit(finder); assertFalse("optimized query should no longer contain && operator", finder.logicalAndfound); CloseableIteration<BindingSet, QueryEvaluationException> result = strategy.evaluate(optimized, new EmptyBindingSet()); assertNotNull(result); assertTrue(result.hasNext()); BindingSet bindings = result.next(); assertTrue(bindings.hasBinding("a")); assertTrue(bindings.hasBinding("b")); assertTrue(bindings.hasBinding("c")); }
Example #27
Source File: ConstantOptimizerTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testFunctionOptimization() throws RDF4JException { String query = "prefix ex: <ex:>" + "select ?a ?b ?c \n " + "where {\n" + " bind(concat(?a, ?b) as ?c) \n" + "}"; ParsedQuery pq = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, null); EvaluationStrategy strategy = new StrictEvaluationStrategy(new EmptyTripleSource(), null); TupleExpr original = pq.getTupleExpr(); final AlgebraFinder finder = new AlgebraFinder(); original.visit(finder); assertTrue(finder.functionCallFound); // reset for re-use on optimized query finder.reset(); QueryBindingSet constants = new QueryBindingSet(); constants.addBinding("a", ValueFactoryImpl.getInstance().createLiteral("foo")); constants.addBinding("b", ValueFactoryImpl.getInstance().createLiteral("bar")); TupleExpr optimized = optimize(pq.getTupleExpr().clone(), constants, strategy); optimized.visit(finder); assertFalse("optimized query should no longer contain function call", finder.functionCallFound); CloseableIteration<BindingSet, QueryEvaluationException> result = strategy.evaluate(optimized, new EmptyBindingSet()); assertNotNull(result); assertTrue(result.hasNext()); BindingSet bindings = result.next(); assertTrue(bindings.hasBinding("a")); assertTrue(bindings.hasBinding("b")); assertTrue(bindings.hasBinding("c")); }
Example #28
Source File: GroupIteratorTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testSampleEmptySet() throws QueryEvaluationException { Group group = new Group(EMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("sample", new Sample(new Var("a")))); GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance()); assertThat(gi.hasNext()).isTrue(); assertThat(gi.next().size()).isEqualTo(0); }
Example #29
Source File: GroupIteratorTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testMaxEmptySet_Grouped() throws QueryEvaluationException { Group group = new Group(EMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("max", new Max(new Var("a")))); group.addGroupBindingName("x"); // we are grouping by variable x GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance()); assertThat(gi.hasNext()).isFalse(); }
Example #30
Source File: GroupIteratorTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testMinEmptySet() throws QueryEvaluationException { Group group = new Group(EMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("min", new Min(new Var("a")))); GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance()); assertThat(gi.hasNext()).isTrue(); assertThat(gi.next().size()).isEqualTo(0); }