@Unstable @Component @Named(value="vocabularies") @Singleton public class VocabularyScriptService extends Object implements org.xwiki.script.service.ScriptService
Constructor and Description |
---|
VocabularyScriptService() |
Modifier and Type | Method and Description |
---|---|
Vocabulary |
get(String vocabularyId)
Retrieve a vocabulary given its identifier.
|
List<String> |
getAvailableVocabularies()
Retrieves a list of vocabulary ids that are available for use with
getVocabulary(String) . |
Vocabulary |
getVocabulary(String vocabularyId)
Retrieve a vocabulary given its identifier.
|
VocabularyTerm |
resolveTerm(String termId)
Retrieve a term from its owner vocabulary.
|
List<VocabularyTerm> |
search(String input,
String category,
int maxResults)
Suggest the terms that best match the user's input, in all vocabularies
supporting the target category of terms . |
public VocabularyTerm resolveTerm(String termId)
termId
- the term identifier, in the format <vocabulary prefix>:<term id>
, for example
HP:0002066
null
if the term doesn't exist in the vocabulary, or no matching
vocabulary is availablepublic Vocabulary getVocabulary(String vocabularyId)
vocabularyId
- the vocabulary identifier, which is also used as a prefix in every term identifier from that
vocabulary, or a known alias
for it, for example MIM
,
hpo
, HP
or HPO
null
if it doesn't exist or isn't available in the platformpublic Vocabulary get(String vocabularyId)
getVocabulary(String)
which allows
scripts to use the shorter $services.vocabularies.hpo
notation for accessing a vocabulary.vocabularyId
- the vocabulary identifier, which is also used as a prefix in every term identifier from that
vocabulary, or a known alias
for it, for example MIM
,
HP
or HPO
null
if it doesn't exist or isn't available in the platformpublic List<String> getAvailableVocabularies()
getVocabulary(String)
.vocabulary identifiers
, one for each vocabularypublic List<VocabularyTerm> search(String input, String category, int maxResults)
supporting the target category of terms
.input
- the text to search forcategory
- the category of terms to search inmaxResults
- the maximum number of terms to be returnedCopyright © 2011–2018 University of Toronto, Computational Biology Lab. All rights reserved.