[ 
https://issues.apache.org/jira/browse/RYA-273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16057953#comment-16057953
 ] 

ASF GitHub Bot commented on RYA-273:
------------------------------------

Github user amihalik commented on a diff in the pull request:

    https://github.com/apache/incubator-rya/pull/161#discussion_r123325067
  
    --- 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 --
    
    Consider Objects.ToStringHelper


> Construct Query Support for Rya Fluo
> ------------------------------------
>
>                 Key: RYA-273
>                 URL: https://issues.apache.org/jira/browse/RYA-273
>             Project: Rya
>          Issue Type: New Feature
>    Affects Versions: 3.2.10
>            Reporter: Caleb Meier
>            Assignee: Caleb Meier
>
> Add support for Construct Queries to the Rya Fluo Application.  This will 
> require implementing ConstructQueryMetadata for Fluo and creating the 
> appropriate observer to generate the statements indicated by the construct 
> query.  See the documentation for creating a new query node for Fluo: 
> https://github.com/meiercaleb/incubator-rya/tree/periodic_query_service/extras/rya.pcj.fluo



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to