本文整理了Java中org.apache.jena.query.Query.getNamedGraphURIs
方法的一些代码示例,展示了Query.getNamedGraphURIs
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getNamedGraphURIs
方法的具体详情如下:
包路径:org.apache.jena.query.Query
类名称:Query
方法名:getNamedGraphURIs
[英]Return the list of URIs (strings) for the named graphs (FROM NAMED clause)
[中]返回命名图的URI(字符串)列表(来自命名子句)
代码示例来源:origin: apache/jena
@Override
public void visitDatasetDecl(Query query)
{
x ^= query.getNamedGraphURIs().hashCode() ;
}
代码示例来源:origin: apache/jena
/** Return true if the query has either some graph
* URIs or some named graph URIs in its description.
* This does not mean these URIs will be used - just that
* they are noted as part of the query.
*/
public boolean hasDatasetDescription()
{
if ( getGraphURIs() != null && getGraphURIs().size() > 0 )
return true ;
if ( getNamedGraphURIs() != null && getNamedGraphURIs().size() > 0 )
return true ;
return false ;
}
代码示例来源:origin: TopQuadrant/shacl
public FromDataset(Dataset delegate, Query query) throws GraphNotFoundException {
super(delegate);
defaultGraphs = new HashSet<String>(query.getGraphURIs());
namedGraphs = new HashSet<String>(query.getNamedGraphURIs());
initDefaultModel();
}
代码示例来源:origin: ch.epfl.bluebrain.nexus.org.topbraid/shacl
public FromDataset(Dataset delegate, Query query) throws GraphNotFoundException {
super(delegate);
defaultGraphs = new HashSet<String>(query.getGraphURIs());
namedGraphs = new HashSet<String>(query.getNamedGraphURIs());
initDefaultModel();
}
代码示例来源:origin: ch.epfl.bluebrain.nexus.org.topbraid/shacl
public QueryExecution createQueryExecution(Query query, Dataset dataset, QuerySolution initialBinding) {
if(!query.getGraphURIs().isEmpty() || !query.getNamedGraphURIs().isEmpty()) {
dataset = new FromDataset(dataset, query);
}
if ( LOG_QUERIES ) {
// And the data - can be long.
// System.err.println("~~ ~~");
// RDFDataMgr.write(System.err, dataset.getDefaultModel(), Lang.TTL);
System.err.println("~~ ~~");
System.err.println(initialBinding);
System.err.println(query);
}
QueryExecution qexec = QueryExecutionFactoryFilter.get().create(query, dataset, initialBinding);
adjustQueryExecution(qexec);
return qexec;
}
代码示例来源:origin: TopQuadrant/shacl
public QueryExecution createQueryExecution(Query query, Dataset dataset, QuerySolution initialBinding) {
if(!query.getGraphURIs().isEmpty() || !query.getNamedGraphURIs().isEmpty()) {
dataset = new FromDataset(dataset, query);
}
if ( LOG_QUERIES ) {
// And the data - can be long.
// System.err.println("~~ ~~");
// RDFDataMgr.write(System.err, dataset.getDefaultModel(), Lang.TTL);
System.err.println("~~ ~~");
System.err.println(initialBinding);
System.err.println(query);
}
QueryExecution qexec = QueryExecutionFactoryFilter.get().create(query, dataset, initialBinding);
adjustQueryExecution(qexec);
return qexec;
}
代码示例来源:origin: apache/jena
@Override
public void setVars(Map<Var, Node> values) {
setVars(values, query.getNamedGraphURIs());
setVars(values, query.getGraphURIs());
}
代码示例来源:origin: apache/jena
@Override
public void visitDatasetDecl(Query query1)
{
boolean b1 = Lib.equalsListAsSet(query1.getGraphURIs(), query2.getGraphURIs()) ;
check("Default graph URIs", b1 ) ;
boolean b2 = Lib.equalsListAsSet(query1.getNamedGraphURIs(), query2.getNamedGraphURIs()) ;
check("Named graph URIs", b2 ) ;
}
代码示例来源:origin: apache/jena
/**
* Add all the dataset information from the handler argument.
* @param datasetHandler The handler to copy from.
*/
public void addAll(DatasetHandler datasetHandler) {
from(datasetHandler.query.getGraphURIs());
fromNamed(datasetHandler.query.getNamedGraphURIs());
}
代码示例来源:origin: org.apache.jena/jena-querybuilder
/**
* Add all the dataset information from the handler argument.
* @param datasetHandler The handler to copy from.
*/
public void addAll(DatasetHandler datasetHandler) {
from(datasetHandler.query.getGraphURIs());
fromNamed(datasetHandler.query.getNamedGraphURIs());
}
代码示例来源:origin: org.apache.jena/jena-querybuilder
@Override
public void setVars(Map<Var, Node> values) {
setVars(values, query.getNamedGraphURIs());
setVars(values, query.getGraphURIs());
}
代码示例来源:origin: apache/jena
/** Decide the dataset - this modifies the query
* If the query has a dataset description.
*/
@Override
protected DatasetGraph decideDataset(HttpAction action, Query query, String queryStringLog) {
DatasetGraph dsg = action.getActiveDSG() ;
DatasetDescription dsDesc = getDatasetDescription(action, query) ;
if ( dsDesc != null ) {
dsg = DynamicDatasets.dynamicDataset(dsDesc, dsg, false) ;
if ( query.hasDatasetDescription() ) {
query.getGraphURIs().clear() ;
query.getNamedGraphURIs().clear() ;
}
}
return dsg ;
}
}
代码示例来源:origin: org.apache.jena/jena-fuseki-core
/** Decide the dataset - this modifies the query
* If the query has a dataset description.
*/
@Override
protected DatasetGraph decideDataset(HttpAction action, Query query, String queryStringLog) {
DatasetGraph dsg = action.getActiveDSG() ;
DatasetDescription dsDesc = getDatasetDescription(action, query) ;
if ( dsDesc != null ) {
dsg = DynamicDatasets.dynamicDataset(dsDesc, dsg, false) ;
if ( query.hasDatasetDescription() ) {
query.getGraphURIs().clear() ;
query.getNamedGraphURIs().clear() ;
}
}
return dsg ;
}
}
代码示例来源:origin: apache/jena
@Override
public void visitDatasetDecl(Query query)
{
if ( query.getGraphURIs() != null && query.getGraphURIs().size() != 0 )
{
for ( String uri : query.getGraphURIs() )
{
out.print("FROM ") ;
out.print(FmtUtils.stringForURI(uri, query)) ;
out.newline() ;
}
}
if ( query.getNamedGraphURIs() != null && query.getNamedGraphURIs().size() != 0 )
{
for ( String uri : query.getNamedGraphURIs() )
{
// One per line
out.print("FROM NAMED ") ;
out.print(FmtUtils.stringForURI(uri, query)) ;
out.newline() ;
}
}
}
代码示例来源:origin: Galigator/openllet
protected Dataset createDataset()
{
if (_query.getGraphURIs().isEmpty() && _query.getNamedGraphURIs().isEmpty())
return DatasetFactory.create(new ArrayList<>(_graphURIs), new ArrayList<>(_namedGraphURIs));
else
return DatasetFactory.create(_query.getGraphURIs(), _query.getNamedGraphURIs());
}
代码示例来源:origin: apache/jena
/** Return a dataset description (FROM/FROM NAMED clauses) for the query. */
public DatasetDescription getDatasetDescription()
{
if ( ! hasDatasetDescription() )
return null;
DatasetDescription description = new DatasetDescription() ;
description.addAllDefaultGraphURIs(getGraphURIs()) ;
description.addAllNamedGraphURIs(getNamedGraphURIs()) ;
return description ;
}
代码示例来源:origin: apache/jena
private DatasetGraph dynamicDataset(HttpAction action, Query query, DatasetGraph dsg0, DatasetDescription dsDesc0, SecurityContext sCxt) {
if ( dsDesc0 == null )
return dsg0;
if ( ! ALLOW_FROM )
ServletOps.errorBadRequest("Use GRAPH. (FROM/FROM NAMED is not compatible with data access control.)");
DatasetDescription dsDesc1 = DatasetDescription.create(
mask(dsDesc0.getDefaultGraphURIs(), sCxt),
mask(dsDesc0.getNamedGraphURIs(), sCxt));
if ( dsDesc1.isEmpty() )
return DatasetGraphZero.create();
// Fix up the union graph in the graphs if in FROM.
// (FROM NAMED <union graph> is done by DynamicDatasets).
if ( dsDesc1.getDefaultGraphURIs().contains(Quad.unionGraph.getURI())) {
dsDesc1.getDefaultGraphURIs().remove(Quad.unionGraph.getURI());
dsDesc1.getDefaultGraphURIs().addAll(sCxt.visibleGraphNames());
}
DatasetGraph dsg1 = DynamicDatasets.dynamicDataset(dsDesc1, dsg0, false) ;
if ( query.hasDatasetDescription() ) {
query.getGraphURIs().clear() ;
query.getNamedGraphURIs().clear() ;
}
return dsg1 ;
}
代码示例来源:origin: Galigator/openllet
@Override
protected Dataset createDataset()
{
final boolean useQueryGraphs = !_query.getGraphURIs().isEmpty() || !_query.getNamedGraphURIs().isEmpty();
final Collection<String> graphURIs = useQueryGraphs ? _query.getGraphURIs() : _graphURIs;
// this handler will intercept all import resolution failures and will
// try to load imports from resources (helps run these tests with maven)
OntDocumentManager.getInstance().setReadFailureHandler(new ResourceImportLoader());
OntModel model = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC);
for (final String dataURI : graphURIs)
model.read(dataURI, FileUtils.guessLang(dataURI));
model.prepare();
if (PelletSparqlDawgTester.CLASSIFY_KB_IN_ADVANCE)
((PelletInfGraph) model.getGraph()).getKB().classify();
final Dataset dataset = DatasetFactory.create(model);
final Collection<String> namedGraphURIs = useQueryGraphs ? _query.getNamedGraphURIs() : _namedGraphURIs;
for (final String graphURI : namedGraphURIs)
{
model = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC);
FileManager.get().readModel(model, graphURI);
dataset.addNamedModel(graphURI, model);
}
return dataset;
}
内容来源于网络,如有侵权,请联系作者删除!