当前位置: 首页>>代码示例>>Java>>正文


Java Scope类代码示例

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


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

示例1: testComplexQuery

import org.openrdf.query.algebra.StatementPattern.Scope; //导入依赖的package包/类
@Test
public void testComplexQuery() throws Exception {
    String text = "PREFIX foaf: <" + FOAF.NAMESPACE + ">\n"
            + "PREFIX ex: <" + EX + ">\n"
            + "SELECT * WHERE {\n"
            + "  { ?x a foaf:Person } UNION {\n"
            + "    GRAPH ex:Graph1 { ?y a foaf:Person }\n"
            + "  } .\n"
            + "  GRAPH ex:Graph2 {\n"
            + "    ?x foaf:knows ?y .\n"
            + "  }\n ."
            + "  OPTIONAL { ?x foaf:mbox ?m } .\n"
            + "  FILTER (?x != ?y) .\n"
            + "}";
    ParsedQuery query = new SPARQLParser().parseQuery(text, null);
    AntecedentVisitor visitor = new AntecedentVisitor();
    query.getTupleExpr().visit(visitor);
    Set<StatementPattern> expected = Sets.newHashSet(
            new StatementPattern(Scope.NAMED_CONTEXTS, new Var("y"), c(RDF.TYPE), c(FOAF.PERSON), c(G1)),
            new StatementPattern(new Var("x"), c(RDF.TYPE), c(FOAF.PERSON)),
            new StatementPattern(Scope.NAMED_CONTEXTS, new Var("x"), c(FOAF.KNOWS), new Var("y"), c(G2)),
            new StatementPattern(new Var("x"), c(FOAF.MBOX), new Var("m")));
    Assert.assertEquals(expected, visitor.getAntecedents());
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:25,代码来源:AntecedentVisitorTest.java

示例2: extractConstructExpression

import org.openrdf.query.algebra.StatementPattern.Scope; //导入依赖的package包/类
private static TupleExpr extractConstructExpression(
        final Map<String, ExtensionElem> extensions,
        final Iterable<? extends ProjectionElemList> multiProjections) {
    TupleExpr expression = null;
    for (final ProjectionElemList projections : multiProjections) {
        final Var subj = extractConstructVar(extensions, projections.getElements().get(0));
        final Var pred = extractConstructVar(extensions, projections.getElements().get(1));
        final Var obj = extractConstructVar(extensions, projections.getElements().get(2));
        final Var ctx = projections.getElements().size() < 4 ? null : extractConstructVar(
                extensions, projections.getElements().get(3));
        final StatementPattern pattern = new StatementPattern(
                ctx == null ? Scope.DEFAULT_CONTEXTS : Scope.NAMED_CONTEXTS, subj, pred,
                obj, ctx);
        expression = expression == null ? pattern : new Join(expression, pattern);
    }
    return expression;
}
 
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:18,代码来源:SPARQLRenderer.java

示例3: getGraphs

import org.openrdf.query.algebra.StatementPattern.Scope; //导入依赖的package包/类
private Set<URI> getGraphs(StatementPattern sp) {
  if (sp.getScope() == Scope.DEFAULT_CONTEXTS)
    return dataset.getDefaultGraphs();
  return dataset.getNamedGraphs();
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:6,代码来源:GeneralDBSelectQueryOptimizer.java


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