Changeset 2551

Show
Ignore:
Timestamp:
10/28/08 17:17:28 (2 months ago)
Author:
pataphil
Message:

Modified Extract Word Co-Occurrence Network to accept multiple target columns, as opposed to just one.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plugins/analysis/edu.iu.nwb.analysis.extractdirectednetfromtable/src/edu/iu/nwb/analysis/extractdirectednetfromtable/algorithms/ExtractDirectedNetworkAlgorithm.java

    r2402 r2551  
    22 
    33import java.util.Dictionary; 
     4import java.util.Enumeration; 
    45import java.util.Properties; 
    56 
     
    4748        final prefuse.data.Table dataTable = (prefuse.data.Table) data[0].getData(); 
    4849         
    49         String split = null; 
     50        String delimiter = null; 
    5051        String sourceColumn = null; 
    51         String targetColumn = null; 
     52        String targetColumn = null; 
    5253        Object functionFile = null; 
    5354        Properties functions = null; 
    5455         
    55         split = this.parameters.get("delimiter").toString(); 
     56        delimiter = this.parameters.get("delimiter").toString(); 
    5657        sourceColumn = this.parameters.get("sourceColumn").toString(); 
    5758        targetColumn = this.parameters.get("targetColumn").toString(); 
    5859        functionFile = this.parameters.get("aff"); 
    5960         
    60         if(functionFile != null){ 
    61                 functions = PropertyHandler.getProperties(functionFile.toString(),this.logger); 
     61        if(functionFile != null) 
     62        { 
     63                functions = PropertyHandler.getProperties(functionFile.toString(), this.logger); 
    6264        } 
    6365         
    64         try{ 
    65         GraphContainer gc = GraphContainer.initializeGraph(dataTable, sourceColumn, targetColumn, true,functions, this.logger,this.progressMonitor); 
    66         Graph directedNetwork = gc.buildGraph(sourceColumn, targetColumn, split, this.logger); 
     66        try 
     67        { 
     68                GraphContainer gc = GraphContainer.initializeGraph(dataTable, sourceColumn, 
     69                        targetColumn, true, functions, this.logger, this.progressMonitor); 
     70                 
     71                Graph directedNetwork = 
     72                        gc.buildGraph(sourceColumn, targetColumn, delimiter, this.logger); 
    6773         
    68         Data network = ExtractDirectedNetworkAlgorithm.constructData(data[0],(Object)directedNetwork,prefuse.data.Graph.class.toString(),DataProperty.NETWORK_TYPE,  
     74                Data network = ExtractDirectedNetworkAlgorithm.constructData(data[0], 
     75                        (Object)directedNetwork, prefuse.data.Graph.class.toString(), DataProperty.NETWORK_TYPE,  
    6976                        "Network with directed edges from " + sourceColumn + " to " + targetColumn+ "."); 
    7077         
    71         return new Data[] {network}; 
    72         }catch(InvalidColumnNameException ice){ 
    73                 throw new AlgorithmExecutionException(ice.getMessage(),ice); 
     78                return new Data[] {network}; 
     79        } 
     80        catch(InvalidColumnNameException ice) 
     81        { 
     82                throw new AlgorithmExecutionException(ice.getMessage(), ice); 
    7483        } 
    7584         
  • trunk/plugins/analysis/edu.iu.nwb.analysis.extractnetfromtable/src/edu/iu/nwb/analysis/extractnetfromtable/components/GraphContainer.java

    r2402 r2551  
    4141 
    4242        public Graph buildGraph(String sourceColumnName, String targetColumnName, String splitString, LogService log){ 
    43                 if(this.graph.isDirected()){ 
    44                         return buildDirectedGraph(sourceColumnName,targetColumnName,splitString,log); 
    45                 }else{ 
    46                         return buildUndirectedGraph(sourceColumnName,targetColumnName,splitString,log); 
    47                 } 
    48         } 
    49  
    50         private Graph buildUndirectedGraph(String sourceColumnName, String targetColumnName, String splitString, LogService log){ 
     43                String[] targetColumnNames = targetColumnName.split("\\,"); 
     44                 
     45                if(this.graph.isDirected()) 
     46                        return buildDirectedGraph(sourceColumnName, targetColumnNames, splitString, log); 
     47                // else 
     48                return buildUndirectedGraph(sourceColumnName, targetColumnNames, splitString, log); 
     49        } 
     50 
     51        private Graph buildUndirectedGraph(String sourceColumnName, String[] targetColumnNames, 
     52                                                                           String delimiter, LogService log) { 
    5153                boolean dupValues = false; 
    5254                final HashMap dupValuesErrorMessages = new HashMap(); 
     
    5456                int count = 0; 
    5557 
    56                 if(this.progMonitor != null)
     58                if(this.progMonitor != null)
    5759                        this.progMonitor.start(ProgressMonitor.WORK_TRACKABLE, rows); 
    5860                } 
     
    6264                        Node node2 = null; 
    6365                        int row = ((Integer)it.next()).intValue(); 
    64                         final String s = (String) this.table.get(row, targetColumnName); 
     66                         
     67                        final String targetString = 
     68                                buildRowTargetStringFromColumnNames(row, targetColumnNames, this.table, delimiter); 
    6569 
    6670                        Set seenObject = new HashSet(); 
    6771 
    68                         if(s != null){ //no values to extract from 
    69                                 final Pattern p = Pattern.compile("\\Q" + splitString + "\\E"); 
    70                                 final String[] objects = p.split(s); 
    71  
    72                                 for (int i = objects.length - 1; i >= 0; i--) { 
    73                                         if(seenObject.add(objects[i])){ //no duplicate nodes. 
    74                                                 node1 = NodeContainer.mutateNode(objects[i], this.graph, this.table, row, this.nodeMap, AggregateFunctionMappings.SOURCEANDTARGET); 
     72                        if(targetString != null) { //no values to extract from 
     73                                final Pattern splitPattern = Pattern.compile("\\Q" + delimiter + "\\E"); 
     74                                final String[] splitTargetStringArray = splitPattern.split(targetString); 
     75 
     76                                for (int i = splitTargetStringArray.length - 1; i >= 0; i--) { 
     77                                        if(seenObject.add(splitTargetStringArray[i])) { // No duplicate nodes. 
     78                                                node1 = NodeContainer.mutateNode(splitTargetStringArray[i], this.graph, 
     79                                                        this.table, row, this.nodeMap, AggregateFunctionMappings.SOURCEANDTARGET); 
    7580                                        } 
    76                                         node1 = this.graph.getNode(this.nodeMap.getFunctionRow(objects[i]).getRowNumber()); 
     81                                         
     82                                        node1 = this.graph.getNode(this.nodeMap.getFunctionRow(splitTargetStringArray[i]).getRowNumber()); 
     83                                         
    7784                                        for (int j = 0; j < i; j++) { 
    78                                                 if(!objects[j].equals(objects[i])){ 
    79                                                         if(seenObject.add(objects[j])){ //no duplicate nodes. 
    80                                                                 node2 = NodeContainer.mutateNode(objects[j], this.graph, this.table, row, this.nodeMap, AggregateFunctionMappings.SOURCEANDTARGET); 
     85                                                if(!splitTargetStringArray[j].equals(splitTargetStringArray[i])) { 
     86                                                        if(seenObject.add(splitTargetStringArray[j])) { //No duplicate nodes. 
     87                                                                node2 = NodeContainer.mutateNode(splitTargetStringArray[j], 
     88                                                                        this.graph, this.table, row, this.nodeMap, 
     89                                                                        AggregateFunctionMappings.SOURCEANDTARGET); 
    8190 
    8291                                                        } 
    8392                                                        //create or modify an edge as necessary 
    84                                                         node2 = this.graph.getNode(this.nodeMap.getFunctionRow(objects[j]).getRowNumber()); 
     93                                                        node2 = this.graph.getNode(this.nodeMap.getFunctionRow(splitTargetStringArray[j]).getRowNumber()); 
    8594                                                        EdgeContainer.mutateEdge(node1, node2, this.graph, this.table, row, this.edgeMap); 
    86                                                 }else{ 
     95                                                } 
     96                                                else { 
    8797                                                        dupValues = true; //detected a self-loop 
    8898                                                } 
     
    113123        } 
    114124 
    115         private Graph buildDirectedGraph(String sourceColumnName, String targetColumnName, String splitString, LogService log){ 
    116                 final Pattern p = Pattern.compile("\\Q" + splitString + "\\E"); 
     125        private Graph buildDirectedGraph(String sourceColumnName, String[] targetColumnNames, String delimiter, LogService log){ 
     126                final Pattern splitPattern = Pattern.compile("\\Q" + delimiter + "\\E"); 
    117127                final HashMap dupValuesErrorMessages = new HashMap(); 
    118128                Column sourceColumn = this.table.getColumn(sourceColumnName); 
    119                 Column targetColumn = this.table.getColumn(targetColumnName); 
    120129                Node node1; 
    121130                Node node2; 
     
    127136                        this.progMonitor.start(ProgressMonitor.WORK_TRACKABLE, rows); 
    128137                } 
    129  
    130                 for (Iterator it = this.table.rows(); it.hasNext();){ 
    131  
     138                         
     139                for (Iterator it = this.table.rows(); it.hasNext();) { 
    132140                        int row = ((Integer)it.next()).intValue(); 
    133141                        final String sourceString = (String) sourceColumn.get(row); 
    134                         final String targetString = (String) targetColumn.get(row); 
     142                         
     143                        final String targetString = 
     144                                buildRowTargetStringFromColumnNames(row, targetColumnNames, this.table, delimiter); 
    135145 
    136146                        Set seenSource = new HashSet(); 
    137147                        Set seenTarget;// = seenSource; 
    138148 
    139                         if(sourceString != null && targetString != null){ //ensure we have values to extract 
    140  
    141                                 final String[] sources = p.split(sourceString); 
    142                                 final String[] targets = p.split(targetString); 
     149                        if(sourceString != null && targetString != null) { //ensure we have values to extract 
     150                                final String[] sources = splitPattern.split(sourceString); 
     151                                final String[] targets = splitPattern.split(targetString); 
    143152 
    144153                                for (int i = 0; i < sources.length; i++) { 
    145                                         if(seenSource.add(sources[i])){  
    146                                                 node1 = NodeContainer.mutateNode(sources[i],this.graph,this.table,row,this.nodeMap,AggregateFunctionMappings.SOURCE); 
     154                                        if(seenSource.add(sources[i])) {  
     155                                                node1 = NodeContainer.mutateNode(sources[i], this.graph, this.table, row, 
     156                                                        this.nodeMap, AggregateFunctionMappings.SOURCE); 
     157                                                         
    147158                                                seenTarget = new HashSet(); 
    148159 
    149160                                                for (int j = 0; j < targets.length; j++) { 
    150                                                         if(seenTarget.add(targets[j])){ 
    151                                                                 node2 = NodeContainer.mutateNode(targets[j],this.graph,this.table,row,this.nodeMap,AggregateFunctionMappings.TARGET); 
     161                                                        if(seenTarget.add(targets[j])) { 
     162                                                                node2 = NodeContainer.mutateNode(targets[j], this.graph, 
     163                                                                        this.table, row, this.nodeMap, AggregateFunctionMappings.TARGET); 
    152164 
    153165                                                                EdgeContainer.mutateEdge(node1,node2,this.graph,this.table,row,this.edgeMap); 
     
    157169                                } 
    158170                        } 
    159                         else
    160                                 //String title = (String)pdt.get(row,pdt.getColumnNumber("TI")); 
     171                        else
     172                                // String title = (String)pdt.get(row,pdt.getColumnNumber("TI")); 
    161173                                String title = "unknown"; 
    162                                 //ExtractNetworkFromTable.printNoValueToExtractError(title, sourceColumnName, log); 
    163                         } 
    164                         count = count+1; 
     174                                // ExtractNetworkFromTable.printNoValueToExtractError(title, sourceColumnName, log); 
     175                        } 
     176 
     177                        count = count + 1; 
     178 
    165179                        if(this.progMonitor != null) 
    166180                                this.progMonitor.worked(count); 
    167181                } 
     182                                 
    168183                for(Iterator dupIter = dupValuesErrorMessages.keySet().iterator(); dupIter.hasNext();){ 
    169184                        log.log(LogService.LOG_WARNING, (String)dupValuesErrorMessages.get(dupIter.next())); 
    170185                } 
    171186 
    172  
    173187                return this.graph; 
    174188        } 
     
    180194                if(inputSchema.getColumnIndex(sourceColumnName) < 0) 
    181195                        throw new InvalidColumnNameException(sourceColumnName + " was not a column in this table.\n"); 
    182  
    183                 if(inputSchema.getColumnIndex(targetColumnName) < 0) 
     196                 
     197                // Get all of the target column names. 
     198                String[] targetColumnNameArray = targetColumnName.split("\\,"); 
     199                 
     200                // Make sure the one or more column name(s) is/are valid. 
     201                if ((targetColumnNameArray == null) || (targetColumnNameArray.length == 0)) 
    184202                        throw new InvalidColumnNameException(targetColumnName + " was not a column in this table.\n"); 
     203                else 
     204                { 
     205                        for (int ii = 0; ii < targetColumnNameArray.length; ii++) 
     206                        { 
     207                                if (inputSchema.getColumnIndex(targetColumnNameArray[ii]) < 0) 
     208                                { 
     209                                        throw new InvalidColumnNameException(targetColumnNameArray[ii] + 
     210                                                " was not a column in this table.\n"); 
     211                                } 
     212                        } 
     213                } 
    185214 
    186215                Schema nodeSchema = createNodeSchema(); 
     
    208237                if(inputSchema.getColumnIndex(sourceColumnName) < 0) 
    209238                        throw new InvalidColumnNameException(sourceColumnName + " was not a column in this table.\n"); 
    210  
    211                 if(inputSchema.getColumnIndex(targetColumnName) < 0) 
     239                 
     240                // Get all of the target column names. 
     241                String[] targetColumnNameArray = targetColumnName.split("\\,"); 
     242                 
     243                // Make sure the one or more column name(s) is/are valid. 
     244                if ((targetColumnNameArray == null) || (targetColumnNameArray.length == 0)) 
    212245                        throw new InvalidColumnNameException(targetColumnName + " was not a column in this table.\n"); 
     246                else 
     247                { 
     248                        for (int ii = 0; ii < targetColumnNameArray.length; ii++) 
     249                        { 
     250                                if (inputSchema.getColumnIndex(targetColumnNameArray[ii]) < 0) 
     251                                { 
     252                                        throw new InvalidColumnNameException(targetColumnNameArray[ii] + 
     253                                                " was not a column in this table.\n"); 
     254                                } 
     255                        } 
     256                } 
    213257 
    214258                Schema nodeSchema = createNodeSchema(); 
     
    242286                return edgeSchema; 
    243287        } 
     288         
     289        private static String buildRowTargetStringFromColumnNames(int row, String[] targetColumnNames, 
     290                                                                                                                          Table table, String delimiter) { 
     291                StringBuilder targetStringBuilder = new StringBuilder(); 
     292                 
     293                // This is outside of the proceeding for loop because that loop appends the delmiter first. 
     294                Column targetColumn = table.getColumn(targetColumnNames[0]); 
     295                targetStringBuilder.append((String)targetColumn.getString(row)); 
     296                 
     297                for (int iColumn = 1; iColumn < targetColumnNames.length; iColumn++) { 
     298                        targetColumn = table.getColumn(targetColumnNames[iColumn]); 
     299                        targetStringBuilder.append(delimiter); 
     300                        targetStringBuilder.append((String)targetColumn.getString(row)); 
     301                } 
     302                 
     303                return targetStringBuilder.toString(); 
     304        } 
    244305} 
  • trunk/plugins/composite/edu.iu.nwb.composite.extractcowordfromtable/src/edu/iu/nwb/composite/extractcowordfromtable/ExtractCoWordNetworkAlgorithm.java

    r2270 r2551  
    33import java.util.Dictionary; 
    44import java.util.Hashtable; 
     5import java.util.Enumeration; 
    56 
    67import org.cishell.framework.CIShellContext; 
     
    3940 
    4041        public Data[] execute() throws AlgorithmExecutionException { 
    41                 try { 
     42                this.logger.log (LogService.LOG_INFO, "Class: " + extractDirectedNetwork.getClass().getName()); 
     43                 
     44                try 
     45                { 
     46                        // Form a new parameters object which contains the target column as the combined string of 
     47                        // chosen columns. 
     48                        StringBuilder targetColumn = new StringBuilder(); 
     49                        boolean firstColumnHasBeenAdded = false; 
     50                        Dictionary newParameters = new Hashtable(); 
     51                         
     52                        for (Enumeration parameterKeys = parameters.keys(); parameterKeys.hasMoreElements();) 
     53                { 
     54                        String parameterKey = (String)parameterKeys.nextElement(); 
     55                        Object parameterValue = parameters.get(parameterKey); 
     56                        // Explode the current key based on "_" to separate the "column" and original_name. 
     57                        String[] explodedParameterKey = parameterKey.split("\\_"); 
     58                         
     59                        // Does the key start with "column_"?  (Is this a parameter meant for the target 
     60                        // column?) Is it checked? 
     61                        if (isAColumnCheckBoxParameter(explodedParameterKey))  
     62                        { 
     63                                if (columnCheckBoxWasSelected(parameterValue)) { 
     64                                //add column to list of columns we want to be part of the target. 
     65                                 
     66                                //If this is not the first column added, append a delimiter first as well. 
     67                                        if (firstColumnHasBeenAdded)  
     68                                        { 
     69                                                targetColumn.append(","); 
     70                                        } 
     71                                        targetColumn.append(explodedParameterKey[1]); 
     72                                        firstColumnHasBeenAdded = true; 
     73                                } else  
     74                                { 
     75                                        //ignore check box if it was not selected 
     76                                } 
     77                        }        
     78                        else //it was just a normal parameter 
     79                        {        
     80                                //so add it to the new dictionary. 
     81                                newParameters.put(parameterKey, parameterValue); 
     82                        } 
     83                } 
     84                         
     85                        // Add the target column. 
     86                        newParameters.put("targetColumn", targetColumn.toString()); 
     87                         
    4288                        //turn scientometrics data table into prefuse Graph of directed network 
    43                         Algorithm extractAlg = extractDirectedNetwork.createAlgorithm(data, parameters, context); 
     89                        Algorithm extractAlg = extractDirectedNetwork.createAlgorithm(data, newParameters, context); 
    4490                        Data[] directedNetworkData = extractAlg.execute(); 
    4591                        //converter prefuse Graph of directed network into nwb graph file of directed network 
     
    63109                return networkData; 
    64110            } 
     111          
     112          
     113         private boolean isAColumnCheckBoxParameter(String[] explodedParameterKey) { 
     114                 return (explodedParameterKey.length > 1) && (explodedParameterKey[0].equals("column")); 
     115         } 
     116          
     117         private boolean columnCheckBoxWasSelected(Object parameterValue)  
     118         { 
     119                //parameter represents whether a certain column is selected or not 
     120                 boolean columnWasSelected = ((Boolean) parameterValue).booleanValue(); 
     121                 return columnWasSelected; 
     122         } 
     123                  
    65124} 
  • trunk/plugins/composite/edu.iu.nwb.composite.extractcowordfromtable/src/edu/iu/nwb/composite/extractcowordfromtable/ExtractCoWordNetworkAlgorithmFactory.java

    r2268 r2551  
    2727 
    2828 
    29 public class ExtractCoWordNetworkAlgorithmFactory implements AlgorithmFactory,ParameterMutator { 
     29public class ExtractCoWordNetworkAlgorithmFactory implements AlgorithmFactory, ParameterMutator { 
     30        protected static final String PREFIX = "column_"; 
     31         
     32        protected static final String UNFILTERED_COLUMNS[] = 
     33        { 
     34                "abstract", "keyword", "title", "field of application", "chemicals/cas", 
     35        }; 
     36        /* { 
     37                "", "City of Publisher", "DOI", "Document Type", "E-mail Address", "Ending Page", 
     38                "File Type", "ISI Document Delivery Number", "ISSN", "New Article Number", 
     39                "PA", "Part Number", "Publication Date", "Publication Type", "Publication Year", 
     40                "Publisher Web Address", "Reprint Address", "Research Addresses", "SC", "Special Issue", 
     41                "Times Cited", "Unique ID", "Version Number", "Volume" 
     42        }; */ 
     43         
    3044        private AlgorithmFactory extractDirectedNetwork; 
    3145        private AlgorithmFactory bibliographicCoupling; 
     
    3448         
    3549        public ObjectClassDefinition mutateParameters(Data[] data, ObjectClassDefinition parameters) { 
    36                 Table t = (Table) data[0].getData(); 
    37  
    38                 ObjectClassDefinition oldDefinition = parameters; 
    39  
    40                 BasicObjectClassDefinition definition; 
    41                 try { 
    42                         definition = new BasicObjectClassDefinition(oldDefinition.getID(), oldDefinition.getName(), oldDefinition.getDescription(), oldDefinition.getIcon(16)); 
    43                 } catch (IOException e) { 
    44                         definition = new BasicObjectClassDefinition(oldDefinition.getID(), oldDefinition.getName(), oldDefinition.getDescription(), null); 
    45                 } 
    46  
    47                 String[] columnNames = createKeyArray(t.getSchema()); 
     50                Table dataTable = (Table) data[0].getData(); 
     51 
     52                ObjectClassDefinition oldObjectClassDefinition = parameters; 
     53                BasicObjectClassDefinition newObjectClassDefinition; 
     54                 
     55                try 
     56                { 
     57                        newObjectClassDefinition = new BasicObjectClassDefinition(oldObjectClassDefinition.getID(), 
     58                                oldObjectClassDefinition.getName(), oldObjectClassDefinition.getDescription(), 
     59                                oldObjectClassDefinition.getIcon(16)); 
     60                } 
     61                catch (IOException e) 
     62                { 
     63                        newObjectClassDefinition = new BasicObjectClassDefinition(oldObjectClassDefinition.getID(), 
     64                                oldObjectClassDefinition.getName(), oldObjectClassDefinition.getDescription(), null); 
     65                } 
     66 
     67                String[] columnNames = createKeyArray(dataTable.getSchema()); 
    4868                Arrays.sort(columnNames); 
    4969 
    50                 AttributeDefinition[] definitions = oldDefinition.getAttributeDefinitions(ObjectClassDefinition.ALL); 
    51  
    52                 for(int ii = 0; ii < definitions.length; ii++) { 
    53                         String id = definitions[ii].getID(); 
    54                         if((id.equals("sourceColumn") || id.equals("targetColumn"))){ 
    55                                 definition.addAttributeDefinition(ObjectClassDefinition.REQUIRED, 
    56                                                 new BasicAttributeDefinition(id, definitions[ii].getName(), definitions[ii].getDescription(), definitions[ii].getType(), columnNames, columnNames)); 
    57                         } 
    58                         else if(id.equals("delimiter")){ 
    59                                 definition.addAttributeDefinition(ObjectClassDefinition.REQUIRED, definitions[ii]); 
    60                         } 
    61                         else{ 
    62                                 definition.addAttributeDefinition(ObjectClassDefinition.OPTIONAL, definitions[ii]); 
    63                         } 
    64                 } 
    65  
    66                  
    67                 return definition;       
     70                AttributeDefinition[] attributeDefinitions = 
     71                        oldObjectClassDefinition.getAttributeDefinitions(ObjectClassDefinition.ALL); 
     72 
     73                for(int ii = 0; ii < attributeDefinitions.length; ii++) 
     74                { 
     75                        String id = attributeDefinitions[ii].getID(); 
     76                         
     77                        if(id.equals("sourceColumn")) 
     78                        { 
     79                                newObjectClassDefinition.addAttributeDefinition(ObjectClassDefinition.REQUIRED, 
     80                                        new BasicAttributeDefinition(id, attributeDefinitions[ii].getName(), 
     81                                                attributeDefinitions[ii].getDescription(), attributeDefinitions[ii].getType(), 
     82                                                columnNames, columnNames)); 
     83                        } 
     84                        else if(id.equals("delimiter")) 
     85                        { 
     86                                newObjectClassDefinition.addAttributeDefinition(ObjectClassDefinition.REQUIRED, 
     87                                        attributeDefinitions[ii]); 
     88                        } 
     89                        else if(id.equals("targetColumn")) 
     90                        { 
     91                        } 
     92                        else 
     93                        { 
     94                                newObjectClassDefinition.addAttributeDefinition(ObjectClassDefinition.OPTIONAL, 
     95                                        attributeDefinitions[ii]); 
     96                        } 
     97                } 
     98 
     99                 
     100                // return newObjectClassDefinition; 
     101                return addBooleanOptions (newObjectClassDefinition, columnNames, PREFIX); 
     102        } 
     103 
     104        private ObjectClassDefinition addBooleanOptions(ObjectClassDefinition oldObjectClassDefinition, 
     105                                                                                                        String[] columnNames, String prefix) 
     106        { 
     107                BasicObjectClassDefinition newObjectClassDefinition; 
     108                 
     109                try 
     110                { 
     111                        newObjectClassDefinition = new BasicObjectClassDefinition(oldObjectClassDefinition.getID(), 
     112                                oldObjectClassDefinition.getName(), oldObjectClassDefinition.getDescription(), 
     113                                oldObjectClassDefinition.getIcon(16)); 
     114                } 
     115                catch (IOException e) 
     116                { 
     117                        newObjectClassDefinition = new BasicObjectClassDefinition(oldObjectClassDefinition.getID(), 
     118                                oldObjectClassDefinition.getName(), oldObjectClassDefinition.getDescription(), null); 
     119                } 
     120                 
     121                AttributeDefinition[] attributeDefinitions = 
     122                        oldObjectClassDefinition.getAttributeDefinitions(ObjectClassDefinition.REQUIRED); 
     123                 
     124                for(int ii = 0; ii < attributeDefinitions.length; ii++) 
     125                { 
     126                        newObjectClassDefinition.addAttributeDefinition(ObjectClassDefinition.REQUIRED, 
     127                                attributeDefinitions[ii]); 
     128                } 
     129                 
     130                attributeDefinitions = 
     131                        oldObjectClassDefinition.getAttributeDefinitions(ObjectClassDefinition.OPTIONAL); 
     132                 
     133                for(int ii = 0; ii < attributeDefinitions.length; ii++) 
     134                { 
     135                        newObjectClassDefinition.addAttributeDefinition(ObjectClassDefinition.OPTIONAL, 
     136                                attributeDefinitions[ii]); 
     137                } 
     138                 
     139                attributeDefinitions = 
     140                        oldObjectClassDefinition.getAttributeDefinitions(ObjectClassDefinition.ALL); 
     141 
     142                for(int ii = 0; ii < columnNames.length; ii++) 
     143                { 
     144                        String name = columnNames[ii]; 
     145                         
     146                        // Ugh, there has to be a library for this. 
     147                        final int numFilteredColumns = UNFILTERED_COLUMNS.length; 
     148                         
     149                        // We're white listing, so we're filtering by default. 
     150                        boolean filtered = true; 
     151                         
     152                        for (int jj = 0; jj < numFilteredColumns; jj++) 
     153                        { 
     154                                // If the column contains one of our white listed items, let it through. 
     155                                if (name.toLowerCase().indexOf(UNFILTERED_COLUMNS[jj]) != -1) 
     156                                { 
     157                                        filtered = false; 
     158                                         
     159                                        break; 
     160                                } 
     161                        } 
     162                         
     163                        // If the column was filtered (determined in the prior loop), continue on with the next 
     164                        // loop iteration. 
     165                        if (filtered) 
     166                                continue; 
     167                          
     168                        newObjectClassDefinition.addAttributeDefinition(ObjectClassDefinition.REQUIRED, 
     169                                new BasicAttributeDefinition(prefix + name, name, "Normalize column " + name + "?", 
     170                                                                                         AttributeDefinition.BOOLEAN)); 
     171                } 
     172 
     173                 
     174                return newObjectClassDefinition; 
    68175        } 
    69176 
     
    87194                         
    88195                DataConversionService converter = (DataConversionService) 
    89             context.getService(DataConversionService.class.getName()); 
     196               context.getService(DataConversionService.class.getName()); 
    90197                 
    91198                 return new ExtractCoWordNetworkAlgorithm(data, parameters, context, 
     
    100207    private AlgorithmFactory getAlgorithmFactory (String filter)  
    101208    throws InvalidSyntaxException { 
    102         ServiceReference[] algFactoryRefs = bContext 
    103         .getServiceReferences(AlgorithmFactory.class.getName(), filter); 
     209        ServiceReference[] algFactoryRefs = 
     210               bContext.getServiceReferences(AlgorithmFactory.class.getName(), filter); 
    104211         
    105212        if (algFactoryRefs != null && algFactoryRefs.length != 0) {