Return-Path: X-Original-To: apmail-rya-dev-archive@minotaur.apache.org Delivered-To: apmail-rya-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 36A5018ED9 for ; Mon, 7 Dec 2015 12:04:53 +0000 (UTC) Received: (qmail 10291 invoked by uid 500); 7 Dec 2015 12:04:53 -0000 Delivered-To: apmail-rya-dev-archive@rya.apache.org Received: (qmail 10249 invoked by uid 500); 7 Dec 2015 12:04:53 -0000 Mailing-List: contact dev-help@rya.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@rya.incubator.apache.org Delivered-To: mailing list dev@rya.incubator.apache.org Received: (qmail 10238 invoked by uid 99); 7 Dec 2015 12:04:53 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Dec 2015 12:04:53 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 7442AC0481 for ; Mon, 7 Dec 2015 12:04:52 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.426 X-Spam-Level: X-Spam-Status: No, score=0.426 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.554] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 0orfVk--GBJn for ; Mon, 7 Dec 2015 12:04:35 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id E6C2624DB9 for ; Mon, 7 Dec 2015 12:04:32 +0000 (UTC) Received: (qmail 9156 invoked by uid 99); 7 Dec 2015 12:04:31 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Dec 2015 12:04:31 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6B38AE0511; Mon, 7 Dec 2015 12:04:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mihalik@apache.org To: dev@rya.incubator.apache.org Date: Mon, 07 Dec 2015 12:04:46 -0000 Message-Id: <7b3c0c71b0e74f89a1eb7d038fe64a9f@git.apache.org> In-Reply-To: <2a784369c62044fb831722b10b522d49@git.apache.org> References: <2a784369c62044fb831722b10b522d49@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [16/51] [partial] incubator-rya git commit: Cannot delete temp branch, doc'd it. http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/5a03ef61/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloIndexSetTest.java ---------------------------------------------------------------------- diff --git a/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloIndexSetTest.java b/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloIndexSetTest.java deleted file mode 100644 index c8ea57d..0000000 --- a/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloIndexSetTest.java +++ /dev/null @@ -1,4330 +0,0 @@ -package mvm.rya.indexing.external; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - - - -import java.util.List; -import java.util.Set; - -import junit.framework.Assert; -import mvm.rya.indexing.IndexPlanValidator.IndexPlanValidator; -import mvm.rya.indexing.external.tupleSet.AccumuloIndexSet; -import mvm.rya.indexing.external.tupleSet.ExternalProcessorTest.ExternalTupleVstor; -import mvm.rya.indexing.external.tupleSet.ExternalTupleSet; - -import org.apache.accumulo.core.client.AccumuloException; -import org.apache.accumulo.core.client.AccumuloSecurityException; -import org.apache.accumulo.core.client.Connector; -import org.apache.accumulo.core.client.MutationsRejectedException; -import org.apache.accumulo.core.client.TableExistsException; -import org.apache.accumulo.core.client.TableNotFoundException; -import org.apache.accumulo.core.client.mock.MockInstance; -import org.junit.Before; -import org.junit.Test; -import org.openrdf.model.URI; -import org.openrdf.model.impl.LiteralImpl; -import org.openrdf.model.impl.URIImpl; -import org.openrdf.model.vocabulary.RDF; -import org.openrdf.model.vocabulary.RDFS; -import org.openrdf.query.BindingSet; -import org.openrdf.query.MalformedQueryException; -import org.openrdf.query.QueryEvaluationException; -import org.openrdf.query.QueryLanguage; -import org.openrdf.query.QueryResultHandlerException; -import org.openrdf.query.TupleQueryResultHandler; -import org.openrdf.query.TupleQueryResultHandlerException; -import org.openrdf.query.algebra.TupleExpr; -import org.openrdf.query.parser.ParsedQuery; -import org.openrdf.query.parser.sparql.SPARQLParser; -import org.openrdf.repository.RepositoryException; -import org.openrdf.repository.sail.SailRepository; -import org.openrdf.repository.sail.SailRepositoryConnection; -import org.openrdf.sail.Sail; -import org.openrdf.sail.SailException; -import org.openrdf.sail.memory.MemoryStore; - -import com.beust.jcommander.internal.Sets; -import com.google.common.collect.Lists; - -public class AccumuloIndexSetTest { - - private SailRepositoryConnection conn; - private Connector accCon; - String tablename = "table"; - Sail s; - URI obj,obj2,subclass, subclass2, talksTo; - - - - - @Before - public void init() throws RepositoryException, TupleQueryResultHandlerException, QueryEvaluationException, MalformedQueryException, AccumuloException, AccumuloSecurityException, TableExistsException { - - s = new MemoryStore(); - SailRepository repo = new SailRepository(s); - repo.initialize(); - conn = repo.getConnection(); - - URI sub = new URIImpl("uri:entity"); - subclass = new URIImpl("uri:class"); - obj = new URIImpl("uri:obj"); - talksTo = new URIImpl("uri:talksTo"); - - conn.add(sub, RDF.TYPE, subclass); - conn.add(sub, RDFS.LABEL, new LiteralImpl("label")); - conn.add(sub, talksTo, obj); - - URI sub2 = new URIImpl("uri:entity2"); - subclass2 = new URIImpl("uri:class2"); - obj2 = new URIImpl("uri:obj2"); - - conn.add(sub2, RDF.TYPE, subclass2); - conn.add(sub2, RDFS.LABEL, new LiteralImpl("label2")); - conn.add(sub2, talksTo, obj2); - - accCon = new MockInstance().getConnector("root", "".getBytes()); - accCon.tableOperations().create(tablename); - - - - - } - - - - - - @Test - public void testEvaluateSingeIndex() { - - - // TODO Auto-generated method stub - String indexSparqlString = ""// - + "SELECT ?e ?l ?c " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l "// - + "}";// - - - CountingResultHandler crh = new CountingResultHandler(); - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh); - } catch (TupleQueryResultHandlerException e2) { - - e2.printStackTrace(); - } catch (QueryEvaluationException e2) { - - e2.printStackTrace(); - } catch (MalformedQueryException e2) { - - e2.printStackTrace(); - } catch (RepositoryException e2) { - - e2.printStackTrace(); - } - - - - List index = Lists.newArrayList(); - AccumuloIndexSet ais = null; - - try { - ais = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (SailException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MutationsRejectedException e) { - - e.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - -// Scanner scan = null; -// try { -// scan = accCon.createScanner(tablename, new Authorizations("auths")); -// } catch (TableNotFoundException e) { -// -// e.printStackTrace(); -// } - -// scan.setRange(new Range()); -// -// for (Map.Entry entry : scan) { -// System.out.println("Key row string is " + entry.getKey().getRow().toString()); -// System.out.println("Key is " + entry.getKey()); -// System.out.println("Value is " + (new String(entry.getKey().getColumnQualifier().toString()))); -// -// } - - - - - index.add(ais); - - Assert.assertEquals((double)crh.getCount(), ais.cardinality()); - - - - String queryString = ""// - + "SELECT ?e ?c ?l ?o " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l . "// - + " ?e ?o . "// - + "}";// - - - - - CountingResultHandler crh1 = new CountingResultHandler(); - - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1); - } catch (TupleQueryResultHandlerException e1) { - - e1.printStackTrace(); - } catch (QueryEvaluationException e1) { - - e1.printStackTrace(); - } catch (MalformedQueryException e1) { - - e1.printStackTrace(); - } catch (RepositoryException e1) { - - e1.printStackTrace(); - } - - - - - ParsedQuery pq = null; - SPARQLParser sp = new SPARQLParser(); - try { - pq = sp.parseQuery(queryString, null); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } - - ExternalProcessor processor = new ExternalProcessor(index); - - - - Sail processingSail = new ExternalSail(s, processor); - SailRepository smartSailRepo = new SailRepository(processingSail); - try { - smartSailRepo.initialize(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - CountingResultHandler crh2 = new CountingResultHandler(); - - try { - smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2); - } catch (TupleQueryResultHandlerException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - Assert.assertEquals(crh1.getCount(), crh2.getCount()); - - - } - - - - - - - @Test - public void testEvaluateTwoIndexTwoVarOrder1() { - - - try { - accCon.tableOperations().create("table2"); - } catch (AccumuloException e4) { - - e4.printStackTrace(); - } catch (AccumuloSecurityException e4) { - - e4.printStackTrace(); - } catch (TableExistsException e4) { - - e4.printStackTrace(); - } - - - try { - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e3) { - - e3.printStackTrace(); - } - - - - // TODO Auto-generated method stub - String indexSparqlString = ""// - + "SELECT ?e ?l ?c " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l "// - + "}";// - - - String indexSparqlString2 = ""// - + "SELECT ?e ?o ?l " // - + "{" // - + " ?e ?o . "// - + " ?o ?l "// - + "}";// - - - String queryString = ""// - + "SELECT ?e ?c ?l ?o " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l . "// - + " ?e ?o . "// - + " ?o ?l "// - + "}";// - - - - - - - - CountingResultHandler crh1 = new CountingResultHandler(); - CountingResultHandler crh2 = new CountingResultHandler(); - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh1); - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh2); - } catch (TupleQueryResultHandlerException e2) { - - e2.printStackTrace(); - } catch (QueryEvaluationException e2) { - - e2.printStackTrace(); - } catch (MalformedQueryException e2) { - - e2.printStackTrace(); - } catch (RepositoryException e2) { - - e2.printStackTrace(); - } - - - - List index = Lists.newArrayList(); - AccumuloIndexSet ais1 = null; - AccumuloIndexSet ais2 = null; - - try { - ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename); - ais2 = new AccumuloIndexSet(indexSparqlString2, conn, accCon, "table2"); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (SailException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MutationsRejectedException e) { - - e.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - -// Scanner scan = null; -// try { -// scan = accCon.createScanner(tablename, new Authorizations("auths")); -// } catch (TableNotFoundException e) { -// -// e.printStackTrace(); -// } - -// scan.setRange(new Range()); -// -// for (Map.Entry entry : scan) { -// System.out.println("Key row string is " + entry.getKey().getRow().toString()); -// System.out.println("Key is " + entry.getKey()); -// System.out.println("Value is " + (new String(entry.getKey().getColumnQualifier().toString()))); -// -// } - - - - - index.add(ais1); - index.add(ais2); - - Assert.assertEquals((double)crh1.getCount(), ais1.cardinality()); - Assert.assertEquals((double)crh2.getCount(), ais2.cardinality()); - - - crh1 = new CountingResultHandler(); - crh2 = new CountingResultHandler(); - - - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1); - } catch (TupleQueryResultHandlerException e1) { - - e1.printStackTrace(); - } catch (QueryEvaluationException e1) { - - e1.printStackTrace(); - } catch (MalformedQueryException e1) { - - e1.printStackTrace(); - } catch (RepositoryException e1) { - - e1.printStackTrace(); - } - - - - - ParsedQuery pq = null; - SPARQLParser sp = new SPARQLParser(); - try { - pq = sp.parseQuery(queryString, null); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } - - ExternalProcessor processor = new ExternalProcessor(index); - - - - Sail processingSail = new ExternalSail(s, processor); - SailRepository smartSailRepo = new SailRepository(processingSail); - try { - smartSailRepo.initialize(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - - - try { - smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2); - } catch (TupleQueryResultHandlerException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - Assert.assertEquals(2, crh1.getCount()); - Assert.assertEquals(2, crh2.getCount()); - - - - - - } - - - - - - - - - @Test - public void testEvaluateTwoIndexTwoVarOrder2() { - - - try { - accCon.tableOperations().create("table2"); - } catch (AccumuloException e4) { - - e4.printStackTrace(); - } catch (AccumuloSecurityException e4) { - - e4.printStackTrace(); - } catch (TableExistsException e4) { - - e4.printStackTrace(); - } - - - try { - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e3) { - - e3.printStackTrace(); - } - - - - // TODO Auto-generated method stub - String indexSparqlString = ""// - + "SELECT ?c ?e ?l " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l "// - + "}";// - - - String indexSparqlString2 = ""// - + "SELECT ?e ?o ?l " // - + "{" // - + " ?e ?o . "// - + " ?o ?l "// - + "}";// - - - String queryString = ""// - + "SELECT ?e ?c ?l ?o " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l . "// - + " ?e ?o . "// - + " ?o ?l "// - + "}";// - - - - - - - - CountingResultHandler crh1 = new CountingResultHandler(); - CountingResultHandler crh2 = new CountingResultHandler(); - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh1); - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh2); - } catch (TupleQueryResultHandlerException e2) { - - e2.printStackTrace(); - } catch (QueryEvaluationException e2) { - - e2.printStackTrace(); - } catch (MalformedQueryException e2) { - - e2.printStackTrace(); - } catch (RepositoryException e2) { - - e2.printStackTrace(); - } - - - - List index = Lists.newArrayList(); - AccumuloIndexSet ais1 = null; - AccumuloIndexSet ais2 = null; - - try { - ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename); - ais2 = new AccumuloIndexSet(indexSparqlString2, conn, accCon, "table2"); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (SailException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MutationsRejectedException e) { - - e.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - - index.add(ais1); - index.add(ais2); - - Assert.assertEquals((double)crh1.getCount(), ais1.cardinality()); - Assert.assertEquals((double)crh2.getCount(), ais2.cardinality()); - - - crh1 = new CountingResultHandler(); - crh2 = new CountingResultHandler(); - - - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1); - } catch (TupleQueryResultHandlerException e1) { - - e1.printStackTrace(); - } catch (QueryEvaluationException e1) { - - e1.printStackTrace(); - } catch (MalformedQueryException e1) { - - e1.printStackTrace(); - } catch (RepositoryException e1) { - - e1.printStackTrace(); - } - - - - - ParsedQuery pq = null; - SPARQLParser sp = new SPARQLParser(); - try { - pq = sp.parseQuery(queryString, null); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } - - ExternalProcessor processor = new ExternalProcessor(index); - - - - Sail processingSail = new ExternalSail(s, processor); - SailRepository smartSailRepo = new SailRepository(processingSail); - try { - smartSailRepo.initialize(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - - - try { - smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2); - } catch (TupleQueryResultHandlerException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - Assert.assertEquals(2, crh1.getCount()); - Assert.assertEquals(2, crh2.getCount()); - - - - } - - - - - - @Test - public void testEvaluateTwoIndexTwoVarInvalidOrder() { - - - try { - accCon.tableOperations().create("table2"); - } catch (AccumuloException e4) { - - e4.printStackTrace(); - } catch (AccumuloSecurityException e4) { - - e4.printStackTrace(); - } catch (TableExistsException e4) { - - e4.printStackTrace(); - } - - - try { - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e3) { - - e3.printStackTrace(); - } - - - - // TODO Auto-generated method stub - String indexSparqlString = ""// - + "SELECT ?e ?c ?l " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l "// - + "}";// - - - String indexSparqlString2 = ""// - + "SELECT ?e ?o ?l " // - + "{" // - + " ?e ?o . "// - + " ?o ?l "// - + "}";// - - - String queryString = ""// - + "SELECT ?e ?c ?l ?o " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l . "// - + " ?e ?o . "// - + " ?o ?l "// - + "}";// - - - - - - - - CountingResultHandler crh1 = new CountingResultHandler(); - CountingResultHandler crh2 = new CountingResultHandler(); - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh1); - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString2).evaluate(crh2); - } catch (TupleQueryResultHandlerException e2) { - - e2.printStackTrace(); - } catch (QueryEvaluationException e2) { - - e2.printStackTrace(); - } catch (MalformedQueryException e2) { - - e2.printStackTrace(); - } catch (RepositoryException e2) { - - e2.printStackTrace(); - } - - - - List index = Lists.newArrayList(); - AccumuloIndexSet ais1 = null; - AccumuloIndexSet ais2 = null; - - try { - ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename); - ais2 = new AccumuloIndexSet(indexSparqlString2, conn, accCon, "table2"); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (SailException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MutationsRejectedException e) { - - e.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - - - index.add(ais1); - index.add(ais2); - - Assert.assertEquals((double)crh1.getCount(), ais1.cardinality()); - Assert.assertEquals((double)crh2.getCount(), ais2.cardinality()); - - - crh1 = new CountingResultHandler(); - crh2 = new CountingResultHandler(); - - - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1); - } catch (TupleQueryResultHandlerException e1) { - - e1.printStackTrace(); - } catch (QueryEvaluationException e1) { - - e1.printStackTrace(); - } catch (MalformedQueryException e1) { - - e1.printStackTrace(); - } catch (RepositoryException e1) { - - e1.printStackTrace(); - } - - - - - ParsedQuery pq = null; - SPARQLParser sp = new SPARQLParser(); - try { - pq = sp.parseQuery(queryString, null); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } - - ExternalProcessor processor = new ExternalProcessor(index); - - - - Sail processingSail = new ExternalSail(s, processor); - SailRepository smartSailRepo = new SailRepository(processingSail); - try { - smartSailRepo.initialize(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - - try { - smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2); - } catch (TupleQueryResultHandlerException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - Assert.assertEquals(crh1.getCount(), crh2.getCount()); - - - - } - - - - @Test - public void testEvaluateTwoIndexThreeVarOrder1() { - - - - URI superclass = new URIImpl("uri:superclass"); - URI superclass2 = new URIImpl("uri:superclass2"); - - - try { - conn.add(subclass, RDF.TYPE, superclass); - conn.add(subclass2, RDF.TYPE, superclass2); - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e5) { - - e5.printStackTrace(); - } - - - try { - if(accCon.tableOperations().exists("table2")){ - accCon.tableOperations().delete("table2"); - } - accCon.tableOperations().create("table2"); - } catch (AccumuloException e4) { - - e4.printStackTrace(); - } catch (AccumuloSecurityException e4) { - - e4.printStackTrace(); - } catch (TableExistsException e4) { - - e4.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - try { - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e3) { - - e3.printStackTrace(); - } - - - - // TODO Auto-generated method stub - String indexSparqlString = ""// - + "SELECT ?c ?e ?l " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l "// - + "}";// - - - String indexSparqlString2 = ""// - + "SELECT ?e ?c ?l ?f ?o" // - + "{" // - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - String queryString = ""// - + "SELECT ?e ?c ?l ?f ?o " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l. "// - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - - - - - - CountingResultHandler crh1 = new CountingResultHandler(); - CountingResultHandler crh2 = new CountingResultHandler(); - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh1); - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString2).evaluate(crh2); - } catch (TupleQueryResultHandlerException e2) { - - e2.printStackTrace(); - } catch (QueryEvaluationException e2) { - - e2.printStackTrace(); - } catch (MalformedQueryException e2) { - - e2.printStackTrace(); - } catch (RepositoryException e2) { - - e2.printStackTrace(); - } - - - - List index = Lists.newArrayList(); - AccumuloIndexSet ais1 = null; - AccumuloIndexSet ais2 = null; - - try { - ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename); - ais2 = new AccumuloIndexSet(indexSparqlString2, conn, accCon, "table2"); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (SailException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MutationsRejectedException e) { - - e.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - - index.add(ais1); - index.add(ais2); - - Assert.assertEquals((double)crh1.getCount(), ais1.cardinality()); - Assert.assertEquals((double)crh2.getCount(), ais2.cardinality()); - - - crh1 = new CountingResultHandler(); - crh2 = new CountingResultHandler(); - - - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1); - } catch (TupleQueryResultHandlerException e1) { - - e1.printStackTrace(); - } catch (QueryEvaluationException e1) { - - e1.printStackTrace(); - } catch (MalformedQueryException e1) { - - e1.printStackTrace(); - } catch (RepositoryException e1) { - - e1.printStackTrace(); - } - - - - - ParsedQuery pq = null; - SPARQLParser sp = new SPARQLParser(); - try { - pq = sp.parseQuery(queryString, null); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } - - ExternalProcessor processor = new ExternalProcessor(index); - - - - Sail processingSail = new ExternalSail(s, processor); - SailRepository smartSailRepo = new SailRepository(processingSail); - try { - smartSailRepo.initialize(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - - - try { - smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2); - } catch (TupleQueryResultHandlerException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - Assert.assertEquals(2, crh1.getCount()); - Assert.assertEquals(2, crh2.getCount()); - - - - } - - - - - - - - //@Test - public void testEvaluateTwoIndexThreeVarsDiffLabel() { - - - URI superclass = new URIImpl("uri:superclass"); - URI superclass2 = new URIImpl("uri:superclass2"); - - - try { - conn.add(subclass, RDF.TYPE, superclass); - conn.add(subclass2, RDF.TYPE, superclass2); - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e5) { - - e5.printStackTrace(); - } - - - try { - if(accCon.tableOperations().exists("table2")){ - accCon.tableOperations().delete("table2"); - } - accCon.tableOperations().create("table2"); - } catch (AccumuloException e4) { - - e4.printStackTrace(); - } catch (AccumuloSecurityException e4) { - - e4.printStackTrace(); - } catch (TableExistsException e4) { - - e4.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - try { - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e3) { - - e3.printStackTrace(); - } - - - - // TODO Auto-generated method stub - String indexSparqlString = ""// - + "SELECT ?dog ?pig ?owl " // - + "{" // - + " ?pig a ?dog . "// - + " ?pig ?owl "// - + "}";// - - - String indexSparqlString2 = ""// - + "SELECT ?e ?c ?l ?f ?o" // - + "{" // - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - String queryString = ""// - + "SELECT ?e ?c ?l ?f ?o " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l. "// - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - - - - - - CountingResultHandler crh1 = new CountingResultHandler(); - CountingResultHandler crh2 = new CountingResultHandler(); -// try { -// conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh1); -// conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString2).evaluate(crh2); -// } catch (TupleQueryResultHandlerException e2) { -// -// e2.printStackTrace(); -// } catch (QueryEvaluationException e2) { -// -// e2.printStackTrace(); -// } catch (MalformedQueryException e2) { -// -// e2.printStackTrace(); -// } catch (RepositoryException e2) { -// -// e2.printStackTrace(); -// } - - - - List index = Lists.newArrayList(); - AccumuloIndexSet ais1 = null; - AccumuloIndexSet ais2 = null; - - try { - ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename); - ais2 = new AccumuloIndexSet(indexSparqlString2, conn, accCon, "table2"); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (SailException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MutationsRejectedException e) { - - e.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - -// -// Scanner scan = null; -// try { -// scan = accCon.createScanner(tablename, new Authorizations("auths")); -// } catch (TableNotFoundException e) { -// -// e.printStackTrace(); -// } -// -// scan.setRange(new Range()); -// -// for (Map.Entry entry : scan) { -// System.out.println("Key row string is " + entry.getKey().getRow().toString()); -// System.out.println("Key is " + entry.getKey()); -// System.out.println("Value is " + (new String(entry.getKey().getColumnQualifier().toString()))); -// -// } - - - - index.add(ais2); - index.add(ais1); - - -// Assert.assertEquals((double)crh1.getCount(), ais1.cardinality()); -// Assert.assertEquals((double)crh2.getCount(), ais2.cardinality()); -// -// -// crh1 = new CountingResultHandler(); -// crh2 = new CountingResultHandler(); -// -// -// try { -// conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1); -// } catch (TupleQueryResultHandlerException e1) { -// -// e1.printStackTrace(); -// } catch (QueryEvaluationException e1) { -// -// e1.printStackTrace(); -// } catch (MalformedQueryException e1) { -// -// e1.printStackTrace(); -// } catch (RepositoryException e1) { -// -// e1.printStackTrace(); -// } - - - - ParsedQuery pq = null; - SPARQLParser sp = new SPARQLParser(); - try { - pq = sp.parseQuery(queryString, null); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } - - ExternalProcessor processor = new ExternalProcessor(index); - processor.process(pq.getTupleExpr()); - - - Sail processingSail = new ExternalSail(s, processor); - SailRepository smartSailRepo = new SailRepository(processingSail); - try { - smartSailRepo.initialize(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - - - try { - smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2); - } catch (TupleQueryResultHandlerException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - // Assert.assertEquals(2, crh1.getCount()); - Assert.assertEquals(2, crh2.getCount()); - - - - } - - - - - - - - - - - - @Test - public void testEvaluateTwoIndexThreeVarOrder2() { - - - - URI superclass = new URIImpl("uri:superclass"); - URI superclass2 = new URIImpl("uri:superclass2"); - - - try { - conn.add(subclass, RDF.TYPE, superclass); - conn.add(subclass2, RDF.TYPE, superclass2); - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e5) { - - e5.printStackTrace(); - } - - - try { - if(accCon.tableOperations().exists("table2")){ - accCon.tableOperations().delete("table2"); - } - accCon.tableOperations().create("table2"); - } catch (AccumuloException e4) { - - e4.printStackTrace(); - } catch (AccumuloSecurityException e4) { - - e4.printStackTrace(); - } catch (TableExistsException e4) { - - e4.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - try { - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e3) { - - e3.printStackTrace(); - } - - - - // TODO Auto-generated method stub - String indexSparqlString = ""// - + "SELECT ?c ?e ?l " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l "// - + "}";// - - - String indexSparqlString2 = ""// - + "SELECT ?o ?f ?e ?c ?l " // - + "{" // - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - String queryString = ""// - + "SELECT ?e ?c ?l ?f ?o " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l. "// - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - - - - - - CountingResultHandler crh1 = new CountingResultHandler(); - CountingResultHandler crh2 = new CountingResultHandler(); - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh1); - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString2).evaluate(crh2); - } catch (TupleQueryResultHandlerException e2) { - - e2.printStackTrace(); - } catch (QueryEvaluationException e2) { - - e2.printStackTrace(); - } catch (MalformedQueryException e2) { - - e2.printStackTrace(); - } catch (RepositoryException e2) { - - e2.printStackTrace(); - } - - - - List index = Lists.newArrayList(); - AccumuloIndexSet ais1 = null; - AccumuloIndexSet ais2 = null; - - try { - ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename); - ais2 = new AccumuloIndexSet(indexSparqlString2, conn, accCon, "table2"); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (SailException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MutationsRejectedException e) { - - e.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - index.add(ais2); - index.add(ais1); - - - Assert.assertEquals((double)crh1.getCount(), ais1.cardinality()); - Assert.assertEquals((double)crh2.getCount(), ais2.cardinality()); - - - crh1 = new CountingResultHandler(); - crh2 = new CountingResultHandler(); - -// -// try { -// conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1); -// } catch (TupleQueryResultHandlerException e1) { -// -// e1.printStackTrace(); -// } catch (QueryEvaluationException e1) { -// -// e1.printStackTrace(); -// } catch (MalformedQueryException e1) { -// -// e1.printStackTrace(); -// } catch (RepositoryException e1) { -// -// e1.printStackTrace(); -// } - - - - - ParsedQuery pq = null; - SPARQLParser sp = new SPARQLParser(); - try { - pq = sp.parseQuery(queryString, null); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } - - ExternalProcessor processor = new ExternalProcessor(index); - - - - Sail processingSail = new ExternalSail(s, processor); - SailRepository smartSailRepo = new SailRepository(processingSail); - try { - smartSailRepo.initialize(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - - - try { - smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2); - } catch (TupleQueryResultHandlerException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - // Assert.assertEquals(2, crh1.getCount()); - Assert.assertEquals(2, crh2.getCount()); - - - - } - - - - - - @Test - public void testEvaluateTwoIndexThreeVarOrder3ThreeBindingSet() { - - - URI sub3 = new URIImpl("uri:entity3"); - URI subclass3 = new URIImpl("uri:class3"); - URI obj3 = new URIImpl("uri:obj3"); - - URI superclass = new URIImpl("uri:superclass"); - URI superclass2 = new URIImpl("uri:superclass2"); - URI superclass3 = new URIImpl("uri:superclass3"); - - - try { - - conn.add(sub3, RDF.TYPE, subclass3); - conn.add(sub3, RDFS.LABEL, new LiteralImpl("label3")); - conn.add(sub3, talksTo, obj3); - - conn.add(subclass, RDF.TYPE, superclass); - conn.add(subclass2, RDF.TYPE, superclass2); - conn.add(subclass3, RDF.TYPE, superclass3); - - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - conn.add(obj3, RDFS.LABEL, new LiteralImpl("label3")); - - } catch (RepositoryException e5) { - - e5.printStackTrace(); - } - - - try { - if(accCon.tableOperations().exists("table2")){ - accCon.tableOperations().delete("table2"); - } - accCon.tableOperations().create("table2"); - } catch (AccumuloException e4) { - - e4.printStackTrace(); - } catch (AccumuloSecurityException e4) { - - e4.printStackTrace(); - } catch (TableExistsException e4) { - - e4.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - try { - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e3) { - - e3.printStackTrace(); - } - - - - - // TODO Auto-generated method stub - String indexSparqlString = ""// - + "SELECT ?c ?e ?l " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l "// - + "}";// - - - String indexSparqlString2 = ""// - + "SELECT ?o ?f ?l ?e ?c " // - + "{" // - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - String queryString = ""// - + "SELECT ?e ?c ?l ?f ?o " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l. "// - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - - - - - - CountingResultHandler crh1 = new CountingResultHandler(); - CountingResultHandler crh2 = new CountingResultHandler(); - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh1); - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString2).evaluate(crh2); - } catch (TupleQueryResultHandlerException e2) { - - e2.printStackTrace(); - } catch (QueryEvaluationException e2) { - - e2.printStackTrace(); - } catch (MalformedQueryException e2) { - - e2.printStackTrace(); - } catch (RepositoryException e2) { - - e2.printStackTrace(); - } - - - - List index = Lists.newArrayList(); - AccumuloIndexSet ais1 = null; - AccumuloIndexSet ais2 = null; - - try { - ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename); - ais2 = new AccumuloIndexSet(indexSparqlString2, conn, accCon, "table2"); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (SailException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MutationsRejectedException e) { - - e.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - -// Scanner scan1 = null; -// Scanner scan2 = null; -// try { -// scan1 = accCon.createScanner(tablename, new Authorizations("auths")); -// scan2 = accCon.createScanner("table2", new Authorizations("auths")); -// } catch (TableNotFoundException e) { -// -// e.printStackTrace(); -// } -// -// scan1.setRange(new Range()); -// -// for (Map.Entry entry : scan1) { -// System.out.println("Key row string is " + entry.getKey().getRow().toString()); -// System.out.println("Key is " + entry.getKey()); -// System.out.println("Value is " + (new String(entry.getKey().getColumnQualifier().toString()))); -// -// } -// -// -// scan2.setRange(new Range()); -// -// for (Map.Entry entry : scan2) { -// System.out.println("Key row string is " + entry.getKey().getRow().toString()); -// System.out.println("Key is " + entry.getKey()); -// System.out.println("Value is " + (new String(entry.getKey().getColumnQualifier().toString()))); -// -// } - - - - index.add(ais2); - index.add(ais1); - - - Assert.assertEquals((double)crh1.getCount(), ais1.cardinality()); - Assert.assertEquals((double)crh2.getCount(), ais2.cardinality()); - - - crh1 = new CountingResultHandler(); - crh2 = new CountingResultHandler(); - - - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1); - } catch (TupleQueryResultHandlerException e1) { - - e1.printStackTrace(); - } catch (QueryEvaluationException e1) { - - e1.printStackTrace(); - } catch (MalformedQueryException e1) { - - e1.printStackTrace(); - } catch (RepositoryException e1) { - - e1.printStackTrace(); - } - - - - - ParsedQuery pq = null; - SPARQLParser sp = new SPARQLParser(); - try { - pq = sp.parseQuery(queryString, null); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } - - ExternalProcessor processor = new ExternalProcessor(index); - - - - Sail processingSail = new ExternalSail(s, processor); - SailRepository smartSailRepo = new SailRepository(processingSail); - try { - smartSailRepo.initialize(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - // new SPARQLResultsXMLWriter(System.out) - - try { - smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2); - } catch (TupleQueryResultHandlerException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - Assert.assertEquals(3, crh1.getCount()); - Assert.assertEquals(3, crh2.getCount()); - - - - } - - - - - - - - @Test - public void testEvaluateTwoIndexThreeVarOrder5ThreeBindingSet() { - - - URI sub3 = new URIImpl("uri:entity3"); - URI subclass3 = new URIImpl("uri:class3"); - URI obj3 = new URIImpl("uri:obj3"); - - URI superclass = new URIImpl("uri:superclass"); - URI superclass2 = new URIImpl("uri:superclass2"); - URI superclass3 = new URIImpl("uri:superclass3"); - - - try { - - conn.add(sub3, RDF.TYPE, subclass3); - conn.add(sub3, RDFS.LABEL, new LiteralImpl("label3")); - conn.add(sub3, talksTo, obj3); - - conn.add(subclass, RDF.TYPE, superclass); - conn.add(subclass2, RDF.TYPE, superclass2); - conn.add(subclass3, RDF.TYPE, superclass3); - - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - conn.add(obj3, RDFS.LABEL, new LiteralImpl("label3")); - - } catch (RepositoryException e5) { - - e5.printStackTrace(); - } - - - try { - if(accCon.tableOperations().exists("table2")){ - accCon.tableOperations().delete("table2"); - } - accCon.tableOperations().create("table2"); - } catch (AccumuloException e4) { - - e4.printStackTrace(); - } catch (AccumuloSecurityException e4) { - - e4.printStackTrace(); - } catch (TableExistsException e4) { - - e4.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - try { - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e3) { - - e3.printStackTrace(); - } - - - - - // TODO Auto-generated method stub - String indexSparqlString = ""// - + "SELECT ?c ?e ?l " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l "// - + "}";// - - - String indexSparqlString2 = ""// - + "SELECT ?o ?f ?e ?l ?c " // - + "{" // - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - String queryString = ""// - + "SELECT ?e ?c ?l ?f ?o " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l. "// - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - - - - - - CountingResultHandler crh1 = new CountingResultHandler(); - CountingResultHandler crh2 = new CountingResultHandler(); - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh1); - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString2).evaluate(crh2); - } catch (TupleQueryResultHandlerException e2) { - - e2.printStackTrace(); - } catch (QueryEvaluationException e2) { - - e2.printStackTrace(); - } catch (MalformedQueryException e2) { - - e2.printStackTrace(); - } catch (RepositoryException e2) { - - e2.printStackTrace(); - } - - - - List index = Lists.newArrayList(); - AccumuloIndexSet ais1 = null; - AccumuloIndexSet ais2 = null; - - try { - ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename); - ais2 = new AccumuloIndexSet(indexSparqlString2, conn, accCon, "table2"); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (SailException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MutationsRejectedException e) { - - e.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - index.add(ais2); - index.add(ais1); - - - Assert.assertEquals((double)crh1.getCount(), ais1.cardinality()); - Assert.assertEquals((double)crh2.getCount(), ais2.cardinality()); - - - crh1 = new CountingResultHandler(); - crh2 = new CountingResultHandler(); - - - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1); - } catch (TupleQueryResultHandlerException e1) { - - e1.printStackTrace(); - } catch (QueryEvaluationException e1) { - - e1.printStackTrace(); - } catch (MalformedQueryException e1) { - - e1.printStackTrace(); - } catch (RepositoryException e1) { - - e1.printStackTrace(); - } - - - - - ParsedQuery pq = null; - SPARQLParser sp = new SPARQLParser(); - try { - pq = sp.parseQuery(queryString, null); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } - - ExternalProcessor processor = new ExternalProcessor(index); - - - - Sail processingSail = new ExternalSail(s, processor); - SailRepository smartSailRepo = new SailRepository(processingSail); - try { - smartSailRepo.initialize(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - // new SPARQLResultsXMLWriter(System.out) - - try { - smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2); - } catch (TupleQueryResultHandlerException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - Assert.assertEquals(3, crh1.getCount()); - Assert.assertEquals(3, crh2.getCount()); - - - - } - - - - - - - - - - - - - - @Test - public void testEvaluateTwoIndexThreeVarOrder4ThreeBindingSet() { - - - URI sub3 = new URIImpl("uri:entity3"); - URI subclass3 = new URIImpl("uri:class3"); - URI obj3 = new URIImpl("uri:obj3"); - - URI superclass = new URIImpl("uri:superclass"); - URI superclass2 = new URIImpl("uri:superclass2"); - URI superclass3 = new URIImpl("uri:superclass3"); - - - try { - - conn.add(sub3, RDF.TYPE, subclass3); - conn.add(sub3, RDFS.LABEL, new LiteralImpl("label3")); - conn.add(sub3, talksTo, obj3); - - conn.add(subclass, RDF.TYPE, superclass); - conn.add(subclass2, RDF.TYPE, superclass2); - conn.add(subclass3, RDF.TYPE, superclass3); - - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - conn.add(obj3, RDFS.LABEL, new LiteralImpl("label3")); - - } catch (RepositoryException e5) { - - e5.printStackTrace(); - } - - - try { - if(accCon.tableOperations().exists("table2")){ - accCon.tableOperations().delete("table2"); - } - accCon.tableOperations().create("table2"); - } catch (AccumuloException e4) { - - e4.printStackTrace(); - } catch (AccumuloSecurityException e4) { - - e4.printStackTrace(); - } catch (TableExistsException e4) { - - e4.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - try { - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e3) { - - e3.printStackTrace(); - } - - - - - // TODO Auto-generated method stub - String indexSparqlString = ""// - + "SELECT ?c ?e ?l " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l "// - + "}";// - - - String indexSparqlString2 = ""// - + "SELECT ?o ?f ?c ?e ?l " // - + "{" // - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - String queryString = ""// - + "SELECT ?e ?c ?l ?f ?o " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l. "// - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - - - - - - CountingResultHandler crh1 = new CountingResultHandler(); - CountingResultHandler crh2 = new CountingResultHandler(); - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh1); - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString2).evaluate(crh2); - } catch (TupleQueryResultHandlerException e2) { - - e2.printStackTrace(); - } catch (QueryEvaluationException e2) { - - e2.printStackTrace(); - } catch (MalformedQueryException e2) { - - e2.printStackTrace(); - } catch (RepositoryException e2) { - - e2.printStackTrace(); - } - - - - List index = Lists.newArrayList(); - AccumuloIndexSet ais1 = null; - AccumuloIndexSet ais2 = null; - - try { - ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename); - ais2 = new AccumuloIndexSet(indexSparqlString2, conn, accCon, "table2"); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (SailException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MutationsRejectedException e) { - - e.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - -// Scanner scan1 = null; -// Scanner scan2 = null; -// try { -// scan1 = accCon.createScanner(tablename, new Authorizations("auths")); -// scan2 = accCon.createScanner("table2", new Authorizations("auths")); -// } catch (TableNotFoundException e) { -// -// e.printStackTrace(); -// } -// -// scan1.setRange(new Range()); -// -// for (Map.Entry entry : scan1) { -// System.out.println("Key row string is " + entry.getKey().getRow().toString()); -// System.out.println("Key is " + entry.getKey()); -// System.out.println("Value is " + (new String(entry.getKey().getColumnQualifier().toString()))); -// -// } -// -// -// scan2.setRange(new Range()); -// -// for (Map.Entry entry : scan2) { -// System.out.println("Key row string is " + entry.getKey().getRow().toString()); -// System.out.println("Key is " + entry.getKey()); -// System.out.println("Value is " + (new String(entry.getKey().getColumnQualifier().toString()))); -// -// } - - - - index.add(ais2); - index.add(ais1); - - - Assert.assertEquals((double)crh1.getCount(), ais1.cardinality()); - Assert.assertEquals((double)crh2.getCount(), ais2.cardinality()); - - - crh1 = new CountingResultHandler(); - crh2 = new CountingResultHandler(); - - - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1); - } catch (TupleQueryResultHandlerException e1) { - - e1.printStackTrace(); - } catch (QueryEvaluationException e1) { - - e1.printStackTrace(); - } catch (MalformedQueryException e1) { - - e1.printStackTrace(); - } catch (RepositoryException e1) { - - e1.printStackTrace(); - } - - - - - ParsedQuery pq = null; - SPARQLParser sp = new SPARQLParser(); - try { - pq = sp.parseQuery(queryString, null); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } - - ExternalProcessor processor = new ExternalProcessor(index); - - - - Sail processingSail = new ExternalSail(s, processor); - SailRepository smartSailRepo = new SailRepository(processingSail); - try { - smartSailRepo.initialize(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - //new SPARQLResultsXMLWriter(System.out) - - try { - smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2); - } catch (TupleQueryResultHandlerException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - Assert.assertEquals(3, crh1.getCount()); - Assert.assertEquals(3, crh2.getCount()); - - - - } - - - - - - - - - @Test - public void testEvaluateTwoIndexThreeVarOrder6ThreeBindingSet() { - - - URI sub3 = new URIImpl("uri:entity3"); - URI subclass3 = new URIImpl("uri:class3"); - URI obj3 = new URIImpl("uri:obj3"); - - URI superclass = new URIImpl("uri:superclass"); - URI superclass2 = new URIImpl("uri:superclass2"); - URI superclass3 = new URIImpl("uri:superclass3"); - - - try { - - conn.add(sub3, RDF.TYPE, subclass3); - conn.add(sub3, RDFS.LABEL, new LiteralImpl("label3")); - conn.add(sub3, talksTo, obj3); - - conn.add(subclass, RDF.TYPE, superclass); - conn.add(subclass2, RDF.TYPE, superclass2); - conn.add(subclass3, RDF.TYPE, superclass3); - - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - conn.add(obj3, RDFS.LABEL, new LiteralImpl("label3")); - - } catch (RepositoryException e5) { - - e5.printStackTrace(); - } - - - try { - if(accCon.tableOperations().exists("table2")){ - accCon.tableOperations().delete("table2"); - } - accCon.tableOperations().create("table2"); - } catch (AccumuloException e4) { - - e4.printStackTrace(); - } catch (AccumuloSecurityException e4) { - - e4.printStackTrace(); - } catch (TableExistsException e4) { - - e4.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - try { - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e3) { - - e3.printStackTrace(); - } - - - - - // TODO Auto-generated method stub - String indexSparqlString = ""// - + "SELECT ?c ?e ?l " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l "// - + "}";// - - - String indexSparqlString2 = ""// - + "SELECT ?c ?l ?e ?o ?f " // - + "{" // - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - String queryString = ""// - + "SELECT ?e ?c ?l ?f ?o " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l. "// - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - - - - - - CountingResultHandler crh1 = new CountingResultHandler(); - CountingResultHandler crh2 = new CountingResultHandler(); - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh1); - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString2).evaluate(crh2); - } catch (TupleQueryResultHandlerException e2) { - - e2.printStackTrace(); - } catch (QueryEvaluationException e2) { - - e2.printStackTrace(); - } catch (MalformedQueryException e2) { - - e2.printStackTrace(); - } catch (RepositoryException e2) { - - e2.printStackTrace(); - } - - - - List index = Lists.newArrayList(); - AccumuloIndexSet ais1 = null; - AccumuloIndexSet ais2 = null; - - try { - ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename); - ais2 = new AccumuloIndexSet(indexSparqlString2, conn, accCon, "table2"); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (SailException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MutationsRejectedException e) { - - e.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - - - index.add(ais2); - index.add(ais1); - - - Assert.assertEquals((double)crh1.getCount(), ais1.cardinality()); - Assert.assertEquals((double)crh2.getCount(), ais2.cardinality()); - - - crh1 = new CountingResultHandler(); - crh2 = new CountingResultHandler(); - - - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1); - } catch (TupleQueryResultHandlerException e1) { - - e1.printStackTrace(); - } catch (QueryEvaluationException e1) { - - e1.printStackTrace(); - } catch (MalformedQueryException e1) { - - e1.printStackTrace(); - } catch (RepositoryException e1) { - - e1.printStackTrace(); - } - - - - - ParsedQuery pq = null; - SPARQLParser sp = new SPARQLParser(); - try { - pq = sp.parseQuery(queryString, null); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } - - ExternalProcessor processor = new ExternalProcessor(index); - - - - Sail processingSail = new ExternalSail(s, processor); - SailRepository smartSailRepo = new SailRepository(processingSail); - try { - smartSailRepo.initialize(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - //new SPARQLResultsXMLWriter(System.out) - - try { - smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2); - } catch (TupleQueryResultHandlerException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - Assert.assertEquals(3, crh1.getCount()); - Assert.assertEquals(3, crh2.getCount()); - - - - } - - - - - - - - - - @Test - public void testEvaluateTwoIndexThreeVarOrder7ThreeBindingSet() { - - - URI sub3 = new URIImpl("uri:entity3"); - URI subclass3 = new URIImpl("uri:class3"); - URI obj3 = new URIImpl("uri:obj3"); - - URI superclass = new URIImpl("uri:superclass"); - URI superclass2 = new URIImpl("uri:superclass2"); - URI superclass3 = new URIImpl("uri:superclass3"); - - - try { - - conn.add(sub3, RDF.TYPE, subclass3); - conn.add(sub3, RDFS.LABEL, new LiteralImpl("label3")); - conn.add(sub3, talksTo, obj3); - - conn.add(subclass, RDF.TYPE, superclass); - conn.add(subclass2, RDF.TYPE, superclass2); - conn.add(subclass3, RDF.TYPE, superclass3); - - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - conn.add(obj3, RDFS.LABEL, new LiteralImpl("label3")); - - } catch (RepositoryException e5) { - - e5.printStackTrace(); - } - - - try { - if(accCon.tableOperations().exists("table2")){ - accCon.tableOperations().delete("table2"); - } - accCon.tableOperations().create("table2"); - } catch (AccumuloException e4) { - - e4.printStackTrace(); - } catch (AccumuloSecurityException e4) { - - e4.printStackTrace(); - } catch (TableExistsException e4) { - - e4.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - try { - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e3) { - - e3.printStackTrace(); - } - - - - - // TODO Auto-generated method stub - String indexSparqlString = ""// - + "SELECT ?c ?e ?l " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l "// - + "}";// - - - String indexSparqlString2 = ""// - + "SELECT ?o ?l ?c ?e ?f " // - + "{" // - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - String queryString = ""// - + "SELECT ?e ?c ?l ?f ?o " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l. "// - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - - - - - - CountingResultHandler crh1 = new CountingResultHandler(); - CountingResultHandler crh2 = new CountingResultHandler(); - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh1); - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString2).evaluate(crh2); - } catch (TupleQueryResultHandlerException e2) { - - e2.printStackTrace(); - } catch (QueryEvaluationException e2) { - - e2.printStackTrace(); - } catch (MalformedQueryException e2) { - - e2.printStackTrace(); - } catch (RepositoryException e2) { - - e2.printStackTrace(); - } - - - - List index = Lists.newArrayList(); - AccumuloIndexSet ais1 = null; - AccumuloIndexSet ais2 = null; - - try { - ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename); - ais2 = new AccumuloIndexSet(indexSparqlString2, conn, accCon, "table2"); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (SailException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MutationsRejectedException e) { - - e.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - - - index.add(ais2); - index.add(ais1); - - - Assert.assertEquals((double)crh1.getCount(), ais1.cardinality()); - Assert.assertEquals((double)crh2.getCount(), ais2.cardinality()); - - - crh1 = new CountingResultHandler(); - crh2 = new CountingResultHandler(); - - - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1); - } catch (TupleQueryResultHandlerException e1) { - - e1.printStackTrace(); - } catch (QueryEvaluationException e1) { - - e1.printStackTrace(); - } catch (MalformedQueryException e1) { - - e1.printStackTrace(); - } catch (RepositoryException e1) { - - e1.printStackTrace(); - } - - - - - ParsedQuery pq = null; - SPARQLParser sp = new SPARQLParser(); - try { - pq = sp.parseQuery(queryString, null); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } - - ExternalProcessor processor = new ExternalProcessor(index); - - - - Sail processingSail = new ExternalSail(s, processor); - SailRepository smartSailRepo = new SailRepository(processingSail); - try { - smartSailRepo.initialize(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - //new SPARQLResultsXMLWriter(System.out) - - try { - smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2); - } catch (TupleQueryResultHandlerException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (RepositoryException e) { - - e.printStackTrace(); - } - - Assert.assertEquals(3, crh1.getCount()); - Assert.assertEquals(3, crh2.getCount()); - - - - } - - - - - - - - - - - - - @Test - public void testEvaluateTwoIndexThreeVarInvalidOrder1() { - - - - URI superclass = new URIImpl("uri:superclass"); - URI superclass2 = new URIImpl("uri:superclass2"); - - - try { - conn.add(subclass, RDF.TYPE, superclass); - conn.add(subclass2, RDF.TYPE, superclass2); - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e5) { - - e5.printStackTrace(); - } - - - try { - if(accCon.tableOperations().exists("table2")){ - accCon.tableOperations().delete("table2"); - } - accCon.tableOperations().create("table2"); - } catch (AccumuloException e4) { - - e4.printStackTrace(); - } catch (AccumuloSecurityException e4) { - - e4.printStackTrace(); - } catch (TableExistsException e4) { - - e4.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - try { - conn.add(obj, RDFS.LABEL, new LiteralImpl("label")); - conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2")); - } catch (RepositoryException e3) { - - e3.printStackTrace(); - } - - - - // TODO Auto-generated method stub - String indexSparqlString = ""// - + "SELECT ?c ?e ?l " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l "// - + "}";// - - - String indexSparqlString2 = ""// - + "SELECT ?e ?o ?f ?c ?l " // - + "{" // - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - String queryString = ""// - + "SELECT ?e ?c ?l ?f ?o " // - + "{" // - + " ?e a ?c . "// - + " ?e ?l. "// - + " ?e ?o . "// - + " ?o ?l. "// - + " ?c a ?f . " // - + "}";// - - - - - - - - CountingResultHandler crh1 = new CountingResultHandler(); - CountingResultHandler crh2 = new CountingResultHandler(); - try { - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString).evaluate(crh1); - conn.prepareTupleQuery(QueryLanguage.SPARQL, indexSparqlString2).evaluate(crh2); - } catch (TupleQueryResultHandlerException e2) { - - e2.printStackTrace(); - } catch (QueryEvaluationException e2) { - - e2.printStackTrace(); - } catch (MalformedQueryException e2) { - - e2.printStackTrace(); - } catch (RepositoryException e2) { - - e2.printStackTrace(); - } - - - - List index = Lists.newArrayList(); - AccumuloIndexSet ais1 = null; - AccumuloIndexSet ais2 = null; - - try { - ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename); - ais2 = new AccumuloIndexSet(indexSparqlString2, conn, accCon, "table2"); - } catch (MalformedQueryException e) { - - e.printStackTrace(); - } catch (SailException e) { - - e.printStackTrace(); - } catch (QueryEvaluationException e) { - - e.printStackTrace(); - } catch (MutationsRejectedException e) { - - e.printStackTrace(); - } catch (TableNotFoundException e) { - - e.printStackTrace(); - } - - - index.add(ais2