Add one relationship to the extent

        subj - subject or origin of the relationship, an IRI coded as a unicode object
        pred - predicate or type of the relationship, an IRI coded as a unicode object
        obj - object of the relationship, a boolean, floating point or unicode object
        attrs - optional attribute mapping of relationship metadata, i.e. {attrname1: attrval1, attrname2: attrval2}
        rid - optional ID for the relationship in IRI form. If not specified one will be generated.

        returns an ID (IRI) for the resulting relationship

def add(self, subj, pred, obj, attrs=None, rid=None):
        '''
        Add one relationship to the extent

        subj - subject or origin of the relationship, an IRI coded as a unicode object
        pred - predicate or type of the relationship, an IRI coded as a unicode object
        obj - object of the relationship, a boolean, floating point or unicode object
        attrs - optional attribute mapping of relationship metadata, i.e. {attrname1: attrval1, attrname2: attrval2}
        rid - optional ID for the relationship in IRI form. If not specified one will be generated.

        returns an ID (IRI) for the resulting relationship
        '''
        cur = self._conn.cursor()
        #relationship.
        if rid:
            querystr = u"INSERT INTO relationship (subj, pred, obj, rid) VALUES (?, ?, ?, ?);"
            cur.execute(querystr, (subj, pred, obj, rid))
        else:
            querystr = u"INSERT INTO relationship (subj, pred, obj) VALUES (?, ?, ?);"
            cur.execute(querystr, (subj, pred, obj))
        rawid = cur.lastrowid
        for a_name, a_val in attrs.iteritems():
            querystr = u"INSERT INTO attribute (rawid, name, value) VALUES (?, ?, ?);"
            cur.execute(querystr, (rawid, a_name, a_val))
        self._conn.commit()
        cur.close()
        return