I am trying to construct a long query using the rdf4j library and would like to use the count function that is available with SPARQL.
The original SPARQL query looks like this:
SELECT (COUNT(?letter) AS ?count) WHERE { \
?letter a :Letter . \
?letter :writtenBy :John . \
?letter :writtenOn ?date . \
FILTER(?date > NOW() && }
This is what I have so far using the rdf4j library
GraphPattern longPattern = GraphPatterns.tp(letter, ex.iri("a"), ex.iri("Letter")).
and(GraphPatterns.tp(letter, ex.iri("writtenBy"), ex.iri("John"))).
and(GraphPatterns.tp(letter, ex.iri("writtenOn"), date));
How can I implement the Count and use the NOW() functionality of sparql? I know there is a filter method but I don't know how to use the NOW() with it. All of the variables (letter, date) and a select query have been initialised within java using SparqlBuilder.