Skip to content
Permalink
Browse files
Cleanup in commons-rdf-rdf4j to close PMD and FindBugs warnings
  • Loading branch information
ajs6f committed Dec 14, 2017
1 parent 4c95437 commit 37ab026c576c8841f378cc2376ca02c478567e84
Showing 14 changed files with 14 additions and 16 deletions.
@@ -12,3 +12,4 @@ hs_err_pid*
.classpath
.project
*.orig
.DS_Store
@@ -101,6 +101,7 @@
* @see RDF
*
*/
@SuppressWarnings("PMD.UnnecessaryFullyQualifiedName") // we use fully-qualified names for clarity
public final class RDF4J implements RDF {

/**
@@ -32,6 +32,6 @@
public interface RDF4JBlankNode extends RDF4JBlankNodeOrIRI, BlankNode {

@Override
public BNode asValue();
BNode asValue();

}
@@ -32,6 +32,6 @@
public interface RDF4JBlankNodeOrIRI extends RDF4JTerm, BlankNodeOrIRI {

@Override
public Resource asValue();
Resource asValue();

}
@@ -25,7 +25,6 @@
import org.apache.commons.rdf.api.IRI;
import org.apache.commons.rdf.api.Quad;
import org.apache.commons.rdf.api.RDFTerm;
import org.apache.commons.rdf.rdf4j.RDF4J.Option;

/**
* Marker interface for RDF4J implementations of Dataset.
@@ -28,7 +28,6 @@
import org.apache.commons.rdf.api.Triple;
import org.eclipse.rdf4j.model.Model;
import org.eclipse.rdf4j.repository.Repository;
import org.apache.commons.rdf.rdf4j.RDF4J.Option;

/**
* Marker interface for RDF4J implementations of Graph.
@@ -69,7 +68,7 @@ public interface RDF4JGraph extends Graph, RDF4JGraphLike<Triple> {
* @return The context mask as a set of {@link BlankNodeOrIRI} graph names,
* which may contain the value <code>null</code>.
*/
public Set<RDF4JBlankNodeOrIRI> getContextMask();
Set<RDF4JBlankNodeOrIRI> getContextMask();

/**
* {@inheritDoc}
@@ -49,7 +49,7 @@
*
* @return The corresponding RDF4J Model.
*/
public Optional<Model> asModel();
Optional<Model> asModel();

/**
* Return the corresponding RDF4J {@link Repository}, if present.
@@ -61,6 +61,6 @@
*
* @return The corresponding RDF4J Repository.
*/
public Optional<Repository> asRepository();
Optional<Repository> asRepository();

}
@@ -35,5 +35,5 @@ public interface RDF4JTerm extends RDFTerm {
* @return The wrapped {@link Value} (e.g. a {@link Literal}, {@link IRI} or
* {@link BNode}.
*/
public Value asValue();
Value asValue();
}
@@ -39,5 +39,5 @@ public interface RDF4JTripleLike extends TripleLike {
*
* @return The corresponding RDF4J Statement.
*/
public Statement asStatement();
Statement asStatement();
}
@@ -66,8 +66,7 @@ private AddToQuadConsumer(final Consumer<Quad> quadTarget) {
}

@Override
public void handleStatement(final org.eclipse.rdf4j.model.Statement st)
throws org.eclipse.rdf4j.rio.RDFHandlerException {
public void handleStatement(final org.eclipse.rdf4j.model.Statement st) throws RDFHandlerException {
// TODO: if getRdfTermFactory() is a non-rdf4j factory, should
// we use factory.createQuad() instead?
// Unsure what is the promise of setting getRdfTermFactory() --
@@ -91,8 +90,7 @@ public AddToModel(final Model model) {
}

@Override
public void handleStatement(final org.eclipse.rdf4j.model.Statement st)
throws org.eclipse.rdf4j.rio.RDFHandlerException {
public void handleStatement(final org.eclipse.rdf4j.model.Statement st) throws RDFHandlerException {
model.add(st);
}

@@ -28,7 +28,6 @@
import org.apache.commons.rdf.rdf4j.RDF4JQuad;
import org.apache.commons.rdf.rdf4j.RDF4JTerm;
import org.apache.commons.rdf.rdf4j.RDF4J;
import org.apache.commons.rdf.rdf4j.RDF4J.Option;
import org.apache.commons.rdf.rdf4j.RDF4JTriple;
import org.eclipse.rdf4j.model.BNode;
import org.eclipse.rdf4j.model.IRI;
@@ -37,6 +37,7 @@
import org.eclipse.rdf4j.model.Resource;
import org.eclipse.rdf4j.repository.Repository;

@SuppressWarnings("PMD.UnnecessaryFullyQualifiedName") // we use fully-qualified names for clarity
final class ModelGraphImpl implements RDF4JGraph {

private final Model model;
@@ -170,7 +170,7 @@ public Stream<RDF4JQuad> stream(final Optional<BlankNodeOrIRI> graphName, final
}
}
// Make sure the RepositoryConnection is closed
return stream.onClose(conn::close);
return stream == null ? null : stream.onClose(conn::close);

}

@@ -173,7 +173,7 @@ public Stream<RDF4JTriple> stream(final BlankNodeOrIRI subject, final IRI predic
}
}
// Make sure the RepositoryConnection is closed
return stream.onClose(conn::close);
return stream == null ? null : stream.onClose(conn::close);
}

@Override

0 comments on commit 37ab026

Please sign in to comment.