Skip to content

Commit

Permalink
Merge branch 'main' into merge-main
Browse files Browse the repository at this point in the history
# Conflicts:
#	tools/federation/src/main/java/org/eclipse/rdf4j/federated/evaluation/TripleSourceBase.java
  • Loading branch information
hmottestad committed Dec 28, 2022
2 parents fffe84c + 63cbd23 commit 831c1e4
Show file tree
Hide file tree
Showing 21 changed files with 231 additions and 158 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/develop-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
jdk: [11, 18]
jdk: [11, 19]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
jdk: [11, 18]
jdk: [11, 19]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
jdk: [11, 18]
jdk: [11, 19]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
Expand Down
1 change: 0 additions & 1 deletion compliance/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<configuration>
<!-- we do not want to deploy the compliance modules to Sonatype -->
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,15 @@ public E getNextElement() throws T {
checkException();
return take;
} catch (InterruptedException e) {
checkException();
close();
Thread.currentThread().interrupt();
try {
checkException();
} finally {
try {
close();
} finally {
Thread.currentThread().interrupt();
}
}
return null;
}
}
Expand Down Expand Up @@ -221,6 +227,7 @@ public void checkException() throws T {
}
}
}

}

private boolean isAfterLast(E take) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public GraphQueryResult evaluate() throws QueryEvaluationException {
try {
conn.flushTransactionState(Protocol.Action.QUERY);
return client.sendGraphQuery(queryLanguage, queryString, baseURI, dataset, getIncludeInferred(),
getMaxExecutionTime(), ((WeakReference) null), getBindingsArray());
getMaxExecutionTime(), ((WeakReference<?>) null), getBindingsArray());
} catch (IOException | RepositoryException | MalformedQueryException e) {
throw new HTTPQueryEvaluationException(e.getMessage(), e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public TupleQueryResult evaluate() throws QueryEvaluationException {
conn.flushTransactionState(Protocol.Action.QUERY);

return client.sendTupleQuery(queryLanguage, queryString, baseURI, dataset, getIncludeInferred(),
getMaxExecutionTime(), ((WeakReference) null), getBindingsArray());
getMaxExecutionTime(), ((WeakReference<?>) null), getBindingsArray());
} catch (IOException | RepositoryException | MalformedQueryException e) {
throw new HTTPQueryEvaluationException(e.getMessage(), e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public GraphQueryResult evaluate() throws QueryEvaluationException {
// TODO getQueryString() already inserts bindings, use emptybindingset
// as last argument?
return client.sendGraphQuery(queryLanguage, getQueryString(), baseURI, dataset, getIncludeInferred(),
getMaxExecutionTime(), ((WeakReference) null), getBindingsArray());
getMaxExecutionTime(), ((WeakReference<?>) null), getBindingsArray());
} catch (IOException | RepositoryException | MalformedQueryException e) {
throw new QueryEvaluationException(e.getMessage(), e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public TupleQueryResult evaluate() throws QueryEvaluationException {
SPARQLProtocolSession client = getHttpClient();
try {
return client.sendTupleQuery(QueryLanguage.SPARQL, getQueryString(), baseURI, dataset, getIncludeInferred(),
getMaxExecutionTime(), ((WeakReference) null), getBindingsArray());
getMaxExecutionTime(), ((WeakReference<?>) null), getBindingsArray());
} catch (IOException | RepositoryException | MalformedQueryException e) {
throw new QueryEvaluationException(e.getMessage(), e);
}
Expand Down
1 change: 0 additions & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<configuration>
<!-- we do not want to deploy the examples to Sonatype -->
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
Expand Down
50 changes: 43 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand Down Expand Up @@ -659,12 +659,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
<version>3.4.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -674,7 +674,7 @@
<plugin>
<groupId>au.com.acegi</groupId>
<artifactId>xml-format-maven-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.2</version>
<configuration>
<tabIndent>true</tabIndent>
<excludes>eclipse-settings/**,**/target/**,**/site/themes/**,**/.*/**</excludes>
Expand All @@ -683,7 +683,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<version>2.10</version>
<configuration>
<useProjectReferences>true</useProjectReferences>
<downloadSources>true</downloadSources>
Expand Down Expand Up @@ -776,7 +776,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
<executions>
<execution>
<phase>generate-resources</phase>
Expand Down Expand Up @@ -928,7 +928,38 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<version>3.4.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>enforce-maven-3</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.6.0</version>
</requireMavenVersion>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>4.0.0-M4</version>
</plugin>
</plugins>
</pluginManagement>
Expand All @@ -947,6 +978,11 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
</plugin>
</plugins>
<extensions>
<extension>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ public class FedXConnection extends AbstractSailConnection {
*/
private WriteStrategy writeStrategy;

public FedXConnection(FedX federation, FederationContext federationContext)
throws SailException {
public FedXConnection(FedX federation, FederationContext federationContext) throws SailException {
super(federation);
this.federation = federation;
this.federationContext = federationContext;
Expand All @@ -100,9 +99,8 @@ public void setTransactionSettings(TransactionSetting... settings) {
}

@Override
protected CloseableIteration<? extends BindingSet, QueryEvaluationException> evaluateInternal(
TupleExpr query, Dataset dataset, BindingSet bindings,
boolean includeInferred) throws SailException {
protected CloseableIteration<? extends BindingSet, QueryEvaluationException> evaluateInternal(TupleExpr query,
Dataset dataset, BindingSet bindings, boolean includeInferred) throws SailException {

final TupleExpr originalQuery = query;

Expand Down Expand Up @@ -132,8 +130,8 @@ protected CloseableIteration<? extends BindingSet, QueryEvaluationException> eva
FederationEvaluationStatistics stats = new FederationEvaluationStatistics(queryInfo, dataset);
query = strategy.optimize(query, stats, bindings);
} catch (Exception e) {
log.warn("Exception occured during optimization (Query: " + queryInfo.getQueryID() + "): "
+ e.getMessage());
log.warn(
"Exception occured during optimization (Query: " + queryInfo.getQueryID() + "): " + e.getMessage());
log.debug("Details: ", e);
throw new SailException(e);
}
Expand Down Expand Up @@ -250,8 +248,7 @@ public CloseableIteration<Resource, QueryEvaluationException> performTask() thro
try (RepositoryConnection conn = e.getConnection()) {
// we need to materialize the contexts as they are only accessible
// while the connection is open
return new CollectionIteration<>(
Iterations.asList(conn.getContextIDs()));
return new CollectionIteration<>(Iterations.asList(conn.getContextIDs()));
}
}

Expand All @@ -269,13 +266,12 @@ public void cancel() {
// execute the union in a separate thread
federationContext.getManager().getExecutor().execute(union);

return new DistinctIteration<>(
new ExceptionConvertingIteration<>(union) {
@Override
protected SailException convert(Exception e) {
return new SailException(e);
}
});
return new DistinctIteration<>(new ExceptionConvertingIteration<>(union) {
@Override
protected SailException convert(Exception e) {
return new SailException(e);
}
});
}

@Override
Expand All @@ -286,8 +282,7 @@ protected String getNamespaceInternal(String prefix) throws SailException {
}

@Override
protected CloseableIteration<? extends Namespace, SailException> getNamespacesInternal()
throws SailException {
protected CloseableIteration<? extends Namespace, SailException> getNamespacesInternal() throws SailException {
// do not support this feature, but also do not throw an exception
// as this method is expected for the RDF4J workbench to work
return new EmptyIteration<>();
Expand Down Expand Up @@ -330,8 +325,7 @@ protected SailException convert(Exception e) {
}

@Override
protected void addStatementInternal(Resource subj, IRI pred, Value obj,
Resource... contexts) throws SailException {
protected void addStatementInternal(Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException {
try {
getWriteStrategyInternal().addStatement(subj, pred, obj, contexts);
} catch (RepositoryException e) {
Expand All @@ -345,8 +339,8 @@ protected void removeNamespaceInternal(String prefix) throws SailException {
}

@Override
protected void removeStatementsInternal(Resource subj, IRI pred, Value obj,
Resource... contexts) throws SailException {
protected void removeStatementsInternal(Resource subj, IRI pred, Value obj, Resource... contexts)
throws SailException {
try {
getWriteStrategyInternal().removeStatement(subj, pred, obj, contexts);
} catch (RepositoryException e) {
Expand Down Expand Up @@ -383,8 +377,8 @@ protected long sizeInternal(Resource... contexts) throws SailException {
}
}
if (errorEndpoints.size() > 0) {
throw new SailException("Could not determine size for members " + errorEndpoints +
"(Supported for NativeStore and RemoteRepository only). Computed size: " + size);
throw new SailException("Could not determine size for members " + errorEndpoints
+ "(Supported for NativeStore and RemoteRepository only). Computed size: " + size);
}
return size;
}
Expand Down Expand Up @@ -500,8 +494,8 @@ public boolean pendingRemovals() {
}

@Override
public Explanation explain(Explanation.Level level, TupleExpr tupleExpr, Dataset dataset,
BindingSet bindings, boolean includeInferred, int timeoutSeconds) {
public Explanation explain(Explanation.Level level, TupleExpr tupleExpr, Dataset dataset, BindingSet bindings,
boolean includeInferred, int timeoutSeconds) {
throw new UnsupportedOperationException();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,18 +385,18 @@ protected static Set<String> findQueryPrefixes(String queryString) {

HashSet<String> res = new HashSet<>();

Scanner sc = new Scanner(queryString);
while (true) {
while (sc.findInLine(prefixPattern) != null) {
MatchResult m = sc.match();
res.add(m.group(1));
}
if (!sc.hasNextLine()) {
break;
try (Scanner sc = new Scanner(queryString)) {
while (true) {
while (sc.findInLine(prefixPattern) != null) {
MatchResult m = sc.match();
res.add(m.group(1));
}
if (!sc.hasNextLine()) {
break;
}
sc.nextLine();
}
sc.nextLine();
}
sc.close();
return res;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,16 +509,17 @@ protected QueryEvaluationStep prepareNJoin(NJoin join, QueryEvaluationContext co

return bindings -> {
boolean completed = false;
CloseableIteration<BindingSet, QueryEvaluationException> result = resultProvider.evaluate(bindings);
CloseableIteration<BindingSet, QueryEvaluationException> result = null;
try {
for (int i = 1, n = join.getNumberOfArguments(); i < n; i++) {
result = resultProvider.evaluate(bindings);

for (int i = 1, n = join.getNumberOfArguments(); i < n; i++) {
result = executeJoin(joinScheduler, result, join.getArg(i), join.getJoinVariables(i), bindings,
join.getQueryInfo());
}
completed = true;
} finally {
if (!completed) {
if (!completed && result != null) {
result.close();
}
}
Expand Down
Loading

0 comments on commit 831c1e4

Please sign in to comment.