     isSubjOf: ->
     defines: ->
     isObjOf: ->
+
+    addMethod: (name, code, compiler) ->
+      @methods[name] = compiler(code).bind this
+      @methods[name].code = code
+      @methods[name].compiler = compiler
 
   class Relation extends Euclidic
     constructor: ({@subj, @rel, @obj, @params}) ->

    toString: ->
      "#{@subj.name} #{@name} #{@obj.name}"

  class Db
    constructor: (@namespace, @prefix = '$') ->
      @names = {}
      @o = {}
      @relationshis = [] # might not need this

      @create 'sys'
      @create 'root'
      @create name: 'relation', klass: Relation

    create: ({name, klass = Euclidic}) ->
      name or= arguments[0]

          @util.addName @namespace, parts, o

      return @o[o.id] = o

    util:
      initContexts: (o) ->
