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


Java Algebra.compile方法代码示例

本文整理汇总了Java中com.hp.hpl.jena.sparql.algebra.Algebra.compile方法的典型用法代码示例。如果您正苦于以下问题:Java Algebra.compile方法的具体用法?Java Algebra.compile怎么用?Java Algebra.compile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hp.hpl.jena.sparql.algebra.Algebra的用法示例。


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

示例1: executeQuery

import com.hp.hpl.jena.sparql.algebra.Algebra; //导入方法依赖的package包/类
public String executeQuery() {

		Query query = QueryFactory.create(this.getQuery(), Syntax.syntaxARQ);

		Op op = Algebra.compile(query);

		try {
			
			if(new String("internal").equals(this.service)) {
				this.results = jenaService.runLocalOp(op);
			} else if (new String("external").equals(this.service)) {
				this.results = jenaService.runExternalOp(op);
			}

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
		}
		return ("success");
	}
 
开发者ID:christoff-buerger,项目名称:reneviz,代码行数:21,代码来源:SparqlController.java

示例2: translateQuery

import com.hp.hpl.jena.sparql.algebra.Algebra; //导入方法依赖的package包/类
public JoinTree translateQuery(){
	
	// parse the query and extract prefixes
    Query query = QueryFactory.read("file:"+inputFile);
    prefixes = query.getPrefixMapping();
    
    logger.info("** SPARQL QUERY **\n" + query +"\n****************"  );
    
    // extract variables, list of triples and filter
    Op opQuery = Algebra.compile(query);
    QueryVisitor queryVisitor = new QueryVisitor();
    OpWalker.walk(opQuery, queryVisitor);
    triples = queryVisitor.getTriple_patterns();
    variables  = queryVisitor.getVariables();
    
    
    // build the tree
    Node root_node = buildTree();
    JoinTree tree = new JoinTree(root_node, inputFile);
    
    // TODO: set the filter when is ready
    //tree.setFilter(queryVisitor.getFilter());
    
    // if distinct keyword is present
    tree.setDistinct(query.isDistinct());
    
    logger.info("** Spark JoinTree **\n" + tree +"\n****************" );
    
    return tree;
}
 
开发者ID:tf-dbis-uni-freiburg,项目名称:PRoST,代码行数:31,代码来源:Translator.java

示例3: main

import com.hp.hpl.jena.sparql.algebra.Algebra; //导入方法依赖的package包/类
public static void main(String []args)
{
    // Parse
    //Query query = QueryFactory.read("file:C:\\SVN\\PigSPARQL_main\\queries\\q8.sparql") ;
    Query query = QueryFactory.read("file:queries/SP2Bench/q8mod.sparql") ;
    //System.out.println(query) ;
    
    // Generate algebra
    Op op = Algebra.compile(query) ;
    op = Algebra.optimize(op) ;
    //System.out.println(op) ;

    // Print Algebra Using SSE
    //PrintUtils.printOp(query, true);
    //System.out.println();

    String dftGraphURI = "file:datasets/SP2BEnch/dblp25M.n3" ;
    //String dftGraphURI = "file:D:\\ZerProf\\Uni\\Master\\Masterarbeit\\sp2b\\bin\\dblp50K.n3" ;
    Dataset dataset = DatasetFactory.create(dftGraphURI);
    
    // Execute it.
    QueryIterator qIter = Algebra.exec(op, dataset) ;
    
    // Results
    int results = 0;
    for ( ; qIter.hasNext() ; )
    {
        Binding b = qIter.nextBinding() ;
        results++;
        System.out.println(b) ;
    }
    qIter.close() ;
    System.out.println("# solution mappings: "+results);
}
 
开发者ID:aschaetzle,项目名称:PigSPARQL,代码行数:35,代码来源:QueryEvaluator.java

示例4: run

import com.hp.hpl.jena.sparql.algebra.Algebra; //导入方法依赖的package包/类
@Override
public void run() {
    dataset.begin(ReadWrite.READ);
    System.out.println("------------------");
    System.out.println(query);
    Op op = Algebra.compile(query);
    op = Algebra.optimize(op);
    System.out.println(op);
    System.out.println("------------------");
    System.out.println(query);
    long time = System.currentTimeMillis();
    try (QueryExecution qe = QueryExecutionFactory.create(query, dataset)) {
        ResultSet results = qe.execSelect();
        if(pretty){
            System.out.println("Output as pretty printed text");
            ResultSetFormatter.out(stream, results, query);
            
        }else{
            System.out.println("Output as CSV");
            ResultSetFormatter.outputAsCSV(stream, results);

        }
    }catch (Exception e){
        JOptionPane.showMessageDialog(null, "Writting to textarea failed!");
        e.printStackTrace();
    }
    time = System.currentTimeMillis() - time;
    String timeString = "\n Performed query in: "+time+"ms";
    try {
        stream.write(timeString.getBytes());
        stream.showText();
    } catch (IOException ex) {
        JOptionPane.showMessageDialog(null, "Writting to textarea failed!");
    }
    System.out.println(time);
    System.out.println("Finished query");
    dataset.end();
}
 
开发者ID:MarcelH91,项目名称:WikiOnto,代码行数:39,代码来源:QueryProcessor.java

示例5: RemediatorQuery

import com.hp.hpl.jena.sparql.algebra.Algebra; //导入方法依赖的package包/类
public RemediatorQuery(String queryString) {
	super();
	this.queryString = queryString;
	this.originalQuery = QueryFactory.create(this.queryString);
	this.originalOperations = Algebra.compile(this.originalQuery);
	queryVars = new QueryVars(
			OpVars.mentionedVars(this.originalOperations));
	Simplifier  simplifier = new Simplifier();
	this.simplifiedOperations = Transformer.transform(simplifier, this.originalOperations);
	//Create lookup for simplified operations
	for(Triple triple:((OpBGP)this.simplifiedOperations).getPattern().getList()){
		//TODO Should only put in relevant operations for this dataset.
		simplifiedTriples.put(triple.hashCode(), triple);
	}
}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:16,代码来源:RemediatorQuery.java


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