files

Relations, SQL, views, algebra or how to cook that broth

I’ve been experimenting, again with these. Apart from some bugs, the things are moving. I’ll try to summarise my findings and thoughts on this beast called relations.

throw everything into the water

Let’s start with a little bit of maths. It gives me that comfort feeling of being serious if I put down some formulas. I might be shooting myself in the head, which is not that comforting.

So, in our case, a relation is a n-tuple - R(X(1),..,X(n)), where Xi are some sets, possibly ordered, or partially ordered sets. The simplest useful relation would be the R(x) - a single value. The equivalent of an SQL databse table is R(Y(1),...,Y(n)), where Y(i) is a column in that table. The equivalent of a SELECT … WHERE query in this little math markup journey is F(R(Y(1),…,Y(n))), where F() is a filter function implementing the conditions in the where clause. Similarly a row in the db is R(y1,…,yn), where yi is the value for Y(i) in that row.

read more


Todo list

A basic todolist fior the file system

means done

  • Change extension based file checking to mime based

Relations battle plan

The battle plan for implementing relations in drupal in no particular order.

  • framework
    • relations hook
    • composition
    • intersection
    • exclusion
    • relation node type
    • integration with listings api of cck fame
  • data model
    • adjacency lists
    • trees
    • term
    • user
  • user interface
    • add relation between two things
    • add to tree
    • query builder
      • composition
      • exclusion
      • intersection

read more


Relation modules

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

read more


Database structure

This is the layout of the files table. We need some extra fields if we want to allow remote files. Also, we need to track if files can be put inline, and if they should show up.