You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by GitBox <gi...@apache.org> on 2021/04/22 11:16:44 UTC

[GitHub] [jena] afs commented on a change in pull request #984: JENA-2088: Quad execution. Rework the basic graph pattern execution. Code clean up.

afs commented on a change in pull request #984:
URL: https://github.com/apache/jena/pull/984#discussion_r618308941



##########
File path: jena-arq/src/main/java/org/apache/jena/sparql/engine/main/solver/PatternMatchData.java
##########
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.sparql.engine.main.solver;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.function.Predicate;
+
+import org.apache.jena.graph.Graph;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.Triple;
+import org.apache.jena.sparql.core.BasicPattern;
+import org.apache.jena.sparql.core.DatasetGraph;
+import org.apache.jena.sparql.core.Quad;
+import org.apache.jena.sparql.engine.ExecutionContext;
+import org.apache.jena.sparql.engine.QueryIterator;
+import org.apache.jena.sparql.engine.binding.Binding;
+import org.apache.jena.sparql.engine.iterator.Abortable;
+import org.apache.jena.sparql.engine.iterator.QueryIterAbortable;
+
+/**
+ * Match a graph node + basic graph pattern.
+ */
+public class PatternMatchData {
+
+    /**
+     * Non-reordering execution of a triple pattern (basic graph pattern),
+     * given an iterator of bindings as input.
+     */
+    public static QueryIterator execute(Graph graph, BasicPattern pattern,
+                                        QueryIterator input, Predicate<Triple> filter,

Review comment:
       Not yet. This PR is "replace machinery, same functionality". Filter have only been implemented for TDB1 and TDB2.

##########
File path: jena-arq/src/main/java/org/apache/jena/sparql/engine/main/solver/PatternMatchData.java
##########
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.sparql.engine.main.solver;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.function.Predicate;
+
+import org.apache.jena.graph.Graph;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.Triple;
+import org.apache.jena.sparql.core.BasicPattern;
+import org.apache.jena.sparql.core.DatasetGraph;
+import org.apache.jena.sparql.core.Quad;
+import org.apache.jena.sparql.engine.ExecutionContext;
+import org.apache.jena.sparql.engine.QueryIterator;
+import org.apache.jena.sparql.engine.binding.Binding;
+import org.apache.jena.sparql.engine.iterator.Abortable;
+import org.apache.jena.sparql.engine.iterator.QueryIterAbortable;
+
+/**
+ * Match a graph node + basic graph pattern.
+ */
+public class PatternMatchData {
+
+    /**
+     * Non-reordering execution of a triple pattern (basic graph pattern),
+     * given an iterator of bindings as input.
+     */
+    public static QueryIterator execute(Graph graph, BasicPattern pattern,
+                                        QueryIterator input, Predicate<Triple> filter,
+                                        ExecutionContext execCxt)
+    {
+        List<Triple> triples = pattern.getList();
+
+        Iterator<Binding> chain = input;
+        List<Abortable> killList = new ArrayList<>();
+
+        for ( Triple triple : triples ) {
+            // Plain, no RDF-star
+            //chain = StageMatchTriple.accessTriple(chain, graph, triple, filter, execCxt);

Review comment:
       `StageMatchTriple.accessTriple` does a direct data access, no processing of RDF-star embedded triples with variables `<<:s :p ?o>>`. `SolverRX3.rdfStarTriple`  processes this extras and then calls `StageMatchTriple.accessTriple` in `SolverRX3.matchData`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org