equal
deleted
inserted
replaced
207 cursor = cnx.system_sql('SELECT e.type, e.eid FROM entities as e, cw_CWEType as s ' |
207 cursor = cnx.system_sql('SELECT e.type, e.eid FROM entities as e, cw_CWEType as s ' |
208 'WHERE s.cw_name=e.type AND NOT EXISTS(SELECT 1 FROM is_relation as cs ' |
208 'WHERE s.cw_name=e.type AND NOT EXISTS(SELECT 1 FROM is_relation as cs ' |
209 ' WHERE cs.eid_from=e.eid AND cs.eid_to=s.cw_eid) ' |
209 ' WHERE cs.eid_from=e.eid AND cs.eid_to=s.cw_eid) ' |
210 'ORDER BY e.eid') |
210 'ORDER BY e.eid') |
211 for row in cursor.fetchall(): |
211 for row in cursor.fetchall(): |
212 sys.stderr.write(msg % row) |
212 sys.stderr.write(msg % tuple(row)) |
213 if fix: |
213 if fix: |
214 cnx.system_sql('INSERT INTO is_relation (eid_from, eid_to) ' |
214 cnx.system_sql('INSERT INTO is_relation (eid_from, eid_to) ' |
215 'SELECT e.eid, s.cw_eid FROM entities as e, cw_CWEType as s ' |
215 'SELECT e.eid, s.cw_eid FROM entities as e, cw_CWEType as s ' |
216 'WHERE s.cw_name=e.type AND NOT EXISTS(SELECT 1 FROM is_relation as cs ' |
216 'WHERE s.cw_name=e.type AND NOT EXISTS(SELECT 1 FROM is_relation as cs ' |
217 ' WHERE cs.eid_from=e.eid AND cs.eid_to=s.cw_eid)') |
217 ' WHERE cs.eid_from=e.eid AND cs.eid_to=s.cw_eid)') |
221 cursor = cnx.system_sql('SELECT e.type, e.eid FROM entities as e, cw_CWEType as s ' |
221 cursor = cnx.system_sql('SELECT e.type, e.eid FROM entities as e, cw_CWEType as s ' |
222 'WHERE s.cw_name=e.type AND NOT EXISTS(SELECT 1 FROM is_instance_of_relation as cs ' |
222 'WHERE s.cw_name=e.type AND NOT EXISTS(SELECT 1 FROM is_instance_of_relation as cs ' |
223 ' WHERE cs.eid_from=e.eid AND cs.eid_to=s.cw_eid) ' |
223 ' WHERE cs.eid_from=e.eid AND cs.eid_to=s.cw_eid) ' |
224 'ORDER BY e.eid') |
224 'ORDER BY e.eid') |
225 for row in cursor.fetchall(): |
225 for row in cursor.fetchall(): |
226 sys.stderr.write(msg % row) |
226 sys.stderr.write(msg % tuple(row)) |
227 if fix: |
227 if fix: |
228 cnx.system_sql('INSERT INTO is_instance_of_relation (eid_from, eid_to) ' |
228 cnx.system_sql('INSERT INTO is_instance_of_relation (eid_from, eid_to) ' |
229 'SELECT e.eid, s.cw_eid FROM entities as e, cw_CWEType as s ' |
229 'SELECT e.eid, s.cw_eid FROM entities as e, cw_CWEType as s ' |
230 'WHERE s.cw_name=e.type AND NOT EXISTS(SELECT 1 FROM is_instance_of_relation as cs ' |
230 'WHERE s.cw_name=e.type AND NOT EXISTS(SELECT 1 FROM is_instance_of_relation as cs ' |
231 ' WHERE cs.eid_from=e.eid AND cs.eid_to=s.cw_eid)') |
231 ' WHERE cs.eid_from=e.eid AND cs.eid_to=s.cw_eid)') |