From 6a1bf8308370e36e319f9e75dbb91ce436de5c71 Mon Sep 17 00:00:00 2001
From: Thinh Dong <dnnthinh@gmail.com>
Date: Tue, 21 Aug 2012 14:56:11 +0000
Subject: [PATCH] - Updated Graph patterns renderer

---
 .../renderer/GraphPatternRendererVisitor.java | 696 ++++++++----------
 1 file changed, 305 insertions(+), 391 deletions(-)

diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/GraphPatternRendererVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/GraphPatternRendererVisitor.java
index b4992237..78d4feda 100644
--- a/src/fr/inrialpes/exmo/align/impl/renderer/GraphPatternRendererVisitor.java
+++ b/src/fr/inrialpes/exmo/align/impl/renderer/GraphPatternRendererVisitor.java
@@ -43,36 +43,28 @@ import fr.inrialpes.exmo.align.impl.edoal.ClassDomainRestriction;
 import fr.inrialpes.exmo.align.impl.edoal.ClassExpression;
 import fr.inrialpes.exmo.align.impl.edoal.ClassId;
 import fr.inrialpes.exmo.align.impl.edoal.ClassOccurenceRestriction;
-import fr.inrialpes.exmo.align.impl.edoal.ClassRestriction;
 import fr.inrialpes.exmo.align.impl.edoal.ClassTypeRestriction;
 import fr.inrialpes.exmo.align.impl.edoal.ClassValueRestriction;
 import fr.inrialpes.exmo.align.impl.edoal.Comparator;
 import fr.inrialpes.exmo.align.impl.edoal.Datatype;
 import fr.inrialpes.exmo.align.impl.edoal.EDOALVisitor;
-import fr.inrialpes.exmo.align.impl.edoal.Expression;
-import fr.inrialpes.exmo.align.impl.edoal.InstanceExpression;
 import fr.inrialpes.exmo.align.impl.edoal.InstanceId;
 import fr.inrialpes.exmo.align.impl.edoal.PathExpression;
 import fr.inrialpes.exmo.align.impl.edoal.PropertyConstruction;
 import fr.inrialpes.exmo.align.impl.edoal.PropertyDomainRestriction;
-import fr.inrialpes.exmo.align.impl.edoal.PropertyExpression;
 import fr.inrialpes.exmo.align.impl.edoal.PropertyId;
-import fr.inrialpes.exmo.align.impl.edoal.PropertyRestriction;
 import fr.inrialpes.exmo.align.impl.edoal.PropertyTypeRestriction;
 import fr.inrialpes.exmo.align.impl.edoal.PropertyValueRestriction;
 import fr.inrialpes.exmo.align.impl.edoal.RelationCoDomainRestriction;
 import fr.inrialpes.exmo.align.impl.edoal.RelationConstruction;
 import fr.inrialpes.exmo.align.impl.edoal.RelationDomainRestriction;
-import fr.inrialpes.exmo.align.impl.edoal.RelationExpression;
 import fr.inrialpes.exmo.align.impl.edoal.RelationId;
-import fr.inrialpes.exmo.align.impl.edoal.RelationRestriction;
 import fr.inrialpes.exmo.align.impl.edoal.Transformation;
 import fr.inrialpes.exmo.align.impl.edoal.Value;
