Tripal provides an application programming interface (API) for working with controlled vocabulary terms. Tripal v4 is highly dependent on controlled vocabularies for identifying all content types and fields attached to those content types. Furthermore, Tripal4 terms are completely database agnositic with basic term details stored in Drupal. Look at the TripalVocab and TripalTerm classes for information on how to integrate these terms with any database backend.
◆ tripal_add_term()
tripal_add_term |
( |
|
$details | ) |
|
Adds a Tripal Term.
Use this function to add new terms programmaticly. If the term already exists no new term is added.
- Parameters
-
$details | An array with at least the following keys: -vocabulary : An associative array with the following keys
- name: The full name of the vocabulary (e.g. The Sequence Ontology).
- namespace: The namespace of the vocabulary (e.g. sequence).
- idspace: The ID space of the vocabulary (e.g. SO). If there is more then one IDSpace, use addIDSpace() to add additional ones.
- short_name: The short name of the vocabulary (e.g. SO). DEPRECATED: replaced by idspace.
- description: A description of the vocabulary.
- url: the URL containing a reference for this vocabulary.
- urlprefix: The URL with tokens referencing a specific term in the given idspace. -accession : The name unique ID of the term. -name : The name of the term. -definition : The term's description.
|
- Returns
- TRUE if the term was added, FALSE otherwise. If the term already exists it will be updated and the return value will be TRUE.
◆ tripal_add_vocabulary()
tripal_add_vocabulary |
( |
|
$details | ) |
|
Add a Tripal Vocabulary.
Use this function to add new vocabularies programmaticly. If the vocabulary already exists no new vocabulary is added.
- Parameters
-
$details | An array with at least the following keys:
- name: The full name of the vocabulary (e.g. The Sequence Ontology).
- namespace: The namespace of the vocabulary (e.g. sequence).
- idspace: The ID space of the vocabulary (e.g. SO). If there is more then one IDSpace, use addIDSpace() to add additional ones.
- short_name: The short name of the vocabulary (e.g. SO). DEPRECATED: replaced by idspace.
- description: A description of the vocabulary.
- url: the URL containing a reference for this vocabulary.
- urlprefix: The URL with tokens referencing a specific term in the given idspace.
|
- Returns
- TRUE if the vocabulary was added, FALSE otherwise. If the vocabulary already exists it will be updated and the return value will be TRUE.
->addVocabulary($details);
◆ tripal_get_term_children()
tripal_get_term_children |
( |
|
$vocabulary, |
|
|
|
$accession |
|
) |
| |
Retrieves the immediate children of the given term.
- Parameters
-
$vocabulary | The vocabulary of the vocabulary in which the term is found. |
$accession | The unique identifier (accession) for this term. |
- Returns
- Returns an array of terms where each term is compatible with the array returned by the tripal_get_term_details() function.
◆ tripal_get_term_details()
tripal_get_term_details |
( |
|
$vocabulary, |
|
|
|
$accession |
|
) |
| |
Retrieves full information about a vocabulary term.
- Parameters
-
$vocabulary | The short name of the vocabulary in which the term is found. |
$accession | The unique identifier (accession) for this term. |
- Returns
- An array with at least the following keys:
- vocabulary : An array containing the following keys:
- name: The full name of the vocabulary (e.g. The Sequence Ontology).
- namespace: The namespace of the vocabulary (e.g. sequence).
- idspace: The ID space of the vocabulary (e.g. SO). If there is more then one IDSpace, use addIDSpace() to add additional ones.
- short_name: The short name of the vocabulary (e.g. SO). DEPRECATED: replaced by idspace.
- description: A description of the vocabulary.
- url: the URL containing a reference for this vocabulary.
- urlprefix: The URL with tokens referencing a specific term in the given idspace.
- TripalVocab: the Tripal vocabulary object.
- accession : The name unique ID of the term.
- url : The URL for the term.
- name : The name of the term.
- definition : The term's description.
- TripalTerm: the Tripal term object. Returns NULL if the term cannot be found.
◆ tripal_get_vocabularies()
tripal_get_vocabularies |
( |
| ) |
|
Retrieves the list of vocabularies that are available on the site.
- Returns
- An array of vocabularies where each entry in the array is compatible with the array returned by the tripal_get_vocabulary_details() function.
◆ tripal_get_vocabulary_details()
tripal_get_vocabulary_details |
( |
|
$name | ) |
|
Retrieves full information about a vocabulary.
Vocabularies are stored in a database backend. Tripal has no requirements for how terms are stored. By default, the tripal_chado modules provides storage for vocabularies and terms. This function will call the hook_vocab_get_term() function for the database backend that is housing the vocabularies and allow it to return the details about the term.
- Parameters
-
$name | The name, namespace or idspace of the vocabulary. |
- Returns
- An array with at least the following keys:
- name: The full name of the vocabulary (e.g. The Sequence Ontology).
- namespace: The namespace of the vocabulary (e.g. sequence).
- idspace: The ID space of the vocabulary (e.g. SO). If there is more then one IDSpace, use addIDSpace() to add additional ones.
- description: A description of the vocabulary.
- url: the URL containing a reference for this vocabulary.
- urlprefix: The URL with tokens referencing a specific term in the given idspace.
- sw_url: The URL for mapping terms via the semantic web.
- num_terms: The number of terms loaded in the vocabulary.
- TripalVocab: The object describing this vocabulary.
◆ tripal_get_vocabulary_root_terms()
tripal_get_vocabulary_root_terms |
( |
|
$vocabulary | ) |
|
Retrieves the base terms of the given vocabulary.
- Parameters
-
$vocabulary | The vocabulary of the vocabulary in which the term is found. |
$accession | The unique identifier (accession) for this term. |
- Returns
- Returns an array of terms where each term is compatible with the array returned by the tripal_get_term_details() function.