本文整理汇总了Java中com.hp.hpl.jena.sparql.core.DatasetGraph.getDefaultGraph方法的典型用法代码示例。如果您正苦于以下问题:Java DatasetGraph.getDefaultGraph方法的具体用法?Java DatasetGraph.getDefaultGraph怎么用?Java DatasetGraph.getDefaultGraph使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.sparql.core.DatasetGraph
的用法示例。
在下文中一共展示了DatasetGraph.getDefaultGraph方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import com.hp.hpl.jena.sparql.core.DatasetGraph; //导入方法依赖的package包/类
@Override
public void load(
final SolrQueryRequest request,
final SolrQueryResponse response,
final ContentStream stream,
final UpdateRequestProcessor processor) throws Exception {
final PipedRDFIterator<Triple> iterator = new PipedRDFIterator<Triple>();
final StreamRDF inputStream = new PipedTriplesStream(iterator);
executor.submit(new Runnable() {
@Override
public void run() {
try {
RDFDataMgr.parse(
inputStream,
stream.getStream(),
RDFLanguages.contentTypeToLang(stream.getContentType()));
} catch (final IOException exception) {
throw new SolrException(ErrorCode.SERVER_ERROR, exception);
}
}
});
// Graph Store Protocol indicates the target graph URI separately.
// So the incoming Content-type here is one that maps "Triples Loader" but
// the indexed tuple could be a Quad.
final String graphUri = request.getParams().get(Names.GRAPH_URI_ATTRIBUTE_NAME);
final DatasetGraph dataset = new LocalDatasetGraph(request, response, null, null);
final Graph defaultGraph = graphUri == null
? dataset.getDefaultGraph()
: dataset.getGraph(NodeFactory.createURI(graphUri));
while (iterator.hasNext()) {
defaultGraph.add(iterator.next());
}
}
示例2: execute
import com.hp.hpl.jena.sparql.core.DatasetGraph; //导入方法依赖的package包/类
static void execute(DatasetGraph dsg, Op op, Context context) {
/*
Algebra.exec(op, dsg)
==>
QueryEngineFactory f = QueryEngineRegistry.findFactory(op, ds, null) ;
Plan plan = f.create(op, ds, BindingRoot.create(), null) ;
return plan.iterator() ;
*/
context = Context.setupContext(context, dsg) ;
OpExecutorFactory factory = QC.getFactory(context) ;
if ( factory == null )
factory = OpExecutor.stdFactory ;
ExecutionContext execCxt = new ExecutionContext(context, dsg.getDefaultGraph(), dsg, factory) ;
QueryIterator qIterRoot = OpExecutor.createRootQueryIterator(execCxt) ;
QueryIterator qIterPlan = QC.execute(op, qIterRoot, execCxt) ;
Plan plan = new PlanOp(op, null, qIterPlan) ;
runPlan(plan) ;
/*
Query query = null ;
Dataset dataset = null ;
QueryEngineFactory qefactory = null ;
@SuppressWarnings("resource")
QueryExecutionBase queryExecutionBase = new QueryExecutionBase(query, dataset, context, qefactory) ;
*/
}
示例3: accept
import com.hp.hpl.jena.sparql.core.DatasetGraph; //导入方法依赖的package包/类
public boolean accept(Query query, DatasetGraph dataset, Context context) {
return dataset.getDefaultGraph() instanceof GraphD2RQ;
}