\hypertarget{vocRegistry_8c}{ \section{vocRegistry.c File Reference} \label{vocRegistry_8c}\index{vocRegistry.c@{vocRegistry.c}} } {\tt \#include $<$stdio.h$>$}\par {\tt \#include $<$stdlib.h$>$}\par {\tt \#include $<$unistd.h$>$}\par {\tt \#include $<$signal.h$>$}\par {\tt \#include $<$errno.h$>$}\par {\tt \#include \char`\"{}VOClient.h\char`\"{}}\par \subsection*{Functions} \begin{CompactItemize} \item RegResult \hyperlink{vocRegistry_8c_555aa2dc7ece17033e9399ed00ff4b78}{voc\_\-regSearch} (char $\ast$term1, char $\ast$term2, int orValues) \begin{CompactList}\small\item\em High-level Registry query interface. \item\end{CompactList}\item RegResult \hyperlink{vocRegistry_8c_25e61b2c021394192ca8e74e96f45b28}{voc\_\-regSearchByService} (char $\ast$svc, char $\ast$term, int orValues) \begin{CompactList}\small\item\em Search Registry using a search term and service constraint. \item\end{CompactList}\item RegQuery \hyperlink{vocRegistry_8c_cfd7f451139af07ff58c173d793b3962}{voc\_\-regQuery} (char $\ast$term, int orValues) \begin{CompactList}\small\item\em Create a RegistryQuery object. \item\end{CompactList}\item void \hyperlink{vocRegistry_8c_eb0ee2e29939419af10cfbebc82e2110}{voc\_\-regAddSearchTerm} (RegQuery query, char $\ast$term, int orValue) \begin{CompactList}\small\item\em Add a search term to the specified query. \item\end{CompactList}\item void \hyperlink{vocRegistry_8c_9b9e8c445ffb38711ef4ee345fa0f68d}{voc\_\-regRemoveSearchTerm} (RegQuery query, char $\ast$term) \begin{CompactList}\small\item\em Remove a search term to the specified query. \item\end{CompactList}\item void \hyperlink{vocRegistry_8c_8d63761f770b4327d44cd1c618ce186f}{voc\_\-regConstWaveband} (RegQuery query, char $\ast$waveband) \begin{CompactList}\small\item\em Constrain the Registry search by waveband. \item\end{CompactList}\item \hypertarget{vocRegistry_8c_ae38f1ab3f9a3682971fd8edf339b20c}{ void \textbf{voc\_\-regConstSvcType} (RegQuery query, char $\ast$svcType)} \label{vocRegistry_8c_ae38f1ab3f9a3682971fd8edf339b20c} \item void \hyperlink{vocRegistry_8c_494458ce877c4fa8442ff398873195b4}{voc\_\-regDALOnly} (RegQuery query, int value) \begin{CompactList}\small\item\em Set the \char`\"{}DAL Only\char`\"{} flag. \item\end{CompactList}\item void \hyperlink{vocRegistry_8c_800645e5f4dc73bcf99730db9cb4d439}{voc\_\-regSortRes} (RegQuery query, int value) \begin{CompactList}\small\item\em Set the resource \char`\"{}sort\char`\"{} flag. \item\end{CompactList}\item int \hyperlink{vocRegistry_8c_4780f7c8975abf074f3b41e27c31a7e3}{voc\_\-regGetSTCount} (RegQuery query) \begin{CompactList}\small\item\em Get the number of search terms in the current query. \item\end{CompactList}\item char $\ast$ \hyperlink{vocRegistry_8c_6b8ad34f22f1c22e34b56dc0ff635355}{voc\_\-regGetQueryString} (RegQuery query) \begin{CompactList}\small\item\em Get the current query as an http GET URL. \item\end{CompactList}\item RegResult \hyperlink{vocRegistry_8c_cea0f3cbac1f593ad5899a5252803689}{voc\_\-regExecute} (RegQuery query) \begin{CompactList}\small\item\em Execute the specified query. \item\end{CompactList}\item char $\ast$ \hyperlink{vocRegistry_8c_ac9bb69c156fbdae90cb33f396336995}{voc\_\-regExecuteRaw} (RegQuery query) \begin{CompactList}\small\item\em Execute the specified query and return raw result string. \item\end{CompactList}\item int \hyperlink{vocRegistry_8c_b6ce658f8bb8803ad73c5c15ccdf7dd4}{voc\_\-resGetCount} (RegResult res) \begin{CompactList}\small\item\em Return a count of the number of results records. \item\end{CompactList}\item char $\ast$ \hyperlink{vocRegistry_8c_c5376fa75dc000e0b820fd4e29e5cfaa}{voc\_\-resGetStr} (RegResult res, char $\ast$attribute, int index) \begin{CompactList}\small\item\em Get a string-valued attribute from the result resource record. \item\end{CompactList}\item double \hyperlink{vocRegistry_8c_3dceef82335c216785372fdd9789cc0c}{voc\_\-resGetFloat} (RegResult res, char $\ast$attribute, int index) \begin{CompactList}\small\item\em Get a real-valued attribute from the result resource record. \item\end{CompactList}\item int \hyperlink{vocRegistry_8c_8b2e5aa46ad515427da01b9314434cef}{voc\_\-resGetInt} (RegResult res, char $\ast$attribute, int index) \begin{CompactList}\small\item\em Get an int-valued attribute from the result resource record. \item\end{CompactList}\end{CompactItemize} \subsection*{Variables} \begin{CompactItemize} \item \hypertarget{vocRegistry_8c_e8b9013ac3d6a8f93991444d8c8c5919}{ VOClient $\ast$ \textbf{vo}} \label{vocRegistry_8c_e8b9013ac3d6a8f93991444d8c8c5919} \end{CompactItemize} \label{_details} \hypertarget{_details}{} \subsection{Detailed Description} VOC\_\-REGISTRYQUERY -- Utility code to act as a client interface to the NVO Registry service. RegistryQuery ---------------------- High-Level Query: res = voc\_\-regSearch (sql, keywords, orValues) res =voc\_\-regSearchByService (svc, term, orValues) Programmatic Query: query = voc\_\-regQuery (term, orValues) // OR keyword list? voc\_\-regConstSvcType (query, svcType) // search constraints voc\_\-regConstWaveband (query, waveband) voc\_\-regDALOnly (query, value) voc\_\-regSortRes (query, value) voc\_\-regAddSearchTerm (query, term, orValue) // OR term w/ previous voc\_\-regRemoveSearchTerm (query, term) // remove search term count = voc\_\-regGetSTCount (query) str = voc\_\-regGetQueryString (query) // GET form of query res = voc\_\-regExecute (query) // return result obj str = voc\_\-regExecuteRaw (query) // return raw XML RegistryQueryResult count = voc\_\-resGetCount (res) str = voc\_\-resGetStr (res, attribute, index) dval = voc\_\-resGetFloat (res, attribute, index) ival = voc\_\-resGetInt (res, attribute, index) For this implementation, we've chose to use the NVO Registry at JHU/STScI, specifically the QueryRegistry() method which provides a 'SimpleResource' form of the resource record. Support for the newer IVOA standard will be added later, for now we can quickly access the most commonly used fields of a resource using both a keyword and SQL form of the search. \begin{Desc} \item[Author:]Michael Fitzpatrick \end{Desc} \begin{Desc} \item[Version:]July 2006 \end{Desc} \subsection{Function Documentation} \hypertarget{vocRegistry_8c_eb0ee2e29939419af10cfbebc82e2110}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-regAddSearchTerm@{voc\_\-regAddSearchTerm}} \index{voc\_\-regAddSearchTerm@{voc\_\-regAddSearchTerm}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-regAddSearchTerm}]{\setlength{\rightskip}{0pt plus 5cm}void voc\_\-regAddSearchTerm (RegQuery {\em query}, \/ char $\ast$ {\em term}, \/ int {\em orValue})}} \label{vocRegistry_8c_eb0ee2e29939419af10cfbebc82e2110} Add a search term to the specified query. VOC\_\-REGADDSEARCHTERM -- Add a search term (sql predicate or keyword list) to the specified query. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em query}]Registry query handle \item[{\em term}]keyword search term \item[{\em orValues}]logically OR values? \end{description} \end{Desc} \begin{Desc} \item[Returns:]nothing \end{Desc} \hypertarget{vocRegistry_8c_8d63761f770b4327d44cd1c618ce186f}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-regConstWaveband@{voc\_\-regConstWaveband}} \index{voc\_\-regConstWaveband@{voc\_\-regConstWaveband}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-regConstWaveband}]{\setlength{\rightskip}{0pt plus 5cm}void voc\_\-regConstWaveband (RegQuery {\em query}, \/ char $\ast$ {\em waveband})}} \label{vocRegistry_8c_8d63761f770b4327d44cd1c618ce186f} Constrain the Registry search by waveband. Constrain the Registry search by service type. VOC\_\-REGCONSTWAVEBAND -- Constrain the Registry search by waveband. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em query}]Registry query handle \item[{\em waveband}]waveband string \end{description} \end{Desc} \begin{Desc} \item[Returns:]nothing\end{Desc} VOC\_\-REGCONSTSVCTYPE -- Constraing the Registry search by service type. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em query}]Registry query handle \item[{\em svcType}]service type string \end{description} \end{Desc} \begin{Desc} \item[Returns:]nothing \end{Desc} \hypertarget{vocRegistry_8c_494458ce877c4fa8442ff398873195b4}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-regDALOnly@{voc\_\-regDALOnly}} \index{voc\_\-regDALOnly@{voc\_\-regDALOnly}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-regDALOnly}]{\setlength{\rightskip}{0pt plus 5cm}void voc\_\-regDALOnly (RegQuery {\em query}, \/ int {\em value})}} \label{vocRegistry_8c_494458ce877c4fa8442ff398873195b4} Set the \char`\"{}DAL Only\char`\"{} flag. VOC\_\-REGDALONLY -- Set the \char`\"{}DAL Only\char`\"{} flag. If set, we expand a resource search to break out the individual DAL services into separate results. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em query}]Registry query handle \item[{\em value}]value of the DAL-only flag \end{description} \end{Desc} \begin{Desc} \item[Returns:]nothing \end{Desc} \hypertarget{vocRegistry_8c_cea0f3cbac1f593ad5899a5252803689}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-regExecute@{voc\_\-regExecute}} \index{voc\_\-regExecute@{voc\_\-regExecute}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-regExecute}]{\setlength{\rightskip}{0pt plus 5cm}RegResult voc\_\-regExecute (RegQuery {\em query})}} \label{vocRegistry_8c_cea0f3cbac1f593ad5899a5252803689} Execute the specified query. VOC\_\-REGEXECUTE -- Execute the specified query, returning a result object code or NULL. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em query}]Registry query handle \end{description} \end{Desc} \begin{Desc} \item[Returns:]registry result object handle \end{Desc} \hypertarget{vocRegistry_8c_ac9bb69c156fbdae90cb33f396336995}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-regExecuteRaw@{voc\_\-regExecuteRaw}} \index{voc\_\-regExecuteRaw@{voc\_\-regExecuteRaw}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-regExecuteRaw}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ voc\_\-regExecuteRaw (RegQuery {\em query})}} \label{vocRegistry_8c_ac9bb69c156fbdae90cb33f396336995} Execute the specified query and return raw result string. VOC\_\-REGEXECUTERAW -- Execute the specified query and return the raw resulting XML string. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em query}]Registry query handle \end{description} \end{Desc} \begin{Desc} \item[Returns:]raw data return from data \end{Desc} \hypertarget{vocRegistry_8c_6b8ad34f22f1c22e34b56dc0ff635355}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-regGetQueryString@{voc\_\-regGetQueryString}} \index{voc\_\-regGetQueryString@{voc\_\-regGetQueryString}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-regGetQueryString}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ voc\_\-regGetQueryString (RegQuery {\em query})}} \label{vocRegistry_8c_6b8ad34f22f1c22e34b56dc0ff635355} Get the current query as an http GET URL. VOC\_\-REGGETQUERYSTRING -- Get the current query as an http GET URL. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em query}]Registry query handle \end{description} \end{Desc} \begin{Desc} \item[Returns:]query URL \end{Desc} \hypertarget{vocRegistry_8c_4780f7c8975abf074f3b41e27c31a7e3}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-regGetSTCount@{voc\_\-regGetSTCount}} \index{voc\_\-regGetSTCount@{voc\_\-regGetSTCount}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-regGetSTCount}]{\setlength{\rightskip}{0pt plus 5cm}int voc\_\-regGetSTCount (RegQuery {\em query})}} \label{vocRegistry_8c_4780f7c8975abf074f3b41e27c31a7e3} Get the number of search terms in the current query. VOC\_\-REGGETSTCOUNT -- Get the number of search terms in the current query. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em query}]Registry query handle \end{description} \end{Desc} \begin{Desc} \item[Returns:]nothing \end{Desc} \hypertarget{vocRegistry_8c_cfd7f451139af07ff58c173d793b3962}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-regQuery@{voc\_\-regQuery}} \index{voc\_\-regQuery@{voc\_\-regQuery}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-regQuery}]{\setlength{\rightskip}{0pt plus 5cm}RegQuery voc\_\-regQuery (char $\ast$ {\em term}, \/ int {\em orValues})}} \label{vocRegistry_8c_cfd7f451139af07ff58c173d793b3962} Create a RegistryQuery object. VOC\_\-REGQUERY -- Create a RegistryQuery object. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em term}]keyword search term \item[{\em orValues}]logically OR values? \end{description} \end{Desc} \begin{Desc} \item[Returns:]handle to Registry Query object \end{Desc} \hypertarget{vocRegistry_8c_9b9e8c445ffb38711ef4ee345fa0f68d}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-regRemoveSearchTerm@{voc\_\-regRemoveSearchTerm}} \index{voc\_\-regRemoveSearchTerm@{voc\_\-regRemoveSearchTerm}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-regRemoveSearchTerm}]{\setlength{\rightskip}{0pt plus 5cm}void voc\_\-regRemoveSearchTerm (RegQuery {\em query}, \/ char $\ast$ {\em term})}} \label{vocRegistry_8c_9b9e8c445ffb38711ef4ee345fa0f68d} Remove a search term to the specified query. VOC\_\-REMOVESEARCHTERM -- Remove the search term from the query. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em query}]Registry query handle \item[{\em term}]keyword search term \end{description} \end{Desc} \begin{Desc} \item[Returns:]nothing \end{Desc} \hypertarget{vocRegistry_8c_555aa2dc7ece17033e9399ed00ff4b78}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-regSearch@{voc\_\-regSearch}} \index{voc\_\-regSearch@{voc\_\-regSearch}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-regSearch}]{\setlength{\rightskip}{0pt plus 5cm}RegResult voc\_\-regSearch (char $\ast$ {\em term1}, \/ char $\ast$ {\em term2}, \/ int {\em orValues})}} \label{vocRegistry_8c_555aa2dc7ece17033e9399ed00ff4b78} High-level Registry query interface. VOC\_\-REGSEARCH -- High-level procedure to form a query and execute it immediately. We allow that 'term1' may be a complex SQL WHERE predicate, and that 'term2' (or vice versa) is a search-keyword list. The 'orValues' applies to the keyword list (if present), otherwise it applies to the two search term elements. The default action if two terms are specified is to logically AND them. The thinking here is that one might want SIAP services for Quasars. This is easily expressed in an SQL form to get SIAP resources, however a Quasar may be known as a QSO, AGN, active-nuclei, etc and so we need a easy way to OR the keywords but AND that result with the SQL predicate. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em term1}]first search term \item[{\em term2}]second search term \item[{\em orValues}]logically OR values? \end{description} \end{Desc} \begin{Desc} \item[Returns:]handle to Registry result object \end{Desc} \hypertarget{vocRegistry_8c_25e61b2c021394192ca8e74e96f45b28}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-regSearchByService@{voc\_\-regSearchByService}} \index{voc\_\-regSearchByService@{voc\_\-regSearchByService}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-regSearchByService}]{\setlength{\rightskip}{0pt plus 5cm}RegResult voc\_\-regSearchByService (char $\ast$ {\em svc}, \/ char $\ast$ {\em term}, \/ int {\em orValues})}} \label{vocRegistry_8c_25e61b2c021394192ca8e74e96f45b28} Search Registry using a search term and service constraint. VOC\_\-REGSEARCHBYSERVICE -- Search the Registry using a search term and constrain by service type. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em svc}]service type constraint \item[{\em term}]keyword search term \item[{\em orValues}]logically OR values? \end{description} \end{Desc} \begin{Desc} \item[Returns:]handle to Registry result object \end{Desc} \hypertarget{vocRegistry_8c_800645e5f4dc73bcf99730db9cb4d439}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-regSortRes@{voc\_\-regSortRes}} \index{voc\_\-regSortRes@{voc\_\-regSortRes}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-regSortRes}]{\setlength{\rightskip}{0pt plus 5cm}void voc\_\-regSortRes (RegQuery {\em query}, \/ int {\em value})}} \label{vocRegistry_8c_800645e5f4dc73bcf99730db9cb4d439} Set the resource \char`\"{}sort\char`\"{} flag. VOC\_\-REGSORTRES -- Set the resource \char`\"{}sort\char`\"{} flag. If enabled, we try to order the resource table by some logical means. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em query}]Registry query handle \item[{\em value}]value of the sort flag \end{description} \end{Desc} \begin{Desc} \item[Returns:]nothing \end{Desc} \hypertarget{vocRegistry_8c_b6ce658f8bb8803ad73c5c15ccdf7dd4}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-resGetCount@{voc\_\-resGetCount}} \index{voc\_\-resGetCount@{voc\_\-resGetCount}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-resGetCount}]{\setlength{\rightskip}{0pt plus 5cm}int voc\_\-resGetCount (RegResult {\em res})}} \label{vocRegistry_8c_b6ce658f8bb8803ad73c5c15ccdf7dd4} Return a count of the number of results records. VOC\_\-RESGETCOUNT -- Return a count of the number of results records. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em res}]Registry result handle \end{description} \end{Desc} \begin{Desc} \item[Returns:]number of result records \end{Desc} \hypertarget{vocRegistry_8c_3dceef82335c216785372fdd9789cc0c}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-resGetFloat@{voc\_\-resGetFloat}} \index{voc\_\-resGetFloat@{voc\_\-resGetFloat}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-resGetFloat}]{\setlength{\rightskip}{0pt plus 5cm}double voc\_\-resGetFloat (RegResult {\em res}, \/ char $\ast$ {\em attribute}, \/ int {\em index})}} \label{vocRegistry_8c_3dceef82335c216785372fdd9789cc0c} Get a real-valued attribute from the result resource record. VOC\_\-GETFLOAT -- Get a real-valued attribute from the result resource record. Currently recognized real-valued attributes include: MaxSR maximum search radius Attribute string are case-insensitive. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em res}]Registry result handle \item[{\em attr}]record attribute \item[{\em index}]record index \end{description} \end{Desc} \begin{Desc} \item[Returns:]string-valued attribute \end{Desc} \hypertarget{vocRegistry_8c_8b2e5aa46ad515427da01b9314434cef}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-resGetInt@{voc\_\-resGetInt}} \index{voc\_\-resGetInt@{voc\_\-resGetInt}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-resGetInt}]{\setlength{\rightskip}{0pt plus 5cm}int voc\_\-resGetInt (RegResult {\em res}, \/ char $\ast$ {\em attribute}, \/ int {\em index})}} \label{vocRegistry_8c_8b2e5aa46ad515427da01b9314434cef} Get an int-valued attribute from the result resource record. VOC\_\-GETINT -- Get a integer-valued attribute from the result resource record. Currently recognized real-valued attributes include: MaxRecords maximum records returned by the service Attribute string are case-insensitive. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em res}]Registry result handle \item[{\em attr}]record attribute \item[{\em index}]record index \end{description} \end{Desc} \begin{Desc} \item[Returns:]string-valued attribute \end{Desc} \hypertarget{vocRegistry_8c_c5376fa75dc000e0b820fd4e29e5cfaa}{ \index{vocRegistry.c@{vocRegistry.c}!voc\_\-resGetStr@{voc\_\-resGetStr}} \index{voc\_\-resGetStr@{voc\_\-resGetStr}!vocRegistry.c@{vocRegistry.c}} \subsubsection[{voc\_\-resGetStr}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ voc\_\-resGetStr (RegResult {\em res}, \/ char $\ast$ {\em attribute}, \/ int {\em index})}} \label{vocRegistry_8c_c5376fa75dc000e0b820fd4e29e5cfaa} Get a string-valued attribute from the result resource record. VOC\_\-GETSTR -- Get a string-valued attribute from the result resource record. Currently recognized real-valued attributes include: Title Resource title (long version) ShortName Short name of Resource ServiceURL Service URL (if appropriate) ReferenceURL URL to reference about Resource Description Text description of resource Identifier Standard ivo identifier of resource ServiceType Service Type (Cone, Siap, etc) Type Resource Type (catalog, survey, etc) CoverageSpatial Spatial coverage (STC) CoverageTemporal Temporal coverage of data CoverageSpectral Spectral coverage (csv list of bandpasses) ContentLevel Content level (research, EPO, etc -- csv list) Attribute strings are case-insensitive. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em res}]Registry result handle \item[{\em attr}]record attribute \item[{\em index}]record index \end{description} \end{Desc} \begin{Desc} \item[Returns:]string-valued attribute \end{Desc}