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

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

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

    https://github.com/apache/incubator-rya/pull/161#discussion_r122251690
  
    --- Diff: 
common/rya.api/src/main/java/org/apache/rya/api/domain/serialization/kryo/RyaStatementSerializer.java
 ---
    @@ -0,0 +1,156 @@
    +package org.apache.rya.api.domain.serialization.kryo;
    +/*
    + * 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.openrdf.model.impl.URIImpl;
    +import org.openrdf.model.vocabulary.XMLSchema;
    +
    +import com.esotericsoftware.kryo.Kryo;
    +import com.esotericsoftware.kryo.Serializer;
    +import com.esotericsoftware.kryo.io.Input;
    +import com.esotericsoftware.kryo.io.Output;
    +
    +import org.apache.rya.api.domain.RyaStatement;
    +import org.apache.rya.api.domain.RyaType;
    +import org.apache.rya.api.domain.RyaURI;
    +
    +/**
    + * Kryo Serializer for {@link RyaStatement}s
    + *
    + */
    +public class RyaStatementSerializer extends Serializer<RyaStatement> {
    +    
    +    /**
    +     * Uses Kryo to write RyaStatement to {@lin Output}
    +     * @param kryo - writes statement to output
    +     * @param output - output stream that statement is written to
    +     * @param object - statement written to output
    +     */
    +    public static void writeToKryo(Kryo kryo, Output output, RyaStatement 
object) {
    +        output.writeString(object.getSubject().getData());
    +        output.writeString(object.getPredicate().getData());
    +        output.writeString(object.getObject().getDataType().toString());
    +        output.writeString(object.getObject().getData());
    +        boolean hasContext = object.getContext() != null;
    +        output.writeBoolean(hasContext);
    +        if(hasContext){
    +            output.writeString(object.getContext().getData());
    +        }
    +        boolean shouldWrite = object.getColumnVisibility() != null;
    +        output.writeBoolean(shouldWrite);
    +        if(shouldWrite){
    +            output.writeInt(object.getColumnVisibility().length);
    +            output.writeBytes(object.getColumnVisibility());
    +        }
    +        shouldWrite = object.getQualifer() != null;
    +        output.writeBoolean(shouldWrite);
    +        if(shouldWrite){
    +            output.writeString(object.getQualifer());
    +        }
    +        shouldWrite = object.getTimestamp() != null;
    +        output.writeBoolean(shouldWrite);
    +        if(shouldWrite){
    +            output.writeLong(object.getTimestamp());
    +        }
    +        shouldWrite = object.getValue() != null;
    +        output.writeBoolean(shouldWrite);
    +        if(shouldWrite){
    +            output.writeBytes(object.getValue());
    +        }
    +    }   
    +
    +    /**
    +     * Uses Kryo to write RyaStatement to {@lin Output}
    +     * @param kryo - writes statement to output
    +     * @param output - output stream that statement is written to
    +     * @param object - statement written to output
    +     */
    +    @Override
    +    public void write(Kryo kryo, Output output, RyaStatement object) {
    +        writeToKryo(kryo, output, object);
    +    }
    +    
    +    /**
    +     * Uses Kryo to read a RyaStatement from {@link Input}
    +     * @param kryo - reads statement from input
    +     * @param input - Input stream that statement is read from
    +     * @param type - Type read from input stream
    +     * @return - statement read from input stream
    +     */
    +    public static RyaStatement readFromKryo(Kryo kryo, Input input, 
Class<RyaStatement> type){
    +        return read(input);
    +    }
    +
    +    /**
    +     * Reads RyaStatement from {@link Input} stream
    +     * @param input - input stream that statement is read from
    +     * @return - statement read from input stream
    +     */
    +    public static RyaStatement read(Input input){
    +        String subject = input.readString();
    --- End diff --
    
    null check


> 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