You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@rya.apache.org by meiercaleb <gi...@git.apache.org> on 2017/01/12 19:38:31 UTC

[GitHub] incubator-rya pull request #137: Rya 234 statement metadata optimizer

GitHub user meiercaleb opened a pull request:

    https://github.com/apache/incubator-rya/pull/137

    Rya 234 statement metadata optimizer

    <!--
    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.
    -->
    ## Description
    >What Changed?
    Added a package so that reified queries can be issued to Rya in an efficient way.  Using the StatementMetada field of a RyaStatement, users can issue reified queries that includes contextual properties of each triple.  Reified queries are matched with a StatementMetadataNode, which is inserted
    into the query plan using StatementMetadataOpitimizer.
    
    ### Tests
    Tests have been included to test the functionality of the StatementMetadataNode, StatementMetadataOptimizer and related classes for both Mongo backed Rya and Accumulo backed Rya.
    
    ### Links
    [Jira](https://issues.apache.org/jira/browse/RYA-234)
    
    ### Checklist
    - [ ] Code Review
    - [ ] Squash Commits
    
    #### People To Reivew
    Andrew Smith, Puja Valiyil


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/meiercaleb/incubator-rya RYA-234-StatementMetadataOptimizer

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-rya/pull/137.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #137
    
----
commit 5b81536d84805a5a7cdd76804a371c35a402c329
Author: Caleb Meier <ca...@parsons.com>
Date:   2016-12-13T20:26:29Z

    RYA-144-ExternalSetMatchingFramework

commit 7d30f76af3131313d14c964c6573e913856fcc68
Author: Caleb Meier <ca...@parsons.com>
Date:   2017-01-06T00:22:20Z

    RYA-234-StatementMetadataOptimizer

commit 8967299418fdf9b2e176d1a6abb0fc53f2cae251
Author: Caleb Meier <ca...@parsons.com>
Date:   2017-01-12T05:27:23Z

    Preliminary Pull Request Commit

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rya pull request #137: Rya 234 statement metadata optimizer

Posted by pujav65 <gi...@git.apache.org>.
Github user pujav65 commented on a diff in the pull request:

    https://github.com/apache/incubator-rya/pull/137#discussion_r97358061
  
    --- Diff: README.md ---
    @@ -61,7 +61,15 @@ Run the command to build the code `mvn clean install`
     
     If all goes well, the build should be successful and a war should be produced in `web/web.rya/target/web.rya.war`
     
    -Note: To perform a build of the geomesa/lucene indexing, run the build with the profile 'indexing' `mvn clean install -P indexing`
    +Note: The following profiles are available to tailor the build:
    +
    +
    +| Profile ID | Purpose |
    +| ---------- | ------- |
    +| geoindexing | perform a build of the geomesa/lucene indexing |
    +| mongodb | build with mongoDB configuration (defaults to accumulo) |
    +
    +To run the build with the profile 'geoindexing' `mvn clean install -P geoindexing`.
    --- End diff --
    
    was this for another jira ticket.  I'm confused over why it was bundled here or if this is just a bad rebase or something


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rya pull request #137: Rya 234 statement metadata optimizer

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-rya/pull/137


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rya pull request #137: Rya 234 statement metadata optimizer

Posted by meiercaleb <gi...@git.apache.org>.
Github user meiercaleb commented on a diff in the pull request:

    https://github.com/apache/incubator-rya/pull/137#discussion_r97367956
  
    --- Diff: common/rya.api/src/main/java/org/apache/rya/api/domain/StatementMetadata.java ---
    @@ -19,36 +19,50 @@
     package org.apache.rya.api.domain;
     
     import java.io.UnsupportedEncodingException;
    +import java.lang.reflect.Type;
     import java.util.HashMap;
     import java.util.Map;
     
     import org.apache.rya.api.persist.RdfDAOException;
    +import org.openrdf.model.impl.URIImpl;
     
    +import com.google.common.base.Preconditions;
    +import com.google.common.reflect.TypeToken;
     import com.google.gson.Gson;
    +import com.google.gson.GsonBuilder;
    +import com.google.gson.JsonDeserializationContext;
    +import com.google.gson.JsonDeserializer;
    +import com.google.gson.JsonElement;
    +import com.google.gson.JsonObject;
    +import com.google.gson.JsonParseException;
    +import com.google.gson.JsonPrimitive;
    +import com.google.gson.JsonSerializationContext;
    +import com.google.gson.JsonSerializer;
     
     public class StatementMetadata {
    -    
    -    private static Gson gson = new Gson();
    +
    +    private static Gson gson;
         public static StatementMetadata EMPTY_METADATA = new StatementMetadata();
    -    
    -    private Map<String, String> metadataMap = new HashMap<String, String>();
    -    
    +
    +    private Map<RyaURI, RyaType> metadataMap = new HashMap<>();
    +    @SuppressWarnings("serial")
    +    private Type type = new TypeToken<Map<RyaURI, RyaType>>(){}.getType();
    +
         public StatementMetadata() {
    -        
    -    }
    -    
    -    public void addMetadata(String key, String value){
    -        metadataMap.put(key, value);
    +        gson = new GsonBuilder().enableComplexMapKeySerialization()
    +                .registerTypeHierarchyAdapter(RyaType.class, new RyaTypeAdapter()).create();
         }
     
         public StatementMetadata(byte[] value) throws RdfDAOException {
    +        super();
    --- End diff --
    
    Whoops!  Good catch.  I think I meant to put this().


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rya pull request #137: Rya 234 statement metadata optimizer

Posted by pujav65 <gi...@git.apache.org>.
Github user pujav65 commented on a diff in the pull request:

    https://github.com/apache/incubator-rya/pull/137#discussion_r97359270
  
    --- Diff: common/rya.api/src/main/java/org/apache/rya/api/domain/StatementMetadata.java ---
    @@ -19,36 +19,50 @@
     package org.apache.rya.api.domain;
     
     import java.io.UnsupportedEncodingException;
    +import java.lang.reflect.Type;
     import java.util.HashMap;
     import java.util.Map;
     
     import org.apache.rya.api.persist.RdfDAOException;
    +import org.openrdf.model.impl.URIImpl;
     
    +import com.google.common.base.Preconditions;
    +import com.google.common.reflect.TypeToken;
     import com.google.gson.Gson;
    +import com.google.gson.GsonBuilder;
    +import com.google.gson.JsonDeserializationContext;
    +import com.google.gson.JsonDeserializer;
    +import com.google.gson.JsonElement;
    +import com.google.gson.JsonObject;
    +import com.google.gson.JsonParseException;
    +import com.google.gson.JsonPrimitive;
    +import com.google.gson.JsonSerializationContext;
    +import com.google.gson.JsonSerializer;
     
     public class StatementMetadata {
    -    
    -    private static Gson gson = new Gson();
    +
    +    private static Gson gson;
         public static StatementMetadata EMPTY_METADATA = new StatementMetadata();
    -    
    -    private Map<String, String> metadataMap = new HashMap<String, String>();
    -    
    +
    +    private Map<RyaURI, RyaType> metadataMap = new HashMap<>();
    +    @SuppressWarnings("serial")
    +    private Type type = new TypeToken<Map<RyaURI, RyaType>>(){}.getType();
    +
         public StatementMetadata() {
    -        
    -    }
    -    
    -    public void addMetadata(String key, String value){
    -        metadataMap.put(key, value);
    +        gson = new GsonBuilder().enableComplexMapKeySerialization()
    +                .registerTypeHierarchyAdapter(RyaType.class, new RyaTypeAdapter()).create();
         }
     
         public StatementMetadata(byte[] value) throws RdfDAOException {
    +        super();
    --- End diff --
    
    whats the super class here?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rya pull request #137: Rya 234 statement metadata optimizer

Posted by meiercaleb <gi...@git.apache.org>.
Github user meiercaleb commented on a diff in the pull request:

    https://github.com/apache/incubator-rya/pull/137#discussion_r97369470
  
    --- Diff: common/rya.api/src/main/java/org/apache/rya/api/domain/StatementMetadata.java ---
    @@ -19,36 +19,50 @@
     package org.apache.rya.api.domain;
     
     import java.io.UnsupportedEncodingException;
    +import java.lang.reflect.Type;
     import java.util.HashMap;
     import java.util.Map;
     
     import org.apache.rya.api.persist.RdfDAOException;
    +import org.openrdf.model.impl.URIImpl;
     
    +import com.google.common.base.Preconditions;
    +import com.google.common.reflect.TypeToken;
     import com.google.gson.Gson;
    +import com.google.gson.GsonBuilder;
    +import com.google.gson.JsonDeserializationContext;
    +import com.google.gson.JsonDeserializer;
    +import com.google.gson.JsonElement;
    +import com.google.gson.JsonObject;
    +import com.google.gson.JsonParseException;
    +import com.google.gson.JsonPrimitive;
    +import com.google.gson.JsonSerializationContext;
    +import com.google.gson.JsonSerializer;
     
     public class StatementMetadata {
    -    
    -    private static Gson gson = new Gson();
    +
    +    private static Gson gson;
         public static StatementMetadata EMPTY_METADATA = new StatementMetadata();
    -    
    -    private Map<String, String> metadataMap = new HashMap<String, String>();
    -    
    +
    +    private Map<RyaURI, RyaType> metadataMap = new HashMap<>();
    +    @SuppressWarnings("serial")
    +    private Type type = new TypeToken<Map<RyaURI, RyaType>>(){}.getType();
    +
         public StatementMetadata() {
    -        
    -    }
    -    
    -    public void addMetadata(String key, String value){
    -        metadataMap.put(key, value);
    +        gson = new GsonBuilder().enableComplexMapKeySerialization()
    --- End diff --
    
    Nope.  Good catch. You're right.  


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rya issue #137: Rya 234 statement metadata optimizer

Posted by pujav65 <gi...@git.apache.org>.
Github user pujav65 commented on the issue:

    https://github.com/apache/incubator-rya/pull/137
  
    asfbot build


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rya pull request #137: Rya 234 statement metadata optimizer

Posted by meiercaleb <gi...@git.apache.org>.
Github user meiercaleb commented on a diff in the pull request:

    https://github.com/apache/incubator-rya/pull/137#discussion_r97367294
  
    --- Diff: README.md ---
    @@ -61,7 +61,15 @@ Run the command to build the code `mvn clean install`
     
     If all goes well, the build should be successful and a war should be produced in `web/web.rya/target/web.rya.war`
     
    -Note: To perform a build of the geomesa/lucene indexing, run the build with the profile 'indexing' `mvn clean install -P indexing`
    +Note: The following profiles are available to tailor the build:
    +
    +
    +| Profile ID | Purpose |
    +| ---------- | ------- |
    +| geoindexing | perform a build of the geomesa/lucene indexing |
    +| mongodb | build with mongoDB configuration (defaults to accumulo) |
    +
    +To run the build with the profile 'geoindexing' `mvn clean install -P geoindexing`.
    --- End diff --
    
    By product of the rebase.  Initially this branch was clone off of a branch that Andrew was working on (he had made some progress on the external optimizer framework that I picked up).  That pulled in a number of other commits that have been merged -- I didn't know whether you wanted my PR to highlight only my changes or if you wanted other peoples commits included.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-rya pull request #137: Rya 234 statement metadata optimizer

Posted by pujav65 <gi...@git.apache.org>.
Github user pujav65 commented on a diff in the pull request:

    https://github.com/apache/incubator-rya/pull/137#discussion_r97359750
  
    --- Diff: common/rya.api/src/main/java/org/apache/rya/api/domain/StatementMetadata.java ---
    @@ -19,36 +19,50 @@
     package org.apache.rya.api.domain;
     
     import java.io.UnsupportedEncodingException;
    +import java.lang.reflect.Type;
     import java.util.HashMap;
     import java.util.Map;
     
     import org.apache.rya.api.persist.RdfDAOException;
    +import org.openrdf.model.impl.URIImpl;
     
    +import com.google.common.base.Preconditions;
    +import com.google.common.reflect.TypeToken;
     import com.google.gson.Gson;
    +import com.google.gson.GsonBuilder;
    +import com.google.gson.JsonDeserializationContext;
    +import com.google.gson.JsonDeserializer;
    +import com.google.gson.JsonElement;
    +import com.google.gson.JsonObject;
    +import com.google.gson.JsonParseException;
    +import com.google.gson.JsonPrimitive;
    +import com.google.gson.JsonSerializationContext;
    +import com.google.gson.JsonSerializer;
     
     public class StatementMetadata {
    -    
    -    private static Gson gson = new Gson();
    +
    +    private static Gson gson;
         public static StatementMetadata EMPTY_METADATA = new StatementMetadata();
    -    
    -    private Map<String, String> metadataMap = new HashMap<String, String>();
    -    
    +
    +    private Map<RyaURI, RyaType> metadataMap = new HashMap<>();
    +    @SuppressWarnings("serial")
    +    private Type type = new TypeToken<Map<RyaURI, RyaType>>(){}.getType();
    +
         public StatementMetadata() {
    -        
    -    }
    -    
    -    public void addMetadata(String key, String value){
    -        metadataMap.put(key, value);
    +        gson = new GsonBuilder().enableComplexMapKeySerialization()
    --- End diff --
    
    should we be resetting this static object repeatedly?  Why not just have a static initialization?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---