-import fr.inrialpes.exmo.align.impl.edoal.ValueExpression;
 import fr.inrialpes.exmo.align.parser.SyntaxElement.Constructor;
 
 /**
- * Translate BGP from alignment
+ * Translate correspondences into Graph Patterns
  *
  * @author 
  * @version
@@ -88,13 +80,12 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
     protected boolean ignoreerrors = false;
     protected static boolean blanks = false;
     protected boolean weakens = false;
-    
+    private boolean classValueCond = false;
     private String instance = null;
     private String value = "";
     private String uriType = null;
     private String datatype = "";
     private Object valueRestriction = null;
-    private boolean isValueRestriction = false;
 
     private Stack<String> stackBGP = new Stack<String>();
     private Stack<Constructor> stackOp = new Stack<Constructor>();
@@ -128,7 +119,7 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
 		super( writer );
     }
 
-    public static void resetVariablesName(String s, String o) {
+    public static void resetVariablesName( String s, String o ) {
     	count = 1;
     	sub = "?" + s;
     	if ( blanks ) {
@@ -139,7 +130,7 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
     	}
     }   
     
-    public void resetVariables(String s, String o) {
+    public void resetVariables( String s, String o ) {
     	resetVariablesName(s, o);
     	strBGP = "";
 		strBGP_Or = "";
@@ -151,11 +142,11 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
     }
     
     public List<String> getBGP(){
-    	try {
-    		listBGP.add(strBGP);
+    	try {    		
+    		listBGP.add( strBGP );
     	}
     	catch (Exception e) {
-    		System.err.println("No query!");
+    		System.err.println( "No query!" );
     	}
     	return listBGP;
     }
@@ -164,24 +155,24 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
     	return listCond;
     }
     
-    public String getPrefixDomain(URI u) {
+    public String getPrefixDomain( URI u ) {
     	String str = u.toString();
     	int index;
-    	if (str.contains("#"))
+    	if ( str.contains("#") )
     		index = str.lastIndexOf("#");
     	else
     		index = str.lastIndexOf("/");
     	return str.substring(0, index+1);
     }
     
-    public String getPrefixName(URI u) {
+    public String getPrefixName( URI u ) {
     	String str = u.toString();
     	int index;
-    	if (str.contains("#"))
+    	if ( str.contains("#") )
     		index = str.lastIndexOf("#");
     	else
     		index = str.lastIndexOf("/");
-    	return str.substring(index+1);
+    	return str.substring( index+1 );
     }
     
     public static String getNamespace(){
@@ -194,48 +185,25 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
 	    FileWriter writer = new FileWriter( dir+"query"+number +".rq" );
 	    out = new BufferedWriter( writer );
 	    number++;
-	    out.write(query);
+	    out.write( query );
 	    if ( out != null ) // there was at least one file
 		out.close();
 	} catch(IOException ioe) {
-	    System.err.println(ioe);
+	    System.err.println( ioe );
 	}
     }
 
-    public void visit( Expression o ) throws AlignmentException {
-	if ( o instanceof PathExpression ) visit( (PathExpression)o );
-	else if ( o instanceof ClassExpression ) visit( (ClassExpression)o );
-	else if ( o instanceof InstanceExpression ) visit( (InstanceExpression)o );
-	else throw new AlignmentException( "Cannot dispatch Expression "+o );
-    }
-
-    // DONE
-    public void visit( final PathExpression p ) throws AlignmentException {
-		if ( p instanceof RelationExpression ) visit( (RelationExpression)p );
-		else if ( p instanceof PropertyExpression ) visit( (PropertyExpression)p );
-		else throw new AlignmentException( "Cannot dispatch PathExpression "+p );
-    }
-
-    // DONE
-    public void visit( final ClassExpression e ) throws AlignmentException {    	
-    	if ( e instanceof ClassId ) visit( (ClassId)e );
-		else if ( e instanceof ClassConstruction )  visit( (ClassConstruction)e );
-		else if ( e instanceof ClassRestriction )  	visit( (ClassRestriction)e );		
-		else throw new AlignmentException( "Cannot dispatch ClassExpression "+e );
-    }
-
-    // DONE+TESTED
     public void visit( final ClassId e ) throws AlignmentException {
     	if ( e.getURI() != null ) {
     		String prefix = getPrefixDomain(e.getURI());
     		String tag = getPrefixName(e.getURI());
     		String shortCut;
-    		if(!prefixList.containsKey(prefix)){
+    		if( !prefixList.containsKey(prefix) ){
     			shortCut = getNamespace();
-    			prefixList.put(prefix, shortCut);
+    			prefixList.put( prefix, shortCut );
     		}
     		else {
-    			shortCut = prefixList.get(prefix);
+    			shortCut = prefixList.get( prefix );
     		}
     		//if (flagRestriction == 1){
 				//strBGP += "?p rdfs:domain " + shortCut + ":"+ tag + " ." + NL;			
@@ -255,21 +223,21 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
 			}
 			else {
 				strBGP += sub + " a " + shortCut + ":"+ tag + " ." + NL;			
-				if (op != Constructor.NOT) {
+				if ( op != Constructor.NOT ) {
 					Stack<String> tempStack = new Stack<String>();
-					if (stackBGP.isEmpty()){
+					if ( stackBGP.empty() ){
 						strBGP_Or = sub + " a " + shortCut + ":"+ tag + " ." + NL;
-						tempStack.push(strBGP_Or);
+						tempStack.push( strBGP_Or );
 					}
 					else {
-						while (!stackBGP.isEmpty()){
+						while ( !stackBGP.empty() ){
 							strBGP_Or = stackBGP.pop();
 							strBGP_Or += sub + " a " + shortCut + ":"+ tag + " ." + NL;
-							tempStack.push(strBGP_Or);
+							tempStack.push( strBGP_Or );
 						}						
 					}
-					while (!tempStack.isEmpty()){
-						stackBGP.push(tempStack.pop());
+					while ( !tempStack.empty() ){
+						stackBGP.push( tempStack.pop() );
 					}
 				}
 				
@@ -277,59 +245,58 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
     	}
     }
 
-    // DONE+TESTED
     public void visit( final ClassConstruction e ) throws AlignmentException {		
     	op = e.getOperator();
 		countInList = 0;
-		if (op == Constructor.OR){			
+		if (op == Constructor.OR) {			
 			int size = e.getComponents().size();
 			Stack<String> tempStack = new Stack<String>();
 			Stack<String> tempResult = new Stack<String>();
-			while(!stackBGP.empty()){
+			
+			while( !stackBGP.empty() ) {
 		    	tempStack.push(stackBGP.pop());		    	
 		    }
 			for ( final ClassExpression ce : e.getComponents() ) {
 			    strBGP += "{" + NL;
-			    if(op != null){
-					stackOp.push(op);
+			    if( op != null ) {
+					stackOp.push( op );
 				}
 			    stackBGP.clear();
-			    if(!tempStack.empty()){
-			    	for(int i=0; i<tempStack.size(); i++)
-			    		stackBGP.push(tempStack.get(i));
+			    if( !tempStack.empty() ) {
+			    	for( int i=0; i<tempStack.size(); i++ ) {
+			    		stackBGP.push( tempStack.get(i) );			    		
+			    	}
 			    }
 			    countInList++;
-			    visit( ce );
-			    
-			    if(op == Constructor.NOT)
-			    	stackBGP.clear();
-			    
-			    if(!stackOp.isEmpty())
+			    ce.accept( this );
+			    if(!stackOp.empty()) {
 					op = stackOp.pop();
-			   
-			    while(!stackBGP.empty()){
-			    	tempResult.push(stackBGP.pop());
-			    }		    
-			    
+				}
+			    if( op == Constructor.NOT ) {
+			    	stackBGP.clear();			    
+			    }
+			    while( !stackBGP.empty() ) {			    	
+			    	tempResult.push( stackBGP.pop() );
+			    }			    
 			    size--;
-			    if(size != 0)
+			    if( size != 0 )
 			    	strBGP += "}" + " UNION " + NL;
 			    else
 			    	strBGP += "}" + NL;
-			}
-			while(!tempResult.empty()){
-				stackBGP.push(tempResult.pop());
+			}				
+			while( !tempResult.empty() ) {				
+				stackBGP.push( tempResult.pop() );
 		    }
 		}
-		else if (op == Constructor.NOT){
+		else if ( op == Constructor.NOT ) {
 			
 			for ( final ClassExpression ce : e.getComponents() ) {
 			    strBGP +="MINUS {" + NL + INDENT;			    
-			    if(op != null){
-					stackOp.push(op);
+			    if( op != null ) {
+					stackOp.push( op );
 				}
-			    visit( ce );
-			    if(!stackOp.isEmpty())
+			    ce.accept( this );			    
+			    if( !stackOp.empty() )
 					op = stackOp.pop();
 			    strBGP +="}" + NL;			    
 			}
@@ -337,65 +304,75 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
 		}
 		else {			
 			for ( final ClassExpression ce : e.getComponents() ) {
-			    if(op != null){
-					stackOp.push(op);
+			    if( op != null ) {
+					stackOp.push( op );
 				}			    
-			    visit( ce );			    
-			    if(!stackOp.isEmpty())
+			    ce.accept( this );
+			    stackBGP.clear();
+			    if( !stackOp.empty() )
 					op = stackOp.pop();			    
 			}
 		}
 		
-		if(stackOp.isEmpty()) {
-			if(op == Constructor.NOT || flagRestriction == 1)
+		if( stackOp.empty() ) {
+			if( op == Constructor.NOT || flagRestriction == 1 )
 				stackBGP.clear();
-			while (!stackBGP.empty()){	    		
-	    		listBGP.add(stackBGP.pop());	    		
+			while ( !stackBGP.empty() ) {	    		
+	    		listBGP.add( stackBGP.pop() );	    		
 	    	}
 		}
 
-		op = null;		
-    }
-    
-    // DONE+TESTED
-    public void visit(final ClassRestriction e) throws AlignmentException {    	
-    	if ( e instanceof ClassValueRestriction ) visit( (ClassValueRestriction)e );
-		else if ( e instanceof ClassTypeRestriction )  visit( (ClassTypeRestriction)e );
-		else if ( e instanceof ClassDomainRestriction )  visit( (ClassDomainRestriction)e );
-		else if ( e instanceof ClassOccurenceRestriction ) visit( (ClassOccurenceRestriction)e );
-		else throw new AlignmentException( "Cannot dispatch ClassExpression "+e );
-    	objectsRestriction.clear();
+		//op = null;		
     }
 
-    // DONE+TESTED
     public void visit( final ClassValueRestriction c ) throws AlignmentException {
-	    instance = null;
+    	String str = "";
+    	instance = "";
 	    value = "";
-	    isValueRestriction = true;
 	    flagRestriction = 1;
-	    visit( c.getValue() );
+	    c.getValue().accept( this );
 	    flagRestriction = 0;
 	    
-	    if(instance != null)
+	    if( !instance.equals("") )
 	    	valueRestriction = instance;
-	    else if(!value.equals(""))
+	    else if( !value.equals("") )
 	    	valueRestriction = value;
 	    
-		visit( c.getRestrictionPath() );
+		if( c.getComparator().getURI().equals( Comparator.GREATER.getURI() ) ) {
+			opOccurence = ">";
+			classValueCond = true;
+		}
+		if( c.getComparator().getURI().equals( Comparator.LOWER.getURI() ) ) {
+			opOccurence = "<";
+			classValueCond = true;
+		}
+	    
+	    c.getRestrictionPath().accept( this );
 		
-		isValueRestriction = false;
 		String temp = obj;
-		Iterator<String> listObj = objectsRestriction.iterator();
-		while ( listObj.hasNext() ) {
-			obj = listObj.next();				
-			flagRestriction = 1;
-			visit( c.getValue() );
-			flagRestriction = 0;
-		}		
-		
+		if ( ( c.getComparator().getURI().equals( Comparator.GREATER.getURI() )
+				|| c.getComparator().getURI().equals( Comparator.LOWER.getURI() ) )
+				&& !objectsRestriction.isEmpty() ) {
+			Iterator<String> listObj = objectsRestriction.iterator();
+			if (op == Constructor.COMP) {			
+				str = "FILTER(" + listObj.next() + opOccurence + valueRestriction + ")" +NL;		    
+			}
+			else{
+				while ( listObj.hasNext() ) {
+					str += "FILTER(" + listObj.next() + opOccurence + valueRestriction + ")" +NL;	
+				}
+			}
+			while( countInList > listCond.size() )
+				listCond.add( "" );
+			if( countInList>0 )
+				listCond.add( countInList-1, str );
+			else
+				listCond.add( countInList, str );
+			strBGP += str;
+		}
 		valueRestriction = null;
 		obj = temp;
-		if(op == Constructor.AND){		
+		if( op == Constructor.AND ){		
 			if ( blanks ) {
 	    		obj = "_:o" + ++count;
 	    	}
@@ -403,18 +380,18 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
 	    		obj = "?o" + ++count;
 	    	} 
 		}
-		
+		if( stackBGP.size() > 0 )
+    		stackBGP.remove( stackBGP.size()-1 );
     }
 
-    // DONE+TESTED
     public void visit( final ClassTypeRestriction c ) throws AlignmentException {	
     	String str = "";
     	datatype = "";
-    	visit( c.getRestrictionPath() );
+    	c.getRestrictionPath().accept( this );
 		if ( !objectsRestriction.isEmpty() ) {
 			Iterator<String> listObj = objectsRestriction.iterator();
 			int size = objectsRestriction.size();
-			if (size > 0) {
+			if ( size > 0 ) {
 				increaseIndent();
 				str = "FILTER (datatype(" + listObj.next() + ") = ";				
 				visit( c.getType() );
@@ -426,182 +403,184 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
 				str += "xsd:" + datatype;
 			}
 			str += ")" + NL;
-			while(countInList > listCond.size())
-				listCond.add("");
+			while( countInList > listCond.size() )
+				listCond.add( "" );
 			if(countInList>0)
-				listCond.add(countInList-1, str);
+				listCond.add( countInList-1, str );
 			else
-				listCond.add(countInList, str);
+				listCond.add( countInList, str );
 			strBGP += str;
 		}
 		objectsRestriction.clear();
     }
 
-    // DONE+TESTED
     public void visit( final ClassDomainRestriction c ) throws AlignmentException {					
-    	visit( c.getRestrictionPath() );
+    	c.getRestrictionPath().accept( this );
     	Iterator<String> listObj = objectsRestriction.iterator();
     	while ( listObj.hasNext() ) {
 			subjectsRestriction.add(listObj.next());			
 		}
-    	if(listBGP.size() > 0)
-    		strBGP_Or = listBGP.remove(listBGP.size()-1);
+    	if( listBGP.size() > 0 )
+    		strBGP_Or = listBGP.remove( listBGP.size()-1 );
     	if(stackBGP.size() > 0)
-    		stackBGP.remove(stackBGP.size()-1);
-    	visit( c.getDomain() );
-    	stackBGP.add(strBGP_Or);
+    		stackBGP.remove( stackBGP.size()-1 );
+    	c.getDomain().accept( this );
+    	stackBGP.add( strBGP_Or );
     	objectsRestriction.clear();
     }
 
-    // DONE+TESTED
     public void visit( final ClassOccurenceRestriction c ) throws AlignmentException {
-		if(c.getComparator().getURI().equals( Comparator.EQUAL.getURI())) {
+		String str="";
+    	if( c.getComparator().getURI().equals( Comparator.EQUAL.getURI() ) ) {
 			nbCardinality = c.getOccurence();
 			opOccurence = "=";
 		}
-		if(c.getComparator().getURI().equals( Comparator.GREATER.getURI())) {
+		if( c.getComparator().getURI().equals( Comparator.GREATER.getURI() ) ) {
 			nbCardinality = c.getOccurence();
 			opOccurence = ">";
 		}
-		if(c.getComparator().getURI().equals( Comparator.LOWER.getURI())) {
+		if( c.getComparator().getURI().equals( Comparator.LOWER.getURI() ) ) {
 			nbCardinality = c.getOccurence();
 			opOccurence = "<";
 		}
 		
-		visit( c.getRestrictionPath() );	
-		Iterator<String> listObj = objectsRestriction.iterator();
-		if (op == Constructor.COMP) {			
-			strBGP += "FILTER(COUNT(" + listObj.next() + ")" + opOccurence + nbCardinality + ")" +NL;		    
-		}
-		else{
-			while ( listObj.hasNext() ) {
-				strBGP += "FILTER(COUNT(" + listObj.next() + ")" + opOccurence + nbCardinality + ")" +NL;	
+		c.getRestrictionPath().accept( this );	
+		
+		if ( !objectsRestriction.isEmpty() ) {
+			Iterator<String> listObj = objectsRestriction.iterator();
+			if (op == Constructor.COMP) {			
+				String tmp = "";
+				while ( listObj.hasNext() )
+					tmp = listObj.next();
+				str += "FILTER(COUNT(" + tmp + ")" + opOccurence + nbCardinality + ")" +NL;	    
 			}
+			else{
+				while ( listObj.hasNext() ) {
+					str += "FILTER(COUNT(" + listObj.next() + ")" + opOccurence + nbCardinality + ")" +NL;	
+				}
+			}
+			while( countInList > listCond.size() )
+				listCond.add( "" );
+			if( countInList>0 )
+				listCond.add( countInList-1, str );
+			else
+				listCond.add( countInList, str );
+			strBGP += str;
 		}
-		if(stackBGP.size() > 0)
-    		stackBGP.remove(stackBGP.size()-1);
+		
+		if( stackBGP.size() > 0 )
+    		stackBGP.remove( stackBGP.size()-1 );
 		nbCardinality = null;
 		opOccurence = "";
     }
     
-    // DONE
-    public void visit(final PropertyExpression e) throws AlignmentException {
-	if ( e instanceof PropertyId ) visit( (PropertyId)e );
-	else if ( e instanceof PropertyConstruction ) visit( (PropertyConstruction)e );
-	else if ( e instanceof PropertyRestriction ) visit( (PropertyRestriction)e );
-	else throw new AlignmentException( "Cannot dispatch ClassExpression "+e );
-    }
-	
-    // DONE
-    public void visit(final PropertyId e) throws AlignmentException {
+    public void visit( final PropertyId e ) throws AlignmentException {
     	if ( e.getURI() != null ) {	
-    		String prefix = getPrefixDomain(e.getURI());
-    		String tag = getPrefixName(e.getURI());
+    		String prefix = getPrefixDomain( e.getURI() );
+    		String tag = getPrefixName( e.getURI() );
     		String shortCut;
-    		if(!prefixList.containsKey(prefix)){
+    		if( !prefixList.containsKey( prefix ) ){
     			shortCut = getNamespace();
-    			prefixList.put(prefix, shortCut);
+    			prefixList.put( prefix, shortCut );
     		}
     		else {
-    			shortCut = prefixList.get(prefix);
+    			shortCut = prefixList.get( prefix );
     		}
     		String temp = obj;
-    		if(op == null && valueRestriction != null)
+    		if( op == null && valueRestriction != null && !classValueCond )
     			obj = "\"" + valueRestriction.toString() + "\"";
 		    strBGP += sub + " " + shortCut + ":"+ tag + " " + obj + " ." +NL;
-		    if (op != Constructor.NOT) {
+		    if ( op != Constructor.NOT ) {
 				Stack<String> tempStack = new Stack<String>();
-				if (stackBGP.isEmpty()){
+				if ( stackBGP.isEmpty() ) {
 					strBGP_Or = sub + " " + shortCut + ":"+ tag + " " + obj + " ." +NL;
-					tempStack.push(strBGP_Or);
+					tempStack.push( strBGP_Or );
 				}
 				else {
-					while (!stackBGP.isEmpty()){
+					while ( !stackBGP.isEmpty() ){
 						strBGP_Or = stackBGP.pop();
 						strBGP_Or += sub + " " + shortCut + ":"+ tag + " " + obj + " ." +NL;
-						tempStack.push(strBGP_Or);
+						tempStack.push( strBGP_Or );
 					}						
 				}
-				while (!tempStack.isEmpty()){
-					stackBGP.push(tempStack.pop());
+				while ( !tempStack.isEmpty() ){
+					stackBGP.push( tempStack.pop() );
 				}
 			}
     		obj = temp;
 		}
     }
 
-    // DONE
-    public void visit(final PropertyConstruction e) throws AlignmentException {
+    public void visit( final PropertyConstruction e ) throws AlignmentException {
     	op = e.getOperator();
     	
-		if (op == Constructor.OR){			
+		if ( op == Constructor.OR ){			
 			int size = e.getComponents().size();
 			Stack<String> tempStack = new Stack<String>();
 			Stack<String> tempResult = new Stack<String>();
-			while(!stackBGP.empty()){
-		    	tempStack.push(stackBGP.pop());		    	
+			while ( !stackBGP.empty() ) {
+		    	tempStack.push( stackBGP.pop() );		    	
 		    }
-			if(valueRestriction != null)
+			if ( valueRestriction != null && !classValueCond )
 				obj = "\"" + valueRestriction.toString() + "\"";
 			for ( final PathExpression re : e.getComponents() ) {
 			    strBGP += "{" +NL;
-			    if(op != null){
+			    if ( op != null ) {
 					stackOp.push(op);
 				}
 			    stackBGP.clear();
-			    if(!tempStack.empty()){
-			    	for(int i=0; i<tempStack.size(); i++)
-			    		stackBGP.push(tempStack.get(i));
+			    if ( !tempStack.empty() ) {
+			    	for( int i=0; i<tempStack.size(); i++ )
+			    		stackBGP.push( tempStack.get(i) );
 			    }
 			    countInList++;
-			    visit( re );
-			    if(op == Constructor.NOT)
+			    re.accept( this );
+			    if ( op == Constructor.NOT )
 			    	stackBGP.clear();
-			    if(!stackOp.isEmpty())
+			    if( !stackOp.isEmpty() )
 					op = stackOp.pop();
 		    
-			    while(!stackBGP.empty()){
+			    while( !stackBGP.empty() ){
 			    	tempResult.push(stackBGP.pop());
 			    }
 			    size--;
-			    if(size != 0)
+			    if( size != 0 )
 			    	strBGP += "}" + " UNION " + NL;			    
 			    else
 			    	strBGP += "}" +NL;
 			}
-			while(!tempResult.empty()){
-				stackBGP.push(tempResult.pop());
+			while( !tempResult.empty() ){
+				stackBGP.push( tempResult.pop() );
 		    }
-			objectsRestriction.add(obj);
+			objectsRestriction.add( obj );
 		}
-		else if (op == Constructor.NOT){			
+		else if ( op == Constructor.NOT ) {			
 			for ( final PathExpression re : e.getComponents() ) {
 			    strBGP += "MINUS {" +NL;
-			    if(op != null){
-					stackOp.push(op);
+			    if( op != null ) {
+					stackOp.push( op );
 				}
-			    visit( re );
-			    if(!stackOp.isEmpty())
+			    re.accept( this );
+			    if( !stackOp.isEmpty() )
 					op = stackOp.pop();
 			}			
 			strBGP += "}" +NL;
 		}
-		else if (op == Constructor.COMP){			
+		else if ( op == Constructor.COMP ){			
 			int size = e.getComponents().size();
 			String tempSub = sub;			
 			
 			for ( final PathExpression re : e.getComponents() ) {
-			    writer.print(linePrefix);			    
-			    if(op != null){
+			    if ( op != null ) {
 					stackOp.push(op);
 				}
-			    visit( re );
-			    if(!stackOp.isEmpty())
+			    re.accept( this );
+			    if ( !stackOp.isEmpty() )
 					op = stackOp.pop();
 			    size--;
-			    if(size != 0){
+			    if ( size != 0 ) {
 			    	sub = obj;
-			    	if( size == 1 && valueRestriction != null ) {
+			    	if( size == 1 && valueRestriction != null && !classValueCond ) {
 			    		obj = "\"" + valueRestriction.toString() + "\"";
 			    	}
 			    	else {
@@ -614,25 +593,25 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
 			    	}
 			    }
 			}
-			objectsRestriction.add(obj);
+			objectsRestriction.add( obj );
 			sub = tempSub;
 		}		
 		else {
 			
 			int size = e.getComponents().size();
-			if(valueRestriction != null)
+			if ( valueRestriction != null && !classValueCond )
 				obj = "\"" + valueRestriction.toString() + "\"";
 			for ( final PathExpression re : e.getComponents() ) {
 			    			 
-			    if(op != null){
-					stackOp.push(op);
+			    if ( op != null ) {
+					stackOp.push( op );
 				}
-			    visit( re );
+			    re.accept( this );
 			    if(!stackOp.isEmpty())
 					op = stackOp.pop();
 			    size--;	    
-			    objectsRestriction.add(obj);
-			    if(size != 0 && valueRestriction == null){
+			    objectsRestriction.add( obj );
+			    if( size != 0 && valueRestriction == null ){
 			    	if ( blanks ) {
 			    		obj = "_:o" + ++count;
 			    	}
@@ -642,14 +621,14 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
 			    }
 			}		
 		}
-		if(stackOp.isEmpty()) {
-			if(op == Constructor.NOT)
+		if ( stackOp.isEmpty() ) {
+			if ( op == Constructor.NOT )
 				stackBGP.clear();
-			while (!stackBGP.empty()){	    		
-	    		listBGP.add(stackBGP.pop());	    		
+			while ( !stackBGP.empty() ) {	    		
+	    		listBGP.add( stackBGP.pop() );	    		
 	    	}
 		}
-		op = null;
+		//op = null;
 		if ( blanks ) {
     		obj = "_:o" + ++count;
     	}
@@ -657,85 +636,66 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
     		obj = "?o" + ++count;
     	}
     }
-    
-    // DONE
-    public void visit(final PropertyRestriction e) throws AlignmentException {
-    	if ( e instanceof PropertyValueRestriction ) visit( (PropertyValueRestriction)e );
-		else if ( e instanceof PropertyDomainRestriction ) visit( (PropertyDomainRestriction)e );
-		else if ( e instanceof PropertyTypeRestriction ) visit( (PropertyTypeRestriction)e );
-		else throw new AlignmentException( "Cannot dispatch ClassExpression "+e );
-    	//resetVariablesName();    
-    }
-	
-    // DONE
-    public void visit(final PropertyValueRestriction c) throws AlignmentException {
-    	
-    	if(c.getComparator().getURI().equals( Comparator.EQUAL.getURI())){    		
+
+    public void visit( final PropertyValueRestriction c ) throws AlignmentException {
+    	String str = "";
+    	if ( c.getComparator().getURI().equals( Comparator.EQUAL.getURI() ) ) {    		
     		strBGP += sub + " ?p ";
     		strBGP_Or = sub + " ?p ";
-    		visit( c.getValue() );
+    		c.getValue().accept( this );
     		strBGP += "\"" + value + "\" ." + NL;
     		strBGP_Or += "\"" + value + "\" ." + NL;    		    		
     	}
-    	else if(c.getComparator().getURI().equals( Comparator.GREATER.getURI())){    		
+    	else if ( c.getComparator().getURI().equals( Comparator.GREATER.getURI() ) ) {    		
     		strBGP += sub + " ?p " + obj + " ." + NL;
     		strBGP_Or = sub + " ?p " + obj + " ." + NL;
 			
-    		String str = "FILTER (xsd:" + uriType + "(" + obj + ") > ";
+    		str = "FILTER (xsd:" + uriType + "(" + obj + ") > ";
     		flagRestriction = 1;
-    		visit( c.getValue() );
+    		c.getValue().accept( this );
     		flagRestriction = 0;
-			str += "\"" + value + "\")" + NL;
-			while(countInList > listCond.size())
-				listCond.add("");
-			if(countInList>0)
-				listCond.add(countInList-1, str);
-			else
-				listCond.add(countInList, str);
-			strBGP += str;
+			str += "\"" + value + "\")" + NL;			
     	}
-    	else if(c.getComparator().getURI().equals( Comparator.LOWER.getURI())){    		
+    	else if ( c.getComparator().getURI().equals( Comparator.LOWER.getURI() ) ) {    		
     		strBGP += sub + " ?p " + obj + " ." + NL;    		
     		strBGP_Or = sub + " ?p " + obj + " ." + NL;
 			
-    		String str = "FILTER (xsd:" + uriType + "(" + obj + ") < ";
+    		str = "FILTER (xsd:" + uriType + "(" + obj + ") < ";
     		flagRestriction = 1;
-    		visit( c.getValue() );
+    		c.getValue().accept( this );
     		flagRestriction = 0;
 			str += "\"" + value + "\")" + NL;
-			while(countInList > listCond.size())
-				listCond.add("");
-			if(countInList>0)
-				listCond.add(countInList-1, str);
-			else
-				listCond.add(countInList, str);
-			strBGP += str;
     	}
+    	while ( countInList > listCond.size() )
+			listCond.add( "" );
+		if ( countInList>0 )
+			listCond.add( countInList-1, str );
+		else
+			listCond.add( countInList, str );
+		strBGP += str;
     	stackBGP.push(strBGP_Or);
     	//else throw new AlignmentException( "Cannot dispatch Comparator "+c );
     }
 
-    // DONE
-    public void visit(final PropertyDomainRestriction c) throws AlignmentException {
+    public void visit( final PropertyDomainRestriction c ) throws AlignmentException {
     	flagRestriction = 1;
 		strBGP += sub + " ?p " + obj + " ." + NL;    		
 		strBGP_Or = sub + " ?p " + obj + " ." + NL;		
 
-    	visit( c.getDomain() );
+		c.getDomain().accept( this );
     	
     	flagRestriction = 0;
 	
     }
 
-    // DONE
-    public void visit(final PropertyTypeRestriction c) throws AlignmentException {
+    public void visit( final PropertyTypeRestriction c ) throws AlignmentException {
     	
     	String str = "FILTER (datatype(" + objectsRestriction + ") = ";
 		
 		if ( !objectsRestriction.isEmpty() ) {
 			Iterator<String> listObj = objectsRestriction.iterator();
 			int size = objectsRestriction.size();
-			if (size > 0) {
+			if ( size > 0 ) {
 				increaseIndent();
 				str = "FILTER (datatype(" + listObj.next() + ") = ";				
 				visit( c.getType() );
@@ -747,55 +707,46 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
 				str += "xsd:" + datatype;
 			}
 			str += ")" + NL;
-			while(countInList > listCond.size())
-				listCond.add("");
-			if(countInList>0)
-				listCond.add(countInList-1, str);
+			while ( countInList > listCond.size() )
+				listCond.add( "" );
+			if( countInList>0 )
+				listCond.add( countInList-1, str );
 			else
-				listCond.add(countInList, str);
+				listCond.add( countInList, str );
 			strBGP += str;
 		}
 		objectsRestriction.clear();
     }
     
-    // DONE
-    public void visit( final RelationExpression e ) throws AlignmentException {
-    	if ( e instanceof RelationId ) visit( (RelationId)e );
-		else if ( e instanceof RelationRestriction ) visit( (RelationRestriction)e );
-		else if ( e instanceof RelationConstruction ) visit( (RelationConstruction)e );
-		else throw new AlignmentException( "Cannot dispatch ClassExpression "+e );
-    }
-	
-    // DONE
     public void visit( final RelationId e ) throws AlignmentException {
 		if ( e.getURI() != null ) {
 			String prefix = getPrefixDomain(e.getURI());
     		String tag = getPrefixName(e.getURI());
     		String shortCut;
-    		if(!prefixList.containsKey(prefix)){
+    		if ( !prefixList.containsKey(prefix) ) {
     			shortCut = getNamespace();
-    			prefixList.put(prefix, shortCut);
+    			prefixList.put( prefix, shortCut );
     		}
     		else {
-    			shortCut = prefixList.get(prefix);
+    			shortCut = prefixList.get( prefix );
     		}
 			strBGP += sub + " " + shortCut + ":"+ tag + "";
 			String str = sub + " " + shortCut + ":"+ tag + "";
 		    
-		    if (op == Constructor.TRANSITIVE){
+		    if ( op == Constructor.TRANSITIVE ) {
 		    	strBGP += "*";
 		    	str += "*";
 		    }
 		    	
-		    if(op == null && valueRestriction != null)
+		    if ( op == null && valueRestriction != null && !classValueCond )
 	    		obj = valueRestriction.toString();
 	    	
 		    strBGP += " " + obj + " ." + NL;
 		    str += " " + obj + " ." + NL;
 		    
-		    if (op != Constructor.NOT) {
+		    if ( op != Constructor.NOT ) {
 				Stack<String> tempStack = new Stack<String>();
-				if (stackBGP.isEmpty()){
+				if ( stackBGP.isEmpty() ){
 					strBGP_Or = str;
 					tempStack.push(strBGP_Or);
 				}
@@ -803,36 +754,35 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
 					while (!stackBGP.isEmpty()){
 						strBGP_Or = stackBGP.pop();
 						strBGP_Or += str;
-						tempStack.push(strBGP_Or);
+						tempStack.push( strBGP_Or );
 					}						
 				}
-				while (!tempStack.isEmpty()){
-					stackBGP.push(tempStack.pop());
+				while ( !tempStack.isEmpty() ) {
+					stackBGP.push( tempStack.pop() );
 				}
 			}
 		}
     }
 
-    // DONE
     public void visit( final RelationConstruction e ) throws AlignmentException {
 		
 		op = e.getOperator();
 
-		if (op == Constructor.OR){			
+		if ( op == Constructor.OR )  {			
 			int size = e.getComponents().size();
 			Stack<String> tempStack = new Stack<String>();
 			Stack<String> tempResult = new Stack<String>();
-			while(!stackBGP.empty()){
+			while ( !stackBGP.empty() ) {
 		    	tempStack.push(stackBGP.pop());		    	
 		    }
-			if(valueRestriction != null)
+			if ( valueRestriction != null && !classValueCond )
 				obj = valueRestriction.toString();
 			String temp = obj;
 			for ( final PathExpression re : e.getComponents() ) {
 			    writer.print(linePrefix);
 			    strBGP += "{" + NL;
-			    if(op != null){
-					stackOp.push(op);
+			    if ( op != null ) {
+					stackOp.push( op );
 				}
 			    stackBGP.clear();
 			    if(!tempStack.empty()){
@@ -840,63 +790,64 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
 			    		stackBGP.push(tempStack.get(i));
 			    }
 			    countInList++;
-			    visit( re );
-			    if(op == Constructor.NOT){
+			    re.accept( this );
+			    if ( op == Constructor.NOT ) {
 			    	stackBGP.clear();
 			    }
-			    if(!stackOp.isEmpty())
+			    if ( !stackOp.isEmpty() )
 					op = stackOp.pop();
 			    
-			    while(!stackBGP.empty()){
-			    	tempResult.push(stackBGP.pop());
+			    while ( !stackBGP.empty() ) {
+			    	tempResult.push( stackBGP.pop() );
 			    }
 			    obj = temp;
 			    size--;
-			    if(size != 0)
+			    if ( size != 0 )
 			    	strBGP += "}" + "UNION " + NL;
 			    else
 			    	strBGP += "}" + NL;
 			}
-			while(!tempResult.empty()){
-				stackBGP.push(tempResult.pop());
+			while ( !tempResult.empty() ) {
+				stackBGP.push( tempResult.pop() );
 		    }
-			objectsRestriction.add(obj);
+			objectsRestriction.add( obj );
 		}
-		else if (op == Constructor.NOT){			
+		else if ( op == Constructor.NOT ) {			
 			for ( final PathExpression re : e.getComponents() ) {
 				strBGP += "MINUS {" + NL;
-			    if(op != null){
-					stackOp.push(op);
+			    if ( op != null ) {
+					stackOp.push( op );
 				}
-			    visit( re );
-			    if(!stackOp.isEmpty())
+			    re.accept( this );
+			    if( !stackOp.isEmpty() )
 					op = stackOp.pop();
 			    strBGP += "}" + NL;
 			}			
 		}
-		else if (op == Constructor.COMP){
+		else if ( op == Constructor.COMP ) {
 			int size = e.getComponents().size();
 			String temp = sub;
 			for ( final PathExpression re : e.getComponents() ) {			   
-			    if(op != null){
-					stackOp.push(op);
+			    if ( op != null ) {
+					stackOp.push( op );
 				}
-			    visit( re );
-			    if(!stackOp.isEmpty())
+			    re.accept( this );
+			    if( !stackOp.isEmpty() )
 					op = stackOp.pop();
 			    size--;
-			    if(size != 0) {
+			    if( size != 0 ) {
 			    	sub = obj;
-			    	if(size == 1 && valueRestriction != null)
+			    	if ( size == 1 && valueRestriction != null && !classValueCond ) {
 			    		obj = valueRestriction.toString();
+			    	}
 			    	else {
 			    		if ( blanks ) {
 				    		obj = "_:o" + ++count;
 				    	}
 				    	else {
-				    		obj = "?o" + ++count;
-				    		objectsRestriction.add(obj);
-				    	}			    		
+				    		obj = "?o" + ++count;				    		
+				    	}
+			    		objectsRestriction.add( obj );
 			    	}
 			    					    	
 			    }			    
@@ -904,44 +855,43 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
 			
 			sub = temp;
 		}
-		else if (op == Constructor.INVERSE){
+		else if ( op == Constructor.INVERSE ) {
 			String tempSub = sub;
 			for ( final PathExpression re : e.getComponents() ) {
-			    writer.print(linePrefix);			 
 			    String temp = sub;
 			    sub = obj;
 			    obj = temp;
-			    if(op != null){
-					stackOp.push(op);
+			    if( op != null ) {
+					stackOp.push( op );
 				}
-			    visit( re );
-			    if(!stackOp.isEmpty())
+			    re.accept( this );
+			    if ( !stackOp.isEmpty() )
 					op = stackOp.pop();
 			    sub = tempSub;
 			}
 		}
-		else if (op == Constructor.SYMMETRIC){					
+		else if ( op == Constructor.SYMMETRIC ) {					
 			String tempSub = sub;
 			for ( final PathExpression re : e.getComponents() ) {
 			    strBGP += "{" + NL;
-			    if(op != null){
+			    if ( op != null ) {
 					stackOp.push(op);
 				}
-			    visit( re );
-			    if(!stackOp.isEmpty())
+			    re.accept( this );
+			    if( !stackOp.isEmpty() )
 					op = stackOp.pop();
-			    objectsRestriction.add(obj);
+			    objectsRestriction.add( obj );
 			    String temp = sub;
 			    sub = obj;
 			    obj = temp;
 			    strBGP += "} UNION {" + NL;
-			    if(op != null){
+			    if( op != null ) {
 					stackOp.push(op);
 				}
-			    visit( re );
+			    re.accept( this );
 			    if(!stackOp.isEmpty())
 					op = stackOp.pop();
-			    objectsRestriction.add(obj);
+			    objectsRestriction.add( obj );
 			    strBGP +="}" + NL;
 			    
 			}
@@ -952,19 +902,19 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
 			    if(op != null){
 					stackOp.push(op);
 				}
-			    visit( re );	
+			    re.accept( this );
 			    if(!stackOp.isEmpty())
 					op = stackOp.pop();
 			}
 		}
-		else if (op == Constructor.REFLEXIVE){						
+		else if ( op == Constructor.REFLEXIVE ) {						
 			String str = obj;
 			for ( final PathExpression re : e.getComponents() ) {			    		    
-			    if(op != null){
-					stackOp.push(op);
+			    if ( op != null ) {
+					stackOp.push( op );
 				}
 			    obj = sub;
-			    visit( re );
+			    re.accept( this );
 			    obj = str;
 			    if(!stackOp.isEmpty())
 					op = stackOp.pop();
@@ -973,19 +923,19 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
 		else {
 			
 			int size = e.getComponents().size();
-			if(valueRestriction != null)
+			if ( valueRestriction != null && !classValueCond )
 				obj = valueRestriction.toString();
 			for ( final PathExpression re : e.getComponents() ) {
 						 
-			    if(op != null){
-					stackOp.push(op);
+			    if ( op != null ) {
+					stackOp.push( op );
 				}
-			    visit( re );
-			    if(!stackOp.isEmpty())
+			    re.accept( this );
+			    if ( !stackOp.isEmpty() )
 					op = stackOp.pop();
 			    size--;
-			    objectsRestriction.add(obj);
-			    if(size != 0 && valueRestriction == null){
+			    objectsRestriction.add( obj );
+			    if ( size != 0 && valueRestriction == null ) {
 			    	if ( blanks ) {
 			    		obj = "_:o" + ++count;
 			    	}
@@ -996,14 +946,14 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
 			}		
 		}
 		
-		if(stackOp.isEmpty()) {
-			if(op == Constructor.NOT)
+		if ( stackOp.isEmpty() ) {
+			if ( op == Constructor.NOT )
 				stackBGP.clear();
-			while (!stackBGP.empty()){	    		
-	    		listBGP.add(stackBGP.pop());	    		
+			while ( !stackBGP.empty() ) {	    		
+	    		listBGP.add(stackBGP.pop() );	    		
 	    	}
 		}
-		op = null;
+		//op = null;
 		if ( blanks ) {
     		obj = "_:o" + ++count;
     	}
@@ -1011,105 +961,69 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito
     		obj = "?o" + ++count;
     	}
     }
-    
-    // DONE
-    public void visit( final RelationRestriction e ) throws AlignmentException {
-		if ( e instanceof RelationCoDomainRestriction ) visit( (RelationCoDomainRestriction)e );
-		else if ( e instanceof RelationDomainRestriction ) visit( (RelationDomainRestriction)e );
-		else throw new AlignmentException( "Cannot dispatch ClassExpression "+e );
-		//resetVariablesName();
-    }
 	
-    // DONE
     public void visit(final RelationCoDomainRestriction c) throws AlignmentException {
     	flagRestriction = 1;		
     	
-    	visit( c.getCoDomain() );
+    	c.getCoDomain().accept( this );
     	
     	flagRestriction = 0;
     }
 
-    // DONE
     public void visit(final RelationDomainRestriction c) throws AlignmentException {
 
     	flagRestriction = 1;
 		
 		strBGP += sub + " ?p " + obj + " ." + NL;    		
 		
-    	visit( c.getDomain() );
+		c.getDomain().accept( this );
     	
     	flagRestriction = 0;
     }
-    
-    // DONE
-    public void visit( final InstanceExpression e ) throws AlignmentException {
-	if ( e instanceof InstanceId ) visit( (InstanceId)e );
-	else throw new AlignmentException( "Cannot handle InstanceExpression "+e );
-    }
 
-    // DONE+TESTED
     public void visit( final InstanceId e ) throws AlignmentException {
 		if ( e.getURI() != null ) {
-			String prefix = getPrefixDomain(e.getURI());
-    		String tag = getPrefixName(e.getURI());
+			String prefix = getPrefixDomain( e.getURI() );
+    		String tag = getPrefixName( e.getURI() );
     		String shortCut;
-    		if(!prefixList.containsKey(prefix)){
+    		if ( !prefixList.containsKey( prefix) ){
     			shortCut = getNamespace();
-    			prefixList.put(prefix, shortCut);
+    			prefixList.put( prefix, shortCut );
     		}
     		else {
-    			shortCut = prefixList.get(prefix);
+    			shortCut = prefixList.get( prefix );
     		}
-			if(flagRestriction != 1)
+			if ( flagRestriction != 1 )
 				strBGP += shortCut + ":"+ tag + " ?p ?o1 ." +NL;
 			else
 				instance = shortCut + ":"+ tag;
 		}
     }
     
-    // DONE+TESTED
-    public void visit( final ValueExpression e ) throws AlignmentException {
-	if ( e instanceof InstanceExpression )visit( (InstanceExpression)e );	
-	else if ( e instanceof PathExpression )  {
-		if(isValueRestriction) 
-			return;
-		else
-			visit( (PathExpression)e );
-	}
-	else if ( e instanceof Apply )  visit( (Apply)e );
-	else if ( e instanceof Value )  visit( (Value)e );
-	else throw new AlignmentException( "Cannot dispatch ClassExpression "+e );
-    }
-
     public void visit( final Value e ) throws AlignmentException {
     	if (e.getType() != null) {
 	    	String str = e.getType().toString();
 	    	int index;
-	    	if (str.contains("#"))
+	    	if ( str.contains("#") )
 	    		index = str.lastIndexOf("#");
 	    	else
 	    		index = str.lastIndexOf("/");
-	    	uriType = str.substring(0, index+1);
+	    	uriType = str.substring( index+1 );
     	}
     	value = e.getValue();
     }
 	
-    public void visit( final Apply e ) throws AlignmentException {
+    public void visit( final Apply e ) throws AlignmentException {}
 
-    }
-
-    public void visit( final Transformation transf ) throws AlignmentException {
-
-    }
+    public void visit( final Transformation transf ) throws AlignmentException {}
 
-    // DONE
     public void visit( final Datatype e ) throws AlignmentException {
     	int index;
-    	if (e.getType().contains("#"))
+    	if ( e.getType().contains("#") )
     		index = e.getType().lastIndexOf("#");
     	else
     		index = e.getType().lastIndexOf("/");
-    	datatype = e.getType().substring(index+1);
+    	datatype = e.getType().substring( index+1 );
     }
 
 }
-- 
GitLab