Github user meiercaleb commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/161#discussion_r123546312
--- Diff:
extras/rya.pcj.fluo/pcj.fluo.app/src/main/java/org/apache/rya/indexing/pcj/fluo/app/query/ConstructQueryMetadata.java
---
@@ -0,0 +1,192 @@
+package org.apache.rya.indexing.pcj.fluo.app.query;
+
+/*
+ * 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 org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.rya.indexing.pcj.fluo.app.ConstructGraph;
+import org.apache.rya.indexing.pcj.storage.accumulo.VariableOrder;
+import org.openrdf.query.BindingSet;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
+
+import edu.umd.cs.findbugs.annotations.DefaultAnnotation;
+import edu.umd.cs.findbugs.annotations.NonNull;
+
+/**
+ * Metadata object used to store metadata for Construct Query Nodes found
in
+ * SPARQL queries.
+ *
+ */
+public class ConstructQueryMetadata extends CommonNodeMetadata {
+
+ private String childNodeId;
+ private ConstructGraph graph;
+ private String sparql;
+
+ /**
+ * Creates ConstructQueryMetadata object from the provided metadata
arguments.
+ * @param nodeId - id for the ConstructQueryNode
+ * @param childNodeId - id for the child of the ConstructQueryNode
+ * @param graph - {@link ConstructGraph} used to project {@link
BindingSet}s onto sets of statement representing construct graph
+ * @param sparql - SPARQL query containing construct graph
+ */
+ public ConstructQueryMetadata(String nodeId, String childNodeId,
ConstructGraph graph, String sparql) {
+ super(nodeId, new VariableOrder("subject", "predicate", "object"));
+ Preconditions.checkNotNull(childNodeId);
+ Preconditions.checkNotNull(graph);
+ Preconditions.checkNotNull(sparql);
+ this.childNodeId = childNodeId;
+ this.graph = graph;
+ this.sparql = sparql;
+ }
+
+ /**
+ * @return sparql query string representing this construct query
+ */
+ public String getSparql() {
+ return sparql;
+ }
+
+ /**
+ * @return The node whose results are projected onto the given
+ * {@link ConstructGraph}.
+ */
+ public String getChildNodeId() {
+ return childNodeId;
+ }
+
+ /**
+ * @return The ConstructGraph used to form statement {@link
BindingSet}s for
+ * this Construct Query
+ */
+ public ConstructGraph getConstructGraph() {
+ return graph;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(super.getNodeId(),
super.getVariableOrder(), childNodeId, graph, sparql);
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+
+ if (o instanceof ConstructQueryMetadata) {
+ ConstructQueryMetadata queryMetadata =
(ConstructQueryMetadata) o;
+ if (super.equals(queryMetadata)) {
+ return new EqualsBuilder().append(childNodeId,
queryMetadata.childNodeId).append(graph, queryMetadata.graph)
+ .append(sparql, queryMetadata.sparql).isEquals();
+ }
+ return false;
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return new StringBuilder().append("Construct Query Metadata
{\n").append(" Node ID: " + super.getNodeId() + "\n")
--- End diff --
Okay. I'll keep it in mind in the future.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---