SourceForge: molwind/molwind: changeset 72:01cb018eec47
Adapted the Graph classes for showing an image
authorOktay Degirmenci <Oktay.Degirmenci@merck.de>
Thu Oct 29 11:19:09 2009 +0100 (3 weeks ago)
changeset 7201cb018eec47
parent 7168a717b18829
child 73120285fd9540
Adapted the Graph classes for showing an image
molwind-chemical/pom.xml
molwind-chemical/src/main/java/org/molwind/chemical/io/SDFileIterator.java
molwind-chemical/src/main/java/org/molwind/chemical/io/SDFileLocator.java
molwind-chemical/src/main/java/org/molwind/chemical/model/ChemicalEntity.java
molwind-chemical/src/main/java/org/molwind/chemical/model/SubstructureResolver.java
molwind-chemical/target/classes/org/molwind/chemical/io/SDFileIterator.class
molwind-chemical/target/classes/org/molwind/chemical/io/SDFileLocator.class
molwind-chemical/target/classes/org/molwind/chemical/model/ChemicalEntity.class
molwind-chemical/target/classes/org/molwind/chemical/model/SubstructureResolver.class
molwind-client/molwind-webservice/molwind-endpoint/target/generated/wsdl/org/molwind/webservice/jaxws/GetWorldNames.java
molwind-client/molwind-webservice/molwind-endpoint/target/generated/wsdl/org/molwind/webservice/jaxws/GetWorldNamesResponse.java
molwind-client/molwind-webservice/molwind-endpoint/target/generated/wsdl/org/molwind/webservice/jaxws/IOExceptionBean.java
molwind-client/molwind-webservice/molwind-endpoint/target/generated/wsdl/org/molwind/webservice/jaxws/JDOMExceptionBean.java
molwind-client/molwind-webservice/molwind-webclient/src/main/java/org/molwind/webservice/IMolwindWebservice.java
molwind-client/molwind-webservice/molwind-webclient/src/main/java/org/molwind/webservice/IOException_Exception.java
molwind-client/molwind-webservice/molwind-webclient/src/main/java/org/molwind/webservice/JDOMException_Exception.java
molwind-client/molwind-webservice/molwind-webclient/src/main/java/org/molwind/webservice/MolwindWebserviceService.java
molwind-client/molwind-webservice/molwind-webclient/target/classes/org/molwind/webservice/IOException_Exception.class
molwind-client/molwind-webservice/molwind-webclient/target/classes/org/molwind/webservice/JDOMException_Exception.class
molwind-core/pom.xml
molwind-core/src/main/java/org/molwind/graph/DefaultEntityGraph.java
molwind-core/target/classes/org/molwind/graph/DefaultEntityGraph.class
pom.xml
     1.1 --- a/molwind-chemical/pom.xml	Thu Oct 15 17:28:16 2009 +0200
     1.2 +++ b/molwind-chemical/pom.xml	Thu Oct 29 11:19:09 2009 +0100
     1.3 @@ -38,11 +38,32 @@
     1.4      <dependency>
     1.5        <groupId>org.molwind</groupId>
     1.6        <artifactId>molwind-core</artifactId>
     1.7 +      <version>1.0-SNAPSHOT</version>
     1.8      </dependency>
     1.9      <dependency>
    1.10        <groupId>org.openscience.cdk</groupId>
    1.11        <artifactId>cdk</artifactId>
    1.12      </dependency>
    1.13 +    <dependency>
    1.14 +      <groupId>net.sf.jung</groupId>
    1.15 +      <artifactId>jung-api</artifactId>
    1.16 +      <version>2.0</version>
    1.17 +    </dependency> 
    1.18 +    <dependency>
    1.19 +      <groupId>net.sf.jung</groupId>
    1.20 +      <artifactId>jung-io</artifactId>
    1.21 +      <version>2.0</version>
    1.22 +    </dependency>
    1.23 +    <dependency>
    1.24 +      <groupId>net.sf.jung</groupId>
    1.25 +      <artifactId>jung-visualization</artifactId>
    1.26 +      <version>2.0</version>
    1.27 +    </dependency>
    1.28 +    <dependency>
    1.29 +      <groupId>net.sf.jung</groupId>
    1.30 +      <artifactId>jung-graph-impl</artifactId>
    1.31 +      <version>2.0</version>
    1.32 +    </dependency>  
    1.33    </dependencies>
    1.34  
    1.35    <parent>
    1.36 @@ -55,7 +76,31 @@
    1.37  
    1.38  
    1.39    <!-- Build Settings -->
    1.40 -
    1.41 +<profiles>
    1.42 +       <profile>
    1.43 +            <id>graph</id>
    1.44 +            <build>
    1.45 +                <defaultGoal>test</defaultGoal>
    1.46 +                <plugins>
    1.47 +                    <plugin>
    1.48 +                        <groupId>org.codehaus.mojo</groupId>
    1.49 +                        <artifactId>exec-maven-plugin</artifactId>
    1.50 +                        <executions>
    1.51 +                            <execution>
    1.52 +                                <phase>test</phase>
    1.53 +                                <goals>
    1.54 +                                    <goal>java</goal>
    1.55 +                                </goals>
    1.56 +                                <configuration>
    1.57 +                                    <mainClass>org.molwind.chemical.io.GraphMain2</mainClass>
    1.58 +                                </configuration>
    1.59 +                            </execution>
    1.60 +                        </executions>
    1.61 +                    </plugin>
    1.62 +                </plugins>
    1.63 +            </build>
    1.64 +        </profile>
    1.65 + </profiles>
    1.66  
    1.67  
    1.68  
    1.69 @@ -79,4 +124,4 @@
    1.70  
    1.71  
    1.72  
    1.73 -</project>
    1.74 \ No newline at end of file
    1.75 +</project>
     2.1 --- a/molwind-chemical/src/main/java/org/molwind/chemical/io/SDFileIterator.java	Thu Oct 15 17:28:16 2009 +0200
     2.2 +++ b/molwind-chemical/src/main/java/org/molwind/chemical/io/SDFileIterator.java	Thu Oct 29 11:19:09 2009 +0100
     2.3 @@ -47,11 +47,12 @@
     2.4      private ArrayList<File> files;
     2.5      private Iterator fileIterator;
     2.6      private Iterator entityIterator;
     2.7 -    private IteratingMDLReader sdfReader;
     2.8 +    private IteratingMDLReader sdfReader=null;
     2.9      private RelationshipResolver relationshipResolver;
    2.10      private ChemicalEntity currentEntity;
    2.11      private ChemicalEntity lastEntity;
    2.12      private EntityGraph compounds;
    2.13 +    
    2.14  
    2.15      /**
    2.16       * Creates a new chemical entity iterator based on the underlying SD files
    2.17 @@ -64,8 +65,12 @@
    2.18       */
    2.19      public SDFileIterator(final File[] theFiles,
    2.20              final RelationshipResolver resolver) {
    2.21 -        files = (ArrayList<File>) Arrays.asList(theFiles);
    2.22 -        fileIterator = null;
    2.23 +        files =  new ArrayList<File>();
    2.24 +	for(File f:theFiles){
    2.25 +	    files.add(f);
    2.26 +	}
    2.27 +
    2.28 +	fileIterator = null;
    2.29          entityIterator = null;
    2.30          sdfReader = null;
    2.31          relationshipResolver = resolver;
    2.32 @@ -73,18 +78,35 @@
    2.33          lastEntity = null;
    2.34          compounds = null;
    2.35      }
    2.36 +    
    2.37 +    
    2.38 +   
    2.39 +
    2.40 +   
    2.41 +
    2.42 +    
    2.43 +
    2.44 +    
    2.45  
    2.46  
    2.47      private ChemicalEntity readNext()
    2.48      throws IOException {
    2.49 +
    2.50 +
    2.51          if (sdfReader == null || !sdfReader.hasNext()) {
    2.52 +
    2.53 +	    
    2.54 +
    2.55 +
    2.56              if (fileIterator == null) {
    2.57                  fileIterator = files.iterator();
    2.58              }
    2.59              if (sdfReader != null) {
    2.60 -                sdfReader.close();
    2.61 +		sdfReader.close();
    2.62 +		return null;
    2.63              }
    2.64              if (!fileIterator.hasNext()) {
    2.65 +	
    2.66                  return null;
    2.67              }
    2.68  
    2.69 @@ -92,38 +114,79 @@
    2.70              FileReader fileReader = new FileReader(file);
    2.71              sdfReader = new IteratingMDLReader(fileReader,
    2.72                      DefaultChemObjectBuilder.getInstance());
    2.73 +	    
    2.74 +            if (!sdfReader.hasNext()) {
    2.75 +	
    2.76 +                sdfReader.close();
    2.77  
    2.78 -            if (!sdfReader.hasNext()) {
    2.79 -                sdfReader.close();
    2.80                  return null;
    2.81              }
    2.82          }
    2.83  
    2.84 -        IMolecule molecule = (IMolecule) sdfReader.next();
    2.85 -        ChemicalEntity chemicalEntity = new ChemicalEntity(molecule);
    2.86 +	IMolecule molecule = (IMolecule) sdfReader.next();
    2.87 +	
    2.88 +	ChemicalEntity chemicalEntity = new ChemicalEntity(molecule);
    2.89 +	if ((relationshipResolver != null)
    2.90 +	    && (relationshipResolver instanceof Identity)) {
    2.91 +	    chemicalEntity.setIdentity((Identity) relationshipResolver);
    2.92 +	}
    2.93 +	
    2.94 +        return chemicalEntity;
    2.95 +    }
    2.96  
    2.97 -        if ((relationshipResolver != null)
    2.98 -                && (relationshipResolver instanceof Identity)) {
    2.99 -            chemicalEntity.setIdentity((Identity) relationshipResolver);
   2.100 -        }
   2.101  
   2.102 -        return chemicalEntity;
   2.103 +   
   2.104 +    
   2.105 +    /**
   2.106 +     *
   2.107 +     *
   2.108 +     *
   2.109 +     *
   2.110 +     */
   2.111 +    public void setFileReader(File f) 
   2.112 +	throws IOException{
   2.113 +	FileReader fileReader = new FileReader(f);
   2.114 +	sdfReader = new IteratingMDLReader(fileReader,DefaultChemObjectBuilder.getInstance());
   2.115 +
   2.116 +    }
   2.117 +    
   2.118 +    /**
   2.119 +     *
   2.120 +     *
   2.121 +     *
   2.122 +     *
   2.123 +     *
   2.124 +     */
   2.125 +    public DefaultEntityGraph getGraph2()
   2.126 +    	throws IOException{
   2.127 +
   2.128 +	return (DefaultEntityGraph) getGraph();
   2.129      }
   2.130  
   2.131      private EntityGraph getGraph()
   2.132      throws IOException {
   2.133 +
   2.134          if (compounds == null) {
   2.135 +
   2.136 +	   
   2.137              ChemicalEntity currentEntity = null;
   2.138              ChemicalEntity lastEntity = null;
   2.139 -
   2.140 +	    int i = 0;
   2.141              while ((currentEntity = readNext()) != null) {
   2.142 +	
   2.143                  if ((relationshipResolver != null) && (lastEntity != null)) {
   2.144                      relationshipResolver.related(lastEntity, currentEntity);
   2.145                  }
   2.146 +
   2.147                  lastEntity = currentEntity;
   2.148 +	   
   2.149              }
   2.150 +	   
   2.151              if (relationshipResolver != null) {
   2.152 +			    
   2.153 +	
   2.154                  compounds = relationshipResolver.resolve();
   2.155 +
   2.156              } else {
   2.157                  compounds = new DefaultEntityGraph();
   2.158              }
     3.1 --- a/molwind-chemical/src/main/java/org/molwind/chemical/io/SDFileLocator.java	Thu Oct 15 17:28:16 2009 +0200
     3.2 +++ b/molwind-chemical/src/main/java/org/molwind/chemical/io/SDFileLocator.java	Thu Oct 29 11:19:09 2009 +0100
     3.3 @@ -264,9 +264,8 @@
     3.4      private void iterateDirectory(String dPath,ArrayList<String> result)throws Exception
     3.5      {
     3.6  	
     3.7 -
     3.8  	File file = new File(dPath);
     3.9 -       
    3.10 +   
    3.11  		
    3.12  	
    3.13  	File[] files = file.listFiles();
     4.1 --- a/molwind-chemical/src/main/java/org/molwind/chemical/model/ChemicalEntity.java	Thu Oct 15 17:28:16 2009 +0200
     4.2 +++ b/molwind-chemical/src/main/java/org/molwind/chemical/model/ChemicalEntity.java	Thu Oct 29 11:19:09 2009 +0100
     4.3 @@ -48,7 +48,8 @@
     4.4      private IMolecule molecule;
     4.5      private Identity identity;
     4.6      private MoleculeRenderer moleculeRenderer;
     4.7 -
     4.8 +    private String id;
     4.9 +    private String parentId;
    4.10      private static InChIGeneratorFactory inChIFactory;
    4.11  
    4.12      /**
    4.13 @@ -89,8 +90,7 @@
    4.14       *      the new Identity value
    4.15       */
    4.16      public void setIdentity(final Identity newIdentity) {
    4.17 -        this.identity = newIdentity;
    4.18 -    }
    4.19 +        this.identity = newIdentity;    }
    4.20  
    4.21      /**
    4.22       * Adds a new relationship if it is not existing already.
    4.23 @@ -267,7 +267,12 @@
    4.24       *      the value of the attribute
    4.25       */
    4.26      public String getAttribute(final String name) {
    4.27 -        // TODO Auto-generated method stub
    4.28 +	if(name=="ID")
    4.29 +	    return this.id;
    4.30 +	if(name=="PARENT_ID")
    4.31 +	    return this.parentId;
    4.32 +	    
    4.33 +
    4.34          return null;
    4.35      }
    4.36  
    4.37 @@ -280,7 +285,12 @@
    4.38       *      the value of the attribute
    4.39       */
    4.40      public void setAttribute(final String name, final String value) {
    4.41 -        // TODO Auto-generated method stub
    4.42 +	if(name.equals("ID"))
    4.43 +	    this.id=value;
    4.44 +	   
    4.45 +	if(name.equals("PARENT_ID"))
    4.46 +	    this.parentId=value;
    4.47 +	
    4.48      }
    4.49  
    4.50  }
     5.1 --- a/molwind-chemical/src/main/java/org/molwind/chemical/model/SubstructureResolver.java	Thu Oct 15 17:28:16 2009 +0200
     5.2 +++ b/molwind-chemical/src/main/java/org/molwind/chemical/model/SubstructureResolver.java	Thu Oct 29 11:19:09 2009 +0100
     5.3 @@ -37,10 +37,13 @@
     5.4  public class SubstructureResolver
     5.5  implements RelationshipResolver, EntityGraphAnalyzer, Identity {
     5.6  
     5.7 -    private String parentName;
     5.8 -    private String idName;
     5.9 +    
    5.10 +    
    5.11      private EntityGraph compounds;
    5.12      private boolean analyzed;
    5.13 +    
    5.14 +    private String idName = "ID";
    5.15 +    private String parentName="PARENT_ID";
    5.16  
    5.17      /**
    5.18       * Creates a new Substructure resolver which uses the given attributes to
    5.19 @@ -103,6 +106,7 @@
    5.20       */
    5.21      public boolean related(final WorldEntity entity1,
    5.22              final WorldEntity entity2) {
    5.23 +
    5.24          if ((entity1 == null)
    5.25                  || (entity2 == null)
    5.26                  || !(entity1 instanceof ChemicalEntity)
    5.27 @@ -112,14 +116,19 @@
    5.28  
    5.29          ChemicalEntity chemicalEntity1 = (ChemicalEntity) entity1;
    5.30          ChemicalEntity chemicalEntity2 = (ChemicalEntity) entity2;
    5.31 -
    5.32          String parentId1 = chemicalEntity1.getAttribute(parentName);
    5.33          String id1 = getId(chemicalEntity1);
    5.34          String parentId2 = chemicalEntity2.getAttribute(parentName);
    5.35          String id2 = getId(chemicalEntity2);
    5.36  
    5.37 -        boolean related = false;
    5.38  
    5.39 +	/**	System.out.println("ChemicalEntity 1: "+ chemicalEntity1.getAttribute(idName));
    5.40 +	 *	System.out.println("ChemicalEntity 2: "+ chemicalEntity1.getAttribute(idName));
    5.41 +	 *	System.out.println("ParentEntity 1: "+ chemicalEntity1.getAttribute(parentName));
    5.42 +	 *	System.out.println("ParentEntity 2: "+ chemicalEntity2.getAttribute(parentName));
    5.43 +	 */	       
    5.44 +	 
    5.45 +	boolean related = false;
    5.46          if (parentId1 != null) {
    5.47              if (parentId1.equals(id2)) {
    5.48                  return addRelation(chemicalEntity1, chemicalEntity2);
     6.1 Binary file molwind-chemical/target/classes/org/molwind/chemical/io/SDFileIterator.class has changed
     7.1 Binary file molwind-chemical/target/classes/org/molwind/chemical/io/SDFileLocator.class has changed
     8.1 Binary file molwind-chemical/target/classes/org/molwind/chemical/model/ChemicalEntity.class has changed
     9.1 Binary file molwind-chemical/target/classes/org/molwind/chemical/model/SubstructureResolver.class has changed
    10.1 --- a/molwind-client/molwind-webservice/molwind-endpoint/target/generated/wsdl/org/molwind/webservice/jaxws/GetWorldNames.java	Thu Oct 15 17:28:16 2009 +0200
    10.2 +++ b/molwind-client/molwind-webservice/molwind-endpoint/target/generated/wsdl/org/molwind/webservice/jaxws/GetWorldNames.java	Thu Oct 29 11:19:09 2009 +0100
    10.3 @@ -8,7 +8,7 @@
    10.4  
    10.5  /**
    10.6   * This class was generated by the CXF 2.0.9
    10.7 - * Thu Oct 15 17:27:16 CEST 2009
    10.8 + * Wed Oct 28 17:11:36 CET 2009
    10.9   * Generated source version: 2.0.9
   10.10   * 
   10.11   */
    11.1 --- a/molwind-client/molwind-webservice/molwind-endpoint/target/generated/wsdl/org/molwind/webservice/jaxws/GetWorldNamesResponse.java	Thu Oct 15 17:28:16 2009 +0200
    11.2 +++ b/molwind-client/molwind-webservice/molwind-endpoint/target/generated/wsdl/org/molwind/webservice/jaxws/GetWorldNamesResponse.java	Thu Oct 29 11:19:09 2009 +0100
    11.3 @@ -9,7 +9,7 @@
    11.4  
    11.5  /**
    11.6   * This class was generated by the CXF 2.0.9
    11.7 - * Thu Oct 15 17:27:16 CEST 2009
    11.8 + * Wed Oct 28 17:11:36 CET 2009
    11.9   * Generated source version: 2.0.9
   11.10   * 
   11.11   */
    12.1 --- a/molwind-client/molwind-webservice/molwind-endpoint/target/generated/wsdl/org/molwind/webservice/jaxws/IOExceptionBean.java	Thu Oct 15 17:28:16 2009 +0200
    12.2 +++ b/molwind-client/molwind-webservice/molwind-endpoint/target/generated/wsdl/org/molwind/webservice/jaxws/IOExceptionBean.java	Thu Oct 29 11:19:09 2009 +0100
    12.3 @@ -8,7 +8,7 @@
    12.4  
    12.5  /**
    12.6   * This class was generated by the CXF 2.0.9
    12.7 - * Thu Oct 15 17:27:19 CEST 2009
    12.8 + * Wed Oct 28 17:11:39 CET 2009
    12.9   * Generated source version: 2.0.9
   12.10   * 
   12.11   */
    13.1 --- a/molwind-client/molwind-webservice/molwind-endpoint/target/generated/wsdl/org/molwind/webservice/jaxws/JDOMExceptionBean.java	Thu Oct 15 17:28:16 2009 +0200
    13.2 +++ b/molwind-client/molwind-webservice/molwind-endpoint/target/generated/wsdl/org/molwind/webservice/jaxws/JDOMExceptionBean.java	Thu Oct 29 11:19:09 2009 +0100
    13.3 @@ -8,7 +8,7 @@
    13.4  
    13.5  /**
    13.6   * This class was generated by the CXF 2.0.9
    13.7 - * Thu Oct 15 17:27:18 CEST 2009
    13.8 + * Wed Oct 28 17:11:39 CET 2009
    13.9   * Generated source version: 2.0.9
   13.10   * 
   13.11   */
    14.1 --- a/molwind-client/molwind-webservice/molwind-webclient/src/main/java/org/molwind/webservice/IMolwindWebservice.java	Thu Oct 15 17:28:16 2009 +0200
    14.2 +++ b/molwind-client/molwind-webservice/molwind-webclient/src/main/java/org/molwind/webservice/IMolwindWebservice.java	Thu Oct 29 11:19:09 2009 +0100
    14.3 @@ -9,7 +9,7 @@
    14.4  
    14.5  /**
    14.6   * This class was generated by Apache CXF 2.2.4
    14.7 - * Thu Oct 15 17:27:34 CEST 2009
    14.8 + * Wed Oct 28 17:12:07 CET 2009
    14.9   * Generated source version: 2.2.4
   14.10   * 
   14.11   */
    15.1 --- a/molwind-client/molwind-webservice/molwind-webclient/src/main/java/org/molwind/webservice/IOException_Exception.java	Thu Oct 15 17:28:16 2009 +0200
    15.2 +++ b/molwind-client/molwind-webservice/molwind-webclient/src/main/java/org/molwind/webservice/IOException_Exception.java	Thu Oct 29 11:19:09 2009 +0100
    15.3 @@ -6,14 +6,14 @@
    15.4  
    15.5  /**
    15.6   * This class was generated by Apache CXF 2.2.4
    15.7 - * Thu Oct 15 17:27:34 CEST 2009
    15.8 + * Wed Oct 28 17:12:07 CET 2009
    15.9   * Generated source version: 2.2.4
   15.10   * 
   15.11   */
   15.12  
   15.13  @WebFault(name = "IOException", targetNamespace = "http://webservice.molwind.org/")
   15.14  public class IOException_Exception extends Exception {
   15.15 -    public static final long serialVersionUID = 20091015172734L;
   15.16 +    public static final long serialVersionUID = 20091028171207L;
   15.17      
   15.18      private org.molwind.webservice.IOException ioException;
   15.19  
    16.1 --- a/molwind-client/molwind-webservice/molwind-webclient/src/main/java/org/molwind/webservice/JDOMException_Exception.java	Thu Oct 15 17:28:16 2009 +0200
    16.2 +++ b/molwind-client/molwind-webservice/molwind-webclient/src/main/java/org/molwind/webservice/JDOMException_Exception.java	Thu Oct 29 11:19:09 2009 +0100
    16.3 @@ -6,14 +6,14 @@
    16.4  
    16.5  /**
    16.6   * This class was generated by Apache CXF 2.2.4
    16.7 - * Thu Oct 15 17:27:34 CEST 2009
    16.8 + * Wed Oct 28 17:12:07 CET 2009
    16.9   * Generated source version: 2.2.4
   16.10   * 
   16.11   */
   16.12  
   16.13  @WebFault(name = "JDOMException", targetNamespace = "http://webservice.molwind.org/")
   16.14  public class JDOMException_Exception extends Exception {
   16.15 -    public static final long serialVersionUID = 20091015172734L;
   16.16 +    public static final long serialVersionUID = 20091028171207L;
   16.17      
   16.18      private org.molwind.webservice.JDOMException jdomException;
   16.19  
    17.1 --- a/molwind-client/molwind-webservice/molwind-webclient/src/main/java/org/molwind/webservice/MolwindWebserviceService.java	Thu Oct 15 17:28:16 2009 +0200
    17.2 +++ b/molwind-client/molwind-webservice/molwind-webclient/src/main/java/org/molwind/webservice/MolwindWebserviceService.java	Thu Oct 29 11:19:09 2009 +0100
    17.3 @@ -15,7 +15,7 @@
    17.4  
    17.5  /**
    17.6   * This class was generated by Apache CXF 2.2.4
    17.7 - * Thu Oct 15 17:27:34 CEST 2009
    17.8 + * Wed Oct 28 17:12:07 CET 2009
    17.9   * Generated source version: 2.2.4
   17.10   * 
   17.11   */
    18.1 Binary file molwind-client/molwind-webservice/molwind-webclient/target/classes/org/molwind/webservice/IOException_Exception.class has changed
    19.1 Binary file molwind-client/molwind-webservice/molwind-webclient/target/classes/org/molwind/webservice/JDOMException_Exception.class has changed
    20.1 --- a/molwind-core/pom.xml	Thu Oct 15 17:28:16 2009 +0200
    20.2 +++ b/molwind-core/pom.xml	Thu Oct 29 11:19:09 2009 +0100
    20.3 @@ -51,6 +51,11 @@
    20.4      </dependency>
    20.5      <dependency>
    20.6        <groupId>net.sf.jung</groupId>
    20.7 +      <artifactId>jung-visualization</artifactId>
    20.8 +      <version>2.0</version>
    20.9 +    </dependency>
   20.10 +    <dependency>
   20.11 +      <groupId>net.sf.jung</groupId>
   20.12        <artifactId>jung-graph-impl</artifactId>
   20.13        <version>2.0</version>
   20.14      </dependency>  
   20.15 @@ -75,6 +80,8 @@
   20.16        </plugin>
   20.17    </plugins>
   20.18  </build>
   20.19 + 
   20.20 +
   20.21  
   20.22  
   20.23  
   20.24 @@ -96,6 +103,31 @@
   20.25      <url>http://freehg.org/u/molwind/molwind</url>
   20.26    </scm>
   20.27  
   20.28 +<profiles>
   20.29 +       <profile>
   20.30 +            <id>graph</id>
   20.31 +            <build>
   20.32 +                <defaultGoal>test</defaultGoal>
   20.33 +                <plugins>
   20.34 +                    <plugin>
   20.35 +                        <groupId>org.codehaus.mojo</groupId>
   20.36 +                        <artifactId>exec-maven-plugin</artifactId>
   20.37 +                        <executions>
   20.38 +                            <execution>
   20.39 +                                <phase>test</phase>
   20.40 +                                <goals>
   20.41 +                                    <goal>java</goal>
   20.42 +                                </goals>
   20.43 +                                <configuration>
   20.44 +                                    <mainClass>org.molwind.graph.Test</mainClass>
   20.45 +                                </configuration>
   20.46 +                            </execution>
   20.47 +                        </executions>
   20.48 +                    </plugin>
   20.49 +                </plugins>
   20.50 +            </build>
   20.51 +        </profile>
   20.52 + </profiles>
   20.53  
   20.54  
   20.55  
    21.1 --- a/molwind-core/src/main/java/org/molwind/graph/DefaultEntityGraph.java	Thu Oct 15 17:28:16 2009 +0200
    21.2 +++ b/molwind-core/src/main/java/org/molwind/graph/DefaultEntityGraph.java	Thu Oct 29 11:19:09 2009 +0100
    21.3 @@ -29,6 +29,18 @@
    21.4  
    21.5  import edu.uci.ics.jung.graph.SparseGraph;
    21.6  import edu.uci.ics.jung.io.GraphMLWriter;
    21.7 +import edu.uci.ics.jung.graph.util.Pair;
    21.8 +import edu.uci.ics.jung.graph.util.EdgeType;
    21.9 +
   21.10 +import edu.uci.ics.jung.algorithms.layout.Layout;
   21.11 +import edu.uci.ics.jung.algorithms.layout.CircleLayout;
   21.12 +
   21.13 +import edu.uci.ics.jung.graph.Graph; 
   21.14 +import edu.uci.ics.jung.visualization.BasicVisualizationServer;
   21.15 +
   21.16 +import javax.swing.JFrame;
   21.17 +import java.awt.Dimension;
   21.18 +
   21.19  
   21.20  
   21.21  /**
   21.22 @@ -42,14 +54,17 @@
   21.23      private SparseGraph graph;
   21.24      private HashMap entities;
   21.25  
   21.26 +
   21.27      /**
   21.28       * Creates a new (empty) graph of entities.
   21.29       */
   21.30      public DefaultEntityGraph() {
   21.31 -        graph = new SparseGraph();
   21.32 +        graph = new SparseGraph<EntityVertex,EntityEdge>();
   21.33          entities = new HashMap();
   21.34      }
   21.35  
   21.36 +  
   21.37 +
   21.38      /**
   21.39       * Adds an entity i.e. vertex to graph. If the vertex id is existing
   21.40       * already the vertex is replaced.
   21.41 @@ -123,10 +138,11 @@
   21.42              entities.put(vertexId2, vertex2);
   21.43              graph.addVertex(vertex2);
   21.44          }
   21.45 +	Pair<EntityVertex> endpoints = new Pair<EntityVertex>(vertex1,vertex2);
   21.46  
   21.47          DefaultEntityEdge edge = new DefaultEntityEdge(vertex1, vertex2);
   21.48          edge.setRelationship(relation);
   21.49 -	//TODO.....find solution for the new jung2 api   graph.addEdge(edge);
   21.50 +        graph.addEdge(edge,endpoints,EdgeType.DIRECTED);
   21.51      }
   21.52  
   21.53      /**
   21.54 @@ -137,7 +153,7 @@
   21.55       */
   21.56      public void analyze(final EntityGraphAnalyzer analyzer) {
   21.57          Iterator it = entities.entrySet().iterator();
   21.58 -
   21.59 +	
   21.60          while (it.hasNext()) {
   21.61              Map.Entry entry = (Map.Entry) it.next();
   21.62              EntityVertex vertex = (EntityVertex) entry.getValue();
   21.63 @@ -147,6 +163,8 @@
   21.64              }
   21.65          }
   21.66      }
   21.67 +    
   21.68 +   
   21.69  
   21.70      /**
   21.71       * Returns an iterator over a set of elements.
   21.72 @@ -174,4 +192,27 @@
   21.73  	}
   21.74  	return sw.toString();
   21.75      }
   21.76 +    
   21.77 +    
   21.78 +    public void viewGraph(int size){
   21.79 +
   21.80 +	Layout layout = new CircleLayout(graph);
   21.81 +	layout.setSize(new Dimension(size, size));
   21.82 +	
   21.83 +	BasicVisualizationServer vv = new BasicVisualizationServer(layout);
   21.84 +	vv.setPreferredSize(new Dimension(size, size)); //Sets the viewing area size
   21.85 +	JFrame frame = new JFrame("Simple Graph View");
   21.86 +	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   21.87 +	frame.getContentPane().add(vv);
   21.88 +	frame.pack();
   21.89 +	frame.setVisible(true);
   21.90 +	
   21.91 +    }
   21.92 +    
   21.93 +  
   21.94 +    
   21.95 +    
   21.96 +
   21.97 +	
   21.98 +    
   21.99  }
    22.1 Binary file molwind-core/target/classes/org/molwind/graph/DefaultEntityGraph.class has changed
    23.1 --- a/pom.xml	Thu Oct 15 17:28:16 2009 +0200
    23.2 +++ b/pom.xml	Thu Oct 29 11:19:09 2009 +0100
    23.3 @@ -91,7 +91,8 @@
    23.4          <version>1.0.4</version>
    23.5          <scope>system</scope>
    23.6          <systemPath>/cdata/media/molwind/cdk-1.0.4.jar</systemPath>
    23.7 -      </dependency>
    23.8 +      </dependency> 
    23.9 +     
   23.10        <dependency>
   23.11          <groupId>jdom</groupId>
   23.12          <artifactId>jdom</artifactId>
   23.13 @@ -107,6 +108,7 @@
   23.14      <module>molwind-chemical</module>
   23.15      <module>molwind-client</module>
   23.16    </modules>
   23.17 + 
   23.18  
   23.19    <properties>
   23.20      <encoding>UTF-8</encoding>
   23.21 @@ -146,7 +148,7 @@
   23.22        <groupId>org.apache.maven.plugins</groupId>
   23.23        <artifactId>maven-shade-plugin</artifactId>
   23.24        <version>1.2</version>
   23.25 -      <executions>
   23.26 +      <!--<executions>
   23.27          <execution>
   23.28  	  <phase>package</phase>
   23.29  	  <goals>
   23.30 @@ -165,7 +167,7 @@
   23.31  	    </artifactSet>
   23.32  	   </configuration>  
   23.33  	</execution>
   23.34 -      </executions> 
   23.35 +      </executions> --> 
   23.36      </plugin>
   23.37        <plugin>
   23.38          <groupId>org.apache.maven.plugins</groupId>
   23.39 @@ -277,7 +279,7 @@
   23.40        </releases>
   23.41      </pluginRepository>
   23.42    </pluginRepositories>
   23.43 -
   23.44 + 
   23.45  
   23.46  
   23.47