• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ParsedTupleQuery类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.openrdf.query.parser.ParsedTupleQuery的典型用法代码示例。如果您正苦于以下问题:Java ParsedTupleQuery类的具体用法?Java ParsedTupleQuery怎么用?Java ParsedTupleQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ParsedTupleQuery类属于org.openrdf.query.parser包,在下文中一共展示了ParsedTupleQuery类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: AccumuloIndexSet

import org.openrdf.query.parser.ParsedTupleQuery; //导入依赖的package包/类
/**
    *
    * @param accCon
    *            - connection to a valid Accumulo instance
    * @param tablename
    *            - name of an existing PCJ table
    * @throws MalformedQueryException
    * @throws SailException
    * @throws QueryEvaluationException
    * @throws TableNotFoundException
    * @throws AccumuloSecurityException
    * @throws AccumuloException
    * @throws PCJStorageException
    */
public AccumuloIndexSet(final Configuration conf, final String tablename)
		throws MalformedQueryException, SailException,
                   QueryEvaluationException, TableNotFoundException, AccumuloException, AccumuloSecurityException, PCJStorageException {
       this.tablename = tablename;
	this.accCon = ConfigUtils.getConnector(conf);
	this.auths = getAuthorizations(conf);
       PcjMetadata meta = pcj.getPcjMetadata(accCon, tablename);
	final SPARQLParser sp = new SPARQLParser();
	final ParsedTupleQuery pq = (ParsedTupleQuery) sp.parseQuery(meta.getSparql(), null);

	setProjectionExpr((Projection) pq.getTupleExpr());
	final Set<VariableOrder> orders = meta.getVarOrders();

	varOrder = Lists.newArrayList();
	for (final VariableOrder var : orders) {
		varOrder.add(var.toString());
	}
	setLocalityGroups(tablename, accCon, varOrder);
	this.setSupportedVariableOrderMap(varOrder);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:35,代码来源:AccumuloIndexSet.java


示例2: MongoPcjQueryNode

import org.openrdf.query.parser.ParsedTupleQuery; //导入依赖的package包/类
/**
 * Creates a new {@link MongoPcjQueryNode}.
 *
 * @param sparql - sparql query whose results will be stored in PCJ document. (not empty of null)
 * @param pcjId - name of an existing PCJ. (not empty or null)
 * @param pcjDocs - {@link MongoPcjDocuments} used to maintain PCJs in mongo. (not null)
 *
 * @throws MalformedQueryException - The SPARQL query needs to contain a projection.
 */
public MongoPcjQueryNode(final String sparql, final String pcjId, final MongoPcjDocuments pcjDocs) throws MalformedQueryException {
    checkArgument(!Strings.isNullOrEmpty(sparql));
    checkArgument(!Strings.isNullOrEmpty(pcjId));
    this.pcjDocs = checkNotNull(pcjDocs);
    this.pcjId = pcjId;
    final SPARQLParser sp = new SPARQLParser();
    final ParsedTupleQuery pq = (ParsedTupleQuery) sp.parseQuery(sparql, null);
    final TupleExpr te = pq.getTupleExpr();
    Preconditions.checkArgument(PCJOptimizerUtilities.isPCJValid(te), "TupleExpr is an invalid PCJ.");

    final Optional<Projection> projection = new ParsedQueryUtil().findProjection(pq);
    if (!projection.isPresent()) {
        throw new MalformedQueryException("SPARQL query '" + sparql + "' does not contain a Projection.");
    }
    setProjectionExpr(projection.get());
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:26,代码来源:MongoPcjQueryNode.java


示例3: getQueryTask

import org.openrdf.query.parser.ParsedTupleQuery; //导入依赖的package包/类
public QueryTask getQueryTask(QueryDefinition query,
			WriterConfig config, OutputStream out)
			throws MalformedQueryException, RepositoryException {
		QueryParser parser = new SPARQLParserFactory().getParser();
		ParsedQuery parsedQuery = parser.parseQuery(query.getQuery(),
				config.getBaseUri());
		RepositoryConnection conn = cf.getConnection();
		try {
			if (parsedQuery instanceof ParsedTupleQuery) {
				return new TupleQueryTask(conn, query, config, out);
			} else if (parsedQuery instanceof ParsedBooleanQuery) {
				return new AskQueryTask(conn, query, config, out);
			} else if (parsedQuery instanceof ParsedGraphQuery) {
				return new GraphQueryTask(conn, query, config, out);
			}			
		} finally {
//			conn.close();
		}
		throw new MalformedQueryException("Unknown query type: "
				+ ParsedQuery.class.getName());
	}
 
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:22,代码来源:QueryService.java


示例4: prepareQuery

import org.openrdf.query.parser.ParsedTupleQuery; //导入依赖的package包/类
@Override
public Query prepareQuery(QueryLanguage ql, String query, String baseURI)
      throws RepositoryException, MalformedQueryException
{
   validateQueryLanguage(ql);
   ParsedQuery parsedQuery = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, baseURI);

   if (parsedQuery instanceof ParsedTupleQuery) {
      return prepareTupleQuery(ql, query, baseURI);
   }
   else if (parsedQuery instanceof ParsedBooleanQuery) {
      return prepareBooleanQuery(ql, query, baseURI);
   }
   else if (parsedQuery instanceof ParsedGraphQuery) {
      return prepareGraphQuery(ql, query, baseURI);
   }
   throw new MalformedQueryException("Unrecognized query type:\n" + query); //$NON-NLS-1$
}
 
开发者ID:obidea,项目名称:semantika-endpoint,代码行数:19,代码来源:SemantikaRepositoryConnection.java


示例5: getExprQuery

import org.openrdf.query.parser.ParsedTupleQuery; //导入依赖的package包/类
/**
 * Creates a new query based on a tuple expression and original query. The
 * new query will have the same type null
 * ({@link org.openrdf.query.TupleQuery},
 * {@link org.openrdf.query.GraphQuery} or
 * {@link org.openrdf.query.BooleanQuery}) as the given original query.
 *
 * @param orig the original query
 * @param expr the expression used for the new query
 * @return new query based on expression
 */
protected Query getExprQuery(ParsedQuery orig, TupleExpr expr) {
	if (orig instanceof ParsedTupleQuery) {
		return new SailTupleExprQuery(
				new ParsedTupleQuery(expr), conn);
	} else if (orig instanceof ParsedGraphQuery) {
		return new SailGraphExprQuery(
				new ParsedGraphQuery(expr), conn);
	} else {
		return new SailBooleanExprQuery(
				new ParsedBooleanQuery(expr), conn);
	}
}
 
开发者ID:lszeremeta,项目名称:neo4j-sparql-extension-yars,代码行数:24,代码来源:QueryRewriter.java


示例6: serialize

import org.openrdf.query.parser.ParsedTupleQuery; //导入依赖的package包/类
/**
 * Converts a {@link Filter} to a SPARQL query containing only the SPARQL representation
 * of the Filter along with a Select clause that return all variables.  The argument of the
 * Filter is replaced by a {@link SingletonSet} so that the body of the SPARQL query consists of only a
 * single Filter clause.  
 * @param filter - Filter to be serialized
 * @return - SPARQL String containing a single Filter clause that represents the serialized Filter
 * @throws FilterParseException
 */
public static String serialize(Filter filter) throws FilterParseException {
    Filter clone = filter.clone();
    clone.setArg(new SingletonSet());
    try {
        return removeAngularBracketsFromNonUriFunctions(renderer.render(new ParsedTupleQuery(clone)));
    } catch (Exception e) {
        throw new FilterParseException("Unable to parse Filter.", e);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:19,代码来源:FilterSerializer.java


示例7: getQueryType

import org.openrdf.query.parser.ParsedTupleQuery; //导入依赖的package包/类
public QueryType getQueryType(ParsedQuery parsedQuery) {
	if (parsedQuery instanceof ParsedTupleQuery) {
		return QueryType.SELECT;
	} else if (parsedQuery instanceof ParsedBooleanQuery) {
		return QueryType.ASK;
	} else if (parsedQuery instanceof ParsedGraphQuery) {
		return QueryType.CONSTRUCT;
	}	else {
		return null;
	}
}
 
开发者ID:erfgoed-en-locatie,项目名称:artsholland-platform,代码行数:12,代码来源:QueryService.java


示例8: SailTupleExprQuery

import org.openrdf.query.parser.ParsedTupleQuery; //导入依赖的package包/类
public SailTupleExprQuery(ParsedTupleQuery tupleQuery, SailRepositoryConnection sailConnection) {
	super(tupleQuery, sailConnection);
}
 
开发者ID:lszeremeta,项目名称:neo4j-sparql-extension-yars,代码行数:4,代码来源:SailTupleExprQuery.java


示例9: isTupleQuery

import org.openrdf.query.parser.ParsedTupleQuery; //导入依赖的package包/类
public boolean isTupleQuery() {
	return query instanceof ParsedTupleQuery;
}
 
开发者ID:anno4j,项目名称:anno4j,代码行数:4,代码来源:SparqlQuery.java



注:本文中的org.openrdf.query.parser.ParsedTupleQuery类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Flops类代码示例发布时间:2022-05-22
下一篇:
Java RegistryToggleState类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap