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

Public Member Functions

 __construct (array $configuration, $plugin_id, $plugin_definition, TripalLogger $logger, ChadoConnection $connection)
 
 isValid ()
 
 recordExists ()
 
 createRecord ()
 
 destroy ()
 
 getParent ($child)
 
 getChildren ($parent=NULL)
 
 getTerm ($accession, $options=[])
 
 getTerms ($name, $options=[])
 
 getDefaultVocabulary ()
 
 saveTerm ($term, $options=[])
 
 removeTerm ($accession)
 
 getURLPrefix ()
 
 setURLPrefix ($prefix)
 
 getDescription ()
 
 setDescription ($description)
 
 setDefaultVocabulary ($name)
 
- Public Member Functions inherited from Drupal\tripal\TripalVocabTerms\TripalIdSpaceBase
 __construct (array $configuration, $plugin_id, $plugin_definition)
 
- Public Member Functions inherited from Drupal\tripal\TripalVocabTerms\TripalCollectionPluginBase
 getName ()
 
- Public Member Functions inherited from Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface
 saveTerm (TripalTerm $term, array $options=[])
 

Static Public Member Functions

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

Protected Member Functions

 loadIdSpace ()
 
 getChadoCV (TripalTerm $term)
 
 getChadoDB (TripalTerm $term)
 
 getChadoDBXref (TripalTerm $term)
 
 getChadoDBXrefbyTermID (string $term_id)
 
 insertChadoDBxrefbyTermID (string $term_id)
 
 getChadoCVTerm (TripalTerm $term)
 
 insertTerm (TripalTerm $term, $options)
 
 saveTermAttributes (TripalTerm $term, object $cvterm, array $options)
 
 updateTerm (TripalTerm $term, object &$cvterm, array $options)
 
 getDefaultVocabCache ()
 
 setDefaultVocabCache ($vocabulary)
 

Protected Attributes

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

Detailed Description

Chado Implementation of TripalIdSpaceBase

@TripalIdSpace( id = "chado_id_space", label = @Translation("Vocabulary IDSpace in Chado"), )

Constructor & Destructor Documentation

◆ __construct()

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

{}

Member Function Documentation

◆ create()

static Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::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\TripalIdSpace\ChadoIdSpace::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\TripalIdSpace\ChadoIdSpace::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.

◆ getChadoCV()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::getChadoCV ( TripalTerm  $term)
protected

Retrieve a record from the Chado cv table.

Parameters
TripalTerm$termThe TripalTerm object to save.
Returns
object The cv record in object form.

◆ getChadoCVTerm()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::getChadoCVTerm ( TripalTerm  $term)
protected

Retrieve a record from the Chado cvterm table.

This function uses the db.name (IdSpace), cv.name (vocabulary) and dbxref.accession values to uniquely identify a term in Chado.

Parameters
TripalTerm$termThe TripalTerm object to save.
Returns
object The cvterm record in object form.

◆ getChadoDB()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::getChadoDB ( TripalTerm  $term)
protected

Retrieve a record from the Chado db table.

Parameters
TripalTerm$termThe TripalTerm object to save.
Returns
object The db record in object form.

◆ getChadoDBXref()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::getChadoDBXref ( TripalTerm  $term)
protected

Retrieve a record from the Chado dbxref table.

Parameters
TripalTerm$termThe TripalTerm object to save.
Returns
object The dbxref record in object form.

◆ getChadoDBXrefbyTermID()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::getChadoDBXrefbyTermID ( string  $term_id)
protected

Retreives a record from the Cahdo dbxref table using the term ID.

Parameters
string$term_idThe term ID (e.g. GO:0044708).

◆ getChildren()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::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.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ getDefaultVocabCache()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::getDefaultVocabCache ( )
protected

Retrieves from the Drupal cache the default vocabulary for this space.

Returns
string The deffault vocabulary name.

◆ getDefaultVocabulary()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::getDefaultVocabulary ( )

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

Returns
string The vocabulary name.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ getDescription()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::getDescription ( )

{Returns the description of this id space.

Returns
string The description.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ getParent()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::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.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ getTerm()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::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.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ getTerms()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::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.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ getURLPrefix()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::getURLPrefix ( )

{Returns the URL prefix of this id space.

Returns
string The URL prefix.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ insertChadoDBxrefbyTermID()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::insertChadoDBxrefbyTermID ( string  $term_id)
protected

Adds a record from the Cahdo dbxref table using the term ID.

The database record must already exist.

Parameters
string$term_idThe term ID (e.g. GO:0044708).
Returns
object|NULL The dbxref Object.

◆ insertTerm()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::insertTerm ( TripalTerm  $term,
  $options 
)
protected

Inserts a new term into Chado.

The term should be checked that it does not exist prior to calling this function.

Parameters
Drupal\tripal\TripalVocabTerms\TripalTerm$termThe term object to update
array$optionsThe options passed to the saveTerm() function.
Returns
boolean True if the insert was successful, false otherwise.

◆ isValid()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::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.

◆ loadIdSpace()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::loadIdSpace ( )
protected

Loads an ID Space record from Chado.

This function queries the db table of Chado to get the values for the ID space.

Returns
array 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\TripalIdSpace\ChadoIdSpace::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.

◆ removeTerm()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::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.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ saveTerm()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::saveTerm (   $term,
  $options = [] 
)

{}

◆ saveTermAttributes()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::saveTermAttributes ( TripalTerm  $term,
object  $cvterm,
array  $options 
)
protected
Parameters
TripalTerm$term
object$cvterm
array$options
Returns
bool

◆ setDefaultVocabCache()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::setDefaultVocabCache (   $vocabulary)
protected

Sets in the Drupal cache the default vocabulary.

Parameters
string$vocabularyThe default vocabulary name.

◆ setDefaultVocabulary()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::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.
}}

Reimplemented from Drupal\tripal\TripalVocabTerms\TripalIdSpaceBase.

◆ setDescription()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::setDescription (   $description)

{Sets the description of this id space.

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

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ setURLPrefix()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::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.
}

Implements Drupal\tripal\TripalVocabTerms\Interfaces\TripalIdSpaceInterface.

◆ updateTerm()

Drupal\tripal_chado\Plugin\TripalIdSpace\ChadoIdSpace::updateTerm ( TripalTerm  $term,
object &  $cvterm,
array  $options 
)
protected

Updates an existing term in Chado.

The term should be checked that it already exists prior to execution of this function.

Parameters
Drupal\tripal\TripalVocabTerms\TripalTerm$termThe term object to update
object$cvtermThe record object for the term to update from the Chado cvterm table.
array$optionsThe options passed to the saveTerm() function.
Returns
boolean True if the update was successful, false otherwise.

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