// Convert the named graphs' names into URILiterals
// to be applicable
// later on
for (final String name : this.root.namedGraphs) {
final Indices indices = this.root.dataset
.getNamedGraphIndices(LiteralFactory
.createURILiteralWithoutLazyLiteral(name));
final URILiteral rdfName = indices.getRdfName();
if (namedGraphs.contains(rdfName)) {
final TriplePattern ztp = new TriplePattern(
graphConstraint
.equals(tp.getPos(0)) ? rdfName
: tp.getPos(0),
graphConstraint
.equals(tp.getPos(1)) ? rdfName
: tp.getPos(1),
graphConstraint
.equals(tp.getPos(2)) ? rdfName
: tp.getPos(2));
final Triple zkey = getKey(ztp, null);
final Literal intermediateMax = this.getMaxLiteral(
(SixIndices) indices, zkey, pos);
if (intermediateMax != null
&& (max == null || max
.compareToNotNecessarilySPARQLSpecificationConform(intermediateMax) < 0)) {
max = intermediateMax;
}
}
}
}
// otherwise there might have been named graphs added
// during the evaluation
else {
// get all indices of named graphs and bind them to
// the graph constraint
final Collection<Indices> dataSetIndices = this.root.dataset
.getNamedGraphIndices();
if (dataSetIndices != null) {
for (final Indices indices : dataSetIndices) {
final TriplePattern ztp = new TriplePattern(
graphConstraint
.equals(tp.getPos(0)) ? indices
.getRdfName()
: tp.getPos(0),
graphConstraint
.equals(tp.getPos(1)) ? indices
.getRdfName()
: tp.getPos(1),
graphConstraint
.equals(tp.getPos(2)) ? indices
.getRdfName()
: tp.getPos(2));
final Triple zkey = getKey(ztp, null);
final Literal intermediateMax = this.getMaxLiteral(
(SixIndices) indices, zkey, pos);
if (intermediateMax != null
&& (max == null || max
.compareToNotNecessarilySPARQLSpecificationConform(intermediateMax) < 0)) {
max = intermediateMax;
}
}
}
}
}
// if the graph constraint is an URILiteral fetch the
// matching indices object
// but do not bind anything
else {
for (final Indices indices : indicesC) {
final URILiteral rdfName = indices.getRdfName();
if (namedGraphs.contains(rdfName)) {
final Literal intermediateMax = this.getMaxLiteral(
(SixIndices) indices, key, pos);
if (intermediateMax != null
&& (max == null || max