}
private List<TripleRelation> selectedTripleRelations() {
URIMakerRule rule = new URIMakerRule();
List<TripleRelation> sortedTripleRelations = rule.sortRDFRelations(tripleRelations);
URIMakerRuleChecker subjectChecker = rule.createRuleChecker(triplePattern.getSubject());
URIMakerRuleChecker predicateChecker = rule.createRuleChecker(triplePattern.getPredicate());
URIMakerRuleChecker objectChecker = rule.createRuleChecker(triplePattern.getObject());
List<TripleRelation> result = new ArrayList<TripleRelation>();
for (TripleRelation tripleRelation: sortedTripleRelations) {
TripleRelation selectedTripleRelation = tripleRelation.selectTriple(triplePattern);
if (selectedTripleRelation != null
&& subjectChecker.canMatch(tripleRelation.nodeMaker(TripleRelation.SUBJECT))
&& predicateChecker.canMatch(tripleRelation.nodeMaker(TripleRelation.PREDICATE))
&& objectChecker.canMatch(tripleRelation.nodeMaker(TripleRelation.OBJECT))) {
subjectChecker.addPotentialMatch(tripleRelation.nodeMaker(TripleRelation.SUBJECT));
predicateChecker.addPotentialMatch(tripleRelation.nodeMaker(TripleRelation.PREDICATE));
objectChecker.addPotentialMatch(tripleRelation.nodeMaker(TripleRelation.OBJECT));
TripleRelation r = new JoinOptimizer(selectedTripleRelation).optimize();
if (limitPerRelation != Relation.NO_LIMIT) {
r = r.limit(limitPerRelation);
}
result.add(r);