
com.marklogic.semantics.sesame.client.MarkLogicBackgroundTupleResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of marklogic-sesame Show documentation
Show all versions of marklogic-sesame Show documentation
Adapter for using MarkLogic with the Sesame Framework
/*
* Copyright 2015-2016 MarkLogic Corporation
*
* 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 com.marklogic.semantics.sesame.client;
import org.openrdf.http.client.BackgroundTupleResult;
import org.openrdf.http.client.QueueCursor;
import org.openrdf.query.BindingSet;
import org.openrdf.query.QueryEvaluationException;
import org.openrdf.query.resultio.TupleQueryResultParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.InputStream;
/**
* wrapper on Sesame BackgroundTupleResult
*
* @author James Fuller
*/
class MarkLogicBackgroundTupleResult extends BackgroundTupleResult {
protected final Logger logger = LoggerFactory.getLogger(MarkLogicBackgroundGraphResult.class);
/**
* constructor
*
* @param parser
* @param in
*/
public MarkLogicBackgroundTupleResult(TupleQueryResultParser parser, InputStream in) {
super(parser, in);
}
/**
* constructor
*
* @param queue
* @param parser
* @param in
*/
public MarkLogicBackgroundTupleResult(QueueCursor queue, TupleQueryResultParser parser, InputStream in) {
super(queue, parser, in);
}
/**
* wrap exception to return false instead of throwing error, debug log
*
*/
@Override
public boolean hasNext()
throws QueryEvaluationException
{
try {
return super.hasNext();
}catch(Exception e){
logger.debug("hasNext() stream closed exception",e);
return false;
}
}
/**
* wrap exception, debug log
*
*/
@Override
protected void handleClose() throws QueryEvaluationException {
try {
super.handleClose();
}catch(Exception e){
logger.debug("handleClose() stream closed exception",e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy