Class TapUploadMatcher

  • All Implemented Interfaces:
    UploadMatcher

    public class TapUploadMatcher
    extends java.lang.Object
    implements UploadMatcher
    UploadMatcher implementation for a TAP service.

    Note that although the lon/lat coordinates are phrased in the API as RA/Dec, to match the language of the ConeQueryRowSequence interface, in fact any lon/lat coordinate pairs can be used, of course providing that the same coordinates are understood in the (uploaded) query sequence and the remote TAP table.

    Since:
    4 Oct 2014
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      TapUploadMatcher​(uk.ac.starlink.vo.EndpointSet endpointSet, java.lang.String tableName, java.lang.String raExpr, java.lang.String decExpr, java.lang.String radiusDegExpr, boolean isSync, java.lang.String[] tapCols, ServiceFindMode serviceMode, java.util.Map<java.lang.String,​java.lang.String> extraParams, uk.ac.starlink.util.ContentCoding coding)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAdql​(long maxrec)
      Returns an ADQL expression to retrieve the raw result table from the TAP service.
      ColumnPlan getColumnPlan​(uk.ac.starlink.table.ColumnInfo[] resultCols, uk.ac.starlink.table.ColumnInfo[] uploadCols)
      Returns an object that understands what columns are where in an output table generated from the raw result produced by this matcher.
      static ServiceFindMode[] getSupportedServiceModes()
      Returns service modes supported by this class.
      boolean streamRawResult​(ConeQueryRowSequence coneSeq, uk.ac.starlink.table.TableSink rawResultSink, RowMapper<?> rowMapper, long maxrec)
      Scans a sequence of positional queries, uploads it to a remote service, and writes the returned values to a given sink.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TapUploadMatcher

        public TapUploadMatcher​(uk.ac.starlink.vo.EndpointSet endpointSet,
                                java.lang.String tableName,
                                java.lang.String raExpr,
                                java.lang.String decExpr,
                                java.lang.String radiusDegExpr,
                                boolean isSync,
                                java.lang.String[] tapCols,
                                ServiceFindMode serviceMode,
                                java.util.Map<java.lang.String,​java.lang.String> extraParams,
                                uk.ac.starlink.util.ContentCoding coding)
        Constructor.
        Parameters:
        endpointSet - TAP service endpoint locations
        tableName - name of table in TAP service to match against
        raExpr - column name (or ADQL expression) for RA in decimal degrees in TAP table
        decExpr - column name (or ADQL expression) for Declination in decimal degrees in TAP table
        radiusDegExpr - ADQL expression (maybe constant) for search radius in decimal degrees
        isSync - true for synchronous, false for asynchronous
        tapCols - column names from the remote table to be included in the output table; if null, all are included
        serviceMode - type of match
        extraParams - map of additional parameters for TAP query
        coding - configures HTTP compression for result
    • Method Detail

      • streamRawResult

        public boolean streamRawResult​(ConeQueryRowSequence coneSeq,
                                       uk.ac.starlink.table.TableSink rawResultSink,
                                       RowMapper<?> rowMapper,
                                       long maxrec)
                                throws java.io.IOException
        Description copied from interface: UploadMatcher
        Scans a sequence of positional queries, uploads it to a remote service, and writes the returned values to a given sink.

        Both the read and the write should ideally be streamed (read as uploaded and written as received) so that progress can be logged properly.

        The result is written to the given rawResultSink (which will probably be a RowStore). To make sense of the table thus written, it is necessary to use the RowMapper supplied to this method and the ColumnPlan available from this object. The RowMapper associates result rows with queries from the input row sequence, and the ColumnPlan knows where the special and other columns are in the result table.

        Specified by:
        streamRawResult in interface UploadMatcher
        Parameters:
        coneSeq - sequence of cone-like positional queries
        rawResultSink - destination for result rows obtained from the target matcher service
        rowMapper - used to label rows; queries are labelled with the value returned from the getIndex method of coneSeq
        maxrec - user-supplied limit on the maximum number of output rows, though the service may truncate the result; if <0, no limit is requested
        Returns:
        true iff the result was truncated due to overflow
        Throws:
        java.io.IOException
      • getColumnPlan

        public ColumnPlan getColumnPlan​(uk.ac.starlink.table.ColumnInfo[] resultCols,
                                        uk.ac.starlink.table.ColumnInfo[] uploadCols)
        Description copied from interface: UploadMatcher
        Returns an object that understands what columns are where in an output table generated from the raw result produced by this matcher.
        Specified by:
        getColumnPlan in interface UploadMatcher
        Parameters:
        resultCols - columns in the raw result table written by this object's streamRawResult method
        uploadCols - columns from the table that will be joined to the raw result to get the output table
        Returns:
        column plan
      • getAdql

        public java.lang.String getAdql​(long maxrec)
        Returns an ADQL expression to retrieve the raw result table from the TAP service.
        Parameters:
        maxrec - maximum number of records permitted
        Returns:
        ADQL text
      • getSupportedServiceModes

        public static ServiceFindMode[] getSupportedServiceModes()
        Returns service modes supported by this class. Currently, all are supported apart from ServiceFindMode.BEST_REMOTE. That one is basically impossible to do using ADQL as far as I can tell, since there is in general no way to tell what remote table row a given row of a query result is referring to. You could do it in special cases if the table in question has a primary key.
        Returns:
        supported find modes