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


Java Algebra.optimize方法代码示例

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


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

示例1: 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

示例2: 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

示例3: modifyOp

import com.hp.hpl.jena.sparql.algebra.Algebra; //导入方法依赖的package包/类
@Override
protected Op modifyOp(Op op)
{ 
    if ( context.isFalse(ARQ.optimization) )
        return minimalModifyOp(op) ;
    return Algebra.optimize(op, super.context) ;
}
 
开发者ID:afs,项目名称:quack,代码行数:8,代码来源:QueryEngineMain2.java


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