Java 有没有办法在LARQ中创建几个索引并对它们执行SPARQL

Java 有没有办法在LARQ中创建几个索引并对它们执行SPARQL,java,lucene,sparql,jena,arq,Java,Lucene,Sparql,Jena,Arq,我想索引两个不同的OntModel并对它们执行sparql查询。例如: String query = "PREFIX fise: <http://fise.iks-project.eu/ontology/>\n" + "PREFIX pf: <http://jena.hpl.hp.com/ARQ/property#>\n" + "PREFIX skos: <http://www.w3.o

我想索引两个不同的OntModel并对它们执行sparql查询。例如:

String query = "PREFIX fise: <http://fise.iks-project.eu/ontology/>\n"
                   + "PREFIX pf: <http://jena.hpl.hp.com/ARQ/property#>\n"
                   + "PREFIX skos:   <http://www.w3.org/2004/02/skos/core#>\n"
                   + "SELECT distinct ?def\n" + "WHERE {\n"
                   + "  ?item a skos:Concept .\n"
                   + "  ?item skos:definition ?def.\n"
                   + "  (?label ?score)  pf:textMatch 'someKeyword'. \n"
                   + "};

ResultSet result = QueryExecutionFactory.create(query, ontModel1).execSelect();
ResultSet result2 = QueryExecutionFactory.create(query, ontModel2).execSelect();

但此代码允许设置单个索引。此外,我不想合并两个ont模型。有一个Concext概念,但我不知道如何使用它。

答案似乎是使用查询上下文为每个查询执行注册索引

 QueryExecution qe = QueryExecutionFactory.create(query, model) ;
 LARQ.setDefaultIndex(qe.getContext(), index) ;
 QueryExecution qe = QueryExecutionFactory.create(query, model) ;
 LARQ.setDefaultIndex(qe.getContext(), index) ;