NetworkedPlanet | TMCore Engine API Guide |
Two stored procedures are provided by TMCore to implement the duplicate removal policies described above. These stored procedures can be invoked by any member of the tm_writer database role.
tm_RemoveDuplicates. This stored procedure is invoked with no parameters and removes all duplicate information from all topic maps in the database.
tm_RemoveDuplicatesFromTopicMap. This stored procedure takes a topic map OID as its only parameter and removes all duplicate information from the topic map identified by that parameter.
Either of these duplicate removal stored procedures can be invoked either using TSQL in a command-line application such as the SQL Server ISQL.EXE application, or using the appropriate database management tool such as SQL Server Management Studio for SQL Server 2005. The stored procedures can also be invoked directly through code using the TMCore APIs. The following is an example of how to invoke the tm_RemoveDuplicates procedure from code:
// Assume the tms variable holds an ITopicMapSystem instance // Invoking the stored procedure with a command-timeout value of // 0 allows for a potentially long-running procedure call. tms.ExecuteQuery("EXEC tm_RemoveDuplicates", 0);
Similar code can be used to invoke tm_RemoveDuplicatesFromTopicMap to target a specific topic map:
private void RunTopicMapDuplicateSuppression(ITopicMap tm) { Hashtable parameters = new Hashtable(); parameters["@tmId"] = tm.ID; tm.TopicMapSystem.ExecuteQuery( "EXEC tm_RemoveDuplicatesFromTopicMap @tmId", parameters, 0); }