Topics

programming

php drupal scheme scheming macros design patterns da la

design

design css

random thoughts

scribbles

alter ego

other me 'em that link us my space me linked in

Collections

Programmable web
PHP design patterns

Similar things

  • Relations battle plan
  • Relations Battle Plan II and first results
  • Relations and their domain structures
  • Relations API - query generation and TODO
  • relations update
  • A pause for thought and some cut backs
  • Going mad talking about relations
  • Once again relations, or the need to focus on smaller parts of the big picture. A rant.
  • An initial phase runner for drupal install
  • drpkg and relations svn

guild
Home » blogs » vlado's blog

Relation modules

Submitted by vlado on Mon, 2005-10-31 09:35.code | drupal | programming | projects | relations

Specifications of a bundle of relations and structures modules. They naturally are tightly connected to SQL, so can be viewed as a kind of SQL query builder.

Goals

  • explicit relations module
    • provide a unified db structure for explicitly related things
    • provide a set of functions to get and set relations
    • provide nodeapi extension
  • tree relations module
    • provide a db structure for nested set indexes
    • provide setter and getters for those
    • provide nodeapi extension
  • related by terms module
    • implement the relations api
    • provide a db interface
  • general relations module
    • provide a relations api
    • provide a set of relation operations - addition, difference
    • provide a relations node

general relations

Let's not forget that a relation defines two sets of related elements.

function relation_exec($relation)
Executes a relation, returns the results.

function hook_relation($op='get',$type='any',$left=NULL,$right=NULL)
Provides a mechaninsm to implement different relation models. $op can be get, set, get sql,set sql. Question remains if composition of relation can be performed via this interface. The get and set operations are executed immediately and their results returned.

function relation_compose($first,$second)
Nessesary to implement composite relations. A composite relation is the union of $first and $second relations.

function relation_intersect($first,second)
Returns the intersection of $first and $second relations.

function relation_exclude($first,second)
Returns everything in $first but not $second relations.

The relation node is used to provide a description of a relation type as well as store the sql statements and code in case of complex composite or higher order relations.

tree structures

Main reason for its exhistance is to provide specialised indexing for tree structures of different relations. This is an extension to a relation type.

Provides the following functions
--------------------------------------
function tree_get_children
function tree_get_parents
function tree_get_siblings
function tree_get_previous
function tree_get_next
function tree_insert

Related by terms module

A specialised module to implement a faster version for the composite of node-term-node relation.
function node_term_relation

Graph relation

Implements adjacency graphs for relations. The most common relation module.
function graph_relation

vlado's blog | add new comment
Home » blogs » vlado's blog

dikini.net

spreading confusion by accident since 1970