Added and modify codes for querying relations having specific attributes
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanElementAttributeQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanElementAttributeQuery.java
deleted file mode 100644
index a825ec3..0000000
--- a/src/main/java/de/ids_mannheim/korap/query/SpanElementAttributeQuery.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package de.ids_mannheim.korap.query;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.lucene.index.AtomicReaderContext;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.index.TermContext;
-import org.apache.lucene.search.spans.SpanQuery;
-import org.apache.lucene.search.spans.Spans;
-import org.apache.lucene.util.Bits;
-
-import de.ids_mannheim.korap.query.spans.ElementAttributeSpans;
-
-/** Span enumerations of elements having some specific attribute(s) or 
- * 	<em>not</em> having some attribute(s).
- * 
- * 	@author margaretha
- * */
-public class SpanElementAttributeQuery extends SimpleSpanQuery{
-	
-	boolean isMultipleAttributes;
-	
-	public SpanElementAttributeQuery(SpanElementQuery firstClause,
-			SpanAttributeQuery secondClause, boolean collectPayloads) {
-		super(firstClause, secondClause, collectPayloads);
-	}
-	
-	public SpanElementAttributeQuery(SpanElementQuery firstClause,
-			List<SpanQuery> secondClauses, boolean collectPayloads) {
-		super(firstClause, secondClauses, collectPayloads);
-		isMultipleAttributes = true;
-	}
-
-	@Override
-	public SimpleSpanQuery clone() {
-		SpanElementAttributeQuery sq;
-		if (!isMultipleAttributes){
-			sq = new SpanElementAttributeQuery( 
-					(SpanElementQuery) firstClause.clone(), 
-					(SpanAttributeQuery) secondClause.clone(), 
-					collectPayloads);
-		}
-		else {
-			List<SpanQuery> clauseList = new ArrayList<SpanQuery>();
-			SpanAttributeQuery saq;
-			for (SpanQuery q : this.clauseList ){
-				saq = (SpanAttributeQuery) q;
-				clauseList.add(saq.clone());
-			}
-			
-			sq = new SpanElementAttributeQuery(
-					(SpanElementQuery) firstClause.clone(), 
-					clauseList, 
-					collectPayloads);
-		}
-		return sq;
-	}
-
-	@Override
-	public Spans getSpans(AtomicReaderContext context, Bits acceptDocs,
-			Map<Term, TermContext> termContexts) throws IOException {
-		return null; //new ElementAttributeSpans(this, context, acceptDocs, termContexts);
-	}
-
-	@Override
-	public String toString(String field) {
-		
-		StringBuilder sb = new StringBuilder();
-		sb.append("spanElementAttribute");
-		sb.append("(");
-		sb.append(firstClause.toString(field));
-		sb.append(", ");
-		if (isMultipleAttributes){
-			sb.append("[");
-			
-			SpanQuery sq;
-			for (int i=0; i < clauseList.size(); i++){
-				sq = clauseList.get(i); 
-				sb.append(sq.toString(field));
-				
-				if (i < clauseList.size() -1)
-					sb.append(", ");
-			}
-			
-			sb.append("]");
-		}
-		else {
-			sb.append(secondClause.toString(field));
-		}
-		sb.append(")");
-		return sb.toString();
-	}
-}
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java
index 7352efc..e5c0613 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanWithAttributeQuery.java
@@ -12,7 +12,7 @@
 import org.apache.lucene.search.spans.Spans;
 import org.apache.lucene.util.Bits;
 
-import de.ids_mannheim.korap.query.spans.ElementAttributeSpans;
+import de.ids_mannheim.korap.query.spans.SpansWithAttribute;
 import de.ids_mannheim.korap.query.spans.ElementSpans;
 import de.ids_mannheim.korap.query.spans.RelationSpans;
 
@@ -100,11 +100,11 @@
 		Spans spans = this.getFirstClause().getSpans(context, acceptDocs, termContexts);
 		
 		if (type.equals("spanElementWithAttribute")){			
-			return new ElementAttributeSpans(this, (ElementSpans) spans, 
+			return new SpansWithAttribute(this, (ElementSpans) spans, 
 					context, acceptDocs, termContexts);
 		}
 		
-		return new ElementAttributeSpans(this, (RelationSpans) spans,
+		return new SpansWithAttribute(this, (RelationSpans) spans,
 				context, acceptDocs, termContexts);
 	}
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java
index 45774b9..6789382 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java
@@ -24,7 +24,7 @@
  *
  * Use copyFrom instead of clone
  */
-public class ElementSpans extends WithIdSpans {
+public class ElementSpans extends SpansWithId {
 
 	private List<CandidateElementSpans> candidateList;
 	private int currentDoc, currentPosition;
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java
index 375c840..72d59c8 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java
@@ -38,7 +38,7 @@
  * 
  * 	@author margaretha
  * */
-public class RelationSpans extends WithIdSpans{
+public class RelationSpans extends SpansWithId{
 
 	//short relationId;
 	int targetStart, targetEnd;
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ElementAttributeSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithAttribute.java
similarity index 93%
rename from src/main/java/de/ids_mannheim/korap/query/spans/ElementAttributeSpans.java
rename to src/main/java/de/ids_mannheim/korap/query/spans/SpansWithAttribute.java
index 31fc6c7..94f3590 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ElementAttributeSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithAttribute.java
@@ -16,8 +16,8 @@
 import de.ids_mannheim.korap.query.SpanAttributeQuery;
 import de.ids_mannheim.korap.query.SpanWithAttributeQuery;
 
-/** Span enumeration of elements that have some attribute and/or do <em>not</em> 
- * 	have some attributes. This class handles <em>and</em> operation on attributes.
+/** Span enumeration of element or relation spans having and/or <em>not</em> 
+ * 	having some attributes. This class handles <em>and</em> operation on attributes.
  * 
  * 	Use SpanOrQuery to perform <em>or</em> operation on attributes, i.e. choose 
  * 	between two elements with some attribute constraints. Note that the attribute 
@@ -25,19 +25,19 @@
  *
  * 	@author margaretha
  * */
-public class ElementAttributeSpans extends SimpleSpans{
+public class SpansWithAttribute extends SimpleSpans{
 	
-	private WithIdSpans withAttributeSpans;
+	private SpansWithId withAttributeSpans;
 	private List<AttributeSpans> attributeList;
 	private List<AttributeSpans> notAttributeList;
 	
-	protected Logger logger = LoggerFactory.getLogger(ElementAttributeSpans.class);
+	protected Logger logger = LoggerFactory.getLogger(SpansWithAttribute.class);
 
         // This advices the java compiler to ignore all loggings
         public static final boolean DEBUG = false;	
 
-	public ElementAttributeSpans(SpanWithAttributeQuery spanWithAttributeQuery,
-			WithIdSpans withIdSpans,
+	public SpansWithAttribute(SpanWithAttributeQuery spanWithAttributeQuery,
+			SpansWithId withIdSpans,
 			AtomicReaderContext context, Bits acceptDocs,
 			Map<Term, TermContext> termContexts) throws IOException {
 		super(spanWithAttributeQuery, context, acceptDocs, termContexts);		
@@ -224,7 +224,7 @@
 	/** Advance the element or attribute spans to be in the same doc 
 	 * 	and start position.
 	 * */
-	private boolean ensureSamePosition(WithIdSpans spans,
+	private boolean ensureSamePosition(SpansWithId spans,
 			AttributeSpans attributes) throws IOException {
 		
 		while (hasMoreSpans && ensureSameDoc(spans, attributes)){
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/WithIdSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithId.java
similarity index 84%
rename from src/main/java/de/ids_mannheim/korap/query/spans/WithIdSpans.java
rename to src/main/java/de/ids_mannheim/korap/query/spans/SpansWithId.java
index 76ee1cc..a2aa59a 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/WithIdSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithId.java
@@ -11,18 +11,18 @@
 import de.ids_mannheim.korap.query.SpanElementQuery;
 import de.ids_mannheim.korap.query.SpanRelationQuery;
 
-public abstract class WithIdSpans extends SimpleSpans{
+public abstract class SpansWithId extends SimpleSpans{
 
 	protected short spanId;
 	protected boolean hasSpanId = false; // A dummy flag
 	
-	public WithIdSpans(SpanElementQuery spanElementQuery,
+	public SpansWithId(SpanElementQuery spanElementQuery,
 			AtomicReaderContext context, Bits acceptDocs,
 			Map<Term, TermContext> termContexts) throws IOException {
 		super(spanElementQuery, context, acceptDocs, termContexts);
 	}
 	
-	public WithIdSpans(SpanRelationQuery spanRelationQuery,
+	public SpansWithId(SpanRelationQuery spanRelationQuery,
 			AtomicReaderContext context, Bits acceptDocs,
 			Map<Term, TermContext> termContexts) throws IOException {
 		super(spanRelationQuery, context, acceptDocs, termContexts);