Class Vocabulary
This class is written with reference to Version 2.0 of the document Vocabularies in the VO, and particularly the Desise serialization described there. Note that document is in Working Draft status at time of writing.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the vocabulary flavour string.getTerms()
Returns a map of the terms contained in this vocabulary.getUri()
Returns the URI defining the namespace of this vocabulary.static void
Test.static Vocabulary
readVocabulary
(URL vocabUrl) Returns a vocabulary read from a given URL.static Vocabulary
readVocabularyDesise
(URL vocabUrl) Reads a vocabulary using desise encoding.static Vocabulary
readVocabularyRdfXml
(URL vocabUrl) Deprecated.
-
Constructor Details
-
Vocabulary
Constructor.- Parameters:
uri
- namespace URIterms
- entries in the vocabularyflavour
- vocabulary flavour string
-
-
Method Details
-
getUri
Returns the URI defining the namespace of this vocabulary.- Returns:
- vocabulary namespace URI
-
getFlavour
Returns the vocabulary flavour string.- Returns:
- flavour
-
getTerms
Returns a map of the terms contained in this vocabulary. The map keys are unqualified term names (no # character).- Returns:
- term->properties map
-
readVocabulary
Returns a vocabulary read from a given URL. The URL will usually be equal to the namespace in which the terms are required (http://www.ivoa.net/rdf/<vocab-name>
).- Parameters:
vocabUrl
- resource URL- Returns:
- vocabulary object
- Throws:
IOException
-
readVocabularyDesise
Reads a vocabulary using desise encoding. The vocabulary must be available on (Accept-header) request from the URL in question inapplication/x-desise+json
format. In accordance with the Vocabularies in VO 2.0 standard, all IVOA vocabularies can be so retrieved using URLs equivalent to their namespace URIs, of the formhttp://www.ivoa.net/rdf/<vocab-name>
.- Parameters:
vocabUrl
- vocabulary URL, typically equal to the namespace URI- Returns:
- fully populated vocabulary
- Throws:
IOException
-
readVocabularyRdfXml
Deprecated.does very basic vocabulary parsing; usereadVocabularyDesise
insteadReads a vocabulary using RDF XML encoding. In accordance with the IVOA Vocabularies standard, the vocabulary must be available from the URL in question inapplication/rdf+xml
format.Note: The RDF parsing performed by this method is very sketchy and pulls out only a minimum of information from the retrieved XML (the term values themselves). This implementation is present mainly for historical reasons. For practical purposes, the much more thorough
readVocabularyDesise(java.net.URL)
method should be used instead. It would be possible to ehance this implementation to get more or all the available information from the XML, but since the desise-format variant ought to be available for all IVOA vocabularies, why go to the effort?- Parameters:
vocabUrl
- vocabulary namespace and resource URL- Returns:
- vocabulary object
- Throws:
IOException
-
main
Test.- Throws:
IOException
-
readVocabularyDesise
instead