gd_querydeleted

Performs queries over metadata or Matlab structures marked for deletion in the archive.

 

Syntax 

qresults = gd_querydeleted(query)

qresults = gd_querydeleted(query,datasource)

qresults = gd_querydeleted(query,datasource,resultfields)

qresults = gd_querydeleted(query,datasource,resultfields,

                           orderby)

qresults = gd_querydeleted(query,datasource,resultfields,

                           orderby,resultlimit)

qresults = gd_querydeleted(query,datasource,resultfields,

                           resultlimit)

 

Description

qresults = gd_querydeleted(...) has exactly the same functionality as gd_query but performs the queries over data that has been marked for deletion using the gd_markfordeletion function. gd_querydeleted returns a cell array of metadata structures, one for each matching result. The standard.ID field in each result can be passed to the gd_unmarkfordeletion function, which can recover data that was mistakenly marked for deletion. This function will only return results for data that has not already been permanently deleted from the archive by an administrator.

 

A brief description of the input arguments is given here, see gd_query for further information. To view the query results, use function gd_display.

 

Input Arguments

query                   A query takes the form 'field = value' where field is the name of a field in the archived metadata/variable structure, for example iterations or standard.ID  (dot notation is used to access the subfields of a structure). The value is an alphanumeric value the field should contain. The operator & (meaning ‘and’) can be used to specify more than one search condition.

 

datasource        The data source indicates which type of data to query, and can be specified by one of the following strings (the default datasource value is 'file'):

 

‘file’

Metadata about files.

‘datagroup’

Metadata about datagroups.

‘monitor’

Metadata about monitorable datagroups.

‘varmeta’

Metadata about Matlab variables.

‘var’

Matlab variables.

 

resultfields The resultfields string is a comma separated list indicating which fields should be returned for each result, for example just the standard.ID fields. The default, *, returns all fields. It can also be used to express aggregate functions (count, max, min, avg, sum) applied on a result field, e.g. 'count(standard.ID)'.

 

orderby      The results may be sorted by one or more fields, specified as a comma separated list prefixed with the keyword 'orderby'. Fields are sorted numerically (num) or alphabetically (str), e.g.
'orderby num(field1), str(field2)'. The default sort order is ascending; append the keyword 'desc' after a field to sort it in descending order, e.g. 'orderby num(field1) desc'.

 

resultlimit  The number of results returned from a query can be limited. An integer value means return the top resultlimit values from the results. An ordinal string of the form '1st' or '2nd' etc means return a specific result based on its position.

 

Examples

Query variable metadata that has been marked for deletion, and then unmark the corresponding variables so that they are no longer eligible for deletion from the archive.

 

q = 'standard.archiveDate > 2004-12-01 & a.b < -500';

qresults = gd_querydeleted(q, 'varmeta');

for i=1:size(qresults,2)

    IDs{i} = qresults{i}.standard.ID;

end

unmarktotal = gd_unmarkfordeletion(IDs)

 

unmarktotal =

     5

 

Notes

When querying standard date information (archiveDate or createDate), specify the date/time using the International Standard Date and Time Notation (ISO 8601) which is: "YYYY-MM-DD hh:mm:ss" (hh:mm:ss is optional).

 

The sum and avg aggregate functions will only work on fields containing numerical data. Non-numerical custom metadata is ignored in the calculation and non-numerical standard metadata (e.g. standard.comment) throws an error.

 

Treating numerical data as strings when using orderby, max or min can lead to unexpected results. This can be illustrated in Matlab where sort({‘1’,’5’,’10’}) returns '1'    '10'    '5'. Always use the numerical syntax, e.g. orderby(num(a)) or max(a), when working with numbers in custom metadata.

 

In the current release orderby, groupby, distinct and the aggregate functions cannot be used on standard metadata about datagroup relationships (standard.datagroups, standard.subdatagroups, standard.files and standard.vars).

 

Only results for data marked for deletion and owned by the user (i.e. data the user archived/created) will be returned.

 

If the marked data has been permanently deleted from the archive by an administrator it cannot be queried.

 

A valid proxy certificate is required (see gd_createproxy from the Geodise Compute Toolbox).

 

Your certificate subject must have been added to the authorisation database.

 

See also

gd_unmarkfordeletion, gd_markfordeletion, gd_display, gd_query, gd_createproxy

 



gd_query

contents

gd_retrieve

Copyright © 2007, The Geodise Project, University of Southampton