Class TPFResponseImpl
java.lang.Object
se.liu.ida.hefquin.federation.access.impl.response.DataRetrievalResponseBase<Iterable<Triple>>
se.liu.ida.hefquin.federation.access.impl.response.TPFResponseImpl
- All Implemented Interfaces:
DataRetrievalResponse<Iterable<Triple>>,TPFResponse,TriplesResponse
public class TPFResponseImpl
extends DataRetrievalResponseBase<Iterable<Triple>>
implements TPFResponse
-
Field Summary
FieldsFields inherited from class se.liu.ida.hefquin.federation.access.impl.response.DataRetrievalResponseBase
data, errorDescription, errorStatusCode, exception, requestStartTime, retrievalEndTime -
Constructor Summary
ConstructorsConstructorDescriptionTPFResponseImpl(int errorStatusCode, String errorDescription, Date requestStartTime) Constructs a response for the case that the response was an error message.TPFResponseImpl(int errorStatusCode, String errorDescription, Date requestStartTime, Date retrievalEndTime) Constructs a response for the case that the response was an error message.TPFResponseImpl(Exception exception, Date requestStartTime) Constructs a defective response for the case that an exception was thrown when producing the response.TPFResponseImpl(Exception exception, Date requestStartTime, Date retrievalEndTime) Constructs a defective response for the case that an exception was thrown when producing the response.TPFResponseImpl(List<Triple> matchingTriples, List<Triple> metadataTriples, String nextPageURL, int tripleCount, Date requestStartTime) Constructs a response with the given matching triples, metadata triples, next page URL, triple count, and request start time.TPFResponseImpl(List<Triple> matchingTriples, List<Triple> metadataTriples, String nextPageURL, int tripleCount, Date requestStartTime, Date retrievalEndTime) Constructs a response with the given matching triples, metadata triples, next page URL, triple count, request start time, and retrieval end time.TPFResponseImpl(List<Triple> matchingTriples, List<Triple> metadataTriples, String nextPageURL, Date requestStartTime) Constructs a response with the given matching triples, metadata triples, next page URL, and request start time.TPFResponseImpl(List<Triple> matchingTriples, List<Triple> metadataTriples, String nextPageURL, Date requestStartTime, Date retrievalEndTime) Constructs a response with the given matching triples, metadata triples, next page URL, request start time, and retrieval end time. -
Method Summary
Modifier and TypeMethodDescriptionReturns the cardinality estimate provided as metadata in the given TPF response.Returns an iterator over all metadata triples contained in the given TPF response.Returns the URL via which the next page of the TPF can be requested.WhileDataRetrievalResponse.getResponseData()returns an iterator over all triples contained in the given TPF response, this method here returns an iterator only over the matching triples that have been requested.Returns an iterator over all triples contained in the TPF response, concatenating the payload and metadata into a single iterable.Returnstrueif the metadata of the given TPF response indicates that this response is the last page of matching triples.Methods inherited from class se.liu.ida.hefquin.federation.access.impl.response.DataRetrievalResponseBase
getErrorDescription, getErrorStatusCode, getException, getRequestStartTime, getRetrievalEndTime, throwExceptionIfNoResponseDataMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface se.liu.ida.hefquin.federation.access.DataRetrievalResponse
getErrorDescription, getErrorStatusCode, getException, getRequestDuration, getRequestStartTime, getRetrievalEndTime, isDefective, isErrorMethods inherited from interface se.liu.ida.hefquin.federation.access.TPFResponse
getMetadataSize, getPayloadSize, getSize
-
Field Details
-
metadataTriples
-
cardEstimate
-
nextPageURL
-
-
Constructor Details
-
TPFResponseImpl
public TPFResponseImpl(List<Triple> matchingTriples, List<Triple> metadataTriples, String nextPageURL, Date requestStartTime) Constructs a response with the given matching triples, metadata triples, next page URL, and request start time. The retrieval end time is automatically set to the current time at the moment of construction. This constructor assumes no error occurred.- Parameters:
matchingTriples- the list of triples matching the request pattern (must not be null)metadataTriples- the list of metadata triples (must not be null)nextPageURL- the URL for the next page of results, ornullif there is nonerequestStartTime- the timestamp when the request started
-
TPFResponseImpl
public TPFResponseImpl(List<Triple> matchingTriples, List<Triple> metadataTriples, String nextPageURL, Date requestStartTime, Date retrievalEndTime) Constructs a response with the given matching triples, metadata triples, next page URL, request start time, and retrieval end time. This constructor assumes no error occurred.- Parameters:
matchingTriples- the list of triples matching the request pattern (must not be null)metadataTriples- the list of metadata triples (must not be null)nextPageURL- the URL for the next page of results, ornullif there is nonerequestStartTime- the timestamp when the request startedretrievalEndTime- the time at which the retrieval of this response was completed (must not benull)
-
TPFResponseImpl
public TPFResponseImpl(List<Triple> matchingTriples, List<Triple> metadataTriples, String nextPageURL, int tripleCount, Date requestStartTime) Constructs a response with the given matching triples, metadata triples, next page URL, triple count, and request start time. The retrieval end time is automatically set to the current time at the moment of construction. This constructor assumes no error occurred.- Parameters:
matchingTriples- the list of triples matching the request pattern (must not be null)metadataTriples- the list of metadata triples (must not be null)nextPageURL- the URL for the next page of results, ornullif there is nonetripleCount- the triple countrequestStartTime- the timestamp when the request started
-
TPFResponseImpl
public TPFResponseImpl(List<Triple> matchingTriples, List<Triple> metadataTriples, String nextPageURL, int tripleCount, Date requestStartTime, Date retrievalEndTime) Constructs a response with the given matching triples, metadata triples, next page URL, triple count, request start time, and retrieval end time. This constructor assumes no error occurred.- Parameters:
matchingTriples- the list of triples matching the request pattern (must not be null)metadataTriples- the list of metadata triples (must not be null)nextPageURL- the URL for the next page of results, ornullif there is nonetripleCount- the triple countrequestStartTime- the timestamp when the request startedretrievalEndTime- the time at which the retrieval of this response was completed (must not benull)
-
TPFResponseImpl
Constructs a response for the case that the response was an error message. The retrieval end time is automatically set to the current time at the moment of construction. *@param errorStatusCode the HTTP status code of the error message (must not benull)- Parameters:
errorDescription- a short description of the error (may benull)requestStartTime- the time at which the request was initiated (must not benull)
-
TPFResponseImpl
public TPFResponseImpl(int errorStatusCode, String errorDescription, Date requestStartTime, Date retrievalEndTime) Constructs a response for the case that the response was an error message. *@param errorStatusCode the HTTP status code of the error message (must not benull)- Parameters:
errorDescription- a short description of the error (may benull)requestStartTime- the time at which the request was initiated (must not benull)retrievalEndTime- the time at which the retrieval of this response was completed (must not benull)
-
TPFResponseImpl
Constructs a defective response for the case that an exception was thrown when producing the response. The retrieval end time is automatically set to the current time at the moment of construction.- Parameters:
exception- the exception (must not benull)requestStartTime- the time at which the request was initiated (must not benull)
-
TPFResponseImpl
Constructs a defective response for the case that an exception was thrown when producing the response.- Parameters:
exception- the exception (must not benull)requestStartTime- the time at which the request was initiated (must not benull)retrievalEndTime- the time at which the creation of this response resulted in an exception (must not benull)
-
-
Method Details
-
getMetadata
Description copied from interface:TPFResponseReturns an iterator over all metadata triples contained in the given TPF response.- Specified by:
getMetadatain interfaceTPFResponse- Throws:
UnsupportedOperationDueToRetrievalError- if the response to the corresponding request was an error message (seeDataRetrievalResponse.isError()) or the response is defective (seeDataRetrievalResponse.isDefective()).
-
isLastPage
Description copied from interface:TPFResponseReturnstrueif the metadata of the given TPF response indicates that this response is the last page of matching triples. Returnsnullof there is no metadata related to paging.- Specified by:
isLastPagein interfaceTPFResponse- Throws:
UnsupportedOperationDueToRetrievalError- if the response to the corresponding request was an error message (seeDataRetrievalResponse.isError()) or the response is defective (seeDataRetrievalResponse.isDefective()).
-
getNextPageURL
Description copied from interface:TPFResponseReturns the URL via which the next page of the TPF can be requested. Returnsnullof no such URL is mentioned in the metadata.- Specified by:
getNextPageURLin interfaceTPFResponse- Throws:
UnsupportedOperationDueToRetrievalError- if the response to the corresponding request was an error message (seeDataRetrievalResponse.isError()) or the response is defective (seeDataRetrievalResponse.isDefective()).
-
getCardinalityEstimate
Description copied from interface:TPFResponseReturns the cardinality estimate provided as metadata in the given TPF response. Returnsnullif there is no metadata with a cardinality estimate.- Specified by:
getCardinalityEstimatein interfaceTPFResponse- Throws:
UnsupportedOperationDueToRetrievalError- if the response to the corresponding request was an error message (seeDataRetrievalResponse.isError()) or the response is defective (seeDataRetrievalResponse.isDefective()).
-
getResponseData
Returns an iterator over all triples contained in the TPF response, concatenating the payload and metadata into a single iterable.- Specified by:
getResponseDatain interfaceDataRetrievalResponse<Iterable<Triple>>- Overrides:
getResponseDatain classDataRetrievalResponseBase<Iterable<Triple>>- Throws:
UnsupportedOperationDueToRetrievalError- if the response to the corresponding request was an error message (seeDataRetrievalResponse.isError()) or the response is defective (seeDataRetrievalResponse.isDefective()).
-
getPayload
Description copied from interface:TPFResponseWhileDataRetrievalResponse.getResponseData()returns an iterator over all triples contained in the given TPF response, this method here returns an iterator only over the matching triples that have been requested.- Specified by:
getPayloadin interfaceTPFResponse- Throws:
UnsupportedOperationDueToRetrievalError- if the response to the corresponding request was an error message (seeDataRetrievalResponse.isError()) or the response is defective (seeDataRetrievalResponse.isDefective()).
-