     public func load<S: Sequence>(version: Version, quads: S) throws where S.Iterator.Element == Quad {
         try db.transaction {
             for q in quads {
-                let sid = try assignID(for: q.subject)
-                let pid = try assignID(for: q.predicate)
-                let oid = try assignID(for: q.object)
-                let gid = try assignID(for: q.graph)
+                let sid = try getOrSetID(for: q.subject)
+                let pid = try getOrSetID(for: q.predicate)
+                let oid = try getOrSetID(for: q.object)
+                let gid = try getOrSetID(for: q.graph)
                 try db.run(quadsTable.insert(or: .ignore, subjColumn <- sid, predColumn <- pid, objColumn <- oid, graphColumn <- gid))
             }
             try db.run(sysTable.update(versionColumn <- Int64(version)))

    var db: Connection
    var t2icache: LRUCache<Term, TermID>
    var i2tcache: LRUCache<TermID, Term>

    public init(filename: String, initialize: Bool = false) throws {
        db = try Connection(filename)

            ))
            
            for iri in iris {
                let _ = try getOrSetID(for: Term(iri: iri))
            }
        }
    }
