Tripal
Functions
Semantic Web
Collaboration diagram for Semantic Web:

Functions

 chado_add_semweb_table ($chado_table)
 
 chado_associate_semweb_term ($chado_table, $chado_column, $term, $update=FALSE)
 
 chado_get_semweb_term ($chado_table, $chado_column, $options=[])
 
 chado_get_semweb_terms ($chado_table, $options=[])
 
 chado_format_semweb_term ($cvterm)
 
 chado_get_semweb_column ($chado_table, $term)
 

Detailed Description

Provides an application programming interface (API) for semantic web support.

Function Documentation

◆ chado_add_semweb_table()

chado_add_semweb_table (   $chado_table)

Adds a new Chado table to the semantic web support for Chado.

Newly added tables (i.e. custom tables) need to be integrated into the semantic web infrastructure. After a new table is created and added to the Chado schema, this function should be called to indicate that the table should be included in the semantic web. No associations are made for the columns. The associations should be added using the chado_associate_semweb_term() function.

If the table has already been added previously then this function does nothing. It will not overwrite existing assocations.

Temporary tables (e.g. Tripal tables that begin with 'tripal_' and end with '_temp', are not supported.

Parameters
$chado_tableThe name of the Chado table.

◆ chado_associate_semweb_term()

chado_associate_semweb_term (   $chado_table,
  $chado_column,
  $term,
  $update = FALSE 
)

Associates a controlled vocabulary term with a field in a Chado table.

For sharing of data via the semantic web we need to associate a term from a controlled vocabulary with every column of every table in Chado.

Temporary tables (e.g. Tripal tables that begin with 'tripal_' and end with '_temp', are not supported.

Parameters
$chado_tableThe name of the table in Chado. This argument is optional. If left empty or set to NULL then all fields in all Chado tables with that have the $column_name will be associated with the provided $term.
$chado_columnThe column name in the Chado table to which the term should be associated.
$termA cvterm object as returned by chado_generate_var().
$updateSet to TRUE if the association should be updated to use the new term if a term is already associated with the table and column. Default is FALSE. If not TRUE and a term is already associated, then no change occurs.
Returns
boolean Returns TRUE if the association was made successfully and FALSE otherwise.

◆ chado_format_semweb_term()

chado_format_semweb_term (   $cvterm)

Formats a controlled vocabulary term from Chado for use with Tripal.

Parameters
$cvtermA cvterm object.
Returns
The semantic web name for the term.

◆ chado_get_semweb_column()

chado_get_semweb_column (   $chado_table,
  $term 
)

Retreive the column name in a Chado table that matches a given term.

Parameters
$chado_tableThe name of the Chado table.
$termThe term. This can be a term name or a unique identifer of the form {db}:{accession} or of the form {db}__{term_name}.
Returns
The name of the Chado column that matches the given term or FALSE if the term is not mapped to the Chado table.

◆ chado_get_semweb_term()

chado_get_semweb_term (   $chado_table,
  $chado_column,
  $options = [] 
)

Retrieves the term that maps to the given Chado table and field.

Parameters
$chado_tableThe name of the Chado table.
$chado_columnThe name of the Chado field.
$optionsAn associative array of one or more of the following keys: -return_object: Set to TRUE to return the cvterm object rather than the string version of the term.
Returns
Returns a string-based representation of the term (e.g. SO:0000704). If the 'return_object' options is provided then a cvterm object is returned. returns NULL if no term is mapped to the table and column.

◆ chado_get_semweb_terms()

chado_get_semweb_terms (   $chado_table,
  $options = [] 
)

Retrieves the terms that maps to the given Chado table.

Parameters
$chado_tableThe name of the Chado table.
$optionsAn associative array of one or more of the following keys: -return_object: Set to TRUE to return the cvterm object rather than the string version of the term.
Returns
An array of terms with the table column name as the key and the term details as the avlue. If the 'return_object' options is provided then a cvterm object is used as the value. A NULL value is used if no term is mapped to a column.