net.cds
Class NameResolver

java.lang.Object
  extended by net.cds.CDSParser
      extended by net.cds.NameResolver

public class NameResolver
extends CDSParser

This class uses the name-resolving capabilities of the VizeR/Simbad/NED databases via a network-access to the AXIS services provides by CDS. For this class to run, one needs the AXIS-jar extensions, at least the axis.jar, jaxrpc.jar, saaj.jar, commons-logging.jar, commons-discovery.jar, wsdl4j.jar. Additionally, an access package must be created, in this case by issuing the command: java org.apache.axis.wsdl.WSDL2Java http://cdsws.u-strasbg.fr/axis/services/Sesame?wsdl. Additional info is available at CDS.

A typicla output looks like this:

 
    
      
      PW And
      
        from cache
        RSCVn
        00:18:20.89 +30:57:22.0
        4.5870708
        +30.9561194
        1988A&AS...74..449R
        137133
        V* PW And
        V* PW And
        HD 1405
        AG+30 25
        BD+30 34
        EUVE J0018+30.9
        [FS2003] 0007
        GC 365
        LTT 10110
        PPM 65186
        RBS 39
        2RE J001820+305712
        2RE J0018+305
        RX J0018.3+3057
        1RXS J001821.2+305723
        SAO 53799
        TYC 2261- 1518-1
        uvby98 100001405
        YZ 30 120
        30
      
    
 
The appropriate tags can be queried in accordingly named methods.

This software uses source code created at the Centre de Donn�es astronomiques de Strasbourg, France.


Nested Class Summary
static class NameResolver.Client
          Titre : Sesame Description : Resolves names in Simbad, VizieR and/or NED Copyright : Copyright (c) 2002-2003 Soci\x{00E9}t\x{00E9} : Centre de Donn\x{00E9}es Astronomique de Strasbourg
static class NameResolver.Query
          A test class for resolving names through the simbad service.
 
Field Summary
private static Sesame_pkg.SesameService locate
          The AXIS-enhanced sesame service object.
private static NameResolver resolve
          The reference to the only living name-resolver object.
private static String SESAMEFORMAT
          The query format for sesame.
private static Sesame_pkg.Sesame sesamequery
          The access object created from the sesam service provider.
 
Constructor Summary
private NameResolver()
          Constructs a new name resolver.
 
Method Summary
private  boolean checkString(String target)
          Convenience method that transforms the single query string into a one-element list of strings and passes this list to the parent method.
static List<String> getAliases(String ask)
          Returns a string-list of other names of the target.
static String getCommonName(String ask)
          Returns the main name of the object.
static double getDeclination(String ask)
          Returns the declination of the object in degrees.
static double getDeclinationError(String ask)
          Returns the error in declination in milli arcseconds.
static String getError(String ask)
          Returns the error message or null if no error was encountered.
static String getInfo(String ask)
          Returns the info message or null if no info was encountered.
static String getObjectType(String ask)
          Returns the object type.
static String getPositionReference(String ask)
          Returns the reference to the position of the object.
static int getReferenceCount(String ask)
          Returns the number of references to this object.
static String getResolver(String ask)
          Get the resolver name.
static double getRightAscension(String ask)
          Returns the right ascension of the object in degrees.
static double getRightAscensionError(String ask)
          Returns the error of the right ascension in milli arcseconds.
static String getSexagesimalPosition(String ask)
          Returns right ascension and declination of the target as a single string in the so-called sexagesimal notation.
static boolean inService()
          Returns true, if the sesame service could be located.
protected  boolean isRetrievable()
          Returns true if the web-service is available.
protected  String query(List arg)
          This method is called if the cache needs to be updated.
private static double tryDouble(String parse)
          Tries to convert a string into a double.
 
Methods inherited from class net.cds.CDSParser
checkCache, getParsed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

locate

private static Sesame_pkg.SesameService locate
The AXIS-enhanced sesame service object.


sesamequery

private static Sesame_pkg.Sesame sesamequery
The access object created from the sesam service provider.


SESAMEFORMAT

private static final String SESAMEFORMAT
The query format for sesame.

See Also:
Constant Field Values

resolve

private static NameResolver resolve
The reference to the only living name-resolver object.

Constructor Detail

NameResolver

private NameResolver()
Constructs a new name resolver. The only living instance of a name resolver should be constructed at class load.

Method Detail

inService

public static boolean inService()
Returns true, if the sesame service could be located.


getResolver

public static String getResolver(String ask)
Get the resolver name.

Parameters:
ask - The object description to be queried.
Returns:
The resolver name

getError

public static String getError(String ask)
Returns the error message or null if no error was encountered.

Parameters:
ask - The object description to be queried.
Returns:
The error message or null if no error occured.

getInfo

public static String getInfo(String ask)
Returns the info message or null if no info was encountered.

Parameters:
ask - The object description to be queried.
Returns:
The info message or null if no info was transferred.

getObjectType

public static String getObjectType(String ask)
Returns the object type. See object type documentation.

Parameters:
ask - The object description to be queried.
Returns:
The object type as a string.

getSexagesimalPosition

public static String getSexagesimalPosition(String ask)
Returns right ascension and declination of the target as a single string in the so-called sexagesimal notation.

Parameters:
ask - The object description to be queried.
Returns:
The position in the format HH:MM:SS.S (-)DD:MM:SS.S

getRightAscension

public static double getRightAscension(String ask)
Returns the right ascension of the object in degrees.

Parameters:
ask - The object description to be queried.
Returns:
The right ascension in degrees.

getDeclination

public static double getDeclination(String ask)
Returns the declination of the object in degrees.

Parameters:
ask - The object description to be queried.
Returns:
The declination in degrees.

getRightAscensionError

public static double getRightAscensionError(String ask)
Returns the error of the right ascension in milli arcseconds.

Parameters:
ask - The object description to be queried.
Returns:
The error in the right ascension possition, mas.

getDeclinationError

public static double getDeclinationError(String ask)
Returns the error in declination in milli arcseconds.

Parameters:
ask - The object description to be queried.
Returns:
The error in the declination possition, mas.

getPositionReference

public static String getPositionReference(String ask)
Returns the reference to the position of the object.

Parameters:
ask - The object description to be queried.
Returns:
The bibliographic refernce to the position

tryDouble

private static double tryDouble(String parse)
Tries to convert a string into a double. Returns NaN if a number format exception was thrown.


getCommonName

public static String getCommonName(String ask)
Returns the main name of the object. The main name is the most commonly used identifier, as defined in Simbad.

Parameters:
ask - The object description to be queried.
Returns:
The Simbad main name of the object.

getAliases

public static List<String> getAliases(String ask)
Returns a string-list of other names of the target.

Parameters:
ask - The object description to be queried.
Returns:
A list of strings.

getReferenceCount

public static int getReferenceCount(String ask)
Returns the number of references to this object. If retrieval fails, -1 is returned

Parameters:
ask - The object description to be queried.
Returns:
The number of references to this object.

isRetrievable

protected boolean isRetrievable()
Returns true if the web-service is available. Checks if the static reference to sesamequery is alive.

Specified by:
isRetrievable in class CDSParser

query

protected String query(List arg)
This method is called if the cache needs to be updated. The list is a string-list with a single element.

Specified by:
query in class CDSParser

checkString

private boolean checkString(String target)
Convenience method that transforms the single query string into a one-element list of strings and passes this list to the parent method.