# File lib/activerdf_rdflite/rdflite.rb, line 166
166:         def add_ntriples(ntriples, context)
167: 
168:                 # add each triple to db
169:                 @db.transaction
170:                 insert = @db.prepare('insert into triple values (?,?,?,?);')
171: 
172:     ntriples = NTriplesParser.parse(ntriples)
173:     ntriples.each do |s,p,o|
174:       # convert triples into internal db format
175:       subject, predicate, object = [s,p,o].collect {|r| internalise(r) }
176: 
177:                         # insert triple into database
178:                         insert.execute(subject, predicate, object, context)
179: 
180:                         # if keyword-search available, insert the object into keyword search
181:                         @ferret << {:subject => subject, :object => object} if keyword_search?
182:                 end
183: 
184:                 @db.commit
185:                 @db
186:         end