sherpa.client.SHPSolutions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sherpa-java Show documentation
Show all versions of sherpa-java Show documentation
Defines a SPARQL client API implementation using the SHERPA fast protocol for client-server communication. Requires a SHERPA-enabled server.
/*
* Copyright 2011 Revelytix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sherpa.client;
/**
* Represents a Solutions implementation.
*/
import java.io.IOException;
import java.net.URI;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import sherpa.protocol.BNode;
import sherpa.protocol.IRI;
import sherpa.protocol.PlainLiteral;
import sherpa.protocol.TypedLiteral;
import spark.api.Solutions;
import spark.api.rdf.RDFNode;
import spark.spi.Conversions;
import spark.spi.StreamingSolutions;
import spark.spi.rdf.BlankNodeImpl;
import spark.spi.rdf.NamedNodeImpl;
import spark.spi.rdf.PlainLiteralImpl;
import spark.spi.rdf.TypedLiteralImpl;
public class SHPSolutions extends StreamingSolutions implements Solutions {
private final QueryExecution query;
/**
* Construct an SHPSolutions where
* @param command
* @param query
*/
public SHPSolutions(SHPCommand command, QueryExecution query) {
super(command, query.getVars());
if (vars == null) throw new IllegalStateException("SHPSolutions constructed with un-initialized QueryExecution");
this.query = query;
}
@Override
protected Map fetchNext() {
List