public class Vocabulary extends Object
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.
Constructor and Description |
---|
Vocabulary(String uri,
VocabTerm[] terms,
String flavour)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
getFlavour()
Returns the vocabulary flavour string.
|
Map<String,VocabTerm> |
getTerms()
Returns a map of the terms contained in this vocabulary.
|
String |
getUri()
Returns the URI defining the namespace of this vocabulary.
|
static void |
main(String[] args)
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.
does very basic vocabulary parsing;
use
readVocabularyDesise instead |
public String getUri()
public String getFlavour()
public Map<String,VocabTerm> getTerms()
public static Vocabulary readVocabulary(URL vocabUrl) throws IOException
http://www.ivoa.net/rdf/<vocab-name>
).vocabUrl
- resource URLIOException
public static Vocabulary readVocabularyDesise(URL vocabUrl) throws IOException
application/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 form
http://www.ivoa.net/rdf/<vocab-name>
.vocabUrl
- vocabulary URL, typically equal to the namespace URIIOException
@Deprecated public static Vocabulary readVocabularyRdfXml(URL vocabUrl) throws IOException
readVocabularyDesise
insteadapplication/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?
vocabUrl
- vocabulary namespace and resource URLIOException
public static void main(String[] args) throws IOException
IOException
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.