Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: eclipse-rdf4j/rdf4j
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3e11cd1d6fde4115c6953ab6b8150a71d39dd850
Choose a base ref
..
head repository: eclipse-rdf4j/rdf4j
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 88afcd2a3ea61be1c5ccd9f16d9c95a5d3653051
Choose a head ref
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -49,3 +49,6 @@ docker/ignore
/core/queryparser/sparql/JavaCC/javacc/
/scripts/temp/
org.eclipse.dash.licenses-1.0.2.jar
e2e/node_modules
e2e/playwright-report
e2e/test-results
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@
import org.eclipse.rdf4j.query.Dataset;
import org.eclipse.rdf4j.query.MutableBindingSet;
import org.eclipse.rdf4j.query.QueryEvaluationException;
import org.eclipse.rdf4j.query.algebra.BindingSetAssignment;
import org.eclipse.rdf4j.query.algebra.ExtensionElem;
import org.eclipse.rdf4j.query.algebra.Group;
import org.eclipse.rdf4j.query.algebra.MultiProjection;
@@ -307,6 +308,19 @@ public void meet(ExtensionElem node) throws QueryEvaluationException {
super.meet(node);
}

@Override
public void meet(BindingSetAssignment node) throws QueryEvaluationException {
Set<String> bindingNames = node.getBindingNames();

Set<String> collect = bindingNames.stream()
.map(varName -> varNames.computeIfAbsent(varName, k -> k))
.collect(Collectors.toSet());

node.setBindingNames(collect);

super.meet(node);
}

