[
https://issues.apache.org/jira/browse/RYA-273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16050597#comment-16050597
]
ASF GitHub Bot commented on RYA-273:
------------------------------------
Github user meiercaleb commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/161#discussion_r122229447
--- 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 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;
+
+public class RyaStatementSerializer extends Serializer<RyaStatement> {
+
+ 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());
+ }
+ }
+
+ @Override
+ public void write(Kryo kryo, Output output, RyaStatement object) {
+ writeToKryo(kryo, output, object);
+ }
+
+ public static RyaStatement readFromKryo(Kryo kryo, Input input,
Class<RyaStatement> type){
+ String subject = input.readString();
+ String predicate = input.readString();
+ String objectType = input.readString();
+ String objectValue = input.readString();
+ RyaType value;
+ if (objectType.equals("http://www.w3.org/2001/XMLSchema#anyURI")){
+ value = new RyaURI(objectValue);
+ }
+ else {
+ value = new RyaType(new URIImpl(objectType), objectValue);
+ }
+ RyaStatement statement = new RyaStatement(new RyaURI(subject), new
RyaURI(predicate), value);
+ int length = 0;
+ boolean hasNextValue = input.readBoolean();
+ if (hasNextValue){
+ statement.setContext(new RyaURI(input.readString()));
+ }
+ hasNextValue = input.readBoolean();
+ if (hasNextValue){
+ length = input.readInt();
+ statement.setColumnVisibility(input.readBytes(length));
+ }
+ hasNextValue = input.readBoolean();
+ if (hasNextValue){
+ statement.setQualifer(input.readString());
+ }
+ hasNextValue = input.readBoolean();
+ if (hasNextValue){
+ statement.setTimestamp(input.readLong());
+ }
+ hasNextValue = input.readBoolean();
+ if (hasNextValue){
+ length = input.readInt();
+ statement.setValue(input.readBytes(length));
+ }
+
+ return statement;
+ }
+
+ public static RyaStatement read(Input input){
+ String subject = input.readString();
+ String predicate = input.readString();
+ String objectType = input.readString();
+ String objectValue = input.readString();
+ RyaType value;
+ if (objectType.equals("http://www.w3.org/2001/XMLSchema#anyURI")){
--- End diff --
Yes. Done.
> 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)