Tripal
Public Member Functions | List of all members
Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface Interface Reference
Inheritance diagram for Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface:
Inheritance graph
[legend]
Collaboration diagram for Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface:
Collaboration graph
[legend]

Public Member Functions

 getParent ($child)
 
 getChildren ($parent=NULL)
 
 getTerm ($accession, $options=[])
 
 getTerms ($name, $options=[])
 
 setDefaultVocabulary ($name)
 
 getDefaultVocabulary ()
 
 saveTerm (TripalTerm $term, array $options=[])
 
 removeTerm ($accession)
 
 getURLPrefix ()
 
 setURLPrefix ($prefix)
 
 getDescription ()
 
 setDescription ($description)
 
- Public Member Functions inherited from Drupal\tripal\TripalVocabTerms\Interfaces\TripalCollectionPluginInterface
 createRecord ()
 
 destroy ()
 
 isValid ()
 
 recordExists ()
 

Detailed Description

Defines an interface for tripal id space plugins.

Member Function Documentation

◆ getChildren()

Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface::getChildren (   $parent = NULL)

Gets the children terms of the given term. The given term must be a valid term for this id space or NULL. If the given term is NULL then the root children of this id space is returned.

Parameters
Drupal\tripal\TripalVocabTerms\TripalTerm | NULL$parentThe given term or NULL.
Returns
array An array of children terms where each entry is a tuples and the first element of the tuple is a Drupal\tripal\TripalVocabTerms\TripalTerm child object and the second is the a Drupal\tripal\TripalVocabTerms\TripalTerm relationship type term.

Implemented in Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace.

◆ getDefaultVocabulary()

Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface::getDefaultVocabulary ( )

Returns this id space's default vocabulary name or NULL if no default has been set.

Returns
string The vocabulary name.

Implemented in Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace, and Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace.

◆ getDescription()

Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface::getDescription ( )

Returns the description of this id space.

Returns
string The description.

Implemented in Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace, and Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace.

◆ getParent()

Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface::getParent (   $child)

Gets the parent of the given term. The given term must be a valid term for this id space. If the given term is a root of this id space then NULL is returned.

Parameters
Drupal\tripal\TripalVocabTerms\TripalTerm$childThe given term.
Returns
Drupal\tripal\TripalVocabTerms\TripalTerm|NULL The parent term or NULL.

Implemented in Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace, and Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace.

◆ getTerm()

Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface::getTerm (   $accession,
  $options = [] 
)

Returns the term in this id space with the given accession.

If no such term exists then NULL is returned.

The given options array has the following recognized keys:

includes(array): A list of attribute names to include with the term object. The attribute names can be: 'parents', 'altIds', 'synonyms' 'properties'. If the key is missing then all attributes will be loaded. If present but empty then only basic attributes will be loaded (e.g. name, definition, etc.). The purpose of this attribute is to save time loading when not all attributes are needed.

Parameters
string$accessionThe accession.
array | NULL$optionsThe options array.
Returns
Drupal\tripal\TripalVocabTerms\TripalTerm|NULL The term or NULL.

Implemented in Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace.

◆ getTerms()

Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface::getTerms (   $name,
  $options = [] 
)

Returns terms whose names match the given arguments.

Term can be matched on their name or synonyms. If the provided $name argument matches both the name and a synonym of the same term then both matches will be returned.

The given options array has the following recognized keys:

exact(boolean): True to only include exact matches else false to include all substring matches. The default is false.

Parameters
string$nameThe name.
array$optionsThe options array.
Returns
array Associative array of matching terms. The first-level key is the full string that matched the provided name. The second-level key is the term ID (e.g. GO:0044708) and the value is an the
Drupal\tripal\TripalVocabTerms\TripalTerm term. These terms will only have these attributes loaded: name, definition, accession, idSpace and vocabulary.

Implemented in Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace.

◆ getURLPrefix()

Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface::getURLPrefix ( )

Returns the URL prefix of this id space.

Returns
string The URL prefix.

Implemented in Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace, and Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace.

◆ removeTerm()

Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface::removeTerm (   $accession)

Removes the term with the given accession from this id space. All children terms are also removed. !!!WARNING!!! If the removed term in this id space is referenced by entities this could break data integrity. This method must be used with extreme caution!

Parameters
string$accessionThe accession.
Returns
bool True if the term was removed or false otherwise.

Implemented in Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace, and Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace.

◆ saveTerm()

Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface::saveTerm ( TripalTerm  $term,
array  $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.

Parameters
TripalTerm$termThe TripalTerm object to save.
array$optionsAn associative array of options.
Returns
bool True on success or false otherwise.

◆ setDefaultVocabulary()

Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface::setDefaultVocabulary (   $name)

Sets the default vocabulary of this id space to the given vocabulary name.

Removes this id space from its previous default vocabulary if one is set and then adds this id space to its new default vocabulary if the given name is not NULL. It is still the responsibility of an implementation to actually save changes to its default vocabulary.

Parameters
stringname The vocabulary name.
Returns
bool True on success or false otherwise.

Implemented in Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace, Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace, and Drupal\tripal\TripalVocabTerms\TripalIdSpaceBase.

◆ setDescription()

Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface::setDescription (   $description)

Sets the description of this id space.

Parameters
string$descriptionThe description.
Returns
bool True if the value was set or false otherwise.

Implemented in Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace, and Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace.

◆ setURLPrefix()

Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface::setURLPrefix (   $prefix)

Sets the URL prefix of this id space to the given URL prefix.

Parameters
string$prefixThe URL prefix.
Returns
bool True if the value was set or false otherwise.

Implemented in Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace, and Drupal\tripal\Plugin\TripalIdSpace\TripalDefaultIdSpace.


The documentation for this interface was generated from the following file: