title: Multiple filters in SELECT query using rd4j
body: <p>I am trying to filter through the start date and end date using multiple filters within one query.</p>
  <p>I want to find how many terms are within 3 months of ending, so the SPARQL query I am trying to recreate is:</p>
  <pre><code>SELECT (COUNT(?term) AS ?count) WHERE { \
      ?term a :Term . \
      ?term :startDate ?startDate . \
      ?term :endDate ?endDate . \
      FILTER(?endDate &lt; NOW() + &quot;P3M&quot;^^xsd:duration &amp;&amp; ?endDate &gt;= NOW() &amp;&amp; ?startDate &lt; NOW()) }
  </code></pre>
  <p>This is what I have so far, and I'm also not sure how to include the +3months within the query.
  The graph pattern and other variables have been initialised and are not causing a problem.</p>
  <pre><code>Variable count = SparqlBuilder.var(&quot;count&quot;);
  Aggregate countAgg = Expressions.count(contract);
  Projection select = SparqlBuilder.select(countAgg.as(count));
  Expression&lt;?&gt; nowFunc = Expressions.function(SparqlFunction.NOW );
  
  
  
  SelectQuery activeQuery = Queries.SELECT().prefix(lg).
                  select(countAgg.as(count)).
                  where((activePattern.filter(Expressions.gte(endDate, nowFunc))).and(activePattern.filter(Expressions.lt(startDate, nowFunc))));
  </code></pre>
  <p>I get a &quot;java.lang.StackOverflowError&quot;. I thought I'd try to include the +3 months by using the expression below, but it doesn't work as it is the function that returns the month of an argument.</p>
  <pre><code>Expression&lt;?&gt; threeMonths = Expressions.fucntion(SparqlFunction.MONTH):
  </code></pre>
  <p>EDIT (20/05/2020): The stack overflow error is not the problem, and has been tested. It is being thrown because the query is not being built properly, and both filters are not being applied. The main issue is I can't figure out how to apply two filters within one query. This is the code that has been included:</p>
  <pre><code>SelectQuery activeQuery = Queries.SELECT().prefix(lg).select(countAgg.as(count)).where(activePattern.filter(Expressions.gt(endDate, nowFunc)), activePattern.filter(Expressions.lt(startDate, nowFunc)));
  </code></pre>
  <p>and this is query that shows up:</p>
  <pre><code>SELECT ( COUNT( ?term ) AS ?count )
  WHERE { ?term a Term .
  ?term :contractEndDate ?endDate .
  ?term :contractStartDate ?startDate .
  FILTER ( ?startDate &lt; NOW() ) }
  </code></pre>