protected final Representation getRepresentation(RDFWriterFactory factory, MediaType mediaType)
throws ResourceException
{
ServerConnection con = getConnection();
StatementPatternParams p = new StatementPatternParams(getRequest(), con.getValueFactory());
try {
ModelResult modelResult = getConnection().match(p.getSubject(), p.getPredicate(), p.getObject(),
p.isIncludeInferred(), p.getContext());
if (p.getOffset() > 0 || p.getLimit() > -1) {
Cursor<Statement> cursor = modelResult;
if (p.getOffset() > 0) {
cursor = new OffsetCursor<Statement>(cursor, p.getOffset());
}
if (p.getLimit() > -1) {
cursor = new LimitCursor<Statement>(cursor, p.getLimit());
}
modelResult = new ModelResultImpl(cursor);
}
ModelResultRepresentation result = new ModelResultRepresentation(modelResult, factory, mediaType);