# File lib/activerdf_rdflite/rdflite.rb, line 96
 96:         def delete(s, p, o, c=nil)
 97:                 # convert non-nil input to internal format
 98:                 quad = [s,p,o,c].collect {|r| r.nil? ? nil : internalise(r) }
 99: 
100:                 # construct where clause for deletion (for all non-nil input)
101:                 where_clauses = []
102:                 conditions = []               
103:                 quad.each_with_index do |r,i|
104:                         unless r.nil?
105:                                 conditions << r
106:                                 where_clauses << "#{SPOC[i]} = ?"
107:                         end
108:                 end
109: 
110:                 # construct delete string
111:                 ds = 'delete from triple'
112:                 ds << " where #{where_clauses.join(' and ')}" unless where_clauses.empty?
113: 
114:                 # execute delete string with possible deletion conditions (for each 
115:                 # non-empty where clause)
116:                 $activerdflog.debug("deleting #{[s,p,o,c].join(' ')}")
117:                 @db.execute(ds, *conditions)
118: 
119:                 # delete literal from ferret index
120:                 @ferret.search_each("subject:\"#{s}\", object:\"#{o}\"") do |idx, score|
121:                         @ferret.delete(idx)
122:                 end if keyword_search?
123: 
124:                 @db
125:         end