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


Java ElementTriplesBlock类代码示例

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


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

示例1: visit

import org.apache.jena.sparql.syntax.ElementTriplesBlock; //导入依赖的package包/类
@Override
public void visit(ElementTriplesBlock el) {
    final BasicPattern bgp = el.getPattern();
    final ElementTriplesBlock nzed = new ElementTriplesBlock();
    final NodeExprNormalizer nenzer = new NodeExprNormalizer();
    bgp.forEach((t) -> {
        t.getSubject().visitWith(nenzer);
        Node s = nenzer.getResult();
        t.getPredicate().visitWith(nenzer);
        Node p = nenzer.getResult();
        t.getObject().visitWith(nenzer);
        Node o = nenzer.getResult();
        nzed.addTriple(new Triple(s, p, o));
    });
    endVisit(nzed, nenzer);
}
 
开发者ID:thesmartenergy,项目名称:sparql-generate,代码行数:17,代码来源:ElementNormalizer.java

示例2: buildSyntax

import org.apache.jena.sparql.syntax.ElementTriplesBlock; //导入依赖的package包/类
private QueryIterator buildSyntax(QueryIterator input, Node nodeVar, String pattern, ExecutionContext execCxt)
{
    Var var2 = createNewVar() ; 
    // Triple patterns for   ?x rdfs:label ?hiddenVar
    ElementTriplesBlock elementBGP = new ElementTriplesBlock();
    Triple t = new Triple(nodeVar, RDFS.label.asNode(), var2) ;
    elementBGP.addTriple(t) ;
    
    // Regular expression for  regex(?hiddenVar, "pattern", "i") 
    Expr regex = new E_Regex(new ExprVar(var2.getName()), pattern, "i") ;
    
    ElementGroup elementGroup = new ElementGroup() ;
    elementGroup.addElement(elementBGP) ;
    elementGroup.addElement(new ElementFilter(regex)) ;
    // Compile it.
    // The better design is to build the Op structure programmatically,
    Op op = Algebra.compile(elementGroup) ;
    op = Algebra.optimize(op, execCxt.getContext()) ;
    return QC.execute(op, input, execCxt) ;
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:21,代码来源:labelSearch.java

示例3: visit

import org.apache.jena.sparql.syntax.ElementTriplesBlock; //导入依赖的package包/类
@Override
public void visit(ElementTriplesBlock el) {
    if (el.isEmpty()) {
        out.println("# Empty BGP");
        return;
    }
    formatTriples(el.getPattern());
}
 
开发者ID:thesmartenergy,项目名称:sparql-generate,代码行数:9,代码来源:SPARQLGenerateFormatterElement.java

示例4: getJenaPath

import org.apache.jena.sparql.syntax.ElementTriplesBlock; //导入依赖的package包/类
/**
 * Attempts to parse a given string into a Jena Path.
 * Throws an Exception if the string cannot be parsed.
 * @param string  the string to parse
 * @param model  the Model to operate on (for prefixes)
 * @return a Path or a Resource if this is a URI
 */
public static Object getJenaPath(String string, Model model) throws QueryParseException {
	Query query = ARQFactory.get().createQuery(model, "ASK { ?a \n" + string + "\n ?b }");
	Element element = query.getQueryPattern();
	if(element instanceof ElementGroup) {
		Element e = ((ElementGroup)element).getElements().get(0);
		if(e instanceof ElementPathBlock) {
			return ((ElementPathBlock) e).getPattern().get(0).getPath();
		}
		else if(e instanceof ElementTriplesBlock) {
			return model.asRDFNode(((ElementTriplesBlock) e).getPattern().get(0).getPredicate());
		}
	}
	throw new QueryParseException("Not a SPARQL 1.1 Path expression", 2, 1);
}
 
开发者ID:TopQuadrant,项目名称:shacl,代码行数:22,代码来源:SHACLPaths.java

示例5: needsDotSeparator

import org.apache.jena.sparql.syntax.ElementTriplesBlock; //导入依赖的package包/类
private static boolean needsDotSeparator(Element el) {
    return (el instanceof ElementTriplesBlock) || (el instanceof ElementPathBlock);
}
 
开发者ID:thesmartenergy,项目名称:sparql-generate,代码行数:4,代码来源:SPARQLGenerateFormatterElement.java


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