# Class VocabChecker

java.lang.Object
uk.ac.starlink.ttools.votlint.VocabChecker

public class VocabChecker extends Object
Checks values that are defined by the content of an IVOA Vocabulary.

Since:
  25 Apr 2019
Author:
  Mark Taylor

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`VocabChecker.TermReporter`
Callback interface for reporting vocabulary interrogation results.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final VocabChecker`
`DATALINK_CORE`
Instance for vocabulary at http://www.ivoa.net/rdf/datalink/core.
`static final VocabChecker`
`EXAMPLES`
Instance for vocabulary at http://www.ivoa.net/examples.
`static final VocabChecker`
`MESSENGER`
Instance for vocabulary at http://www.ivoa.net/rdf/messenger.
`static final VocabChecker`
`PRODUCT_TYPE`
Instance for vocabulary at http://www.ivoa.net/rdf/product-type.
`static final VocabChecker`
`REFFRAME`
Instance for vocabulary at http://www.ivoa.net/rdf/refframe.
`static final VocabChecker`
`REFPOSITION`
Instance for vocabulary at http://www.ivoa.net/rdf/refposition.
`static final VocabChecker`
`TIMESCALE`
Instance for vocabulary at http://www.ivoa.net/rdf/timescale.

## Constructor Summary

Constructors
Constructor
Description
`VocabChecker(String vocabUrl, String[] fixedTerms)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`checkTerm(String value, VocabChecker.TermReporter termReporter)`
Checks whether a term is present in this vocabulary, and reports to a callback interface.
`Collection<String>`
`getFixedTerms()`
Returns the hard-coded list of terms known by this checker.
`Map<String, uk.ac.starlink.vo.VocabTerm>`
`getRetrievedTerms()`
Lazily acquires vocabulary values by reading the resource at the vocabulary URI.
`String`
`getVocabularyUri()`
Returns the URI of this object's vocabulary in string form.
`URL`
`getVocabularyUrl()`
Returns the URI/URL of this object's vocabulary.
`static void`
`main(String[] args)`
Run to check hard-coded term lists against online versions.
`String`
`toString()`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### TIMESCALE

public static final VocabChecker TIMESCALE
Instance for vocabulary at http://www.ivoa.net/rdf/timescale.

### REFPOSITION

public static final VocabChecker REFPOSITION
Instance for vocabulary at http://www.ivoa.net/rdf/refposition.

### REFFRAME

public static final VocabChecker REFFRAME
Instance for vocabulary at http://www.ivoa.net/rdf/refframe.

### DATALINK_CORE

public static final VocabChecker DATALINK_CORE
Instance for vocabulary at http://www.ivoa.net/rdf/datalink/core.

### PRODUCT_TYPE

public static final VocabChecker PRODUCT_TYPE
Instance for vocabulary at http://www.ivoa.net/rdf/product-type.

### EXAMPLES

public static final VocabChecker EXAMPLES
Instance for vocabulary at http://www.ivoa.net/examples.

### MESSENGER

public static final VocabChecker MESSENGER
Instance for vocabulary at http://www.ivoa.net/rdf/messenger.

## Constructor Details

### VocabChecker

public VocabChecker(String vocabUrl, String[] fixedTerms)
Constructor.

Parameters:
  `vocabUrl` - URI/URL for vocabulary document
  `fixedTerms` - hard-coded non-preliminary, non-deprecated terms known in the vocabulary; other terms may be available by resolving the vocabulary URL

## Method Details

### checkTerm

public void checkTerm(String value, VocabChecker.TermReporter termReporter)
Checks whether a term is present in this vocabulary, and reports to a callback interface.

Parameters:
  `value` - vocabulary name item to test
  `termReporter` - destination for reports; exactly one of its methods will be invoked

### getVocabularyUrl

public URL getVocabularyUrl()
Returns the URI/URL of this object's vocabulary.

Returns:
  vocabulary URL

### getVocabularyUri

public String getVocabularyUri()
Returns the URI of this object's vocabulary in string form.

Returns:
  vocabulary URL

### getFixedTerms

public Collection<String> getFixedTerms()
Returns the hard-coded list of terms known by this checker. It may not be complete if this class is out of date with respect to the vocabulary itself.

Returns:
  unmodifiable list of known terms

### getRetrievedTerms

public Map<String, uk.ac.starlink.vo.VocabTerm> getRetrievedTerms()
Lazily acquires vocabulary values by reading the resource at the vocabulary URI.

Returns:
  term map retrieved from online vocabulary; in case of a read error this may be empty, but not null

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### main

public static void main(String[] args) throws IOException
Run to check hard-coded term lists against online versions. This can be done periodically, and the hard-coded lists updated accordingly.

Throws:
  `IOException`