This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-rdf.git
commit 1eb7f2cf69dea4c6806fe7d085603bef979f448d Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Thu Apr 24 18:15:08 2025 -0400 Javadoc - Add missing javadoc for generics - Close HTML tags for Java 23 --- .../org/apache/commons/rdf/jena/JenaQuadLike.java | 4 ++- .../rdf/jena/experimental/JenaRDFParser.java | 7 ++++ .../commons/rdf/jena/impl/InternalJenaFactory.java | 7 ++++ .../commons/rdf/jsonldjava/JsonLdQuadLike.java | 4 ++- .../rdf/jsonldjava/experimental/JsonLdParser.java | 7 ++++ .../apache/commons/rdf/rdf4j/RDF4JGraphLike.java | 21 ++++++------ .../rdf/rdf4j/experimental/RDF4JParser.java | 7 ++++ .../rdf/rdf4j/impl/InternalRDF4JFactory.java | 12 +++++++ .../org/apache/commons/rdf/simple/SimpleRDF.java | 9 ++++++ .../commons/rdf/simple/SimpleRDFTermFactory.java | 7 ++++ .../rdf/simple/experimental/AbstractRDFParser.java | 37 ++++++++++++++++++++++ 11 files changed, 111 insertions(+), 11 deletions(-) diff --git a/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaQuadLike.java b/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaQuadLike.java index 03e5d056..cfdbada6 100644 --- a/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaQuadLike.java +++ b/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/JenaQuadLike.java @@ -27,11 +27,13 @@ import org.apache.jena.sparql.core.Quad; * <p> * This is a marker interface common to its specializations {@link JenaQuad} and * {@link JenaGeneralizedQuadLike}. + * </p> * + * @param <T> An {@link RDFTerm} type. * @see JenaQuad * @see JenaGeneralizedQuadLike */ -public interface JenaQuadLike<G extends RDFTerm> extends JenaTripleLike, QuadLike<G> { +public interface JenaQuadLike<T extends RDFTerm> extends JenaTripleLike, QuadLike<T> { /** * Return the adapted Jena quad diff --git a/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/experimental/JenaRDFParser.java b/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/experimental/JenaRDFParser.java index 94f871e0..5bd04698 100644 --- a/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/experimental/JenaRDFParser.java +++ b/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/experimental/JenaRDFParser.java @@ -45,6 +45,13 @@ public class JenaRDFParser extends AbstractRDFParser<JenaRDFParser> { private Consumer<TripleLike> generalizedConsumerTriple; private Consumer<QuadLike<RDFTerm>> generalizedConsumerQuad; + /** + * Constructs a new instance. + */ + public JenaRDFParser() { + // empty + } + @Override protected RDF createRDFTermFactory() { return new JenaRDF(); diff --git a/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/InternalJenaFactory.java b/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/InternalJenaFactory.java index b16338db..5fa8decc 100644 --- a/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/InternalJenaFactory.java +++ b/commons-rdf-jena/src/main/java/org/apache/commons/rdf/jena/impl/InternalJenaFactory.java @@ -62,6 +62,13 @@ public abstract class InternalJenaFactory { JenaSystem.init(); } + /** + * Constructs a new instance. + */ + public InternalJenaFactory() { + // empty + } + /** * Creates a blank node based on the given ID and name. * diff --git a/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuadLike.java b/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuadLike.java index 56c73659..3ed30591 100644 --- a/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuadLike.java +++ b/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuadLike.java @@ -26,8 +26,10 @@ import com.github.jsonldjava.core.RDFDataset.Quad; /** * An empty extension of {@link QuadLike} and {@link JsonLdTripleLike}. + * + * @param <T> An {@link RDFTerm} type. */ -public interface JsonLdQuadLike<G extends RDFTerm> extends QuadLike<G>, JsonLdTripleLike { +public interface JsonLdQuadLike<T extends RDFTerm> extends QuadLike<T>, JsonLdTripleLike { } diff --git a/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/JsonLdParser.java b/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/JsonLdParser.java index 0f7056ca..e57e88dd 100644 --- a/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/JsonLdParser.java +++ b/commons-rdf-jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/experimental/JsonLdParser.java @@ -54,6 +54,13 @@ public class JsonLdParser extends AbstractRDFParser<JsonLdParser> { } } + /** + * Constructs a new instance. + */ + public JsonLdParser() { + // empty + } + @Override protected void checkSource() throws IOException { super.checkSource(); diff --git a/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraphLike.java b/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraphLike.java index 0db74ae8..35af0f8e 100644 --- a/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraphLike.java +++ b/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraphLike.java @@ -15,6 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.commons.rdf.rdf4j; import java.util.Optional; @@ -27,13 +28,14 @@ import org.eclipse.rdf4j.repository.Repository; /** * Marker interface for RDF4J implementations of GraphLike. * <p> - * This is a common interface for {@link RDF4JGraph} and {@link RDF4JDataset} - * which provides access to the underlying RDF4J {@link Model} and/or + * This is a common interface for {@link RDF4JGraph} and {@link RDF4JDataset} which provides access to the underlying RDF4J {@link Model} and/or * {@link Repository}. + * </p> * <p> - * At least one of {@link #asModel()} or {@link #asRepository()} will always be - * {@link Optional#isPresent()}. + * At least one of {@link #asModel()} or {@link #asRepository()} will always be {@link Optional#isPresent()}. + * </p> * + * @param <T> A {@link TripleLike} type. * @see RDF4JDataset * @see RDF4JGraph */ @@ -42,10 +44,11 @@ public interface RDF4JGraphLike<T extends TripleLike> extends GraphLike<T>, Auto /** * Return the corresponding RDF4J {@link Model}, if present. * <p> - * The return value is {@link Optional#isPresent()} if this is backed by a - * Model. + * The return value is {@link Optional#isPresent()} if this is backed by a Model. + * </p> * <p> * Changes to the Model are reflected in both directions. + * </p> * * @return The corresponding RDF4J Model. */ @@ -54,13 +57,13 @@ public interface RDF4JGraphLike<T extends TripleLike> extends GraphLike<T>, Auto /** * Return the corresponding RDF4J {@link Repository}, if present. * <p> - * The return value is {@link Optional#isPresent()} if this is backed by a - * Repository. + * The return value is {@link Optional#isPresent()} if this is backed by a Repository. + * </p> * <p> * Changes to the Repository are reflected in both directions. + * </p> * * @return The corresponding RDF4J Repository. */ Optional<Repository> asRepository(); - } diff --git a/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/experimental/RDF4JParser.java b/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/experimental/RDF4JParser.java index 0c88ba33..beb3fe5d 100644 --- a/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/experimental/RDF4JParser.java +++ b/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/experimental/RDF4JParser.java @@ -102,6 +102,13 @@ public class RDF4JParser extends AbstractRDFParser<RDF4JParser> { private RDF4J rdf4jTermFactory; private ParserConfig parserConfig = new ParserConfig(); + /** + * Constructs a new instance. + */ + public RDF4JParser() { + // empty + } + @Override protected RDF4J createRDFTermFactory() { return new RDF4J(); diff --git a/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/InternalRDF4JFactory.java b/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/InternalRDF4JFactory.java index 31eb0eb7..7273b99a 100644 --- a/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/InternalRDF4JFactory.java +++ b/commons-rdf-rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/InternalRDF4JFactory.java @@ -45,16 +45,25 @@ import org.eclipse.rdf4j.repository.Repository; * {@link RDF4J} methods like {@link RDF4J#createBlankNode()}, * {@link RDF4J#asRDFTerm(org.eclipse.rdf4j.model.Value)} and * {@link RDF4J#asGraph(Repository, Option...)} + * </p> * <p> * This class exists as a <code>public</code> bridge between the packages * {@link org.apache.commons.rdf.rdf4j} and * {@link org.apache.commons.rdf.rdf4j.impl} by exposing the package-public * constructors. + * </p> * * @see RDF4J */ public abstract class InternalRDF4JFactory { + /** + * Constructs a new instance. + */ + public InternalRDF4JFactory() { + // empty + } + /** * Constructs a {@link RDF4JBlankNode} from a RDF4J {@link BNode}. * @@ -95,6 +104,7 @@ public abstract class InternalRDF4JFactory { * Constructs a {@link RDF4JGraph} from a RDF4J {@link Model}. * <p> * Changes in the graph will be reflected in the model, and vice versa. + * </p> * * @param model * RDF4J {@link Model} to adapt @@ -124,6 +134,7 @@ public abstract class InternalRDF4JFactory { * <p> * Changes in the dataset will be reflected in the repsitory, and vice * versa. + * </p> * * @param repository * RDF4J {@link Repository} to adapt @@ -145,6 +156,7 @@ public abstract class InternalRDF4JFactory { * Constructs a {@link RDF4JGraph} from a RDF4J {@link Model}. * <p> * Changes in the graph will be reflected in the model, and vice versa. + * </p> * * @param repository * RDF4J {@link Repository} to adapt diff --git a/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/SimpleRDF.java b/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/SimpleRDF.java index 7a4b6f59..2c615459 100644 --- a/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/SimpleRDF.java +++ b/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/SimpleRDF.java @@ -37,6 +37,7 @@ import org.apache.commons.rdf.api.Triple; * {@link Dataset} instances created by SimpleRDF are simple in-memory * Implementations that are not thread-safe or efficient, but which may be * useful for testing and prototyping purposes. + * </p> */ public class SimpleRDF implements RDF { @@ -45,6 +46,7 @@ public class SimpleRDF implements RDF { * implementation. Used by {@link GraphImpl} to avoid double remapping. * <p> * This method is package protected to avoid any third-party subclasses. + * </p> */ interface SimpleRDFTerm extends RDFTerm { } @@ -54,6 +56,13 @@ public class SimpleRDF implements RDF { */ private final UUID SALT = UUID.randomUUID(); + /** + * Constructs a new instance. + */ + public SimpleRDF() { + // empty + } + @Override public BlankNode createBlankNode() { return new BlankNodeImpl(); diff --git a/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/SimpleRDFTermFactory.java b/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/SimpleRDFTermFactory.java index 676f284b..eab32aa0 100644 --- a/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/SimpleRDFTermFactory.java +++ b/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/SimpleRDFTermFactory.java @@ -36,6 +36,13 @@ public class SimpleRDFTermFactory implements RDFTermFactory { private final SimpleRDF factory = new SimpleRDF(); + /** + * Constructs a new instance. + */ + public SimpleRDFTermFactory() { + // empty + } + @Override public BlankNode createBlankNode() { return factory.createBlankNode(); diff --git a/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/experimental/AbstractRDFParser.java b/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/experimental/AbstractRDFParser.java index e293e053..95003daa 100644 --- a/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/experimental/AbstractRDFParser.java +++ b/commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/experimental/AbstractRDFParser.java @@ -43,11 +43,13 @@ import org.apache.commons.rdf.simple.SimpleRDF; * This abstract class keeps the properties in protected fields like * {@link #sourceFile} using {@link Optional}. Some basic checking like * {@link #checkIsAbsolute(IRI)} is performed. + * </p> * <p> * This class and its subclasses are {@link Cloneable}, immutable and * (therefore) thread-safe - each call to option methods like * {@link #contentType(String)} or {@link #source(IRI)} will return a cloned, * mutated copy. + * </p> * <p> * By default, parsing is done by the abstract method * {@link #parseSynchronusly()} - which is executed in a cloned snapshot - hence @@ -55,6 +57,8 @@ import org.apache.commons.rdf.simple.SimpleRDF; * uses a thread pool in {@link #threadGroup} - but implementations can override * {@link #parse()} (e.g. because it has its own threading model or use * asynchronous remote execution). + * </p> + * @param <T> The AbstractRDFParser subclass. */ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implements RDFParser, Cloneable { @@ -67,13 +71,22 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen // Basically only used for creating IRIs private static final RDF internalRdfTermFactory = new SimpleRDF(); + /** + * Constructs a new instance for subclasses. + */ + public AbstractRDFParser() { + // empty + } + /** * Return the file extension of a Path - if any. * <p> * The returned file extension includes the leading <code>.</code> + * </p> * <p> * Note that this only returns the last extension, e.g. the file extension * for <code>archive.tar.gz</code> would be <code>.gz</code> + * </p> * * @param path * Path which file name might contain an extension @@ -98,6 +111,7 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * <p> * This method can be used by subclasses if {@link #getContentType()} is not * present and {@link #getSourceFile()} is set. + * </p> * * @param path * Path which extension should be checked @@ -172,6 +186,7 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * Check if an iri is absolute. * <p> * Used by {@link #source(String)} and {@link #base(String)}. + * </p> * * @param iri * IRI to check @@ -187,9 +202,11 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * Check that one and only one source is present and valid. * <p> * Used by {@link #parse()}. + * </p> * <p> * Subclasses might override this method, e.g. to support other source * combinations, or to check if the sourceIri is resolvable. + * </p> * * @throws IOException * If a source file can't be read @@ -216,6 +233,7 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * <p> * The default implementation throws an IllegalStateException if the target * has not been set. + * </p> */ protected void checkTarget() { if (target == null) { @@ -259,10 +277,12 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * <p> * This is called by {@link #parse()} to set {@link #rdfTermFactory(RDF)} if * it is {@link Optional#empty()}. + * </p> * <p> * As parsed blank nodes might be made with * {@link RDF#createBlankNode(String)}, each call to this method SHOULD * return a new RDF instance. + * </p> * * @return A new {@link RDF} */ @@ -287,6 +307,7 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * {@link RDFSyntax#byMediaType(String)}, then the corresponding * {@link RDFSyntax} is set on {@link #getContentType()}, otherwise that is * {@link Optional#empty()}. + * </p> * * @return The Content-Type IANA media type, e.g. <code>text/turtle</code>, * or {@link Optional#empty()} if it has not been set @@ -300,6 +321,7 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * <p> * If this is {@link Optional#isPresent()}, then {@link #getContentType()} * contains the value of {@link RDFSyntax#mediaType}. + * </p> * * @return The {@link RDFSyntax} of the content type, or * {@link Optional#empty()} if it has not been set @@ -324,6 +346,7 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * If this is {@link Optional#isPresent()}, then * {@link #getSourceInputStream()} and {@link #getSourceIri()} are * {@link Optional#empty()}. + * </p> * * @return The source {@link Path}, or {@link Optional#empty()} if it has * not been set @@ -337,6 +360,7 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * <p> * If this is {@link Optional#isPresent()}, then {@link #getSourceFile()} * and {@link #getSourceIri()} are {@link Optional#empty()}. + * </p> * * @return The source {@link InputStream}, or {@link Optional#empty()} if it * has not been set @@ -351,6 +375,7 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * If this is {@link Optional#isPresent()}, then * {@link #getSourceInputStream()} and {@link #getSourceInputStream()} are * {@link Optional#empty()}. + * </p> * * @return The source {@link IRI}, or {@link Optional#empty()} if it has not * been set @@ -364,6 +389,7 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * <p> * From the call to {@link #parseSynchronusly()}, this will be a * non-{@code null} value (as a target is a required setting). + * </p> * * @return The target consumer of {@link Quad}s, or {@code null} if it * has not yet been set. @@ -379,9 +405,11 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * {@link #target(Dataset)} has been set, meaning that the implementation * may choose to append parsed quads to the {@link Dataset} directly instead * of relying on the generated {@link #getTarget()} consumer. + * </p> * <p> * If this value is present, then {@link #getTargetGraph()} MUST be * {@link Optional#empty()}. + * </p> * * @return The target Dataset, or {@link Optional#empty()} if another kind * of target has been set. @@ -397,9 +425,11 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * {@link #target(Graph)} has been set, meaning that the implementation may * choose to append parsed triples to the {@link Graph} directly instead of * relying on the generated {@link #getTarget()} consumer. + * </p> * <p> * If this value is present, then {@link #getTargetDataset()} MUST be * {@link Optional#empty()}. + * </p> * * @return The target Graph, or {@link Optional#empty()} if another kind of * target has been set. @@ -423,9 +453,11 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * <p> * One of the source fields MUST be present, as checked by * {@link #checkSource()}. + * </p> * <p> * {@link #checkBaseRequired()} is called to verify if {@link #getBase()} is * required. + * </p> * * @throws IOException * If the source could not be read @@ -440,10 +472,12 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * <p> * The returned clone will always have {@link #getTarget()} and * {@link #getRdfTermFactory()} present. + * </p> * <p> * If the {@link #getSourceFile()} is present, but the {@link #getBase()} is * not present, the base will be set to the <code>file:///</code> IRI for * the Path's real path (e.g. resolving any symbolic links). + * </p> * * @return A completed and checked clone of this RDFParser * @throws IOException @@ -486,6 +520,7 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * <p> * Subclasses should override this and call <code>super.resetSource()</code> * if they need to reset any additional source* fields. + * </p> */ protected void resetSource() { sourceInputStream = null; @@ -498,9 +533,11 @@ public abstract class AbstractRDFParser<T extends AbstractRDFParser<T>> implemen * <p> * Note that the consumer set for {@link #getTarget()} is * <strong>note</strong> reset. + * </p> * <p> * Subclasses should override this and call <code>super.resetTarget()</code> * if they need to reset any additional target* fields. + * </p> */ protected void resetTarget() { targetDataset = null;