
org.ontoware.rdfreactor.runtime.OOQueryResultTableImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rdfreactor.runtime Show documentation
Show all versions of rdfreactor.runtime Show documentation
RDFReactor creates domain-specific, type-safe Java classes which
act as a view over domain-free, loosely typed RDF instances.
This library needs to be shipped together with generated
classes.
The newest version!
package org.ontoware.rdfreactor.runtime;
import java.util.List;
import java.util.Map;
import org.ontoware.aifbcommons.collection.ClosableIterator;
import org.ontoware.rdf2go.exception.ModelRuntimeException;
import org.ontoware.rdf2go.model.Model;
import org.ontoware.rdf2go.model.QueryResultTable;
public class OOQueryResultTableImpl implements OOQueryResultTable {
/**
*
*/
private static final long serialVersionUID = 1L;
private Model m;
private Map> returnTypes;
private QueryResultTable resultTable;
public OOQueryResultTableImpl(Model m, Map> returnTypes, String sparqlSelectQuery)
throws ModelRuntimeException {
this.resultTable = m.sparqlSelect(sparqlSelectQuery);
if (!sparqlSelectQuery.contains("SELECT")) {
throw new ModelRuntimeException("The given query is not a SELECT query");
}
// else
this.m = m;
this.returnTypes = returnTypes;
}
public List getVariables() {
return this.resultTable.getVariables();
}
public ClosableIterator iterator() {
return new SparqlIterator(this, this.resultTable.iterator());
}
public Model getModel() {
return this.m;
}
public Class> getReturnType(String varname) {
return this.returnTypes.get(varname);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy