Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* 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
Expand All @@ -24,7 +24,6 @@
import java.util.List;

import org.apache.rya.api.RdfCloudTripleStoreConfiguration;

import org.openrdf.model.Resource;
import org.openrdf.model.Value;

Expand All @@ -44,9 +43,10 @@ public enum CARDINALITY_OF {

public void destroy() throws RdfDAOException;

// XXX returns -1 if no cardinality could be found.
public double getCardinality(C conf, CARDINALITY_OF card, List<Value> val) throws RdfDAOException;
public double getCardinality(C conf, CARDINALITY_OF card, List<Value> val, Resource context) throws RdfDAOException;

public void setConf(C conf);

public C getConf();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
import java.util.List;
import java.util.Set;

import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.TableExistsException;
import org.apache.hadoop.conf.Configurable;
import org.apache.hadoop.conf.Configuration;
import org.apache.rya.accumulo.AccumuloRdfConfiguration;
import org.apache.rya.api.RdfCloudTripleStoreConfiguration;
import org.apache.rya.api.persist.joinselect.SelectivityEvalDAO;
Expand All @@ -33,11 +38,6 @@
import org.apache.rya.prospector.service.ProspectorServiceEvalStatsDAO;
import org.apache.rya.rdftriplestore.inference.DoNotExpandSP;
import org.apache.rya.rdftriplestore.utils.FixedStatementPattern;

import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.hadoop.conf.Configurable;
import org.apache.hadoop.conf.Configuration;
import org.openrdf.query.BindingSet;
import org.openrdf.query.Dataset;
import org.openrdf.query.algebra.Filter;
Expand All @@ -47,12 +47,15 @@
import org.openrdf.query.algebra.TupleExpr;
import org.openrdf.query.algebra.evaluation.QueryOptimizer;
import org.openrdf.query.algebra.helpers.QueryModelVisitorBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.collect.HashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;

public class EntityOptimizer implements QueryOptimizer, Configurable {
private static final Logger LOG = LoggerFactory.getLogger(EntityTupleSet.class);

private SelectivityEvalDAO<RdfCloudTripleStoreConfiguration> eval;
private RdfCloudTripleStoreConfiguration conf;
Expand All @@ -69,10 +72,8 @@ public EntityOptimizer(RdfCloudTripleStoreConfiguration conf) {
eval = new AccumuloSelectivityEvalDAO(conf, ConfigUtils.getConnector(conf));
((AccumuloSelectivityEvalDAO)eval).setRdfEvalDAO(new ProspectorServiceEvalStatsDAO(ConfigUtils.getConnector(conf), conf));
eval.init();
} catch (AccumuloException e) {
e.printStackTrace();
} catch (AccumuloSecurityException e) {
e.printStackTrace();
} catch (final AccumuloException | AccumuloSecurityException | TableExistsException e) {
LOG.warn("A problem was encountered while constructing the EntityOptimizer.", e);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there a way we can make this more informative?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what else you'd say here. The chained exception will have the details.

}

isEvalDaoSet = true;
Expand Down Expand Up @@ -103,10 +104,8 @@ public void setConf(Configuration conf) {
eval = new AccumuloSelectivityEvalDAO(this.conf, ConfigUtils.getConnector(this.conf));
((AccumuloSelectivityEvalDAO)eval).setRdfEvalDAO(new ProspectorServiceEvalStatsDAO(ConfigUtils.getConnector(this.conf), this.conf));
eval.init();
} catch (AccumuloException e) {
e.printStackTrace();
} catch (AccumuloSecurityException e) {
e.printStackTrace();
} catch (final AccumuloException | AccumuloSecurityException | TableExistsException e) {
LOG.warn("A problem was encountered while setting the Configuration for the EntityOptimizer.", e);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there a way we can make this more informative?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what else you'd say here. The chained exception will have the details.

}

isEvalDaoSet = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.apache.rya.indexing.accumulo.entity;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,15 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/


import info.aduna.iteration.CloseableIteration;
package org.apache.rya.indexing.accumulo.entity;

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;

import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Connector;
import org.apache.commons.io.IOUtils;
import org.apache.rya.accumulo.AccumuloRdfConfiguration;
import org.apache.rya.accumulo.AccumuloRyaDAO;
import org.apache.rya.api.RdfCloudTripleStoreConfiguration;
Expand All @@ -37,24 +37,23 @@
import org.apache.rya.rdftriplestore.RdfCloudTripleStore;
import org.apache.rya.rdftriplestore.RdfCloudTripleStoreConnection;
import org.apache.rya.rdftriplestore.evaluation.ExternalBatchingIterator;

import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Connector;
import org.apache.commons.io.IOUtils;
import org.openrdf.query.BindingSet;
import org.openrdf.query.QueryEvaluationException;
import org.openrdf.query.algebra.StatementPattern;
import org.openrdf.query.algebra.Var;
import org.openrdf.query.algebra.evaluation.QueryBindingSet;
import org.openrdf.query.algebra.evaluation.impl.ExternalSet;
import org.openrdf.sail.SailException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.beust.jcommander.internal.Sets;
import com.google.common.base.Joiner;

public class EntityTupleSet extends ExternalSet implements ExternalBatchingIterator {
import info.aduna.iteration.CloseableIteration;

public class EntityTupleSet extends ExternalSet implements ExternalBatchingIterator {
private static final Logger LOG = LoggerFactory.getLogger(EntityTupleSet.class);

private StarQuery starQuery;
private RdfCloudTripleStoreConfiguration conf;
Expand Down Expand Up @@ -97,26 +96,29 @@ private void init() {
} catch (AccumuloSecurityException e) {
e.printStackTrace();
}
if (conf.isUseStats() && conf.isUseSelectivity()) {

ProspectorServiceEvalStatsDAO evalDao = new ProspectorServiceEvalStatsDAO(accCon, conf);
evalDao.init();
AccumuloSelectivityEvalDAO ase = new AccumuloSelectivityEvalDAO(conf, accCon);
ase.setRdfEvalDAO(evalDao);
ase.init();

cardinality = starQuery.getCardinality(ase);
CardinalityStatementPattern csp = starQuery.getMinCardSp(ase);

minCard = csp.getCardinality();
minSp = csp.getSp();
} else {
// TODO come up with a better default if cardinality is not
// initialized
cardinality = minCard = 1;
minSp = starQuery.getNodes().get(0);
try {
if (conf.isUseStats() && conf.isUseSelectivity()) {
ProspectorServiceEvalStatsDAO evalDao = new ProspectorServiceEvalStatsDAO(accCon, conf);
evalDao.init();
AccumuloSelectivityEvalDAO ase = new AccumuloSelectivityEvalDAO(conf, accCon);
ase.setRdfEvalDAO(evalDao);
ase.init();

cardinality = starQuery.getCardinality(ase);
CardinalityStatementPattern csp = starQuery.getMinCardSp(ase);

minCard = csp.getCardinality();
minSp = csp.getSp();
} else {
// TODO come up with a better default if cardinality is not
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a 'make jira ticket' todo or can this be removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea. This comment was already present when I was converting.

// initialized
cardinality = minCard = 1;
minSp = starQuery.getNodes().get(0);
}
} catch(final Exception e) {
LOG.warn("A problem was encountered while initializing the EntityTupleSet.", e);
}

}

@Override
Expand Down Expand Up @@ -224,7 +226,7 @@ private int numberOfSpVars(StatementPattern sp) {


@Override
public CloseableIteration<BindingSet,QueryEvaluationException> evaluate(final Collection<BindingSet> bindingset) throws QueryEvaluationException {
public CloseableIteration<BindingSet,QueryEvaluationException> evaluate(Collection<BindingSet> bindingset) throws QueryEvaluationException {

if(bindingset.size() < 2 && !this.evalOptUsed) {
BindingSet bs = new QueryBindingSet();
Expand All @@ -248,7 +250,7 @@ public CloseableIteration<BindingSet,QueryEvaluationException> evaluate(final Co

private RdfCloudTripleStoreConnection getRyaSailConnection() throws AccumuloException,
AccumuloSecurityException, SailException {
final RdfCloudTripleStore store = new RdfCloudTripleStore();
RdfCloudTripleStore store = new RdfCloudTripleStore();
AccumuloRyaDAO crdfdao = new AccumuloRyaDAO();
crdfdao.setConnector(accCon);
AccumuloRdfConfiguration acc = new AccumuloRdfConfiguration(conf);
Expand Down
69 changes: 0 additions & 69 deletions extras/rya.prospector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ under the License.
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</dependency>

<dependency>
<groupId>org.apache.mrunit</groupId>
Expand All @@ -75,74 +71,9 @@ under the License.
</excludes>
</configuration>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<versionRange>[3.2,)</versionRange>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<versionRange>[2.9.1-01,)</versionRange>
<goals>
<goal>add-groovy-build-paths</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.9.1-01</version>
</dependency>
<!-- for 2.8.0-01 and later you must have an explicit
dependency on groovy-eclipse-batch -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.3.7-01</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.9.1-01</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand Down

This file was deleted.

Loading