Tripal
|
Public Member Functions | |
__construct (array $details=NULL) | |
isValid () | |
setIdSpace (string $idSpace) | |
setVocabulary (string $vocabulary) | |
setDefinition (string $definition) | |
isEqual (TripalTerm $other) | |
getName () | |
setName ($name) | |
getDefinition () | |
getIdSpace () | |
getIdSpaceObject () | |
getVocabularyObject () | |
setAccession ($accession) | |
getAccession () | |
getVocabulary () | |
getURL () | |
save ($options) | |
getTermId () | |
addParent (TripalTerm $parent, TripalTerm $relationship) | |
getParents () | |
removeParent (string $idSpace, string $accession) | |
addAltId (string $idSpace, string $accession) | |
getAltIds () | |
removeAltId (string $idSpace, string $accession) | |
addSynonym (string $synonym, TripalTerm $type=NULL) | |
removeSynonym (string $synonym) | |
getSynonyms () | |
setIsObsolete (bool $is_obsolete) | |
isObsolete () | |
setIsRelationshipType (bool $is_relationship_type) | |
isRelationshipType () | |
addProperty (TripalTerm $term, string $value, int $rank=NULL) | |
getProperties () | |
removeProperty (string $idSpace, string $accession, int $rank) | |
getLoadedAttributes () | |
setInternalId ($internalId) | |
getInternalId () | |
Static Public Member Functions | |
static | suggestTerms (string $partial, int $max=10) |
Defines a vocabulary term object.
Drupal\tripal\TripalVocabTerms\TripalTerm::__construct | ( | array | $details = NULL | ) |
Constructs a new term object.
Either use the set functions of this object to provide the necessary values or provide them using the $details argument.
Use the isValid() function to make sure the term is valid before saving. A term must have the following values set to be valid: name, idSpace, vocabulary, and accession.
The $details argument accepts the following keys and values
array | NULL | $details | The name. |
Drupal\tripal\TripalVocabTerms\TripalTerm::addAltId | ( | string | $idSpace, |
string | $accession | ||
) |
Adds an alternative term ID for this term.
string | $idSpace | The ID space name of the parent term. |
string | $accession | The accession for the parent term. |
Drupal\tripal\TripalVocabTerms\TripalTerm::addParent | ( | TripalTerm | $parent, |
TripalTerm | $relationship | ||
) |
Adds a parent term
A term may have zero or more parents. A term without parents will be considered a root term. The relationship between the child term and the parent must be specified by another term indicating the relationship (e.g. is_a
, derives_from
, etc).
Drupal\tripal\TripalVocabTerms\TripalTerm | $parent | The parent term or NULL. |
Drupal\tripal\TripalVocabTerms\TripalTerm | $relationship | The relationship term or NULL. |
Drupal\tripal\TripalVocabTerms\TripalTerm::addProperty | ( | TripalTerm | $term, |
string | $value, | ||
int | $rank = NULL |
||
) |
Adds a property to this term.
TripalTerm | $term | A term indicating the propery type. |
string | $value | The value of the property. |
int | NULL | $rank | The rank (or order) of the value. If no rank is specified and if a property of the same term is already present then the rank will be incremented for the next value added. |
Drupal\tripal\TripalVocabTerms\TripalTerm::addSynonym | ( | string | $synonym, |
TripalTerm | $type = NULL |
||
) |
Adds a synonym for this term.
Some terms may have synonymous names. The synonym type is usually one of the of the following terms: 'exact', 'broad', 'narrow', or 'related'.
It is highly encouraged to always provide a type for the synonym.
string | $synonym | The synonym. |
Drupal\tripal\TripalVocabTerms\TripalTerm | $type | An optional Tripal term indicating the type of synonym. |
Drupal\tripal\TripalVocabTerms\TripalTerm::getAccession | ( | ) |
Returns this term's accession.
Drupal\tripal\TripalVocabTerms\TripalTerm::getAltIds | ( | ) |
Returns the list of alternate IDs for this term.
Drupal\tripal\TripalVocabTerms\TripalTerm::getDefinition | ( | ) |
Returns this term's definition.
Drupal\tripal\TripalVocabTerms\TripalTerm::getIdSpace | ( | ) |
Returns this term's id space collection name.
Drupal\tripal\TripalVocabTerms\TripalTerm::getIdSpaceObject | ( | ) |
Returns an instance of this term's id space.
Drupal\tripal\TripalVocabTerms\TripalTerm::getInternalId | ( | ) |
Gets the internal ID of this term. The default is NULL.
Drupal\tripal\TripalVocabTerms\TripalTerm::getLoadedAttributes | ( | ) |
Indicates which attributes are loaded.
A term may have any number of attributes that may or may not be loaded. The array returned by this function will indicatew which attributes are loaded and which are not. The array keys are the attribute names and the value is a boolean indicating if the attribute has been loaded. If all attributes are true then all all ahve been loaded and the term is complete. If some attributes are False then the term is not complete.
Drupal\tripal\TripalVocabTerms\TripalTerm::getName | ( | ) |
Returns this term's name.
Drupal\tripal\TripalVocabTerms\TripalTerm::getParents | ( | ) |
Returns the parents for this term.
Drupal\tripal\TripalVocabTerms\TripalTerm::getProperties | ( | ) |
Retrieves the list of properties for this term.
Drupal\tripal\TripalVocabTerms\TripalTerm::getSynonyms | ( | ) |
Returns the list of synonyms for this term.
Drupal\tripal\TripalVocabTerms\TripalTerm::getTermId | ( | ) |
Retrieves the ID for this term.
The term ID is the combination of the ID space and the accession (e.g. GO:0008150).
Drupal\tripal\TripalVocabTerms\TripalTerm::getURL | ( | ) |
Returns this term's URL.
Drupal\tripal\TripalVocabTerms\TripalTerm::getVocabulary | ( | ) |
Returns this term's default vocabulary collection name.
Drupal\tripal\TripalVocabTerms\TripalTerm::getVocabularyObject | ( | ) |
Returns an instance of this term's vocabulary.
Drupal\tripal\TripalVocabTerms\TripalTerm::isEqual | ( | TripalTerm | $other | ) |
Tests if the given term is equal to this term.
Drupal |
Drupal\tripal\TripalVocabTerms\TripalTerm::isObsolete | ( | ) |
Indicates if this term is obsolete or not.
Drupal\tripal\TripalVocabTerms\TripalTerm::isRelationshipType | ( | ) |
Indicates if the term is a relationship type term.
Drupal\tripal\TripalVocabTerms\TripalTerm::isValid | ( | ) |
Indicates if this term is valid and can be saved.
Drupal\tripal\TripalVocabTerms\TripalTerm::removeAltId | ( | string | $idSpace, |
string | $accession | ||
) |
Removes an alternate ID from this term.
string | $idSpace | The ID space name of the parent term. |
string | $accession | The accession for the parent term. |
Drupal\tripal\TripalVocabTerms\TripalTerm::removeParent | ( | string | $idSpace, |
string | $accession | ||
) |
Removes a parent from the term.
string | $idSpace | The ID space name of the parent term. |
string | $accession | The accession for the parent term. |
Drupal\tripal\TripalVocabTerms\TripalTerm::removeProperty | ( | string | $idSpace, |
string | $accession, | ||
int | $rank | ||
) |
Removes a property from the list of properties.
string | $idSpace | The ID space name of the property term. |
string | $accession | The accession for the property term. |
int | $rank | The rank of the value to remove. |
Drupal\tripal\TripalVocabTerms\TripalTerm::removeSynonym | ( | string | $synonym | ) |
Removes a synonym from this term.
string | $synonym | The synonym. |
Drupal\tripal\TripalVocabTerms\TripalTerm::save | ( | $options | ) |
Saves a term to its ID space data store.
If a term is new in the ID space and has no parents then it will be considered a "root" term for the vocabulary. If the term has parents, use the addParents()
function to add them before calling this function. If the term is not new and already exists you only need to provide parents if you need to change the parentage. If the updateParent
option is True then all parents of an existing term will be removed and will be updated to the parents provided. If updateParent
is False and no parents are provided then no change is made to the parent relationships.
The options array accepts the following recognized keys:
failIfExists(boolean): True to force this method to fail if this term already exists else false to update this term if it already exists. The default is false.
updateParent(boolean): True to update this term's parent to the one given or false to not update this existing term's parent. If this term is new this has no effect. The default is false.
array | $options | The options array. |
Drupal\tripal\TripalVocabTerms\TripalTerm::setAccession | ( | $accession | ) |
Sets this term's accession.
string | The accession. |
Drupal\tripal\TripalVocabTerms\TripalTerm::setDefinition | ( | string | $definition | ) |
Sets the term's description.
string | $description |
Drupal\tripal\TripalVocabTerms\TripalTerm::setIdSpace | ( | string | $idSpace | ) |
Sets the ID space for the term.
string | setIdSpace The name of the ID space. |
Drupal\tripal\TripalVocabTerms\TripalTerm::setInternalId | ( | $internalId | ) |
Sets the internal ID of this term to the given internal ID.
mixed | $internalId | The internal ID. |
Drupal\tripal\TripalVocabTerms\TripalTerm::setIsObsolete | ( | bool | $is_obsolete | ) |
Sets if the term is obsolete or not.
bool | $is_obsolete | True if the term is obsolete, False otherwise. |
Drupal\tripal\TripalVocabTerms\TripalTerm::setIsRelationshipType | ( | bool | $is_relationship_type | ) |
Sets if the term is a relationship type term.
bool | $is_obsolete | True if the term is a relationship type, False otherwise. |
Drupal\tripal\TripalVocabTerms\TripalTerm::setName | ( | $name | ) |
Sets this term's name to the given name.
string | $name | The name. |
Drupal\tripal\TripalVocabTerms\TripalTerm::setVocabulary | ( | string | $vocabulary | ) |
Sets the vocabulary for the term.
string | $vocabulary | The name of the vocabulary. |
|
static |
Returns a list of valid terms based off matches from the given partial term name. A given max number of terms are returned.
string | $partial | The partial term name. |
int | $max | The given max number returned. |