org.eclipse.rdf4j.query.algebra.BindingSetAssignment Java Examples
The following examples show how to use
org.eclipse.rdf4j.query.algebra.BindingSetAssignment.
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: 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 #2
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 #3
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 #4
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 #5
Source File: GeneralizedExternalProcessor.java From rya with Apache License 2.0 | 6 votes |
@Override public void meet(Join queryNode) { // if query tree contains external tuples and they are not // positioned above statement pattern node // reposition if (this.bsas.size() > 0 && !(queryNode.getRightArg() instanceof BindingSetAssignment)) { QNodeExchanger qnev = new QNodeExchanger(queryNode.getRightArg(), bsas); queryNode.visit(qnev); queryNode.replaceChildNode(queryNode.getRightArg(), qnev.getReplaced()); super.meet(queryNode); } else { super.meet(queryNode); } }
Example #6
Source File: GeneralizedExternalProcessor.java From rya with Apache License 2.0 | 6 votes |
@Override public void meet(Join queryNode) { // if query tree contains external tuples and they are not // positioned above statement pattern node // reposition if (this.extTuples.size() > 0 && !(queryNode.getRightArg() instanceof ExternalTupleSet) && !(queryNode.getRightArg() instanceof BindingSetAssignment)) { if (queryNode.getLeftArg() instanceof ExternalTupleSet) { QueryModelNode temp = queryNode.getLeftArg(); queryNode.setLeftArg(queryNode.getRightArg()); queryNode.setRightArg((TupleExpr)temp); } else { QNodeExchanger qnev = new QNodeExchanger(queryNode.getRightArg(), this.extTuples); queryNode.visit(qnev); queryNode.replaceChildNode(queryNode.getRightArg(), qnev.getReplaced()); super.meet(queryNode); } } else { super.meet(queryNode); } }
Example #7
Source File: HalyardTupleExprEvaluation.java From Halyard with Apache License 2.0 | 6 votes |
/** * Switch logic appropriate for each type of {@link TupleExpr} query model node, sending each type to it's appropriate evaluation method. For example, * {@code UnaryTupleOperator} is sent to {@link evaluateUnaryTupleOperator()}. * @param parent * @param expr * @param bindings */ private void evaluateTupleExpr(BindingSetPipe parent, TupleExpr expr, BindingSet bindings) { if (expr instanceof StatementPattern) { statementEvaluation.evaluateStatementPattern(parent, (StatementPattern) expr, bindings); } else if (expr instanceof UnaryTupleOperator) { evaluateUnaryTupleOperator(parent, (UnaryTupleOperator) expr, bindings); } else if (expr instanceof BinaryTupleOperator) { evaluateBinaryTupleOperator(parent, (BinaryTupleOperator) expr, bindings); } else if (expr instanceof SingletonSet) { evaluateSingletonSet(parent, (SingletonSet) expr, bindings); } else if (expr instanceof EmptySet) { evaluateEmptySet(parent, (EmptySet) expr, bindings); } else if (expr instanceof ExternalSet) { evaluateExternalSet(parent, (ExternalSet) expr, bindings); } else if (expr instanceof ZeroLengthPath) { evaluateZeroLengthPath(parent, (ZeroLengthPath) expr, bindings); } else if (expr instanceof ArbitraryLengthPath) { evaluateArbitraryLengthPath(parent, (ArbitraryLengthPath) expr, bindings); } else if (expr instanceof BindingSetAssignment) { evaluateBindingSetAssignment(parent, (BindingSetAssignment) expr, bindings); } else if (expr == null) { parent.handleException(new IllegalArgumentException("expr must not be null")); } else { parent.handleException(new QueryEvaluationException("Unsupported tuple expr type: " + expr.getClass())); } }
Example #8
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 #9
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 #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: LuceneSailConnection.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Evaluate the given Lucene queries, generate bindings from the query result, add the bindings to the query tree, * and remove the Lucene queries from the given query tree. * * @param queries * @throws SailException */ private void evaluateLuceneQueries(Collection<SearchQueryEvaluator> queries) throws SailException { // TODO: optimize lucene queries here // - if they refer to the same subject, merge them into one lucene query // - multiple different property constraints can be put into the lucene // query string (escape colons here) if (closed.get()) { throw new SailException("Sail has been closed already"); } // evaluate queries, generate binding sets, and remove queries for (SearchQueryEvaluator query : queries) { // evaluate the Lucene query and generate bindings final Collection<BindingSet> bindingSets = luceneIndex.evaluate(query); final BindingSetAssignment bsa = new BindingSetAssignment(); // found something? if (bindingSets != null && !bindingSets.isEmpty()) { bsa.setBindingSets(bindingSets); if (bindingSets instanceof BindingSetCollection) { bsa.setBindingNames(((BindingSetCollection) bindingSets).getBindingNames()); } } query.replaceQueryPatternsWithResults(bsa); } }
Example #12
Source File: GeneralizedExternalProcessor.java From rya with Apache License 2.0 | 5 votes |
@Override public void meetNode(QueryModelNode node) { if (!(node instanceof Join || node instanceof StatementPattern || node instanceof BindingSetAssignment || node instanceof Var)) { isValid = false; return; } else{ super.meetNode(node); } }
Example #13
Source File: TupleExprBuilder.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public BindingSetAssignment visit(ASTBindingsClause node, Object data) throws VisitorException { BindingSetAssignment bsa = new BindingSetAssignment(); List<ASTVar> varNodes = node.jjtGetChildren(ASTVar.class); List<Var> vars = new ArrayList<>(varNodes.size()); // preserve order in query Set<String> bindingNames = new LinkedHashSet<>(varNodes.size()); for (ASTVar varNode : varNodes) { Var var = (Var) varNode.jjtAccept(this, data); vars.add(var); bindingNames.add(var.getName()); } bsa.setBindingNames(bindingNames); List<ASTBindingSet> bindingNodes = node.jjtGetChildren(ASTBindingSet.class); List<BindingSet> bindingSets = new ArrayList<>(bindingNodes.size()); for (ASTBindingSet bindingNode : bindingNodes) { BindingSet bindingSet = (BindingSet) bindingNode.jjtAccept(this, vars); bindingSets.add(bindingSet); } bsa.setBindingSets(bindingSets); return bsa; }
Example #14
Source File: TupleExprBuilder.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public BindingSetAssignment visit(ASTInlineData node, Object data) throws VisitorException { BindingSetAssignment bsa = new BindingSetAssignment(); List<ASTVar> varNodes = node.jjtGetChildren(ASTVar.class); List<Var> vars = new ArrayList<>(varNodes.size()); // preserve order in query Set<String> bindingNames = new LinkedHashSet<>(varNodes.size()); for (ASTVar varNode : varNodes) { Var var = (Var) varNode.jjtAccept(this, data); vars.add(var); bindingNames.add(var.getName()); } bsa.setBindingNames(bindingNames); List<ASTBindingSet> bindingNodes = node.jjtGetChildren(ASTBindingSet.class); List<BindingSet> bindingSets = new ArrayList<>(bindingNodes.size()); for (ASTBindingSet bindingNode : bindingNodes) { BindingSet bindingSet = (BindingSet) bindingNode.jjtAccept(this, vars); bindingSets.add(bindingSet); } bsa.setBindingSets(bindingSets); graphPattern.addRequiredTE(bsa); return bsa; }
Example #15
Source File: OneOfVisitor.java From rya with Apache License 2.0 | 5 votes |
@Override protected void meetSP(final StatementPattern node) throws Exception { final Var subVar = node.getSubjectVar(); final Var predVar = node.getPredicateVar(); final Var objVar = node.getObjectVar(); final Var conVar = node.getContextVar(); if (predVar != null && objVar != null && objVar.getValue() != null && objVar.getValue() instanceof Resource && RDF.TYPE.equals(predVar.getValue()) && !EXPANDED.equals(conVar)) { final Resource object = (Resource) objVar.getValue(); if (inferenceEngine.isEnumeratedType(object)) { final Set<BindingSet> solutions = new LinkedHashSet<>(); final Set<Resource> enumeration = inferenceEngine.getEnumeration(object); for (final Resource enumType : enumeration) { final QueryBindingSet qbs = new QueryBindingSet(); qbs.addBinding(subVar.getName(), enumType); solutions.add(qbs); } if (!solutions.isEmpty()) { final BindingSetAssignment enumNode = new BindingSetAssignment(); enumNode.setBindingSets(solutions); node.replaceWith(enumNode); log.trace("Replacing node with inferred one of enumeration: " + enumNode); } } } }
Example #16
Source File: OneOfVisitorTest.java From rya with Apache License 2.0 | 5 votes |
@Test public void testOneOf() throws Exception { // Configure a mock instance engine with an ontology: final InferenceEngine inferenceEngine = mock(InferenceEngine.class); when(inferenceEngine.isEnumeratedType(SUITS)).thenReturn(true); when(inferenceEngine.getEnumeration(SUITS)).thenReturn(CARD_SUIT_ENUMERATION); when(inferenceEngine.isEnumeratedType(RANKS)).thenReturn(true); when(inferenceEngine.getEnumeration(RANKS)).thenReturn(CARD_RANK_ENUMERATION); // Query for a Suits and rewrite using the visitor: final Projection query = new Projection( new StatementPattern(new Var("s"), new Var("p", RDF.TYPE), new Var("o", SUITS)), new ProjectionElemList(new ProjectionElem("s", "subject"))); query.visit(new OneOfVisitor(conf, inferenceEngine)); // Expected structure: BindingSetAssignment containing the enumeration: // BindingSetAssignment(CLUBS, DIAMONDS, HEARTS, SPADES) // Collect the arguments to the BindingSetAssignment: assertTrue(query.getArg() instanceof BindingSetAssignment); final BindingSetAssignment bsa = (BindingSetAssignment) query.getArg(); final Iterable<BindingSet> iterable = bsa.getBindingSets(); final Iterator<BindingSet> iter = iterable.iterator(); assertBindingSet(iter, CARD_SUIT_ENUMERATION.iterator()); // Query for a Ranks and rewrite using the visitor: final Projection query2 = new Projection( new StatementPattern(new Var("s"), new Var("p", RDF.TYPE), new Var("o", RANKS)), new ProjectionElemList(new ProjectionElem("s", "subject"))); query2.visit(new OneOfVisitor(conf, inferenceEngine)); // Expected structure: BindingSetAssignment containing the enumeration: // BindingSetAssignment(ACE, 2, 3, 4, 5, 6, 7, 8, 9, 10, JACK, QUEEN, KING) // Collect the arguments to the BindingSetAssignment: assertTrue(query2.getArg() instanceof BindingSetAssignment); final BindingSetAssignment bsa2 = (BindingSetAssignment) query2.getArg(); final Iterable<BindingSet> iterable2 = bsa2.getBindingSets(); final Iterator<BindingSet> iter2 = iterable2.iterator(); assertBindingSet(iter2, CARD_RANK_ENUMERATION.iterator()); }
Example #17
Source File: TupleExecutionPlanGenerator.java From rya with Apache License 2.0 | 5 votes |
@Override public void meetNode(final QueryModelNode node) throws RuntimeException { if (node instanceof ExternalTupleSet || node instanceof BindingSetAssignment || node instanceof StatementPattern) { nodeSet.add(node); } super.meetNode(node); }
Example #18
Source File: GeneralizedExternalProcessor.java From rya with Apache License 2.0 | 5 votes |
@Override public void meet(Join node) { Set<QueryModelNode> eSet = getQNodes(node); if (eSet.containsAll(sSet) && !(node.getRightArg() instanceof BindingSetAssignment)) { // System.out.println("Eset is " + eSet + " and sSet is " + sSet); if (eSet.equals(sSet)) { node.replaceWith(set); indexPlaced = true; return; } else { if (node.getLeftArg() instanceof StatementPattern && sSet.size() == 1) { if(sSet.contains(node.getLeftArg())) { node.setLeftArg(set); indexPlaced = true; } else if(sSet.contains(node.getRightArg())) { node.setRightArg(set); indexPlaced = true; } else { return; } } else { super.meet(node); } } } else if (eSet.containsAll(sSet)) { super.meet(node); } else { return; } }
Example #19
Source File: EvaluationStatistics.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void meet(BindingSetAssignment node) { // actual cardinality is node.getBindingSets().size() binding sets // but cost is cheap as we don't need to query the triple store // so effective cardinality is 1 or a very slowly increasing function of node.getBindingSets().size(). cardinality = 1.0; }
Example #20
Source File: AbstractBulkJoinPlanNode.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void updateQuery(ParsedQuery parsedQuery, List<BindingSet> newBindindingset) { try { parsedQuery.getTupleExpr() .visitChildren(new AbstractQueryModelVisitor<Exception>() { @Override public void meet(BindingSetAssignment node) { node.setBindingSets(newBindindingset); } }); } catch (Exception e) { throw new RuntimeException(e); } }
Example #21
Source File: GeoRelationQuerySpecTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testReplaceQueryPatternsWithNonEmptyResults() { final String expectedQueryPlan = "Projection\n" + " ProjectionElemList\n" + " ProjectionElem \"matchUri\"\n" + " ProjectionElem \"match\"\n" + " BindingSetAssignment ([[toUri=urn:subject4;to=\"POLYGON ((2.3294 48.8726, 2.2719 48.8643, 2.3370 48.8398, 2.3294 48.8726))\"^^<http://www.opengis.net/ont/geosparql#wktLiteral>]])\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); final MapBindingSet bindingSet = new MapBindingSet(); bindingSet.addBinding("toUri", VF.createIRI("urn:subject4")); bindingSet.addBinding("to", VF.createLiteral( "POLYGON ((2.3294 48.8726, 2.2719 48.8643, 2.3370 48.8398, 2.3294 48.8726))", GEO.WKT_LITERAL)); BindingSetAssignment bsa = new BindingSetAssignment(); bsa.setBindingSets(Collections.singletonList(bindingSet)); querySpec.replaceQueryPatternsWithResults(bsa); String result = querySpec.getParentQueryModelNode().getParentNode().toString().replaceAll("\r\n|\r", "\n"); assertEquals(expectedQueryPlan, result); }
Example #22
Source File: DistanceQuerySpecTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testReplaceQueryPatternsWithNonEmptyResults() { final String expectedQueryPlan = "Projection\n" + " ProjectionElemList\n" + " ProjectionElem \"toUri\"\n" + " ProjectionElem \"to\"\n" + " BindingSetAssignment ([[toUri=urn:subject1;to=\"POINT (2.2945 48.8582)\"^^<http://www.opengis.net/ont/geosparql#wktLiteral>]])\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); final MapBindingSet bindingSet = new MapBindingSet(); bindingSet.addBinding("toUri", VF.createIRI("urn:subject1")); bindingSet.addBinding("to", VF.createLiteral("POINT (2.2945 48.8582)", GEO.WKT_LITERAL)); BindingSetAssignment bsa = new BindingSetAssignment(); bsa.setBindingSets(Collections.singletonList(bindingSet)); querySpec.replaceQueryPatternsWithResults(bsa); String result = querySpec.getParentQueryModelNode().getParentNode().toString().replaceAll("\r\n|\r", "\n"); assertEquals(expectedQueryPlan, result); }
Example #23
Source File: AbstractSearchQueryEvaluator.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void replaceQueryPatternsWithResults(final BindingSetAssignment bsa) { final QueryModelNode placeholder = removeQueryPatterns(); if (bsa != null && bsa.getBindingSets() != null && bsa.getBindingSets().iterator().hasNext()) { placeholder.replaceWith(bsa); } else { placeholder.replaceWith(new EmptySet()); } }
Example #24
Source File: DefaultFedXCostModel.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public double estimateCost(TupleExpr tupleExpr, Set<String> joinVars) { if (tupleExpr instanceof StatementSourcePattern) { return estimateCost((StatementSourcePattern) tupleExpr, joinVars); } if (tupleExpr instanceof ExclusiveStatement) { return estimateCost((ExclusiveStatement) tupleExpr, joinVars); } if (tupleExpr instanceof ExclusiveGroup) { return estimateCost((ExclusiveGroup) tupleExpr, joinVars); } if (tupleExpr instanceof NJoin) { return estimateCost((NJoin) tupleExpr, joinVars); } if (tupleExpr instanceof NUnion) { return estimateCost((NUnion) tupleExpr, joinVars); } if (tupleExpr instanceof FedXService) { return estimateCost((FedXService) tupleExpr, joinVars); } if (tupleExpr instanceof Projection) { return estimateCost((Projection) tupleExpr, joinVars); } if (tupleExpr instanceof BindingSetAssignment) { return 0; } if (tupleExpr instanceof Extension) { return 0; } if (tupleExpr instanceof ArbitraryLengthPath) { return estimateCost((ArbitraryLengthPath) tupleExpr, joinVars); } log.debug("No cost estimation for " + tupleExpr.getClass().getSimpleName() + " available."); return 1000d; }
Example #25
Source File: GeneralizedExternalProcessor.java From rya with Apache License 2.0 | 4 votes |
@Override public void meet(BindingSetAssignment node) { bindingSetList.add(node); super.meet(node); }
Example #26
Source File: PcjIntegrationTestingUtil.java From rya with Apache License 2.0 | 4 votes |
@Override public void meet(final BindingSetAssignment node) { bindingSetList.add(node); super.meet(node); }
Example #27
Source File: BindingSetAssignmentBlock.java From semagrow with Apache License 2.0 | 4 votes |
public Collection<Plan> getPlans(CompilerContext context) { BindingSetAssignment expr = new BindingSetAssignment(); expr.setBindingNames(bindingNames); expr.setBindingSets(bindingSets); return Collections.singleton(context.asPlan(expr)); }
Example #28
Source File: BindingSetAssignmentCollector.java From semagrow with Apache License 2.0 | 4 votes |
public static List<BindingSetAssignment> process(QueryModelNode node) { BindingSetAssignmentCollector collector = new BindingSetAssignmentCollector(); node.visit(collector); return collector.getBindingSetAssigments(); }
Example #29
Source File: BindingSetAssignmentCollector.java From semagrow with Apache License 2.0 | 4 votes |
public List<BindingSetAssignment> getBindingSetAssigments() { return this.stPatterns; }
Example #30
Source File: BindingSetAssignmentCollector.java From semagrow with Apache License 2.0 | 4 votes |
public void meet(BindingSetAssignment node) { this.stPatterns.add(node); }