org.mindswap.pellet.jena.graph.query.BooleanQueryHandler Maven / Gradle / Ivy
The newest version!
// Copyright (c) 2006 - 2008, Clark & Parsia, LLC.
// This source code is available under the terms of the Affero General Public License v3.
//
// Please see LICENSE.txt for full license terms, including the availability of proprietary exceptions.
// Questions, comments, or requests for clarification: [email protected]
package org.mindswap.pellet.jena.graph.query;
import org.mindswap.pellet.KnowledgeBase;
import org.mindswap.pellet.jena.PelletInfGraph;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.graph.Triple;
import com.hp.hpl.jena.util.iterator.ExtendedIterator;
import com.hp.hpl.jena.util.iterator.NullIterator;
import com.hp.hpl.jena.util.iterator.SingletonIterator;
abstract class BooleanQueryHandler extends TripleQueryHandler {
@Override
public ExtendedIterator find(KnowledgeBase kb, PelletInfGraph pellet, Node subj, Node pred, Node obj) {
return contains( kb, pellet.getLoader(), subj, pred, obj )
? new SingletonIterator( Triple.create( subj, pred, obj ) )
: NullIterator.instance();
}
}