The HEASARC Database SystemAccessing the HEASARC Database and MetadataThis section describes three mechanisms through which (primarily internal) users can query the HEASARC database interactively beyond standard Browse user table queries. Users may wish to examine the HEASARC metadata, perform queries that cannot be made by Browse directly, investigate problems with table queries, or have other reasons for such access. APIs for software access are discussed elsewhere. The three mechanisms are the HDBmc command-line interface, the Browse Keyword Search interface to query HEASARC metadata, and vendor-supplied tools for database access. After discussing these access methods, a few examples of the kinds of queries a user might attempt using either HDBmc or other access methods supporting SQL queries are given. The HDBmc commandThe HDBmc command is available for querying the HEASARC database from most HEASARC servers in the /heasarc/bin/ directory. This command provides a tool for doing a single simple query of the database or metadata. The HDBmc command may be used in the following manner: HDBmc observatory=AnObservatoryName HDBmc table=ATableName HDBmc parameter=ATableName HDBmc sql="Any sql query" The optional command-line parameter -host=hostname[:port] may be used to specify the database host name and socket port. The default port is 40975. This argument can be used to connect to the backup database if desired, but it is mostly used when debugging databases or software. There are four commands available within HDBmc. HDBmc: observatoryThe observatory command lists tables available for a given observatory with each table giving a pair of lines of the form table_name=sometable observatory_name=someobservatory The observatory may include a '*' as a wildcard character. This query uses the observatory name as specified in the ZZEXT observatory_name virtual parameter. Example: HDBmc observatory="GENERAL CATALOG" Response: table_name=B/2mass observatory_name=GENERAL CATALOG table_name=I/252 observatory_name=GENERAL CATALOG table_name=I/271 observatory_name=GENERAL CATALOG table_name=heasarc_class observatory_name=GENERAL CATALOG table_name=heasarc_messier observatory_name=GENERAL CATALOG table_name=heasarc_ngc2000 observatory_name=GENERAL CATALOG table_name=heasarc_pg observatory_name=GENERAL CATALOG HDBmc: tableThe table request returns the ZZGEN and ZZEXT metadata associated with a given table as a list of the form field=value where field gives the values in the ZZGEN table and then any virtual parameters for this table from the ZZEXT table. The input table name can be specified as a wildcard so that the output can include many tables. Output for each table begins with a line of the form table_name=theName Example: HDBmc table=heasarc_messier Response: table_name=heasarc_messier table_location=dbms1.gsfc.nasa.gov table_description=Messier Nebulae table_document_url=http://heasarc.gsfc.nasa.gov/W3Browse/general-catalog/messier.html create_date=2003-05-05 18:39:01 modify_date=2003-05-05 18:39:01 table_rows=109 equinox=2000 unique_key=name declination=@dec table_priority=3 table_type=Object target_name=@name right_ascension=@ra default_search_radius=60 frequency_regime=Optical observatory_name=GENERAL CATALOG HDBmc: parameterThe parameter request gives the details for the parameters of the table. A new parameter is signaled by a pair of lines of the form table_name=aTableName parameter_name=aParameterNAme Example: HDBmc parameter=heasarc_messier Response: table_name=heasarc_messier parameter_name=object_type parameter_description=Object Category parameter_format=char2 parameter_unit= parameter_is_index=Y parameter_minval=DI parameter_maxval=S parameter_comment= parameter_default=0 table_name=heasarc_messier parameter_name=bii parameter_description=Galactic Latitude parameter_format=float8 parameter_unit=degree parameter_is_index=Y parameter_minval=-51.932565 parameter_maxval=84.424982 parameter_comment= parameter_default=0 table_name=heasarc_messier parameter_name=lii parameter_description=Galactic Longitude parameter_format=float8 parameter_unit=degree parameter_is_index=Y parameter_minval=1.722578 parameter_maxval=356.865940 parameter_comment= parameter_default=0 ... HDBmc: sqlThe SQL command lets the user send an arbitrary SQL query to the database. The result will be pipe delimited table. Note that the SQL statement needs to be enclosed in quotes to ensure that it is seen as a single token. Double quotes are recommended since SQL uses single quotes as the delimiter for strings. E.g., HDBmc sql="select * from zzext where table_name='zzdp'" would return all of the ZZEXT entries for the ZZDP table (the shortcuts discussed in the previous chapter). Example: HDBmc sql="select * from heasarc_messier" Response: +--------------+----------------------+-----------+--------------+----------------------+... |alt_name |bii |class |constell |dec | +--------------+----------------------+-----------+--------------+----------------------+ |NGC 6475 | -4.5212902| 3600|SCO | -34.816664907176| |NGC 6637 | -10.2731749| 3080|SGR | -32.350009145856| |NGC 6681 | -12.5107943| 3080|SGR | -32.300012468954| |NGC 6405 | -0.7155348| 3600|SCO | -32.21666091568| |NGC 6809 | -23.2733634| 3080|SGR | -30.966694770854| |NGC 6715 | -14.0974428| 3080|SGR | -30.483349176839| |NGC 6266 | 7.3185708| 3080|OPH | -30.116649736484| ... |NGC 3034 | 40.5596785| 6600|UMA | 69.683390351975| +--------------+----------------------+-----------+--------------+----------------------+ (109 rows) (Note that only the first five fields of the output were shown.) Note: The HDBfilter utility is extremely useful for formatting the results of a SQL query made using HDBmc. A more detailed discussion (suitable for programmers) pertaining to the HDBmc command and its inner workings is in another document. Querying HEASARC Metadata Using Browse Keyword SearchThe Browse Keyword Search interface (help) provides a way that users can query Browse metadata through the Web. If users enter the name of a Browse metadata table, then that table will be queried. If there are other keyword parameters, then the specified metadata table will be queried for values for the Browse user tables whose metadata matches the other keywords. E.g., to simply dump the first few values in the ZZGEN table the user can enter zzgen But if the user wants only the XMMMASTER entry for ZZGEN they could try zzgen xmmmaster Or to get the ZZGEN entries for all ASCA tables zzgen asca Keywords are searched against all metadata so one can get more results than one expects. E.g., zzgen xtemaster will return results for both XTEMASTER and XTEINDEX since XTEINDEX mentions XTEMASTER in its metadata. If the user is searching a table that does not have a table_name field, then the additional keywords should not be specified. The table name is matched against the list of tables that the user has specified. Users can put qualifications on the query themselves. E.g., zzext table_name=zzdp will list the data product shortcuts which are stored in the ZZEXT table with the table_name set to zzdp. Or try zzext parameter_name=observatory_name to get the mission/observatory associated with each table. The ZZGEN, ZZPAR, ZZEXT, ZZDP, ZZDPSETS, ZZMASTER, ZZWORDS, ZZLINK, and ZZBIB tables can all be queried using this interface. One note regarding querying the ZZBIB table: It is possible for Browse Keyword Search interface to get confused with the bibcode strings. These often have multiple consecutive periods which can be interpreted as the Browse parameter value range operator (".."). The row and table limits of the keyword search interface apply to these metdata queries. Only the first 200 matching rows will be shown by default if keywords are specified only the top 10 matching tables will be included. The rows and tables qualifiers can be used to change these settings. E.g., zzpar x-ray r:all t:all will describe all parameters of all rows for any table that includes x-ray in its metadata.
|