You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rya.apache.org by ca...@apache.org on 2018/01/09 21:48:51 UTC
[34/50] [abbrv] incubator-rya git commit: RYA-377 Fixing broken build.
RYA-377 Fixing broken build.
Project: http://git-wip-us.apache.org/repos/asf/incubator-rya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rya/commit/923448f1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rya/tree/923448f1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rya/diff/923448f1
Branch: refs/heads/master
Commit: 923448f158a6de8cd0dcc0ce0a60f3bef693a3fc
Parents: 3ebf6db
Author: kchilton2 <ke...@gmail.com>
Authored: Wed Dec 13 15:05:45 2017 -0500
Committer: caleb <ca...@parsons.com>
Committed: Tue Jan 9 15:13:01 2018 -0500
----------------------------------------------------------------------
.../api/function/Filter/FilterEvaluator.java | 117 -------------------
.../api/function/filter/FilterEvaluator.java | 117 +++++++++++++++++++
.../rya/api/function/temporal/TemporalURIs.java | 19 +++
.../function/filter/FilterEvaluatorTest.java | 2 +-
.../filter/FilterProcessorSupplier.java | 2 +-
.../streams/kafka/topology/TopologyFactory.java | 2 +-
.../processors/filter/FilterProcessorTest.java | 2 +-
7 files changed, 140 insertions(+), 121 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/923448f1/common/rya.api.function/src/main/java/org/apache/rya/api/function/Filter/FilterEvaluator.java
----------------------------------------------------------------------
diff --git a/common/rya.api.function/src/main/java/org/apache/rya/api/function/Filter/FilterEvaluator.java b/common/rya.api.function/src/main/java/org/apache/rya/api/function/Filter/FilterEvaluator.java
deleted file mode 100644
index d1e1776..0000000
--- a/common/rya.api.function/src/main/java/org/apache/rya/api/function/Filter/FilterEvaluator.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.
- */
-package org.apache.rya.api.function.Filter;
-
-import static java.util.Objects.requireNonNull;
-
-import org.apache.rya.api.model.VisibilityBindingSet;
-import org.openrdf.model.Resource;
-import org.openrdf.model.Statement;
-import org.openrdf.model.URI;
-import org.openrdf.model.Value;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.model.impl.ValueFactoryImpl;
-import org.openrdf.query.QueryEvaluationException;
-import org.openrdf.query.algebra.Filter;
-import org.openrdf.query.algebra.ValueExpr;
-import org.openrdf.query.algebra.evaluation.TripleSource;
-import org.openrdf.query.algebra.evaluation.impl.EvaluationStrategyImpl;
-import org.openrdf.query.algebra.evaluation.util.QueryEvaluationUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import edu.umd.cs.findbugs.annotations.DefaultAnnotation;
-import edu.umd.cs.findbugs.annotations.NonNull;
-import info.aduna.iteration.CloseableIteration;
-
-/**
- * Processes a {@link Filter} node from a SPARQL query.
- */
-@DefaultAnnotation(NonNull.class)
-public class FilterEvaluator {
- private static final Logger log = LoggerFactory.getLogger(FilterEvaluator.class);
-
- /**
- * Is used to evaluate the conditions of a {@link Filter}.
- */
- private static final EvaluationStrategyImpl EVALUATOR = new EvaluationStrategyImpl(
- new TripleSource() {
- private final ValueFactory valueFactory = new ValueFactoryImpl();
-
- @Override
- public ValueFactory getValueFactory() {
- return valueFactory;
- }
-
- @Override
- public CloseableIteration<? extends Statement, QueryEvaluationException> getStatements(
- final Resource arg0,
- final URI arg1,
- final Value arg2,
- final Resource... arg3) throws QueryEvaluationException {
- throw new UnsupportedOperationException();
- }
- });
-
- private final ValueExpr condition;
-
- /**
- * Constructs an instance of {@link FilterEvaluator}.
- *
- * @param condition - The condition that defines what passes the filter function. (not null)
- */
- public FilterEvaluator(final ValueExpr condition) {
- this.condition = requireNonNull(condition);
- }
-
- /**
- * Make a {@link FilterEvaluator} that processes the logic of a {@link Filter}.
- *
- * @param filter - Defines the Filter that will be processed. (not null)
- * @return The {@link FilterEvaluator} for the provided {@link Filter}.
- */
- public static FilterEvaluator make(final Filter filter) {
- requireNonNull(filter);
- final ValueExpr condition = filter.getCondition();
- return new FilterEvaluator(condition);
- }
-
- /**
- * Checks to see if a {@link VisibilityBindingSet} should be included in the results or not.
- *
- * @param bs - The value that will be evaluated against the filter. (not null)
- * @return {@code true} if the binding set matches the filter and it should be included in the node's results,
- * otherwise {@code false} and it should be excluded.
- */
- public boolean filter(final VisibilityBindingSet bs) {
- requireNonNull(bs);
-
- try {
- final Value result = EVALUATOR.evaluate(condition, bs);
- return QueryEvaluationUtil.getEffectiveBooleanValue(result);
- } catch (final QueryEvaluationException e) {
- //False returned because for whatever reason, the ValueExpr could not be evaluated.
- //In the event that the ValueExpr is a FunctionCall, this Exception will be generated if
- //the Function URI is a valid URI that was found in the FunctionRegistry, but the arguments
- //for that Function could not be parsed.
- log.error("Could not evaluate a Filter.", e);
- return false;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/923448f1/common/rya.api.function/src/main/java/org/apache/rya/api/function/filter/FilterEvaluator.java
----------------------------------------------------------------------
diff --git a/common/rya.api.function/src/main/java/org/apache/rya/api/function/filter/FilterEvaluator.java b/common/rya.api.function/src/main/java/org/apache/rya/api/function/filter/FilterEvaluator.java
new file mode 100644
index 0000000..3ec97cb
--- /dev/null
+++ b/common/rya.api.function/src/main/java/org/apache/rya/api/function/filter/FilterEvaluator.java
@@ -0,0 +1,117 @@
+/*
+ * 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.
+ */
+package org.apache.rya.api.function.filter;
+
+import static java.util.Objects.requireNonNull;
+
+import org.apache.rya.api.model.VisibilityBindingSet;
+import org.openrdf.model.Resource;
+import org.openrdf.model.Statement;
+import org.openrdf.model.URI;
+import org.openrdf.model.Value;
+import org.openrdf.model.ValueFactory;
+import org.openrdf.model.impl.ValueFactoryImpl;
+import org.openrdf.query.QueryEvaluationException;
+import org.openrdf.query.algebra.Filter;
+import org.openrdf.query.algebra.ValueExpr;
+import org.openrdf.query.algebra.evaluation.TripleSource;
+import org.openrdf.query.algebra.evaluation.impl.EvaluationStrategyImpl;
+import org.openrdf.query.algebra.evaluation.util.QueryEvaluationUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import edu.umd.cs.findbugs.annotations.DefaultAnnotation;
+import edu.umd.cs.findbugs.annotations.NonNull;
+import info.aduna.iteration.CloseableIteration;
+
+/**
+ * Processes a {@link Filter} node from a SPARQL query.
+ */
+@DefaultAnnotation(NonNull.class)
+public class FilterEvaluator {
+ private static final Logger log = LoggerFactory.getLogger(FilterEvaluator.class);
+
+ /**
+ * Is used to evaluate the conditions of a {@link Filter}.
+ */
+ private static final EvaluationStrategyImpl EVALUATOR = new EvaluationStrategyImpl(
+ new TripleSource() {
+ private final ValueFactory valueFactory = new ValueFactoryImpl();
+
+ @Override
+ public ValueFactory getValueFactory() {
+ return valueFactory;
+ }
+
+ @Override
+ public CloseableIteration<? extends Statement, QueryEvaluationException> getStatements(
+ final Resource arg0,
+ final URI arg1,
+ final Value arg2,
+ final Resource... arg3) throws QueryEvaluationException {
+ throw new UnsupportedOperationException();
+ }
+ });
+
+ private final ValueExpr condition;
+
+ /**
+ * Constructs an instance of {@link FilterEvaluator}.
+ *
+ * @param condition - The condition that defines what passes the filter function. (not null)
+ */
+ public FilterEvaluator(final ValueExpr condition) {
+ this.condition = requireNonNull(condition);
+ }
+
+ /**
+ * Make a {@link FilterEvaluator} that processes the logic of a {@link Filter}.
+ *
+ * @param filter - Defines the Filter that will be processed. (not null)
+ * @return The {@link FilterEvaluator} for the provided {@link Filter}.
+ */
+ public static FilterEvaluator make(final Filter filter) {
+ requireNonNull(filter);
+ final ValueExpr condition = filter.getCondition();
+ return new FilterEvaluator(condition);
+ }
+
+ /**
+ * Checks to see if a {@link VisibilityBindingSet} should be included in the results or not.
+ *
+ * @param bs - The value that will be evaluated against the filter. (not null)
+ * @return {@code true} if the binding set matches the filter and it should be included in the node's results,
+ * otherwise {@code false} and it should be excluded.
+ */
+ public boolean filter(final VisibilityBindingSet bs) {
+ requireNonNull(bs);
+
+ try {
+ final Value result = EVALUATOR.evaluate(condition, bs);
+ return QueryEvaluationUtil.getEffectiveBooleanValue(result);
+ } catch (final QueryEvaluationException e) {
+ //False returned because for whatever reason, the ValueExpr could not be evaluated.
+ //In the event that the ValueExpr is a FunctionCall, this Exception will be generated if
+ //the Function URI is a valid URI that was found in the FunctionRegistry, but the arguments
+ //for that Function could not be parsed.
+ log.error("Could not evaluate a Filter.", e);
+ return false;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/923448f1/common/rya.api.function/src/main/java/org/apache/rya/api/function/temporal/TemporalURIs.java
----------------------------------------------------------------------
diff --git a/common/rya.api.function/src/main/java/org/apache/rya/api/function/temporal/TemporalURIs.java b/common/rya.api.function/src/main/java/org/apache/rya/api/function/temporal/TemporalURIs.java
index 7902a5f..3fd016a 100644
--- a/common/rya.api.function/src/main/java/org/apache/rya/api/function/temporal/TemporalURIs.java
+++ b/common/rya.api.function/src/main/java/org/apache/rya/api/function/temporal/TemporalURIs.java
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
package org.apache.rya.api.function.temporal;
/**
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/923448f1/common/rya.api.function/src/test/java/org/apache/rya/api/function/filter/FilterEvaluatorTest.java
----------------------------------------------------------------------
diff --git a/common/rya.api.function/src/test/java/org/apache/rya/api/function/filter/FilterEvaluatorTest.java b/common/rya.api.function/src/test/java/org/apache/rya/api/function/filter/FilterEvaluatorTest.java
index 8bbf005..5e5cbe6 100644
--- a/common/rya.api.function/src/test/java/org/apache/rya/api/function/filter/FilterEvaluatorTest.java
+++ b/common/rya.api.function/src/test/java/org/apache/rya/api/function/filter/FilterEvaluatorTest.java
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertTrue;
import java.util.concurrent.atomic.AtomicReference;
-import org.apache.rya.api.function.Filter.FilterEvaluator;
+import org.apache.rya.api.function.filter.FilterEvaluator;
import org.apache.rya.api.model.VisibilityBindingSet;
import org.junit.Test;
import org.openrdf.model.ValueFactory;
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/923448f1/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/processors/filter/FilterProcessorSupplier.java
----------------------------------------------------------------------
diff --git a/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/processors/filter/FilterProcessorSupplier.java b/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/processors/filter/FilterProcessorSupplier.java
index 5997237..2f83aa9 100644
--- a/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/processors/filter/FilterProcessorSupplier.java
+++ b/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/processors/filter/FilterProcessorSupplier.java
@@ -22,7 +22,7 @@ import static java.util.Objects.requireNonNull;
import org.apache.kafka.streams.processor.Processor;
import org.apache.kafka.streams.processor.ProcessorContext;
-import org.apache.rya.api.function.Filter.FilterEvaluator;
+import org.apache.rya.api.function.filter.FilterEvaluator;
import org.apache.rya.api.model.VisibilityBindingSet;
import org.apache.rya.streams.kafka.processors.ProcessorResult;
import org.apache.rya.streams.kafka.processors.ProcessorResult.ResultType;
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/923448f1/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/topology/TopologyFactory.java
----------------------------------------------------------------------
diff --git a/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/topology/TopologyFactory.java b/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/topology/TopologyFactory.java
index 4046e23..68fbb83 100644
--- a/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/topology/TopologyFactory.java
+++ b/extras/rya.streams/kafka/src/main/java/org/apache/rya/streams/kafka/topology/TopologyFactory.java
@@ -38,7 +38,7 @@ import org.apache.kafka.streams.processor.ProcessorSupplier;
import org.apache.kafka.streams.processor.StateStoreSupplier;
import org.apache.kafka.streams.processor.TopologyBuilder;
import org.apache.kafka.streams.state.Stores;
-import org.apache.rya.api.function.Filter.FilterEvaluator;
+import org.apache.rya.api.function.filter.FilterEvaluator;
import org.apache.rya.api.function.join.IterativeJoin;
import org.apache.rya.api.function.join.LeftOuterJoin;
import org.apache.rya.api.function.join.NaturalJoin;
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/923448f1/extras/rya.streams/kafka/src/test/java/org/apache/rya/streams/kafka/processors/filter/FilterProcessorTest.java
----------------------------------------------------------------------
diff --git a/extras/rya.streams/kafka/src/test/java/org/apache/rya/streams/kafka/processors/filter/FilterProcessorTest.java b/extras/rya.streams/kafka/src/test/java/org/apache/rya/streams/kafka/processors/filter/FilterProcessorTest.java
index 4c44bae..3ff8e8d 100644
--- a/extras/rya.streams/kafka/src/test/java/org/apache/rya/streams/kafka/processors/filter/FilterProcessorTest.java
+++ b/extras/rya.streams/kafka/src/test/java/org/apache/rya/streams/kafka/processors/filter/FilterProcessorTest.java
@@ -24,7 +24,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import org.apache.kafka.streams.processor.ProcessorContext;
-import org.apache.rya.api.function.Filter.FilterEvaluator;
+import org.apache.rya.api.function.filter.FilterEvaluator;
import org.apache.rya.api.model.VisibilityBindingSet;
import org.apache.rya.streams.kafka.RdfTestUtil;
import org.apache.rya.streams.kafka.processors.ProcessorResult;