Tripal
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary Class Reference
Inheritance diagram for Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary:
Inheritance graph
[legend]
Collaboration diagram for Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary:
Collaboration graph
[legend]

Public Member Functions

 __construct (array $configuration, $plugin_id, $plugin_definition, TripalLogger $logger, ChadoConnection $connection)
 
 isValid ()
 
 recordExists ()
 
 createRecord ()
 
 destroy ()
 
 getIdSpaceNames ()
 
 addIdSpace ($idSpace)
 
 removeIdSpace ($idSpace)
 
 getTerms ($name, $exact=True)
 
 getURL ()
 
 setURL ($url)
 
 getNameSpace ()
 
 setLabel ($label)
 
 getLabel ()
 
- Public Member Functions inherited from Drupal\tripal\TripalVocabTerms\TripalVocabularyBase
 __construct (array $configuration, $plugin_id, $plugin_definition)
 
- Public Member Functions inherited from Drupal\tripal\TripalVocabTerms\TripalCollectionPluginBase
 getName ()
 

Static Public Member Functions

static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 

Protected Member Functions

 loadVocab ()
 
 getIdSpaceCacheID ()
 
 setIdSpacesCache ($id_spaces)
 
 getIdSpacesCache ()
 

Protected Attributes

 $db_def = NULL
 
 $cv_def = NULL
 
 $messageLogger = NULL
 
 $connection
 
 $is_valid = False
 
- Protected Attributes inherited from Drupal\tripal\TripalVocabTerms\TripalCollectionPluginBase
 $messageLogger = NULL
 

Detailed Description

Chado implementation of the TripalVocabularyBase.

@TripalVocabulary( id = "chado_vocabulary", label = @Translation("Vocabulary in Chado"), )

Constructor & Destructor Documentation

◆ __construct()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::__construct ( array  $configuration,
  $plugin_id,
  $plugin_definition,
TripalLogger  $logger,
ChadoConnection  $connection 
)

{}

Member Function Documentation

◆ addIdSpace()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::addIdSpace (   $idSpace)

{Adds the id space with the given collection name to this vocabulary. The given collection name must be a valid id space collection.

Parameters
string$idSpaceThe id space collection name.
Returns
bool True on success or false otherwise.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalVocabularyInterface.

◆ create()

static Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::create ( ContainerInterface  $container,
array  $configuration,
  $plugin_id,
  $plugin_definition 
)
static

Implements ContainerFactoryPluginInterface->create().

Since we have implemented the ContainerFactoryPluginInterface this static function will be called behind the scenes when a Plugin Manager uses createInstance(). Specifically this method is used to determine the parameters to pass to the contructor.

Parameters
\Symfony\Component\DependencyInjection\ContainerInterface$container
array$configuration
string$plugin_id
mixed$plugin_definition
Returns
static

◆ createRecord()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::createRecord ( )

{Creates the records needed for this collection.This must only be called once on this new collection instance that has just been created by its collection plugin manager.}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalCollectionPluginInterface.

◆ destroy()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::destroy ( )

{Destroys this collection.This must only be called once when on this existing collection that is being removed from its collection plugin manager.}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalCollectionPluginInterface.

◆ getIdSpaceCacheID()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::getIdSpaceCacheID ( )
protected

Returns the IDSpace cache ID.

Returns
string

◆ getIdSpaceNames()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::getIdSpaceNames ( )

{Returns list of id space collection names that is contained in this vocabulary.

Returns
array An array of id space collection name strings.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalVocabularyInterface.

◆ getIdSpacesCache()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::getIdSpacesCache ( )
protected

Retrieves from the Drupal cache the ID spaces of this vocabulary.

The current way to map CV's to DB's is to use the cv2db materialized view but there is no guarantee that that mview is up-to-date and it would take too long to force an update every time we need to get the ID spaces for a vocabulary. This function retrieves the ID spaces for a vocabulary from a Drupal cache.

Returns
array An array of ID Space names.

◆ getLabel()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::getLabel ( )

{Returns the label of the vocabulary.This is the human readable proper name of the vocabulary.Note that the name of the collection serves as the namespace of the vocabulary.

Returns
string $label The name of the vocabulary.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalVocabularyInterface.

◆ getNameSpace()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::getNameSpace ( )

Returns the namespace of the vocabulary

This should be identical to the name of the collection, and therefore, there is no setter function.

Returns
string $namespace The namespace of the vocabulary.

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalVocabularyInterface.

◆ getTerms()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::getTerms (   $name,
  $exact = True 
)

{{Returns the terms in this vocabulary whose names match the given name. Matches can only be exact or a substring depending on the given flag. The default is to only return exact matches.

Parameters
string$nameThe name.
bool$exactTrue to only include exact matches else include all substring matches.
Returns
array Array of matching Drupal\tripal\TripalVocabTerms\TripalTerm instances.
}}

Reimplemented from Drupal\tripal\TripalVocabTerms\TripalVocabularyBase.

◆ getURL()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::getURL ( )

{Returns the URL of this vocabulary.

Returns
string The URL.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalVocabularyInterface.

◆ isValid()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::isValid ( )

{Tests if this collection is valid or not.

Returns
bool True if this collection is valid or false otherwise.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalCollectionPluginInterface.

◆ loadVocab()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::loadVocab ( )
protected

Loads a Vocabulary record from Chado.

This function queries the cv table of Chado to get the values for the vocabulary.

Returns
An associative array containing the columns of the `db1 table of Chado or NULL if the db could not be found.

◆ recordExists()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::recordExists ( )

{Indicates if the underlying data store has a record for this collection.This function will be called by the collection plugin manager to ensure that the record for this collection exists and if not allow it to create it by calling the create() method or prevent addition of duplicate entries.

Returns
bool True if a record exists in the data store, False if not.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalCollectionPluginInterface.

◆ removeIdSpace()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::removeIdSpace (   $idSpace)

{Removes the id space from this vocabulary with the given collection name.

Parameters
string$idSpaceThe id space collection name.
Returns
bool True on success or false otherwise.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalVocabularyInterface.

◆ setIdSpacesCache()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::setIdSpacesCache (   $id_spaces)
protected

Sets the ID spaces for this vocabulary in the Drupal cache.

The current way to map CV's to DB's is to use the cv2db materialized view but there is no guarantee that that mview is up-to-date and it would take too long to force an update every time we need to get the ID spaces for a vocabulary. This function caches it.

Parameters
$id_spacesAn array containing the names of the ID spaces.

◆ setLabel()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::setLabel (   $label)

{Sets the label for the vocabulary.This is the human readable proper name of the vocabulary.Note that the name of the collection serves as the namespace of the vocabulary.

Parameters
string$labelThe name of the vocabulary.
Returns
bool True on success or false otherwise.
bool True if the value was set or false otherwise.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalVocabularyInterface.

◆ setURL()

Drupal\tripal_chado\Plugin\TripalVocabulary\ChadoVocabulary::setURL (   $url)

{Sets the URL of this vocabulary to the given URL.

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

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalVocabularyInterface.


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