本文整理了Java中org.apache.jena.query.Query.getDatasetDescription
方法的一些代码示例,展示了Query.getDatasetDescription
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getDatasetDescription
方法的具体详情如下:
包路径:org.apache.jena.query.Query
类名称:Query
方法名:getDatasetDescription
[英]Return a dataset description (FROM/FROM NAMED clauses) for the query.
[中]返回查询的数据集描述(来自/来自命名子句)。
代码示例来源:origin: stackoverflow.com
Query query = QueryFactory.create(queryString);
query.isSelectType() && query.isQueryResultStar(); // of the form SELECT *?
query.getDatasetDescription(); // FROM / FROM NAMED bits
query.getQueryPattern(); // The meat of the query, the WHERE bit
...etc etc..
Op op = Algebra.compile(query); // Get the algebra for the query
代码示例来源:origin: apache/jena
/** Create a dataset description, given a query and context.
* The context overrides the query FROM/FROM NAMED.
* If neither the context nor query has a dataset description, return null.
* The context uses the key {@link ARQConstants#sysDatasetDescription}.
*/
public static DatasetDescription create(Query query, Context context)
{
if ( context != null && context.isDefined(ARQConstants.sysDatasetDescription) )
{
try {
return (DatasetDescription)context.get(ARQConstants.sysDatasetDescription) ;
} catch (ClassCastException ex)
{
throw new ARQException("Unexpected type (expected DatasetDescription): "+ex.getMessage()) ;
}
}
if ( query != null && query.hasDatasetDescription() )
return query.getDatasetDescription() ;
return null ;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static Query rewrite(Query query) {
DatasetDescription dd = query.getDatasetDescription();
Query result;
if(dd != null) {
result = query.cloneQuery();
Element before = result.getQueryPattern();
Element after = rewrite(before, dd);
result.setQueryPattern(after);
} else {
result = query;
}
return result;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static void applyDatasetDescription(Query query,
DatasetDescription dd) {
DatasetDescription present = query.getDatasetDescription();
if (present == null && dd != null) {
{
List<String> items = dd.getDefaultGraphURIs();
if (items != null) {
for (String item : items) {
query.addGraphURI(item);
}
}
}
{
List<String> items = dd.getNamedGraphURIs();
if (items != null) {
for (String item : items) {
query.addNamedGraphURI(item);
}
}
}
}
}
代码示例来源:origin: apache/jena
@Override
public void startVisit(Query query) {
newQuery.setSyntax(query.getSyntax());
if (query.explicitlySetBaseURI())
newQuery.setBaseURI(query.getPrologue().getResolver());
newQuery.setQueryResultStar(query.isQueryResultStar());
if (query.hasDatasetDescription()) {
DatasetDescription desc = query.getDatasetDescription();
for (String x : desc.getDefaultGraphURIs())
newQuery.addGraphURI(x);
for (String x : desc.getDefaultGraphURIs())
newQuery.addNamedGraphURI(x);
}
// Aggregators.
newQuery.getAggregators().addAll(query.getAggregators());
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public void startVisit(Query query) {
newQuery.setSyntax(query.getSyntax()) ;
if ( query.explicitlySetBaseURI() )
newQuery.setBaseURI(query.getPrologue().getResolver()) ;
newQuery.setQueryResultStar(query.isQueryResultStar()) ;
if ( query.hasDatasetDescription() ) {
DatasetDescription desc = query.getDatasetDescription() ;
for (String x : desc.getDefaultGraphURIs())
newQuery.addGraphURI(x) ;
for (String x : desc.getDefaultGraphURIs())
newQuery.addNamedGraphURI(x) ;
}
// Aggregators.
newQuery.getAggregators().addAll(query.getAggregators()) ;
}
内容来源于网络,如有侵权,请联系作者删除!