diff --git a/pom.xml b/pom.xml index 235b14f..c6844ce 100644 --- a/pom.xml +++ b/pom.xml @@ -1,11 +1,58 @@ 4.0.0 - LDF-Server - LDF-Server - 0.0.2 + org.linkeddatafragments + ldfserver + 0.1.0 war - + Linked Data Fragments Server + http://linkeddatafragments.org + + This is a Java implementation of the Linked Data Fragments Server based on Jena. + + + + MIT License (MIT) + https://raw.githubusercontent.com/LinkedDataFragments/Server.Java/master/LICENSE.txt + repo + + + + https://github.com/LinkedDataFragments/Server.Java.git + https://github.com/LinkedDataFragments/Server.Java.git + v0.1.0 + https://github.com/LinkedDataFragments/Server.Java + + + + rverborgh + Ruben Verborgh + ruben.verborgh@ugent.be + http://ruben.verborgh.org + iMinds + http://iminds.be + Europe/Brussels + + + mielvds + Miel Vander Sande + miel.vandersande@ugent.be + http://semweb.mmlab.be + iMinds + http://iminds.be + Europe/Brussels + + + + + Bart Hanssens + bart.hanssens@fedict.be + FEDICT + + + Olaf Hartig + + 9.3.6.v20151106 @@ -123,6 +170,63 @@ + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.3 + true + + ossrh + https://oss.sonatype.org/ + true + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + diff --git a/src/org/linkeddatafragments/config/ConfigReader.java b/src/org/linkeddatafragments/config/ConfigReader.java index 7b2d99a..d31461b 100644 --- a/src/org/linkeddatafragments/config/ConfigReader.java +++ b/src/org/linkeddatafragments/config/ConfigReader.java @@ -72,10 +72,21 @@ public Map getPrefixes() { return prefixes; } + /** + * Gets the base URL + * + * @return the base URL + */ public String getBaseURL() { return baseURL; } + /** + * Loads a certain {@link IDataSourceType} class at runtime + * + * @param className IDataSourceType class + * @return the created IDataSourceType object + */ protected IDataSourceType initDataSouceType( final String className ) { final Class c; diff --git a/src/org/linkeddatafragments/datasource/AbstractRequestProcessor.java b/src/org/linkeddatafragments/datasource/AbstractRequestProcessor.java index 096c21e..6cfa14e 100644 --- a/src/org/linkeddatafragments/datasource/AbstractRequestProcessor.java +++ b/src/org/linkeddatafragments/datasource/AbstractRequestProcessor.java @@ -14,6 +14,13 @@ abstract public class AbstractRequestProcessor @Override public void close() {} + /** + * Create an {@link ILinkedDataFragment} from {@link ILinkedDataFragmentRequest} + * + * @param request + * @return + * @throws IllegalArgumentException + */ @Override final public ILinkedDataFragment createRequestedFragment( final ILinkedDataFragmentRequest request ) @@ -22,20 +29,45 @@ final public ILinkedDataFragment createRequestedFragment( return getWorker( request ).createRequestedFragment(); } + /** + * Get the {@link Worker} from {@link ILinkedDataFragmentRequest} + * + * @param request + * @return + * @throws IllegalArgumentException + */ abstract protected Worker getWorker( final ILinkedDataFragmentRequest request ) throws IllegalArgumentException; - + /** + * Processes {@link ILinkedDataFragmentRequest}s + * + */ abstract static protected class Worker { + + /** + * The {@link ILinkedDataFragmentRequest} to process + */ public final ILinkedDataFragmentRequest request; + /** + * Create a Worker + * + * @param request + */ public Worker( final ILinkedDataFragmentRequest request ) { this.request = request; } + /** + * Create the requested {@link ILinkedDataFragment} + * + * @return The ILinkedDataFragment + * @throws IllegalArgumentException + */ abstract public ILinkedDataFragment createRequestedFragment() throws IllegalArgumentException; diff --git a/src/org/linkeddatafragments/datasource/AbstractRequestProcessorForTriplePatterns.java b/src/org/linkeddatafragments/datasource/AbstractRequestProcessorForTriplePatterns.java index e15ef76..e1e4bbf 100644 --- a/src/org/linkeddatafragments/datasource/AbstractRequestProcessorForTriplePatterns.java +++ b/src/org/linkeddatafragments/datasource/AbstractRequestProcessorForTriplePatterns.java @@ -28,6 +28,13 @@ AbstractRequestProcessorForTriplePatterns extends AbstractRequestProcessor { + + /** + * + * @param request + * @return + * @throws IllegalArgumentException + */ @Override protected final Worker getWorker( final ILinkedDataFragmentRequest request ) @@ -43,20 +50,41 @@ protected final Worker getWorker( throw new IllegalArgumentException( request.getClass().getName() ); } + /** + * + * @param request + * @return + * @throws IllegalArgumentException + */ abstract protected Worker getTPFSpecificWorker( final ITriplePatternFragmentRequest request ) throws IllegalArgumentException; - + /** + * + * @param + * @param + * @param + */ abstract static protected class Worker extends AbstractRequestProcessor.Worker { + + /** + * + * @param request + */ public Worker( final ITriplePatternFragmentRequest request ) { super( request ); } + /** + * + * @return + * @throws IllegalArgumentException + */ @Override public ILinkedDataFragment createRequestedFragment() throws IllegalArgumentException @@ -78,6 +106,16 @@ public ILinkedDataFragment createRequestedFragment() offset, limit ); } + /** + * + * @param subj + * @param pred + * @param obj + * @param offset + * @param limit + * @return + * @throws IllegalArgumentException + */ abstract protected ILinkedDataFragment createFragment( final ITriplePatternElement subj, final ITriplePatternElement pred, @@ -86,12 +124,23 @@ abstract protected ILinkedDataFragment createFragment( final long limit ) throws IllegalArgumentException; + /** + * + * @return + */ protected ITriplePatternFragment createEmptyTriplePatternFragment() { return new TriplePatternFragmentImpl( request.getFragmentURL(), request.getDatasetURL() ); } + /** + * + * @param triples + * @param totalSize + * @param isLastPage + * @return + */ protected ITriplePatternFragment createTriplePatternFragment( final Model triples, final long totalSize, diff --git a/src/org/linkeddatafragments/datasource/DataSourceBase.java b/src/org/linkeddatafragments/datasource/DataSourceBase.java index c074dcf..45b669f 100644 --- a/src/org/linkeddatafragments/datasource/DataSourceBase.java +++ b/src/org/linkeddatafragments/datasource/DataSourceBase.java @@ -1,24 +1,49 @@ package org.linkeddatafragments.datasource; /** + * The base class for an {@link IDataSource} * * @author Miel Vander Sande * @author Bart Hanssens */ public abstract class DataSourceBase implements IDataSource { + + /** + * Get the datasource title + */ protected String title; + + /** + * Get the datasource description + */ protected String description; + /** + * Create a base for a {@link IDataSource} + * + * @param title the datasource title + * @param description the datasource description + */ public DataSourceBase(String title, String description) { this.title = title; this.description = description; } + /** + * Get the datasource description + * + * @return + */ @Override public String getDescription() { return this.description; }; + /** + * Get the datasource title + * + * @return + */ @Override public String getTitle() { return this.title; diff --git a/src/org/linkeddatafragments/datasource/DataSourceTypesRegistry.java b/src/org/linkeddatafragments/datasource/DataSourceTypesRegistry.java index 7afc56e..f502c6f 100644 --- a/src/org/linkeddatafragments/datasource/DataSourceTypesRegistry.java +++ b/src/org/linkeddatafragments/datasource/DataSourceTypesRegistry.java @@ -13,16 +13,31 @@ public class DataSourceTypesRegistry private static Map registry = new HashMap(); + /** + * + * @param typeName + * @return + */ public static synchronized IDataSourceType getType( final String typeName ) { return registry.get( typeName ); } + /** + * + * @param typeName + * @return + */ public static synchronized boolean isRegistered( final String typeName ) { return registry.containsKey( typeName ); } + /** + * + * @param typeName + * @param type + */ public static synchronized void register( final String typeName, final IDataSourceType type ) { diff --git a/src/org/linkeddatafragments/datasource/IDataSource.java b/src/org/linkeddatafragments/datasource/IDataSource.java index 6f924db..a216c5f 100644 --- a/src/org/linkeddatafragments/datasource/IDataSource.java +++ b/src/org/linkeddatafragments/datasource/IDataSource.java @@ -12,17 +12,27 @@ */ public interface IDataSource extends Closeable { + /** + * + * @return + */ public String getTitle(); + /** + * + * @return + */ public String getDescription(); /** * Returns a data source specific {@link IFragmentRequestParser}. + * @return */ IFragmentRequestParser getRequestParser(); /** * Returns a data source specific {@link IFragmentRequestProcessor}. + * @return */ IFragmentRequestProcessor getRequestProcessor(); } diff --git a/src/org/linkeddatafragments/datasource/IDataSourceType.java b/src/org/linkeddatafragments/datasource/IDataSourceType.java index 6380f90..84559a2 100644 --- a/src/org/linkeddatafragments/datasource/IDataSourceType.java +++ b/src/org/linkeddatafragments/datasource/IDataSourceType.java @@ -24,6 +24,8 @@ public interface IDataSourceType * @param settings * The properties of the data source to be created; usually, these * properties are given in the config file of the LDF server. + * @return + * @throws org.linkeddatafragments.exceptions.DataSourceCreationException */ IDataSource createDataSource( final String title, final String description, diff --git a/src/org/linkeddatafragments/datasource/IFragmentRequestProcessor.java b/src/org/linkeddatafragments/datasource/IFragmentRequestProcessor.java index ba6bd80..3534623 100644 --- a/src/org/linkeddatafragments/datasource/IFragmentRequestProcessor.java +++ b/src/org/linkeddatafragments/datasource/IFragmentRequestProcessor.java @@ -15,6 +15,13 @@ */ public interface IFragmentRequestProcessor extends Closeable { + + /** + * + * @param request + * @return + * @throws IllegalArgumentException + */ ILinkedDataFragment createRequestedFragment( final ILinkedDataFragmentRequest request ) throws IllegalArgumentException; diff --git a/src/org/linkeddatafragments/datasource/hdt/HdtBasedRequestProcessorForTPFs.java b/src/org/linkeddatafragments/datasource/hdt/HdtBasedRequestProcessorForTPFs.java index cfaa011..7305e87 100644 --- a/src/org/linkeddatafragments/datasource/hdt/HdtBasedRequestProcessorForTPFs.java +++ b/src/org/linkeddatafragments/datasource/hdt/HdtBasedRequestProcessorForTPFs.java @@ -29,7 +29,15 @@ public class HdtBasedRequestProcessorForTPFs extends AbstractRequestProcessorForTriplePatterns { + + /** + * HDT Datasource + */ protected final HDT datasource; + + /** + * The dictionary + */ protected final NodeDictionary dictionary; /** @@ -44,6 +52,12 @@ public HdtBasedRequestProcessorForTPFs( String hdtFile ) throws IOException dictionary = new NodeDictionary( datasource.getDictionary() ); } + /** + * + * @param request + * @return + * @throws IllegalArgumentException + */ @Override protected Worker getTPFSpecificWorker( final ITriplePatternFragmentRequest request ) @@ -52,16 +66,34 @@ protected Worker getTPFSpecificWorker( return new Worker( request ); } - + /** + * Worker class for HDT + */ protected class Worker extends AbstractRequestProcessorForTriplePatterns.Worker { + + /** + * Create HDT Worker + * + * @param req + */ public Worker( final ITriplePatternFragmentRequest req ) { super( req ); } + /** + * Creates an {@link ILinkedDataFragment} from the HDT + * + * @param subject + * @param predicate + * @param object + * @param offset + * @param limit + * @return + */ @Override protected ILinkedDataFragment createFragment( final ITriplePatternElement subject, diff --git a/src/org/linkeddatafragments/datasource/hdt/HdtDataSource.java b/src/org/linkeddatafragments/datasource/hdt/HdtDataSource.java index f053b75..12753ea 100644 --- a/src/org/linkeddatafragments/datasource/hdt/HdtDataSource.java +++ b/src/org/linkeddatafragments/datasource/hdt/HdtDataSource.java @@ -15,6 +15,10 @@ */ public class HdtDataSource extends DataSourceBase { + /** + * The request processor + * + */ protected final HdtBasedRequestProcessorForTPFs requestProcessor; /** diff --git a/src/org/linkeddatafragments/datasource/index/IndexDataSource.java b/src/org/linkeddatafragments/datasource/index/IndexDataSource.java index d1500ba..cfc3bd4 100644 --- a/src/org/linkeddatafragments/datasource/index/IndexDataSource.java +++ b/src/org/linkeddatafragments/datasource/index/IndexDataSource.java @@ -16,8 +16,17 @@ */ public class IndexDataSource extends DataSourceBase { + /** + * The request processor + * + */ protected final IndexRequestProcessorForTPFs requestProcessor; + /** + * + * @param baseUrl + * @param datasources + */ public IndexDataSource(String baseUrl, HashMap datasources) { super("Index", "List of all datasources"); requestProcessor = new IndexRequestProcessorForTPFs( baseUrl, datasources ); diff --git a/src/org/linkeddatafragments/datasource/index/IndexRequestProcessorForTPFs.java b/src/org/linkeddatafragments/datasource/index/IndexRequestProcessorForTPFs.java index 65130cc..dcb94da 100644 --- a/src/org/linkeddatafragments/datasource/index/IndexRequestProcessorForTPFs.java +++ b/src/org/linkeddatafragments/datasource/index/IndexRequestProcessorForTPFs.java @@ -37,6 +37,11 @@ public class IndexRequestProcessorForTPFs private final Model model; + /** + * + * @param baseUrl + * @param datasources + */ public IndexRequestProcessorForTPFs( final String baseUrl, final HashMap datasources ) @@ -56,6 +61,12 @@ public IndexRequestProcessorForTPFs( } } + /** + * + * @param request + * @return + * @throws IllegalArgumentException + */ @Override protected Worker getTPFSpecificWorker( final ITriplePatternFragmentRequest request ) @@ -64,16 +75,33 @@ protected Worker getTPFSpecificWorker( return new Worker( request ); } - + /** + * Worker for the index + */ protected class Worker extends AbstractRequestProcessorForTriplePatterns.Worker { + + /** + * Creates a Worker for the datasource index + * + * @param req + */ public Worker( final ITriplePatternFragmentRequest req ) { super( req ); } + /** + * + * @param s + * @param p + * @param o + * @param offset + * @param limit + * @return + */ @Override protected ILinkedDataFragment createFragment( final ITriplePatternElement s, diff --git a/src/org/linkeddatafragments/datasource/tdb/JenaTDBBasedRequestProcessorForTPFs.java b/src/org/linkeddatafragments/datasource/tdb/JenaTDBBasedRequestProcessorForTPFs.java index 740d93b..323fdc5 100644 --- a/src/org/linkeddatafragments/datasource/tdb/JenaTDBBasedRequestProcessorForTPFs.java +++ b/src/org/linkeddatafragments/datasource/tdb/JenaTDBBasedRequestProcessorForTPFs.java @@ -26,7 +26,7 @@ * Implementation of {@link IFragmentRequestProcessor} that processes * {@link ITriplePatternFragmentRequest}s over data stored in Jena TDB. * - * @author Bart Hanssens + * @author Bart Hanssens * @author Olaf Hartig */ public class JenaTDBBasedRequestProcessorForTPFs @@ -41,6 +41,12 @@ public class JenaTDBBasedRequestProcessorForTPFs private final Query query = QueryFactory.create(sparql, Syntax.syntaxSPARQL_11); private final Query countQuery = QueryFactory.create(count, Syntax.syntaxSPARQL_11); + /** + * + * @param request + * @return + * @throws IllegalArgumentException + */ @Override protected Worker getTPFSpecificWorker( final ITriplePatternFragmentRequest request ) @@ -49,16 +55,32 @@ protected Worker getTPFSpecificWorker( return new Worker( request ); } - + /** + * + */ protected class Worker extends AbstractRequestProcessorForTriplePatterns.Worker { + + /** + * + * @param req + */ public Worker( final ITriplePatternFragmentRequest req ) { super( req ); } + /** + * + * @param subject + * @param predicate + * @param object + * @param offset + * @param limit + * @return + */ @Override protected ILinkedDataFragment createFragment( final ITriplePatternElement subject, diff --git a/src/org/linkeddatafragments/datasource/tdb/JenaTDBDataSource.java b/src/org/linkeddatafragments/datasource/tdb/JenaTDBDataSource.java index 314b2dd..c38d4af 100644 --- a/src/org/linkeddatafragments/datasource/tdb/JenaTDBDataSource.java +++ b/src/org/linkeddatafragments/datasource/tdb/JenaTDBDataSource.java @@ -10,11 +10,15 @@ /** * Experimental Jena TDB-backed data source of Basic Linked Data Fragments. * - * @author Bart Hanssens + * @author Bart Hanssens * @author Olaf Hartig */ public class JenaTDBDataSource extends DataSourceBase { + /** + * The request processor + * + */ protected final JenaTDBBasedRequestProcessorForTPFs requestProcessor; @Override diff --git a/src/org/linkeddatafragments/exceptions/DataSourceCreationException.java b/src/org/linkeddatafragments/exceptions/DataSourceCreationException.java index 0dcf13f..ea4924e 100644 --- a/src/org/linkeddatafragments/exceptions/DataSourceCreationException.java +++ b/src/org/linkeddatafragments/exceptions/DataSourceCreationException.java @@ -6,10 +6,19 @@ */ public class DataSourceCreationException extends DataSourceException { + /** + * + * @param cause + */ public DataSourceCreationException(Throwable cause) { super(cause); } + /** + * + * @param datasourceName + * @param message + */ public DataSourceCreationException(String datasourceName, String message) { super(datasourceName, "Could not create DataSource - " + message); } diff --git a/src/org/linkeddatafragments/exceptions/DataSourceException.java b/src/org/linkeddatafragments/exceptions/DataSourceException.java index 11a8e21..2f5973d 100644 --- a/src/org/linkeddatafragments/exceptions/DataSourceException.java +++ b/src/org/linkeddatafragments/exceptions/DataSourceException.java @@ -8,14 +8,28 @@ */ abstract public class DataSourceException extends Exception { + /** + * + * @param cause + */ public DataSourceException(Throwable cause) { super(cause); } + /** + * + * @param datasourceName + * @param message + */ public DataSourceException(String datasourceName, String message) { super("Error for datasource '" + datasourceName + "': " + message); } + /** + * + * @param datasource + * @param message + */ public DataSourceException(IDataSource datasource, String message) { this(datasource.getTitle(), message); } diff --git a/src/org/linkeddatafragments/exceptions/DataSourceNotFoundException.java b/src/org/linkeddatafragments/exceptions/DataSourceNotFoundException.java index 5a8466d..08dca00 100644 --- a/src/org/linkeddatafragments/exceptions/DataSourceNotFoundException.java +++ b/src/org/linkeddatafragments/exceptions/DataSourceNotFoundException.java @@ -6,6 +6,10 @@ */ public class DataSourceNotFoundException extends DataSourceException { + /** + * + * @param dataSourceName + */ public DataSourceNotFoundException(String dataSourceName) { super(dataSourceName, "Datasource not found."); } diff --git a/src/org/linkeddatafragments/exceptions/NoRegisteredMimeTypesException.java b/src/org/linkeddatafragments/exceptions/NoRegisteredMimeTypesException.java index 5310b3c..ad278a6 100644 --- a/src/org/linkeddatafragments/exceptions/NoRegisteredMimeTypesException.java +++ b/src/org/linkeddatafragments/exceptions/NoRegisteredMimeTypesException.java @@ -1,11 +1,15 @@ package org.linkeddatafragments.exceptions; /** - * + * Exception thrown when no mimeTypes are known to the system + * * @author Miel Vander Sande */ public class NoRegisteredMimeTypesException extends Exception { + /** + * Constructs the exception + */ public NoRegisteredMimeTypesException() { super("List of supported mimeTypes is empty."); } diff --git a/src/org/linkeddatafragments/exceptions/UnknownDataSourceTypeException.java b/src/org/linkeddatafragments/exceptions/UnknownDataSourceTypeException.java index cc1877c..1b631a0 100644 --- a/src/org/linkeddatafragments/exceptions/UnknownDataSourceTypeException.java +++ b/src/org/linkeddatafragments/exceptions/UnknownDataSourceTypeException.java @@ -6,6 +6,10 @@ */ public class UnknownDataSourceTypeException extends DataSourceCreationException { + /** + * + * @param type + */ public UnknownDataSourceTypeException(String type) { super("", "Type " + type + " does not exist."); } diff --git a/src/org/linkeddatafragments/fragments/FragmentRequestParserBase.java b/src/org/linkeddatafragments/fragments/FragmentRequestParserBase.java index 5910f7b..092d2ab 100644 --- a/src/org/linkeddatafragments/fragments/FragmentRequestParserBase.java +++ b/src/org/linkeddatafragments/fragments/FragmentRequestParserBase.java @@ -20,19 +20,48 @@ final public ILinkedDataFragmentRequest parseIntoFragmentRequest( return getWorker( httpRequest, config ).createFragmentRequest(); } + /** + * + * @param httpRequest + * @param config + * @return + * @throws IllegalArgumentException + */ abstract protected Worker getWorker( final HttpServletRequest httpRequest, final ConfigReader config ) throws IllegalArgumentException; - + /** + * + */ abstract static protected class Worker { + + /** + * + */ public final HttpServletRequest request; + + /** + * + */ public final ConfigReader config; + /** + * + */ public final boolean pageNumberWasRequested; + + /** + * + */ public final long pageNumber; + /** + * + * @param request + * @param config + */ public Worker( final HttpServletRequest request, final ConfigReader config ) { @@ -57,15 +86,28 @@ public Worker( final HttpServletRequest request, } } + /** + * + * @return + * @throws IllegalArgumentException + */ abstract public ILinkedDataFragmentRequest createFragmentRequest() throws IllegalArgumentException; + /** + * + * @return + */ public String getFragmentURL() { final String datasetURL = getDatasetURL(); final String query = request.getQueryString(); return query == null ? datasetURL : (datasetURL + "?" + query); } + /** + * + * @return + */ public String getDatasetURL() { return extractBaseURL( request, config ) + request.getRequestURI(); } @@ -75,6 +117,13 @@ public String getDatasetURL() { // ----- HELPERS --------- + /** + * + * @param request + * @param config + * @return + */ + public static String extractBaseURL( final HttpServletRequest request, final ConfigReader config ) { if (config.getBaseURL() != null) { diff --git a/src/org/linkeddatafragments/fragments/IFragmentRequestParser.java b/src/org/linkeddatafragments/fragments/IFragmentRequestParser.java index 99cde96..0e2c0dd 100644 --- a/src/org/linkeddatafragments/fragments/IFragmentRequestParser.java +++ b/src/org/linkeddatafragments/fragments/IFragmentRequestParser.java @@ -15,6 +15,9 @@ public interface IFragmentRequestParser * Parses the given HTTP request into a specific * {@link ILinkedDataFragmentRequest}. * + * @param httpRequest + * @param config + * @return * @throws IllegalArgumentException * If the given HTTP request cannot be interpreted (perhaps due to * missing request parameters). diff --git a/src/org/linkeddatafragments/fragments/ILinkedDataFragment.java b/src/org/linkeddatafragments/fragments/ILinkedDataFragment.java index c999d78..3bce34e 100644 --- a/src/org/linkeddatafragments/fragments/ILinkedDataFragment.java +++ b/src/org/linkeddatafragments/fragments/ILinkedDataFragment.java @@ -14,6 +14,7 @@ public interface ILinkedDataFragment extends Closeable /** * Returns an iterator over the RDF data of this fragment (possibly only * partial if the data is paged, as indicated by {@link #isPageOnly()}). + * @return */ StmtIterator getTriples(); @@ -21,6 +22,7 @@ public interface ILinkedDataFragment extends Closeable * Returns true if {@link #getTriples()} returns a page of data only. * In this case, {@link #getPageNumber()} can be used to obtain the * corresponding page number. + * @return */ boolean isPageOnly(); @@ -30,6 +32,7 @@ public interface ILinkedDataFragment extends Closeable * * If the data is not paged, this method throws an exception. * + * @return * @throws UnsupportedOperationException * If the data of this fragment is not paged. */ @@ -42,6 +45,7 @@ public interface ILinkedDataFragment extends Closeable * If the data is not paged (i.e., if {@link #isPageOnly()} returns false), * this method throws an exception. * + * @return * @throws UnsupportedOperationException * If the data of this fragment is not paged. */ @@ -54,6 +58,7 @@ public interface ILinkedDataFragment extends Closeable * * If the data is not paged, this method throws an exception. * + * @return * @throws UnsupportedOperationException * If the data of this fragment is not paged. */ @@ -61,12 +66,14 @@ public interface ILinkedDataFragment extends Closeable /** * Returns an iterator over the metadata of this fragment. + * @return */ StmtIterator getMetadata(); /** * Returns an iterator over an RDF description of the controls associated * with this fragment. + * @return */ StmtIterator getControls(); } diff --git a/src/org/linkeddatafragments/fragments/ILinkedDataFragmentRequest.java b/src/org/linkeddatafragments/fragments/ILinkedDataFragmentRequest.java index eebfa81..ed9aa5d 100644 --- a/src/org/linkeddatafragments/fragments/ILinkedDataFragmentRequest.java +++ b/src/org/linkeddatafragments/fragments/ILinkedDataFragmentRequest.java @@ -7,16 +7,26 @@ */ public interface ILinkedDataFragmentRequest { + + /** + * + */ public final static long TRIPLESPERPAGE = 100L; + + /** + * + */ public final static String PARAMETERNAME_PAGE = "page"; /** * Returns the URL of the requested LDF. + * @return */ String getFragmentURL(); /** * Returns the URL of the dataset to which the requested LDF belongs. + * @return */ String getDatasetURL(); @@ -24,6 +34,7 @@ public interface ILinkedDataFragmentRequest * Returns true if the request is for a specific page of the requested * fragment. In this case, {@link #getPageNumber()} can be used to obtain * the requested page number. + * @return */ boolean isPageRequest(); @@ -31,6 +42,7 @@ public interface ILinkedDataFragmentRequest * Returns the number of the page requested for the LDF; if this is not a * page-based request (that is, if {@link #isPageRequest()} returns true), * then this method returns 1. + * @return */ long getPageNumber(); } diff --git a/src/org/linkeddatafragments/fragments/LinkedDataFragmentBase.java b/src/org/linkeddatafragments/fragments/LinkedDataFragmentBase.java index faf1716..05e81aa 100644 --- a/src/org/linkeddatafragments/fragments/LinkedDataFragmentBase.java +++ b/src/org/linkeddatafragments/fragments/LinkedDataFragmentBase.java @@ -19,11 +19,34 @@ */ public abstract class LinkedDataFragmentBase implements ILinkedDataFragment { + + /** + * + */ public final String fragmentURL; + + /** + * + */ public final String datasetURL; + + /** + * + */ public final long pageNumber; + + /** + * + */ public final boolean isLastPage; + /** + * + * @param fragmentURL + * @param datasetURL + * @param pageNumber + * @param isLastPage + */ protected LinkedDataFragmentBase( final String fragmentURL, final String datasetURL, final long pageNumber, @@ -66,6 +89,7 @@ public long getMaxPageSize() { /** * This implementation uses {@link #addMetadata(Model)}, which should be * overridden in subclasses (instead of overriding this method). + * @return */ @Override public StmtIterator getMetadata() @@ -78,6 +102,7 @@ public StmtIterator getMetadata() /** * This implementation uses {@link #addControls(Model)}, which should be * overridden in subclasses (instead of overriding this method). + * @return */ @Override public StmtIterator getControls() @@ -90,6 +115,7 @@ public StmtIterator getControls() /** * Adds some basic metadata to the given RDF model. * This method may be overridden in subclasses. + * @param model */ public void addMetadata( final Model model ) { @@ -110,6 +136,7 @@ public void addMetadata( final Model model ) /** * Adds an RDF description of page links to the given RDF model. * This method may be overridden in subclasses. + * @param model */ public void addControls( final Model model ) { @@ -151,6 +178,10 @@ public void addControls( final Model model ) } } + /** + * + * @return + */ public String getDatasetURI() { return datasetURL + "#dataset"; } diff --git a/src/org/linkeddatafragments/fragments/LinkedDataFragmentRequestBase.java b/src/org/linkeddatafragments/fragments/LinkedDataFragmentRequestBase.java index 4cc6030..c53ae5a 100644 --- a/src/org/linkeddatafragments/fragments/LinkedDataFragmentRequestBase.java +++ b/src/org/linkeddatafragments/fragments/LinkedDataFragmentRequestBase.java @@ -8,11 +8,34 @@ public abstract class LinkedDataFragmentRequestBase implements ILinkedDataFragmentRequest { + + /** + * + */ public final String fragmentURL; + + /** + * + */ public final String datasetURL; + + /** + * + */ public final boolean pageNumberWasRequested; + + /** + * + */ public final long pageNumber; + /** + * + * @param fragmentURL + * @param datasetURL + * @param pageNumberWasRequested + * @param pageNumber + */ public LinkedDataFragmentRequestBase( final String fragmentURL, final String datasetURL, final boolean pageNumberWasRequested, diff --git a/src/org/linkeddatafragments/fragments/tpf/ITriplePatternElement.java b/src/org/linkeddatafragments/fragments/tpf/ITriplePatternElement.java index ee6166f..6c6d928 100644 --- a/src/org/linkeddatafragments/fragments/tpf/ITriplePatternElement.java +++ b/src/org/linkeddatafragments/fragments/tpf/ITriplePatternElement.java @@ -15,6 +15,7 @@ public interface ITriplePatternElement extends ILinkedDataFragmentRequest { + + /** + * + */ public final static String PARAMETERNAME_SUBJ = "subject"; + + /** + * + */ public final static String PARAMETERNAME_PRED = "predicate"; + + /** + * + */ public final static String PARAMETERNAME_OBJ = "object"; /** * Returns the subject position of the requested triple pattern. + * @return */ ITriplePatternElement getSubject(); /** * Returns the predicate position of the requested triple pattern. + * @return */ ITriplePatternElement getPredicate(); /** * Returns the object position of the requested triple pattern. + * @return */ ITriplePatternElement getObject(); } diff --git a/src/org/linkeddatafragments/fragments/tpf/TPFRequestParser.java b/src/org/linkeddatafragments/fragments/tpf/TPFRequestParser.java index eaa06d4..0af4e9a 100644 --- a/src/org/linkeddatafragments/fragments/tpf/TPFRequestParser.java +++ b/src/org/linkeddatafragments/fragments/tpf/TPFRequestParser.java @@ -11,22 +11,34 @@ /** * An {@link IFragmentRequestParser} for {@link ITriplePatternFragmentRequest}s. * - * @param type for representing RDF terms in triple patterns - * @param type for representing specific variables in triple patterns + * @param + * @param * * @author Olaf Hartig + * @param */ public class TPFRequestParser extends FragmentRequestParserBase { public final TriplePatternElementParser elmtParser; + /** + * + * @param elmtParser + */ public TPFRequestParser( final TriplePatternElementParser elmtParser ) { this.elmtParser = elmtParser; } + /** + * + * @param httpRequest + * @param config + * @return + * @throws IllegalArgumentException + */ @Override protected Worker getWorker( final HttpServletRequest httpRequest, final ConfigReader config ) @@ -35,14 +47,28 @@ protected Worker getWorker( final HttpServletRequest httpRequest, return new Worker( httpRequest, config ); } + /** + * + */ protected class Worker extends FragmentRequestParserBase.Worker { + + /** + * + * @param request + * @param config + */ public Worker( final HttpServletRequest request, final ConfigReader config ) { super( request, config ); } + /** + * + * @return + * @throws IllegalArgumentException + */ @Override public ILinkedDataFragmentRequest createFragmentRequest() throws IllegalArgumentException @@ -57,21 +83,38 @@ public ILinkedDataFragmentRequest createFragmentRequest() getObject() ); } + /** + * + * @return + */ public ITriplePatternElement getSubject() { return getParameterAsTriplePatternElement( ITriplePatternFragmentRequest.PARAMETERNAME_SUBJ ); } + /** + * + * @return + */ public ITriplePatternElement getPredicate() { return getParameterAsTriplePatternElement( ITriplePatternFragmentRequest.PARAMETERNAME_PRED ); } + /** + * + * @return + */ public ITriplePatternElement getObject() { return getParameterAsTriplePatternElement( ITriplePatternFragmentRequest.PARAMETERNAME_OBJ ); } + /** + * + * @param paramName + * @return + */ public ITriplePatternElement getParameterAsTriplePatternElement( final String paramName ) { diff --git a/src/org/linkeddatafragments/fragments/tpf/TPFRequestParserForJenaBackends.java b/src/org/linkeddatafragments/fragments/tpf/TPFRequestParserForJenaBackends.java index 8eb9c56..56897bd 100644 --- a/src/org/linkeddatafragments/fragments/tpf/TPFRequestParserForJenaBackends.java +++ b/src/org/linkeddatafragments/fragments/tpf/TPFRequestParserForJenaBackends.java @@ -14,6 +14,10 @@ public class TPFRequestParserForJenaBackends { private static TPFRequestParserForJenaBackends instance = null; + /** + * + * @return + */ public static TPFRequestParserForJenaBackends getInstance() { if ( instance == null ) { @@ -22,6 +26,9 @@ public static TPFRequestParserForJenaBackends getInstance() return instance; } + /** + * + */ protected TPFRequestParserForJenaBackends() { super( TriplePatternElementParserForJena.getInstance() ); diff --git a/src/org/linkeddatafragments/fragments/tpf/TriplePatternElementFactory.java b/src/org/linkeddatafragments/fragments/tpf/TriplePatternElementFactory.java index 3528d4a..f187ab7 100644 --- a/src/org/linkeddatafragments/fragments/tpf/TriplePatternElementFactory.java +++ b/src/org/linkeddatafragments/fragments/tpf/TriplePatternElementFactory.java @@ -16,29 +16,54 @@ */ public class TriplePatternElementFactory { + + /** + * + * @return + */ public ITriplePatternElement createUnspecifiedVariable() { return new UnspecifiedVariable(); } + /** + * + * @param v + * @return + */ public ITriplePatternElement createNamedVariable( final NVT v ) { return new NamedVariable( v ); } + /** + * + * @param bnode + * @return + */ public ITriplePatternElement createAnonymousVariable( final AVT bnode ) { return new AnonymousVariable( bnode ); } + /** + * + * @param term + * @return + */ public ITriplePatternElement createConstantRDFTerm( final CTT term ) { return new ConstantRDFTerm( term ); } - + /** + * + * @param + * @param + * @param + */ static abstract public class Variable implements ITriplePatternElement { @@ -48,6 +73,12 @@ static abstract public class Variable public CTT asConstantTerm() { throw new UnsupportedOperationException(); } } + /** + * + * @param + * @param + * @param + */ static public class UnspecifiedVariable extends Variable { @@ -65,6 +96,12 @@ static public class UnspecifiedVariable public String toString() { return "UnspecifiedVariable"; } } + /** + * + * @param + * @param + * @param + */ static abstract public class SpecificVariable extends Variable { @@ -72,10 +109,25 @@ static abstract public class SpecificVariable public boolean isSpecificVariable() { return true; } } + /** + * + * @param + * @param + * @param + */ static public class NamedVariable extends SpecificVariable { + + /** + * + */ protected final NVT v; + + /** + * + * @param variable + */ public NamedVariable( final NVT variable ) { v = variable; } @Override public boolean isNamedVariable() { return true; } @@ -89,10 +141,25 @@ static public class NamedVariable public String toString() { return "NamedVariable(" + v.toString() + ")"; } } + /** + * + * @param + * @param + * @param + */ static public class AnonymousVariable extends SpecificVariable { + + /** + * + */ protected final AVT bn; + + /** + * + * @param bnode + */ public AnonymousVariable( final AVT bnode ) { bn = bnode; } @Override public boolean isNamedVariable() { return false; } @@ -106,10 +173,25 @@ static public class AnonymousVariable public String toString() { return "AnonymousVariable(" + bn.toString() + ")"; } } + /** + * + * @param + * @param + * @param + */ static public class ConstantRDFTerm implements ITriplePatternElement { + + /** + * + */ protected final CTT t; + + /** + * + * @param term + */ public ConstantRDFTerm( final CTT term ) { t = term; } @Override public boolean isVariable() { return false; } diff --git a/src/org/linkeddatafragments/fragments/tpf/TriplePatternFragmentBase.java b/src/org/linkeddatafragments/fragments/tpf/TriplePatternFragmentBase.java index 09f24a4..d02bcdf 100644 --- a/src/org/linkeddatafragments/fragments/tpf/TriplePatternFragmentBase.java +++ b/src/org/linkeddatafragments/fragments/tpf/TriplePatternFragmentBase.java @@ -26,6 +26,8 @@ abstract public class TriplePatternFragmentBase extends LinkedDataFragmentBase /** * Creates an empty Triple Pattern Fragment. + * @param fragmentURL + * @param datasetURL */ public TriplePatternFragmentBase( final String fragmentURL, final String datasetURL ) { @@ -34,6 +36,10 @@ public TriplePatternFragmentBase( final String fragmentURL, /** * Creates an empty Triple Pattern Fragment page. + * @param fragmentURL + * @param isLastPage + * @param datasetURL + * @param pageNumber */ public TriplePatternFragmentBase( final String fragmentURL, final String datasetURL, @@ -45,6 +51,10 @@ public TriplePatternFragmentBase( final String fragmentURL, /** * Creates a new Triple Pattern Fragment. * @param totalSize the total size + * @param fragmentURL + * @param datasetURL + * @param pageNumber + * @param isLastPage */ public TriplePatternFragmentBase( long totalSize, final String fragmentURL, @@ -63,6 +73,10 @@ public StmtIterator getTriples() { return getNonEmptyStmtIterator(); } + /** + * + * @return + */ abstract protected StmtIterator getNonEmptyStmtIterator(); @Override @@ -116,6 +130,10 @@ public void addControls( final Model model ) objectMapping.addProperty( CommonResources.HYDRA_PROPERTY, CommonResources.RDF_OBJECT ); } + /** + * + * @return + */ public String getTemplate() { return datasetURL + "{?" + ITriplePatternFragmentRequest.PARAMETERNAME_SUBJ + "," + @@ -123,13 +141,23 @@ public String getTemplate() { ITriplePatternFragmentRequest.PARAMETERNAME_OBJ + "}"; } - + /** + * + */ public static final StmtIterator emptyStmtIterator = new EmptyStmtIterator(); + /** + * + */ public static class EmptyStmtIterator extends NiceIterator implements StmtIterator { + + /** + * + * @return + */ public Statement nextStatement() { throw new NoSuchElementException(); } } diff --git a/src/org/linkeddatafragments/fragments/tpf/TriplePatternFragmentImpl.java b/src/org/linkeddatafragments/fragments/tpf/TriplePatternFragmentImpl.java index 439e5e8..3ebb5ed 100644 --- a/src/org/linkeddatafragments/fragments/tpf/TriplePatternFragmentImpl.java +++ b/src/org/linkeddatafragments/fragments/tpf/TriplePatternFragmentImpl.java @@ -4,16 +4,22 @@ import com.hp.hpl.jena.rdf.model.StmtIterator; /** - * Implementation of {@link TriplePatternFragment}. + * Implementation of {@link ITriplePatternFragment}. * * @author Olaf Hartig */ public class TriplePatternFragmentImpl extends TriplePatternFragmentBase { + + /** + * + */ protected final Model triples; /** * Creates an empty Triple Pattern Fragment. + * @param fragmentURL + * @param datasetURL */ public TriplePatternFragmentImpl( final String fragmentURL, final String datasetURL ) { @@ -22,6 +28,10 @@ public TriplePatternFragmentImpl( final String fragmentURL, /** * Creates an empty Triple Pattern Fragment page. + * @param fragmentURL + * @param datasetURL + * @param isLastPage + * @param pageNumber */ public TriplePatternFragmentImpl( final String fragmentURL, final String datasetURL, @@ -34,6 +44,10 @@ public TriplePatternFragmentImpl( final String fragmentURL, * Creates a new Triple Pattern Fragment. * @param triples the triples (possibly partial) * @param totalSize the total size + * @param fragmentURL + * @param datasetURL + * @param isLastPage + * @param pageNumber */ public TriplePatternFragmentImpl( final Model triples, long totalSize, @@ -45,6 +59,10 @@ public TriplePatternFragmentImpl( final Model triples, this.triples = triples; } + /** + * + * @return + */ @Override protected StmtIterator getNonEmptyStmtIterator() { return triples.listStatements(); diff --git a/src/org/linkeddatafragments/fragments/tpf/TriplePatternFragmentRequestImpl.java b/src/org/linkeddatafragments/fragments/tpf/TriplePatternFragmentRequestImpl.java index aeabd40..5942463 100644 --- a/src/org/linkeddatafragments/fragments/tpf/TriplePatternFragmentRequestImpl.java +++ b/src/org/linkeddatafragments/fragments/tpf/TriplePatternFragmentRequestImpl.java @@ -6,15 +6,40 @@ * An implementation of {@link ITriplePatternFragmentRequest}. * * @author Olaf Hartig + * @param + * @param + * @param */ public class TriplePatternFragmentRequestImpl extends LinkedDataFragmentRequestBase implements ITriplePatternFragmentRequest { + + /** + * + */ public final ITriplePatternElement subject; + + /** + * + */ public final ITriplePatternElement predicate; + + /** + * + */ public final ITriplePatternElement object; + /** + * + * @param fragmentURL + * @param datasetURL + * @param pageNumberWasRequested + * @param pageNumber + * @param subject + * @param predicate + * @param object + */ public TriplePatternFragmentRequestImpl( final String fragmentURL, final String datasetURL, final boolean pageNumberWasRequested, diff --git a/src/org/linkeddatafragments/servlet/LinkedDataFragmentServlet.java b/src/org/linkeddatafragments/servlet/LinkedDataFragmentServlet.java index 3d5d226..04d6649 100644 --- a/src/org/linkeddatafragments/servlet/LinkedDataFragmentServlet.java +++ b/src/org/linkeddatafragments/servlet/LinkedDataFragmentServlet.java @@ -40,7 +40,11 @@ public class LinkedDataFragmentServlet extends HttpServlet { private final static long serialVersionUID = 1L; // Parameters - public final static String CFGFILE = "configFile"; + + /** + * + */ + public final static String CFGFILE = "configFile"; private ConfigReader config; private final HashMap dataSources = new HashMap<>(); @@ -65,6 +69,11 @@ private File getConfigFile(ServletConfig config) throws IOException { return cfg; } + /** + * + * @param servletConfig + * @throws ServletException + */ @Override public void init(ServletConfig servletConfig) throws ServletException { try { @@ -94,6 +103,9 @@ public void init(ServletConfig servletConfig) throws ServletException { } } + /** + * + */ @Override public void destroy() { @@ -135,6 +147,12 @@ private IDataSource getDataSource(HttpServletRequest request) throws DataSourceN return dataSource; } + /** + * + * @param request + * @param response + * @throws ServletException + */ @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException { ILinkedDataFragment fragment = null; diff --git a/src/org/linkeddatafragments/standalone/JettyServer.java b/src/org/linkeddatafragments/standalone/JettyServer.java index b4987eb..8e3a294e 100644 --- a/src/org/linkeddatafragments/standalone/JettyServer.java +++ b/src/org/linkeddatafragments/standalone/JettyServer.java @@ -40,6 +40,11 @@ private static void printHelp(Options options) { "Starts a standalone LDF Triple Pattern server. Options:", options, ""); } + /** + * + * @param args + * @throws Exception + */ public static void main(String[] args) throws Exception { Options options = new Options(); options.addOption("h", "help", false, "Print this help message and then exit."); diff --git a/src/org/linkeddatafragments/util/CommonResources.java b/src/org/linkeddatafragments/util/CommonResources.java index 7c4a89e..8fc051d 100644 --- a/src/org/linkeddatafragments/util/CommonResources.java +++ b/src/org/linkeddatafragments/util/CommonResources.java @@ -3,37 +3,134 @@ import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.ResourceFactory; +/** + * + * @author mielvandersande + */ @SuppressWarnings("javadoc") /** * All common URIs needed for parsing and serializations */ public class CommonResources { + + /** + * + */ public final static String RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; + + /** + * + */ public final static Property RDF_TYPE = createProperty(RDF + "type"); + + /** + * + */ public final static Property RDF_SUBJECT = createProperty(RDF + "subject"); + + /** + * + */ public final static Property RDF_PREDICATE = createProperty(RDF + "predicate"); + + /** + * + */ public final static Property RDF_OBJECT = createProperty(RDF + "object"); + /** + * + */ public final static String VOID = "http://rdfs.org/ns/void#"; + + /** + * + */ public final static Property VOID_TRIPLES = createProperty(VOID + "triples"); + + /** + * + */ public final static Property VOID_SUBSET = createProperty(VOID + "subset"); + + /** + * + */ public final static Property VOID_DATASET = createProperty(VOID + "Dataset"); + /** + * + */ public final static String HYDRA = "http://www.w3.org/ns/hydra/core#"; + + /** + * + */ public final static Property HYDRA_TOTALITEMS = createProperty(HYDRA + "totalItems"); + + /** + * + */ public final static Property HYDRA_ITEMSPERPAGE = createProperty(HYDRA + "itemsPerPage"); + + /** + * + */ public final static Property HYDRA_SEARCH = createProperty(HYDRA + "search"); + + /** + * + */ public final static Property HYDRA_TEMPLATE = createProperty(HYDRA + "template"); + + /** + * + */ public final static Property HYDRA_MAPPING = createProperty(HYDRA + "mapping"); + + /** + * + */ public final static Property HYDRA_VARIABLE = createProperty(HYDRA + "variable"); + + /** + * + */ public final static Property HYDRA_PROPERTY = createProperty(HYDRA + "property"); + + /** + * + */ public final static Property HYDRA_COLLECTION = createProperty(HYDRA + "Collection"); + + /** + * + */ public final static Property HYDRA_PAGEDCOLLECTION = createProperty(HYDRA + "PagedCollection"); + + /** + * + */ public final static Property HYDRA_FIRSTPAGE = createProperty(HYDRA + "firstPage"); + + /** + * + */ public final static Property HYDRA_LASTPAGE = createProperty(HYDRA + "lastPage"); + + /** + * + */ public final static Property HYDRA_NEXTPAGE = createProperty(HYDRA + "nextPage"); + + /** + * + */ public final static Property HYDRA_PREVIOUSPAGE = createProperty(HYDRA + "previousPage"); + /** + * + */ public final static Property INVALID_URI = createProperty("urn:invalid"); private static Property createProperty(String uri) { diff --git a/src/org/linkeddatafragments/util/MIMEParse.java b/src/org/linkeddatafragments/util/MIMEParse.java index 4814635..6b71bb3 100644 --- a/src/org/linkeddatafragments/util/MIMEParse.java +++ b/src/org/linkeddatafragments/util/MIMEParse.java @@ -25,8 +25,8 @@ * * http://code.google.com/p/mimeparse/ * - * Ported by Tom Zellman . - * Extended by Miel Vander Sande + * Ported by Tom Zellman. + * Extended by Miel Vander Sande * */ public final class MIMEParse @@ -72,6 +72,8 @@ public String toString() * into: * * ('application', 'xhtml', {'q', '0.5'}) + * @param mimeType + * @return */ protected static ParseResults parseMimeType(String mimeType) { @@ -110,6 +112,7 @@ protected static ParseResults parseMimeType(String mimeType) * necessary. * * @param range + * @return */ protected static ParseResults parseMediaRange(String range) { @@ -133,6 +136,11 @@ protected static class FitnessAndQuality implements String mimeType; // optionally used + /** + * + * @param fitness + * @param quality + */ public FitnessAndQuality(int fitness, float quality) { this.fitness = fitness; @@ -162,6 +170,7 @@ public int compareTo(FitnessAndQuality o) * * @param mimeType * @param parsedRanges + * @return */ protected static FitnessAndQuality fitnessAndQualityParsed(String mimeType, Collection parsedRanges) @@ -223,7 +232,8 @@ protected static float qualityParsed(String mimeType, * mediaRanges in ranges. For example: * * @param mimeType - * @param parsedRanges + * @param ranges + * @return */ public static float quality(String mimeType, String ranges) { @@ -245,6 +255,7 @@ public static float quality(String mimeType, String ranges) * @param supported * @param header * @return + * @throws org.linkeddatafragments.exceptions.NoRegisteredMimeTypesException */ public static String bestMatch(List supported, String header) throws NoRegisteredMimeTypesException { @@ -270,6 +281,12 @@ public static String bestMatch(List supported, String header) throws NoR return NumberUtils.compare(lastOne.quality, 0) != 0 ? lastOne.mimeType : supported.get(0); } + /** + * + * @param header + * @return + * @throws NoRegisteredMimeTypesException + */ public static String bestMatch(String header) throws NoRegisteredMimeTypesException { return bestMatch(mimeTypes, header); diff --git a/src/org/linkeddatafragments/util/RDFTermParser.java b/src/org/linkeddatafragments/util/RDFTermParser.java index ea56524..eafa401 100644 --- a/src/org/linkeddatafragments/util/RDFTermParser.java +++ b/src/org/linkeddatafragments/util/RDFTermParser.java @@ -12,9 +12,18 @@ */ abstract public class RDFTermParser { + + /** + * + */ public static final Pattern STRINGPATTERN = Pattern.compile("^\"(.*)\"(?:@(.*)|\\^\\^]*)>?)?$"); + /** + * + * @param param + * @return + */ public TermType parseIntoRDFNode( final String param ) { if ( param == null || param.isEmpty() ) @@ -58,18 +67,50 @@ else if ( typeURI != null ) } } + /** + * + * @param label + * @return + */ abstract public TermType createBlankNode( final String label ); + /** + * + * @param uri + * @return + */ abstract public TermType createURI( final String uri ); + /** + * + * @param label + * @param typeURI + * @return + */ abstract public TermType createTypedLiteral( final String label, final String typeURI ); + /** + * + * @param label + * @param langTag + * @return + */ abstract public TermType createLanguageLiteral( final String label, final String langTag ); + /** + * + * @param label + * @return + */ abstract public TermType createPlainLiteral( final String label ); + /** + * + * @param param + * @return + */ abstract public TermType handleUnparsableParameter( final String param ); } diff --git a/src/org/linkeddatafragments/util/TriplePatternElementParser.java b/src/org/linkeddatafragments/util/TriplePatternElementParser.java index 40e6ccc..9621bab 100644 --- a/src/org/linkeddatafragments/util/TriplePatternElementParser.java +++ b/src/org/linkeddatafragments/util/TriplePatternElementParser.java @@ -20,9 +20,18 @@ class TriplePatternElementParser extends RDFTermParser { + + /** + * + */ public final TriplePatternElementFactory factory = new TriplePatternElementFactory(); + /** + * + * @param param + * @return + */ public ITriplePatternElement parseIntoTriplePatternElement( final String param ) { @@ -55,7 +64,17 @@ class TriplePatternElementParser } } + /** + * + * @param varName + * @return + */ abstract public NamedVarType createNamedVariable( final String varName ); + /** + * + * @param label + * @return + */ abstract public AnonVarType createAnonymousVariable( final String label ); } diff --git a/src/org/linkeddatafragments/util/TriplePatternElementParserForJena.java b/src/org/linkeddatafragments/util/TriplePatternElementParserForJena.java index 029c512..aa49252 100644 --- a/src/org/linkeddatafragments/util/TriplePatternElementParserForJena.java +++ b/src/org/linkeddatafragments/util/TriplePatternElementParserForJena.java @@ -15,6 +15,10 @@ public class TriplePatternElementParserForJena { private static TriplePatternElementParserForJena instance = null; + /** + * + * @return + */ public static TriplePatternElementParserForJena getInstance() { if ( instance == null ) { @@ -23,32 +27,61 @@ public static TriplePatternElementParserForJena getInstance() return instance; } + /** + * + */ protected TriplePatternElementParserForJena() {} + /** + * + * @param varName + * @return + */ @Override public String createNamedVariable( final String varName ) { return varName; } + /** + * + * @param label + * @return + */ @Override public String createAnonymousVariable( final String label ) { return label; } + /** + * + * @param label + * @return + */ @Override public RDFNode createBlankNode( final String label ) { return ResourceFactory.createResource(); } + /** + * + * @param uri + * @return + */ @Override public RDFNode createURI( final String uri ) { return ResourceFactory.createResource( uri ); } + /** + * + * @param label + * @param typeURI + * @return + */ @Override public RDFNode createTypedLiteral( final String label, final String typeURI ) @@ -58,6 +91,12 @@ public RDFNode createTypedLiteral( final String label, return ResourceFactory.createTypedLiteral( label, dt ); } + /** + * + * @param label + * @param languageTag + * @return + */ @Override public RDFNode createLanguageLiteral( final String label, final String languageTag ) @@ -65,12 +104,22 @@ public RDFNode createLanguageLiteral( final String label, return ResourceFactory.createLangLiteral( label, languageTag ); } + /** + * + * @param label + * @return + */ @Override public RDFNode createPlainLiteral( final String label ) { return ResourceFactory.createPlainLiteral( label ); } + /** + * + * @param parameter + * @return + */ @Override public RDFNode handleUnparsableParameter( final String parameter ) { diff --git a/src/org/linkeddatafragments/views/HtmlTriplePatternFragmentWriterImpl.java b/src/org/linkeddatafragments/views/HtmlTriplePatternFragmentWriterImpl.java index 4c35f65..5c3bcf3 100644 --- a/src/org/linkeddatafragments/views/HtmlTriplePatternFragmentWriterImpl.java +++ b/src/org/linkeddatafragments/views/HtmlTriplePatternFragmentWriterImpl.java @@ -41,7 +41,12 @@ public class HtmlTriplePatternFragmentWriterImpl extends TriplePatternFragmentWr private final String HYDRA = "http://www.w3.org/ns/hydra/core#"; private final String VOID = "http://rdfs.org/ns/void#"; - + /** + * + * @param prefixes + * @param datasources + * @throws IOException + */ public HtmlTriplePatternFragmentWriterImpl(Map prefixes, HashMap datasources) throws IOException { super(prefixes, datasources); @@ -56,6 +61,15 @@ public HtmlTriplePatternFragmentWriterImpl(Map prefixes, HashMap errorTemplate = cfg.getTemplate("error.ftl.html"); } + /** + * + * @param outputStream + * @param datasource + * @param fragment + * @param tpfRequest + * @throws IOException + * @throws TemplateException + */ @Override public void writeFragment(ServletOutputStream outputStream, IDataSource datasource, ITriplePatternFragment fragment, ITriplePatternFragmentRequest tpfRequest) throws IOException, TemplateException{ Map data = new HashMap(); diff --git a/src/org/linkeddatafragments/views/LinkedDataFragmentWriterBase.java b/src/org/linkeddatafragments/views/LinkedDataFragmentWriterBase.java index 27eea77..c5b10a0 100644 --- a/src/org/linkeddatafragments/views/LinkedDataFragmentWriterBase.java +++ b/src/org/linkeddatafragments/views/LinkedDataFragmentWriterBase.java @@ -13,15 +13,28 @@ public abstract class LinkedDataFragmentWriterBase implements ILinkedDataFragmen private final Map prefixes; private final HashMap datasources; + /** + * + * @param prefixes + * @param datasources + */ public LinkedDataFragmentWriterBase(Map prefixes, HashMap datasources) { this.prefixes = prefixes; this.datasources = datasources; } + /** + * + * @return + */ public Map getPrefixes() { return prefixes; } + /** + * + * @return + */ public HashMap getDatasources() { return datasources; } diff --git a/src/org/linkeddatafragments/views/TriplePatternFragmentWriterBase.java b/src/org/linkeddatafragments/views/TriplePatternFragmentWriterBase.java index 97ade31..464b991 100644 --- a/src/org/linkeddatafragments/views/TriplePatternFragmentWriterBase.java +++ b/src/org/linkeddatafragments/views/TriplePatternFragmentWriterBase.java @@ -12,12 +12,17 @@ import org.linkeddatafragments.fragments.tpf.ITriplePatternFragmentRequest; /** - * Base class of any implementation of {@link ITriplePatternFragmentWriter}. + * Base class of any implementation for ITriplePatternFragment. * * @author Miel Vander Sande */ public abstract class TriplePatternFragmentWriterBase extends LinkedDataFragmentWriterBase implements ILinkedDataFragmentWriter { + /** + * + * @param prefixes + * @param datasources + */ public TriplePatternFragmentWriterBase(Map prefixes, HashMap datasources) { super(prefixes, datasources); } @@ -27,5 +32,14 @@ public void writeFragment(ServletOutputStream outputStream, IDataSource datasour writeFragment(outputStream, datasource, (ITriplePatternFragment) fragment, (ITriplePatternFragmentRequest) ldfRequest); } + /** + * + * @param outputStream + * @param datasource + * @param fragment + * @param tpfRequest + * @throws IOException + * @throws TemplateException + */ abstract public void writeFragment(ServletOutputStream outputStream, IDataSource datasource, ITriplePatternFragment fragment, ITriplePatternFragmentRequest tpfRequest) throws IOException, TemplateException; } diff --git a/src/test/java/org/linkeddatafragments/TestSuite.java b/src/test/java/org/linkeddatafragments/TestSuite.java index 3faaaea..989855e 100644 --- a/src/test/java/org/linkeddatafragments/TestSuite.java +++ b/src/test/java/org/linkeddatafragments/TestSuite.java @@ -8,7 +8,7 @@ /** * - * @author Bart Hanssens + * @author Bart Hanssens */ @RunWith(Suite.class) @Suite.SuiteClasses({ diff --git a/src/test/java/org/linkeddatafragments/datasource/DataSourceTest.java b/src/test/java/org/linkeddatafragments/datasource/DataSourceTest.java index d2ad1c4..39b615d 100644 --- a/src/test/java/org/linkeddatafragments/datasource/DataSourceTest.java +++ b/src/test/java/org/linkeddatafragments/datasource/DataSourceTest.java @@ -24,7 +24,10 @@ /** * - * @author Bart Hanssens + * @author Bart Hanssens + * @param + * @param + * @param */ public abstract class DataSourceTest { @@ -48,6 +51,10 @@ public static void setDatasource(IDataSource ds) { DataSourceTest.ds = ds; } + /** + * + * @return + */ protected abstract TriplePatternElementParser getTriplePatternElementParser(); diff --git a/src/test/java/org/linkeddatafragments/datasource/HdtDataSourceTest.java b/src/test/java/org/linkeddatafragments/datasource/HdtDataSourceTest.java index 712a2a9..aab1956 100644 --- a/src/test/java/org/linkeddatafragments/datasource/HdtDataSourceTest.java +++ b/src/test/java/org/linkeddatafragments/datasource/HdtDataSourceTest.java @@ -20,12 +20,16 @@ /** * - * @author Bart Hanssens + * @author Bart Hanssens */ public class HdtDataSourceTest extends DataSourceTest { private static File hdtfile; + /** + * + * @return + */ @Override protected TriplePatternElementParser getTriplePatternElementParser() @@ -33,6 +37,10 @@ public class HdtDataSourceTest extends DataSourceTest { return TriplePatternElementParserForJena.getInstance(); } + /** + * + * @throws Exception + */ @BeforeClass public static void setUpClass() throws Exception { final String typeName = "HdtTestSourceType"; @@ -61,6 +69,10 @@ public static void setUpClass() throws Exception { setDatasource(DataSourceFactory.create(config)); } + /** + * + * @throws Exception + */ @AfterClass public static void tearDownClass() throws Exception { if (hdtfile != null) { @@ -68,11 +80,19 @@ public static void tearDownClass() throws Exception { } } + /** + * + * @throws Exception + */ @Before public void setUp() throws Exception { } + /** + * + * @throws Exception + */ @After public void tearDown() throws Exception { } diff --git a/src/test/java/org/linkeddatafragments/datasource/JenaTDBDataSourceTest.java b/src/test/java/org/linkeddatafragments/datasource/JenaTDBDataSourceTest.java index 7ea7d42..095f2bf 100644 --- a/src/test/java/org/linkeddatafragments/datasource/JenaTDBDataSourceTest.java +++ b/src/test/java/org/linkeddatafragments/datasource/JenaTDBDataSourceTest.java @@ -27,13 +27,17 @@ /** * - * @author Bart Hanssens + * @author Bart Hanssens */ public class JenaTDBDataSourceTest extends DataSourceTest { private static File jena; private static Dataset dataset; + /** + * + * @return + */ @Override protected TriplePatternElementParser getTriplePatternElementParser() @@ -41,6 +45,10 @@ public class JenaTDBDataSourceTest extends DataSourceTest return TriplePatternElementParserForJena.getInstance(); } + /** + * + * @throws Exception + */ @BeforeClass public static void setUpClass() throws Exception { final String typeName = "JenaSourceType"; @@ -71,6 +79,10 @@ public static void setUpClass() throws Exception { setDatasource(DataSourceFactory.create(config)); } + /** + * + * @throws Exception + */ @AfterClass public static void tearDownClass() throws Exception { TDBFactory.release(dataset); @@ -82,10 +94,18 @@ public static void tearDownClass() throws Exception { } + /** + * + * @throws Exception + */ @Before public void setUp() throws Exception { } + /** + * + * @throws Exception + */ @After public void tearDown() throws Exception { }