@Override
public void meet(Group node) throws QueryEvaluationException {
List<String> collect = node.getGroupBindingNames()
@@ -316,6 +330,7 @@ public void meet(Group node) throws QueryEvaluationException {
node.setGroupBindingNames(collect);
super.meet(node);
}

};
node.visit(queryModelVisitorBase);
return varNames.keySet().toArray(new String[0]);
Original file line number Diff line number Diff line change
@@ -103,6 +103,7 @@ public void addRequiredTE(TupleExpr te) {
*/
void clearRequiredTEs() {
requiredTEs.clear();
optionalTEs.clear();
}

public void addRequiredSP(Var subjVar, Var predVar, Var objVar) {
@@ -173,6 +174,18 @@ public void clear() {
public TupleExpr buildTupleExpr() {
TupleExpr result = buildJoinFromRequiredTEs();

result = buildOptionalTE(result);

for (ValueExpr constraint : constraints) {
result = new Filter(result, constraint);
}
return result;
}

/**
* Build optionals to the supplied TE
*/
public TupleExpr buildOptionalTE(TupleExpr result) {
for (Map.Entry<TupleExpr, List<ValueExpr>> entry : optionalTEs) {
List<ValueExpr> constraints = entry.getValue();
if (constraints != null && !constraints.isEmpty()) {
@@ -186,11 +199,6 @@ public TupleExpr buildTupleExpr() {
result = new LeftJoin(result, entry.getKey());
}
}

for (ValueExpr constraint : constraints) {
result = new Filter(result, constraint);
}

return result;
}

Original file line number Diff line number Diff line change
@@ -2378,6 +2378,8 @@ public Object visit(ASTBind node, Object data) throws VisitorException {

// get a tupleExpr that represents the basic graph pattern, sofar.
TupleExpr arg = graphPattern.buildJoinFromRequiredTEs();
// apply optionals, if any
arg = graphPattern.buildOptionalTE(arg);

// check if alias is not previously used in the BGP
if (arg.getBindingNames().contains(alias)) {
Original file line number Diff line number Diff line change
@@ -266,6 +266,41 @@ public void testServiceGraphPatternChopping() throws Exception {

}

@Test
public void testOtionalBindCoalesce() throws Exception {
StringBuilder qb = new StringBuilder();
qb.append("SELECT ?result \n");
qb.append("WHERE { \n");
qb.append("OPTIONAL {\n" +
" OPTIONAL {\n" +
" BIND(\"value\" AS ?foo)\n" +
" }\n" +
" BIND(COALESCE(?foo, \"no value\") AS ?result)\n" +
" }");
qb.append(" } ");

ASTQueryContainer qc = SyntaxTreeBuilder.parseQuery(qb.toString());
TupleExpr result = builder.visit(qc, null);
String expected = "Projection\n" +
" ProjectionElemList\n" +
" ProjectionElem \"result\"\n" +
" LeftJoin\n" +
" SingletonSet\n" +
" Extension\n" +
" LeftJoin\n" +
" SingletonSet\n" +
" Extension\n" +
" SingletonSet\n" +
" ExtensionElem (foo)\n" +
" ValueConstant (value=\"value\")\n" +
" ExtensionElem (result)\n" +
" Coalesce\n" +
" Var (name=foo)\n" +
" ValueConstant (value=\"no value\")\n";
assertEquals(expected.replace("\r\n", "\n"), result.toString().replace("\r\n", "\n"));
// System.out.println(result);
}

private class ServiceNodeFinder extends AbstractASTVisitor {

private final List<String> graphPatterns = new ArrayList<>();
Original file line number Diff line number Diff line change
@@ -327,7 +327,8 @@ public <E extends Exception> void add(Iteration<? extends Statement, E> statemen
throws RepositoryException, E {
final IRI insertContext = getInsertContext();
if (isNilContext(contexts)) {
super.add(new ConvertingIteration<Statement, Statement, E>(statementIter) {
super.add((Iteration<? extends Statement, E>) new ConvertingIteration<Statement, Statement, E>(
statementIter) {

@Override
protected Statement convert(Statement st) {
12 changes: 6 additions & 6 deletions site/content/download.md
Original file line number Diff line number Diff line change
@@ -51,20 +51,20 @@ See the [Setup instructions](/documentation/programming/setup) in the
which artifacts RDF4J provides.


## RDF4J 5.0.0-M1
## RDF4J 5.0.0-M2

RDF4J 5.0.0-M1 is our latest milestone build of the upcoming 5.0.0 release. It requires Java 11 minimally.
For details on what’s new and how to upgrade, see the [release and upgrade notes](/news/rdf4j-500-M1.md).
RDF4J 5.0.0-M2 is our latest milestone build of the upcoming 5.0.0 release. It requires Java 11 minimally.
For details on what’s new and how to upgrade, see the [release and upgrade notes](/news/rdf4j-500-M2.md).

- [RDF4J 5.0.0-M1 SDK (zip)](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-5.0.0-M1-sdk.zip)<br/>
- [RDF4J 5.0.0-M2 SDK (zip)](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-5.0.0-M2-sdk.zip)<br/>
Full Eclipse RDF4J SDK, containing all libraries, RDF4J Server, Workbench, and Console applications, and Javadoc API.

- [RDF4J 5.0.0-M1 onejar](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-5.0.0-M1-onejar.jar)<br/>
- [RDF4J 5.0.0-M2 onejar](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-5.0.0-M2-onejar.jar)<br/>
Single jar file for easy inclusion of the full RDF4J toolkit in your Java project.

- [RDF4J artifacts](https://search.maven.org/search?q=org.eclipse.rdf4j) on the [Maven Central Repository](http://search.maven.org/)

RDF4J 5.0.0-M1 is also available through maven.
RDF4J 5.0.0-M2 is also available through maven.


## Older releases
24 changes: 24 additions & 0 deletions site/content/news/rdf4j-500-M2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: "RDF4J 5.0.0 Milestone 2"
date: 2023-10-17T09:50:33+0200
layout: "single"
categories: ["news"]
---
Milestone number 2 of the upcoming 5.0.0 release of RDF4J is now available for download.

Notable changes since the previous milestone build:
- We have [switched to the new CONFIG vocabulary](https://github.com/eclipse-rdf4j/rdf4j/pull/4699). If you ware interacting with the config files directly then take care to use the new vocabulary and if need be use the [Configuration class](https://github.com/eclipse-rdf4j/rdf4j/blob/develop/core/model/src/main/java/org/eclipse/rdf4j/model/util/Configurations.java) to help with handling use cases where the new and old config vocabularies are mixed.
- The refactoring and optimizations of the various iterations is nearing completion and there should be very few iterations that are still marked as deprecated.
- More deprecated code has been removed, if you find that you were depending on deprecated code that is now removed then please let us know.


This milestone build is not yet feature-complete, but we are putting it out to receive early feedback on all the improvements we have put in.

<!--more-->

- [issues fixed in 5.0.0 Milestone 2](https://github.com/eclipse/rdf4j/issues?q=is%3Aissue+label%3AM2+is%3Aclosed+milestone%3A5.0.0)
- [issues planned for 5.0.0](https://github.com/eclipse/rdf4j/milestone/80)

### Links

- [Download RDF4J](/download/)
Binary file added site/static/javadoc/5.0.0-M2.tgz
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@
import org.eclipse.rdf4j.query.QueryResults;
import org.eclipse.rdf4j.query.TupleQuery;
import org.eclipse.rdf4j.query.TupleQueryResult;
import org.eclipse.rdf4j.query.Update;
import org.eclipse.rdf4j.rio.RDFFormat;
import org.eclipse.rdf4j.testsuite.sparql.AbstractComplianceTest;
import org.junit.Test;
@@ -41,7 +42,6 @@
* Tests on SPARQL VALUES clauses.
*
* @author Jeen Broekstra
*
*/
public class ValuesTest extends AbstractComplianceTest {

@@ -204,4 +204,21 @@ public void testFilterExistsExternalValuesClause() {
assertEquals("single result expected", 1, result.size());
assertEquals("http://subj1", result.get(0).getValue("s").stringValue());
}

@Test
public void testMultipleValuesClauses() {
Update update = conn.prepareUpdate("PREFIX ex: <http://example.org/>\n" +
"\n" +
"INSERT DATA { ex:sub ex:somePred \"value\" . };\n" +
"\n" +
"INSERT { ?s ?newPred ?newObj }\n" +
"WHERE {\n" +
" # If one combines these into a single VALUES clause then it also works\n" +
" VALUES ?newPred { ex:somePred2 }\n" +
" VALUES ?newObj { \"value2\" }\n" +
" ?s ex:somePred [] .\n" +
"}");
update.execute();
}

}