You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@rya.apache.org by isper3at <gi...@git.apache.org> on 2016/04/07 19:24:04 UTC
[GitHub] incubator-rya pull request: RYA-53 add Visibilty Support to RYA
GitHub user isper3at opened a pull request:
https://github.com/apache/incubator-rya/pull/36
RYA-53 add Visibilty Support to RYA
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/isper3at/incubator-rya fluoVisibilitySupport
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-rya/pull/36.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 #36
----
commit 383ac33140d4a001e16cd061d080aa6ebdc7cf1d
Author: isper3at <sm...@gmail.com>
Date: 2016-03-21T16:55:56Z
[WIP] Added visibility support for PCJ tables
Visibility support added for PCJ tables.
If no visibilities are defined during the query,
only binding sets visible to the accesssor will
be returned.
Added and updated tests for PCJ visibility.
commit 88cda56d146aae5c897d990c020ca24def798cb5
Author: isper3at <sm...@gmail.com>
Date: 2016-03-31T16:19:05Z
Added apache license
commit d0abb46251d6d5284348af9ab74fb1d3591cfa8d
Author: isper3at <sm...@gmail.com>
Date: 2016-03-31T16:28:49Z
Added visibility
insertTriple now has a visibility parameter.
Updated all tests and functional code to use ""
as the visibility
commit 5d1c304c3917f9c27bcd1bfb35b7775b4c8f64af
Author: isper3at <sm...@gmail.com>
Date: 2016-04-05T16:16:14Z
RYA-53
Added fluo support for visibility and
integration tests for fluo->rya pcj with visibility
and direct to rya pcj with visibility.
commit d7b25a74d7415e833c112ed0ba3b3d26f2f3da4f
Author: isper3at <sm...@gmail.com>
Date: 2016-04-07T17:21:39Z
Updated tests
Updated tests to mitigate the removal of deprecated
functions
----
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r58911855
--- Diff: extras/rya.pcj.fluo/pcj.fluo.app/src/main/java/org/apache/rya/indexing/pcj/fluo/app/observers/QueryResultObserver.java ---
@@ -48,8 +50,8 @@
private static final Logger log = Logger.getLogger(QueryResultObserver.class);
private final FluoQueryMetadataDAO queryDao = new FluoQueryMetadataDAO();
-
- private final BindingSetStringConverter converter = new BindingSetStringConverter();
+ private final Encoder encoder = new StringEncoder();
+ private final VisibilityBindingSetStringConverter converter = new VisibilityBindingSetStringConverter();
--- End diff --
static, CONVERTER, ENCODER, might as well update QUERY_DAO?
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r58912137
--- Diff: extras/rya.pcj.fluo/pcj.fluo.client/src/main/java/org/apache/rya/indexing/pcj/fluo/client/util/FluoLoader.java ---
@@ -68,7 +68,7 @@ public void handleStatement(final Statement st) throws RDFHandlerException {
// If the buffer is full, flush it to the Fluo table.
if(buff.size() == FLUSH_SIZE) {
log.trace("Flushing " + buff.size() + " Statements from the buffer to Fluo.");
- insertTriples.insert(fluoClient, buff);
+ insertTriples.insert(fluoClient, buff, "");
--- End diff --
overload insert so empty quotes not necessary
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59236217
--- Diff: extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/VisibilityBindingSetStringConverterTest.java ---
@@ -0,0 +1,131 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.external.tupleSet;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openrdf.model.impl.URIImpl;
+import org.openrdf.query.BindingSet;
+import org.openrdf.query.impl.MapBindingSet;
+
+import mvm.rya.indexing.accumulo.VisibilityBindingSet;
+import mvm.rya.indexing.external.tupleSet.BindingSetConverter.BindingSetConversionException;
+import mvm.rya.indexing.external.tupleSet.PcjTables.VariableOrder;
+
+/**
+ * Tests the methods of {@link BindingSetStringConverter}.
+ */
+public class VisibilityBindingSetStringConverterTest {
+ @Test
+ public void toString_URIs() throws BindingSetConversionException {
+ // Setup the binding set that will be converted.
+ final MapBindingSet originalBindingSet = new MapBindingSet();
+ originalBindingSet.addBinding("x", new URIImpl("http://a"));
+ originalBindingSet.addBinding("y", new URIImpl("http://b"));
+ originalBindingSet.addBinding("z", new URIImpl("http://c"));
+
+ final VisibilityBindingSet visiSet = new VisibilityBindingSet(originalBindingSet, "A&B&C");
+
+ // Convert it to a String.
+ final VariableOrder varOrder = new VariableOrder("y", "z", "x");
+ final VisibilityBindingSetStringConverter converter = new VisibilityBindingSetStringConverter();
+ final String bindingSetString = converter.convert(visiSet, varOrder);
+
+ // Ensure it converted to the expected result.l
+ final String expected =
+ "http://b<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::" +
+ "http://c<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::" +
+ "http://a<<~>>http://www.w3.org/2001/XMLSchema#anyURI" +
+ (char)1 + "A&B&C";
--- End diff --
done
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r58912076
--- Diff: extras/rya.pcj.fluo/pcj.fluo.app/src/main/java/org/apache/rya/indexing/pcj/fluo/app/observers/TripleObserver.java ---
@@ -96,8 +115,14 @@ public void process(final TypedTransactionBase tx, final Bytes row, final Column
tx.delete(row, column);
}
- //determines whether triple matches SPID conditions and generates bindingset
- //whose order is determined by varOrder
+ /**
+ * Determines whether triple matches SPID conditions and generates bindingset
--- End diff --
clean up docs
---
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: RYA-53 add Visibilty Support to RYA
Posted by pujav65 <gi...@git.apache.org>.
Github user pujav65 commented on the pull request:
https://github.com/apache/incubator-rya/pull/36#issuecomment-219093064
merged. can you please close the pull request?
---
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: RYA-53 add Visibilty Support to RYA
Posted by kchilton2 <gi...@git.apache.org>.
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59209572
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/external/BindingSetDecorator.java ---
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.external;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import org.openrdf.model.Value;
+import org.openrdf.query.Binding;
+import org.openrdf.query.BindingSet;
+
+/**
+ * Abstracts out the decoration of a {@link BindingSet}.
+ */
+public abstract class BindingSetDecorator implements BindingSet {
+ private static final long serialVersionUID = 1L;
+ protected final BindingSet set;
+ private volatile int hashCode;
+
+ public BindingSetDecorator(final BindingSet set) {
--- End diff --
What is the nullness contract here? Also missing docs.
---
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: RYA-53 add Visibilty Support to RYA
Posted by kchilton2 <gi...@git.apache.org>.
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59429571
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/external/tupleSet/BindingSetStringConverter.java ---
@@ -57,48 +57,48 @@
private static final ValueFactory valueFactory = new ValueFactoryImpl();
@Override
- public String convert(BindingSet bindingSet, VariableOrder varOrder) {
+ public String convert(final BindingSet bindingSet, final VariableOrder varOrder) {
checkBindingsSubsetOfVarOrder(bindingSet, varOrder);
// Convert each Binding to a String.
- List<String> bindingStrings = new ArrayList<>();
- for(String varName : varOrder) {
+ final List<String> bindingStrings = new ArrayList<>();
+ for(final String varName : varOrder) {
if(bindingSet.hasBinding(varName)) {
// Add a value to the binding set.
final Value value = bindingSet.getBinding(varName).getValue();
final RyaType ryaValue = RdfToRyaConversions.convertValue(value);
- String bindingString = ryaValue.getData() + TYPE_DELIM + ryaValue.getDataType();
+ final String bindingString = ryaValue.getData() + TYPE_DELIM + ryaValue.getDataType();
bindingStrings.add(bindingString);
} else {
// Add a null value to the binding set.
- bindingStrings.add(NULL_VALUE_STRING);
+ bindingStrings.add(NULL_VALUE_STRING);
}
}
-
+
// Join the bindings using the binding delim.
return Joiner.on(BINDING_DELIM).join(bindingStrings);
}
/**
* Checks to see if the names of all the {@link Binding}s in the {@link BindingSet}
* are a subset of the variables names in {@link VariableOrder}.
- *
+ *
* @param bindingSet - The binding set whose Bindings will be inspected. (not null)
* @param varOrder - The names of the bindings that may appear in the BindingSet. (not null)
* @throws IllegalArgumentException Indicates the names of the bindings are
- * not a subset of the variable order.
+ * not a subset of the variable order.
*/
- private static void checkBindingsSubsetOfVarOrder(BindingSet bindingSet, VariableOrder varOrder) throws IllegalArgumentException {
+ protected static void checkBindingsSubsetOfVarOrder(final BindingSet bindingSet, final VariableOrder varOrder) throws IllegalArgumentException {
--- End diff --
You made this projected, but never call it outside of this class. It should remain private.
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r58911697
--- Diff: extras/rya.pcj.fluo/pcj.fluo.app/src/main/java/org/apache/rya/indexing/pcj/fluo/app/FilterResultUpdater.java ---
@@ -62,7 +64,8 @@
private final Encoder encoder = new StringEncoder();
- private final BindingSetStringConverter converter = new BindingSetStringConverter();
+ private final BindingSetStringConverter idConverter = new BindingSetStringConverter();
+ private final VisibilityBindingSetStringConverter valueConverter = new VisibilityBindingSetStringConverter();
--- End diff --
static, [some]_CONVERTER. Might as well update ENCODER while 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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at closed the pull request at:
https://github.com/apache/incubator-rya/pull/36
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r58911896
--- Diff: extras/rya.pcj.fluo/pcj.fluo.app/src/main/java/org/apache/rya/indexing/pcj/fluo/app/observers/TripleObserver.java ---
@@ -50,6 +55,8 @@
*/
public class TripleObserver extends TypedObserver {
+ private static final Encoder ENCODER = new StringEncoder();
+
--- End diff --
Update QUERY_DAO?
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59229603
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/external/BindingSetDecorator.java ---
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.external;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import org.openrdf.model.Value;
+import org.openrdf.query.Binding;
+import org.openrdf.query.BindingSet;
+
+/**
+ * Abstracts out the decoration of a {@link BindingSet}.
+ */
+public abstract class BindingSetDecorator implements BindingSet {
+ private static final long serialVersionUID = 1L;
+ protected final BindingSet set;
+ private volatile int hashCode;
+
+ public BindingSetDecorator(final BindingSet set) {
+ this.set = set;
+ }
+
+ @Override
+ public Iterator<Binding> iterator() {
+ return set.iterator();
+ }
+
+ @Override
+ public Set<String> getBindingNames() {
+ return set.getBindingNames();
+ }
+
+ @Override
+ public Binding getBinding(final String bindingName) {
+ return set.getBinding(bindingName);
+ }
+
+ @Override
+ public boolean hasBinding(final String bindingName) {
+ return set.hasBinding(bindingName);
+ }
+
+ @Override
+ public Value getValue(final String bindingName) {
+ return set.getValue(bindingName);
+ }
+
+ @Override
+ public int size() {
+ return set.size();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = hashCode;
+ if(result == 0) {
+ result = 31 * result + size();
--- End diff --
I was initially going through the fields, it didn't occur to me at the time that it was a changing value
---
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: RYA-53 add Visibilty Support to RYA
Posted by kchilton2 <gi...@git.apache.org>.
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59209843
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/external/BindingSetDecorator.java ---
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.external;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import org.openrdf.model.Value;
+import org.openrdf.query.Binding;
+import org.openrdf.query.BindingSet;
+
+/**
+ * Abstracts out the decoration of a {@link BindingSet}.
+ */
+public abstract class BindingSetDecorator implements BindingSet {
+ private static final long serialVersionUID = 1L;
+ protected final BindingSet set;
+ private volatile int hashCode;
+
+ public BindingSetDecorator(final BindingSet set) {
+ this.set = set;
+ }
+
+ @Override
+ public Iterator<Binding> iterator() {
+ return set.iterator();
+ }
+
+ @Override
+ public Set<String> getBindingNames() {
+ return set.getBindingNames();
+ }
+
+ @Override
+ public Binding getBinding(final String bindingName) {
+ return set.getBinding(bindingName);
+ }
+
+ @Override
+ public boolean hasBinding(final String bindingName) {
+ return set.hasBinding(bindingName);
+ }
+
+ @Override
+ public Value getValue(final String bindingName) {
+ return set.getValue(bindingName);
+ }
+
+ @Override
+ public int size() {
+ return set.size();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = hashCode;
+ if(result == 0) {
+ result = 31 * result + size();
--- End diff --
Why do you include the size of the binding set as part of the hash code?
---
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: RYA-53 add Visibilty Support to RYA
Posted by kchilton2 <gi...@git.apache.org>.
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59214884
--- Diff: extras/rya.pcj.fluo/pcj.fluo.app/src/main/java/org/apache/rya/indexing/pcj/fluo/app/FilterResultUpdater.java ---
@@ -126,11 +129,19 @@ public void updateFilterResults(
filterBindingSet.addBinding(binding);
}
}
- final String filterBindingSetString = converter.convert(filterBindingSet, filterVarOrder);
- final Bytes row = encoder.encode( filterMetadata.getNodeId() + NODEID_BS_DELIM + filterBindingSetString );
+ final String filterBindingSetIdString = ID_CONVERTER.convert(filterBindingSet, filterVarOrder);
+ String filterBindingSetValueString = "";
+ if(childBindingSet instanceof VisibilityBindingSet) {
--- End diff --
We shouldn't do the type checking here. Assume it's always a VisibilityBindingSet once it's within the Fluo app. Lets update the BindingSet object that is passed into the updaters to require a VisibilityBindingSet.
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59236612
--- Diff: extras/rya.pcj.fluo/pcj.fluo.app/src/main/java/org/apache/rya/indexing/pcj/fluo/app/FilterResultUpdater.java ---
@@ -126,11 +129,19 @@ public void updateFilterResults(
filterBindingSet.addBinding(binding);
}
}
- final String filterBindingSetString = converter.convert(filterBindingSet, filterVarOrder);
- final Bytes row = encoder.encode( filterMetadata.getNodeId() + NODEID_BS_DELIM + filterBindingSetString );
+ final String filterBindingSetIdString = ID_CONVERTER.convert(filterBindingSet, filterVarOrder);
+ String filterBindingSetValueString = "";
+ if(childBindingSet instanceof VisibilityBindingSet) {
--- End diff --
I'll go through and update the interfaces?
---
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: RYA-53 add Visibilty Support to RYA
Posted by kchilton2 <gi...@git.apache.org>.
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59215674
--- Diff: extras/rya.pcj.fluo/pcj.fluo.app/src/main/java/org/apache/rya/indexing/pcj/fluo/app/JoinResultUpdater.java ---
@@ -407,15 +411,35 @@ public boolean hasNext() {
public BindingSet next() {
final MapBindingSet bs = new MapBindingSet();
- for(Binding binding : newResult) {
+ for(final Binding binding : newResult) {
bs.addBinding(binding);
}
- for(Binding binding : joinedResults.next()) {
+ final BindingSet joinResult = joinedResults.next();
+ for(final Binding binding : joinResult) {
bs.addBinding(binding);
}
- return bs;
+ String visibility = "";
+ if(newResult instanceof VisibilityBindingSet && joinResult instanceof VisibilityBindingSet) {
--- End diff --
This is another area where we should be able to assume we're using VisibilityBindingSets.
---
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: RYA-53 add Visibilty Support to RYA
Posted by kchilton2 <gi...@git.apache.org>.
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59208887
--- Diff: extras/rya.pcj.fluo/pcj.fluo.app/src/test/java/org/apache/rya/indexing/pcj/fluo/app/NaturalJoinTest.java ---
@@ -46,120 +48,132 @@
@Test
public void newLeftResult_noRightMatches() {
- IterativeJoin naturalJoin = new NaturalJoin();
+ final IterativeJoin naturalJoin = new NaturalJoin();
// There is a new left result.
- MapBindingSet newLeftResult = new MapBindingSet();
+ final MapBindingSet newLeftResult = new MapBindingSet();
newLeftResult.addBinding("name", vf.createLiteral("Bob"));
// There are no right results that join with the left result.
- Iterator<BindingSet> rightResults= new ArrayList<BindingSet>().iterator();
+ final Iterator<BindingSet> rightResults= new ArrayList<BindingSet>().iterator();
// Therefore, the left result is a new join result.
- Iterator<BindingSet> newJoinResultsIt = naturalJoin.newLeftResult(newLeftResult, rightResults);
+ final Iterator<BindingSet> newJoinResultsIt = naturalJoin.newLeftResult(newLeftResult, rightResults);
assertFalse( newJoinResultsIt.hasNext() );
}
@Test
public void newLeftResult_joinsWithRightResults() {
- IterativeJoin naturalJoin = new NaturalJoin();
+ final IterativeJoin naturalJoin = new NaturalJoin();
// There is a new left result.
- MapBindingSet newLeftResult = new MapBindingSet();
+ final MapBindingSet newLeftResult = new MapBindingSet();
newLeftResult.addBinding("name", vf.createLiteral("Bob"));
newLeftResult.addBinding("height", vf.createLiteral("5'9\""));
// There are a few right results that join with the left result.
- MapBindingSet nameAge = new MapBindingSet();
+ final MapBindingSet nameAge = new MapBindingSet();
nameAge.addBinding("name", vf.createLiteral("Bob"));
nameAge.addBinding("age", vf.createLiteral(56));
- MapBindingSet nameHair = new MapBindingSet();
+ final MapBindingSet nameHair = new MapBindingSet();
nameHair.addBinding("name", vf.createLiteral("Bob"));
nameHair.addBinding("hairColor", vf.createLiteral("Brown"));
- Iterator<BindingSet> rightResults = Lists.<BindingSet>newArrayList(nameAge, nameHair).iterator();
+ final Iterator<BindingSet> rightResults = Lists.<BindingSet>newArrayList(nameAge, nameHair).iterator();
// Therefore, there are a few new join results that mix the two together.
- Iterator<BindingSet> newJoinResultsIt = naturalJoin.newLeftResult(newLeftResult, rightResults);
+ final Iterator<BindingSet> newJoinResultsIt = naturalJoin.newLeftResult(newLeftResult, rightResults);
- Set<BindingSet> newJoinResults = new HashSet<>();
+ final Set<BindingSet> newJoinResults = new HashSet<>();
while(newJoinResultsIt.hasNext()) {
newJoinResults.add( newJoinResultsIt.next() );
}
- Set<BindingSet> expected = Sets.<BindingSet>newHashSet();
- MapBindingSet nameHeightAge = new MapBindingSet();
+ final Set<BindingSet> expected = Sets.<BindingSet>newHashSet();
+ final MapBindingSet nameHeightAge = new MapBindingSet();
nameHeightAge.addBinding("name", vf.createLiteral("Bob"));
nameHeightAge.addBinding("height", vf.createLiteral("5'9\""));
nameHeightAge.addBinding("age", vf.createLiteral(56));
- expected.add(nameHeightAge);
+ expected.add(new VisibilityBindingSet(nameHeightAge));
- MapBindingSet nameHeightHair = new MapBindingSet();
+ final MapBindingSet nameHeightHair = new MapBindingSet();
nameHeightHair.addBinding("name", vf.createLiteral("Bob"));
nameHeightHair.addBinding("height", vf.createLiteral("5'9\""));
nameHeightHair.addBinding("hairColor", vf.createLiteral("Brown"));
- expected.add(nameHeightHair);
+ expected.add(new VisibilityBindingSet(nameHeightHair));
assertEquals(expected, newJoinResults);
}
@Test
public void newRightResult_noLeftMatches() {
- IterativeJoin naturalJoin = new NaturalJoin();
+ final IterativeJoin naturalJoin = new NaturalJoin();
// There are no left results.
- Iterator<BindingSet> leftResults= new ArrayList<BindingSet>().iterator();
+ final Iterator<BindingSet> leftResults= new ArrayList<BindingSet>().iterator();
// There is a new right result.
- MapBindingSet newRightResult = new MapBindingSet();
+ final MapBindingSet newRightResult = new MapBindingSet();
newRightResult.addBinding("name", vf.createLiteral("Bob"));
// Therefore, there are no new join results.
- Iterator<BindingSet> newJoinResultsIt = naturalJoin.newRightResult(leftResults, newRightResult);
+ final Iterator<BindingSet> newJoinResultsIt = naturalJoin.newRightResult(leftResults, newRightResult);
assertFalse( newJoinResultsIt.hasNext() );
}
@Test
public void newRightResult_joinsWithLeftResults() {
- IterativeJoin naturalJoin = new NaturalJoin();
+ final IterativeJoin naturalJoin = new NaturalJoin();
// There are a few left results that join with the new right result.
- MapBindingSet nameAge = new MapBindingSet();
+ final MapBindingSet nameAge = new MapBindingSet();
nameAge.addBinding("name", vf.createLiteral("Bob"));
nameAge.addBinding("age", vf.createLiteral(56));
- MapBindingSet nameHair = new MapBindingSet();
+ final MapBindingSet nameHair = new MapBindingSet();
nameHair.addBinding("name", vf.createLiteral("Bob"));
nameHair.addBinding("hairColor", vf.createLiteral("Brown"));
- Iterator<BindingSet> leftResults = Lists.<BindingSet>newArrayList(nameAge, nameHair).iterator();
+ final Iterator<BindingSet> leftResults = Lists.<BindingSet>newArrayList(nameAge, nameHair).iterator();
// There is a new right result.
- MapBindingSet newRightResult = new MapBindingSet();
+ final MapBindingSet newRightResult = new MapBindingSet();
newRightResult.addBinding("name", vf.createLiteral("Bob"));
newRightResult.addBinding("height", vf.createLiteral("5'9\""));
// Therefore, there are a few new join results that mix the two together.
- Iterator<BindingSet> newJoinResultsIt = naturalJoin.newRightResult(leftResults, newRightResult);
+ final Iterator<BindingSet> newJoinResultsIt = naturalJoin.newRightResult(leftResults, newRightResult);
- Set<BindingSet> newJoinResults = new HashSet<>();
+ final Set<BindingSet> newJoinResults = new HashSet<>();
while(newJoinResultsIt.hasNext()) {
newJoinResults.add( newJoinResultsIt.next() );
}
- Set<BindingSet> expected = Sets.<BindingSet>newHashSet();
- MapBindingSet nameHeightAge = new MapBindingSet();
+ final Set<BindingSet> expected = Sets.<BindingSet>newHashSet();
+ final MapBindingSet nameHeightAge = new MapBindingSet();
nameHeightAge.addBinding("name", vf.createLiteral("Bob"));
nameHeightAge.addBinding("height", vf.createLiteral("5'9\""));
nameHeightAge.addBinding("age", vf.createLiteral(56));
- expected.add(nameHeightAge);
+ expected.add(new VisibilityBindingSet(nameHeightAge));
- MapBindingSet nameHeightHair = new MapBindingSet();
+ final MapBindingSet nameHeightHair = new MapBindingSet();
nameHeightHair.addBinding("name", vf.createLiteral("Bob"));
nameHeightHair.addBinding("height", vf.createLiteral("5'9\""));
nameHeightHair.addBinding("hairColor", vf.createLiteral("Brown"));
- expected.add(nameHeightHair);
+ expected.add(new VisibilityBindingSet(nameHeightHair));
+
+ for(final BindingSet bs : newJoinResults) {
--- End diff --
This debug code should be removed.
---
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: RYA-53 add Visibilty Support to RYA
Posted by kchilton2 <gi...@git.apache.org>.
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59427232
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/external/BindingSetDecorator.java ---
@@ -71,7 +78,6 @@ public int size() {
public int hashCode() {
int result = hashCode;
--- End diff --
Why not just return the set's hash code?
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59236187
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/external/tupleSet/FullBindingSetStringConverter.java ---
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.external.tupleSet;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import org.openrdf.model.Value;
+import org.openrdf.query.BindingSet;
+import org.openrdf.query.algebra.evaluation.QueryBindingSet;
+
+import com.google.common.base.Joiner;
+
+import mvm.rya.api.domain.RyaType;
+import mvm.rya.api.resolver.RdfToRyaConversions;
+import mvm.rya.indexing.external.tupleSet.PcjTables.VariableOrder;
+
+/**
+ * Converts {@link BindingSet}s to Strings and back again. The Strings do not
+ * include the binding names and are ordered with a {@link VariableOrder}.
+ */
+@ParametersAreNonnullByDefault
+public class FullBindingSetStringConverter extends BindingSetStringConverter {
--- End diff --
huh....I was using it...I deleted it and everything still works sooooo....huh...
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59442756
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/external/tupleSet/VisibilityBindingSetStringConverter.java ---
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.external.tupleSet;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import org.openrdf.query.BindingSet;
+
+import com.google.common.base.Strings;
+
+import mvm.rya.indexing.accumulo.VisibilityBindingSet;
+import mvm.rya.indexing.external.tupleSet.PcjTables.VariableOrder;
+
+/**
+ * Converts {@link BindingSet}s to Strings and back again. The Strings do not
+ * include the binding names and are ordered with a {@link VariableOrder}.
+ */
+@ParametersAreNonnullByDefault
+public class VisibilityBindingSetStringConverter extends BindingSetStringConverter {
+ public static final char VISIBILITY_DELIM = 1;
+
+ @Override
+ public String convert(final BindingSet bindingSet, final VariableOrder varOrder) {
+ String visibility = "";
+ if(bindingSet instanceof VisibilityBindingSet) {
--- End diff --
each converter already takes a generic that is what the binding set is being converted to/from
---
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: RYA-53 add Visibilty Support to RYA
Posted by kchilton2 <gi...@git.apache.org>.
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59214092
--- Diff: extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/VisibilityBindingSetStringConverterTest.java ---
@@ -0,0 +1,131 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.external.tupleSet;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openrdf.model.impl.URIImpl;
+import org.openrdf.query.BindingSet;
+import org.openrdf.query.impl.MapBindingSet;
+
+import mvm.rya.indexing.accumulo.VisibilityBindingSet;
+import mvm.rya.indexing.external.tupleSet.BindingSetConverter.BindingSetConversionException;
+import mvm.rya.indexing.external.tupleSet.PcjTables.VariableOrder;
+
+/**
+ * Tests the methods of {@link BindingSetStringConverter}.
+ */
+public class VisibilityBindingSetStringConverterTest {
+ @Test
+ public void toString_URIs() throws BindingSetConversionException {
+ // Setup the binding set that will be converted.
+ final MapBindingSet originalBindingSet = new MapBindingSet();
+ originalBindingSet.addBinding("x", new URIImpl("http://a"));
+ originalBindingSet.addBinding("y", new URIImpl("http://b"));
+ originalBindingSet.addBinding("z", new URIImpl("http://c"));
+
+ final VisibilityBindingSet visiSet = new VisibilityBindingSet(originalBindingSet, "A&B&C");
+
+ // Convert it to a String.
+ final VariableOrder varOrder = new VariableOrder("y", "z", "x");
+ final VisibilityBindingSetStringConverter converter = new VisibilityBindingSetStringConverter();
+ final String bindingSetString = converter.convert(visiSet, varOrder);
+
+ // Ensure it converted to the expected result.l
+ final String expected =
+ "http://b<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::" +
+ "http://c<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::" +
+ "http://a<<~>>http://www.w3.org/2001/XMLSchema#anyURI" +
+ (char)1 + "A&B&C";
--- End diff --
Might want to store the (char)1 delimiter as a constant somewhere and reference that 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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59228867
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/accumulo/VisibilityBindingSet.java ---
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.accumulo;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import org.openrdf.query.BindingSet;
+
+import mvm.rya.indexing.external.BindingSetDecorator;
+
+/**
+ * Decorates a {@link BindingSet} with a collection of visibilities.
+ */
+@ParametersAreNonnullByDefault
+public class VisibilityBindingSet extends BindingSetDecorator {
+ private static final long serialVersionUID = 1L;
+ private final String visibility;
+ private volatile int hashCode;
+
+ /**
+ * @param set - Decorates the {@link BindingSet} with no visibilities.
+ */
+ public VisibilityBindingSet(final BindingSet set) {
+ this(set, "");
+ }
+
+ /**
+ * Creates a new {@link VisibilityBindingSet}
+ * @param set - The {@link BindingSet} to decorate
+ * @param visibility - The visibilities on the {@link BindingSet} (not null)
+ */
+ public VisibilityBindingSet(final BindingSet set, final String visibility) {
+ super(set);
+ this.visibility = checkNotNull(visibility);
+ }
+
+ /**
+ * @return - The Visibilities on the {@link BindingSet}
+ */
+ public String getVisibility() {
+ return visibility;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ } else if(o instanceof VisibilityBindingSet) {
+ final VisibilityBindingSet other = (VisibilityBindingSet) o;
+ return set.equals(other) && visibility.equals(other.getVisibility());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
--- End diff --
probably not a bad call to cache it anyway
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r58911417
--- Diff: extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/PcjTablesIntegrationTests.java ---
@@ -151,35 +151,39 @@ public void addResults() throws PcjException, TableNotFoundException, BindingSet
// Create a PCJ table in the Mini Accumulo.
final String pcjTableName = new PcjTableNameFactory().makeTableName(RYA_TABLE_PREFIX, "testPcj");
- Set<VariableOrder> varOrders = new ShiftVarOrderFactory().makeVarOrders(new VariableOrder("name;age"));
- PcjTables pcjs = new PcjTables();
+ final Set<VariableOrder> varOrders = new ShiftVarOrderFactory().makeVarOrders(new VariableOrder("name;age"));
+ final PcjTables pcjs = new PcjTables();
pcjs.createPcjTable(accumuloConn, pcjTableName, varOrders, sparql);
// Add a few results to the PCJ table.
- MapBindingSet alice = new MapBindingSet();
+ final MapBindingSet alice = new MapBindingSet();
alice.addBinding("name", new URIImpl("http://Alice"));
alice.addBinding("age", new NumericLiteralImpl(14, XMLSchema.INTEGER));
- MapBindingSet bob = new MapBindingSet();
+ final MapBindingSet bob = new MapBindingSet();
bob.addBinding("name", new URIImpl("http://Bob"));
bob.addBinding("age", new NumericLiteralImpl(16, XMLSchema.INTEGER));
- MapBindingSet charlie = new MapBindingSet();
+ final MapBindingSet charlie = new MapBindingSet();
charlie.addBinding("name", new URIImpl("http://Charlie"));
charlie.addBinding("age", new NumericLiteralImpl(12, XMLSchema.INTEGER));
- Set<BindingSet> results = Sets.<BindingSet>newHashSet(alice, bob, charlie);
+ final Set<VisibilityBindingSet> results = Sets.<VisibilityBindingSet>newHashSet(
+ new VisibilityBindingSet(alice),
--- End diff --
whitespace
---
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: RYA-53 add Visibilty Support to RYA
Posted by kchilton2 <gi...@git.apache.org>.
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59428283
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/external/tupleSet/FullBindingSetStringConverter.java ---
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.external.tupleSet;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import org.openrdf.model.Value;
+import org.openrdf.query.BindingSet;
+import org.openrdf.query.algebra.evaluation.QueryBindingSet;
+
+import com.google.common.base.Joiner;
+
+import mvm.rya.api.domain.RyaType;
+import mvm.rya.api.resolver.RdfToRyaConversions;
+import mvm.rya.indexing.external.tupleSet.PcjTables.VariableOrder;
+
+/**
+ * Converts {@link BindingSet}s to Strings and back again. The Strings do not
+ * include the binding names and are ordered with a {@link VariableOrder}.
+ */
+@ParametersAreNonnullByDefault
+public class FullBindingSetStringConverter extends BindingSetStringConverter {
--- End diff --
The original idea was to store the binding set + visibility within the value section so that you would no longer need to unmarshal the row id using the variable order, but I don't think you're using that approach.
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59236564
--- Diff: extras/rya.pcj.fluo/pcj.fluo.api/src/main/java/org/apache/rya/indexing/pcj/fluo/api/CreatePcj.java ---
@@ -139,6 +141,7 @@ public CreatePcj(final int spInsertBatchSize) {
* @throws QueryEvaluationException Historic results could not be added to the initialized PCJ because of
* a problem with the Rya connection.
*/
+ @VisibleForTesting
--- End diff --
artifact left over from when I added the withRyaIntegration() that returned the generated table name
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59229223
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/external/BindingSetDecorator.java ---
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.external;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import org.openrdf.model.Value;
+import org.openrdf.query.Binding;
+import org.openrdf.query.BindingSet;
+
+/**
+ * Abstracts out the decoration of a {@link BindingSet}.
+ */
+public abstract class BindingSetDecorator implements BindingSet {
+ private static final long serialVersionUID = 1L;
+ protected final BindingSet set;
+ private volatile int hashCode;
+
+ public BindingSetDecorator(final BindingSet set) {
--- End diff --
done
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r58911970
--- Diff: extras/rya.pcj.fluo/pcj.fluo.app/src/main/java/org/apache/rya/indexing/pcj/fluo/app/observers/TripleObserver.java ---
@@ -65,6 +72,12 @@ public ObservedColumn getObservedColumn() {
public void process(final TypedTransactionBase tx, final Bytes row, final Column column) {
//get string representation of triple
final String triple = IncUpdateDAO.getTripleString(row);
+ final Bytes visiBytes = tx.get(row, FluoQueryColumns.TRIPLES);
+ String visibility = "";
+ if(visiBytes != null) {
+ visibility = ENCODER.decodeString(visiBytes);
+ }
+ final VisibilityBindingSetStringConverter converter = new VisibilityBindingSetStringConverter();
--- End diff --
move out
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r58911089
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/external/tupleSet/BindingSetConverter.java ---
@@ -1,5 +1,5 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
+* Licensed to the Apache Software Foundation (ASF) under one
--- End diff --
remove 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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r58911177
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/external/tupleSet/FullBindingSetStringConverter.java ---
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.external.tupleSet;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import org.openrdf.model.Value;
+import org.openrdf.query.BindingSet;
+import org.openrdf.query.algebra.evaluation.QueryBindingSet;
+
+import com.google.common.base.Joiner;
+
+import mvm.rya.api.domain.RyaType;
+import mvm.rya.api.resolver.RdfToRyaConversions;
+import mvm.rya.indexing.external.tupleSet.PcjTables.VariableOrder;
+
+/**
+ * Converts {@link BindingSet}s to Strings and back again. The Strings do not
+ * include the binding names and are ordered with a {@link VariableOrder}.
+ */
+@ParametersAreNonnullByDefault
+public class FullBindingSetStringConverter extends BindingSetStringConverter {
--- End diff --
Rename?
---
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: RYA-53 add Visibilty Support to RYA
Posted by kchilton2 <gi...@git.apache.org>.
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59209306
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/accumulo/VisibilityBindingSet.java ---
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.accumulo;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import org.openrdf.query.BindingSet;
+
+import mvm.rya.indexing.external.BindingSetDecorator;
+
+/**
+ * Decorates a {@link BindingSet} with a collection of visibilities.
+ */
+@ParametersAreNonnullByDefault
+public class VisibilityBindingSet extends BindingSetDecorator {
+ private static final long serialVersionUID = 1L;
+ private final String visibility;
+ private volatile int hashCode;
+
+ /**
+ * @param set - Decorates the {@link BindingSet} with no visibilities.
+ */
+ public VisibilityBindingSet(final BindingSet set) {
+ this(set, "");
+ }
+
+ /**
+ * Creates a new {@link VisibilityBindingSet}
+ * @param set - The {@link BindingSet} to decorate
+ * @param visibility - The visibilities on the {@link BindingSet} (not null)
+ */
+ public VisibilityBindingSet(final BindingSet set, final String visibility) {
+ super(set);
+ this.visibility = checkNotNull(visibility);
+ }
+
+ /**
+ * @return - The Visibilities on the {@link BindingSet}
+ */
+ public String getVisibility() {
+ return visibility;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ } else if(o instanceof VisibilityBindingSet) {
+ final VisibilityBindingSet other = (VisibilityBindingSet) o;
+ return set.equals(other) && visibility.equals(other.getVisibility());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
--- End diff --
Do we invoke hashCode often enough that we want to cache the value?
---
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: RYA-53 add Visibilty Support to RYA
Posted by kchilton2 <gi...@git.apache.org>.
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59214326
--- Diff: extras/rya.pcj.fluo/pcj.fluo.api/src/main/java/org/apache/rya/indexing/pcj/fluo/api/CreatePcj.java ---
@@ -139,6 +141,7 @@ public CreatePcj(final int spInsertBatchSize) {
* @throws QueryEvaluationException Historic results could not be added to the initialized PCJ because of
* a problem with the Rya connection.
*/
+ @VisibleForTesting
--- End diff --
Why was this added?
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r58912007
--- Diff: extras/rya.pcj.fluo/pcj.fluo.app/src/main/java/org/apache/rya/indexing/pcj/fluo/app/observers/TripleObserver.java ---
@@ -85,9 +97,16 @@ public void process(final TypedTransactionBase tx, final Bytes row, final Column
while(ci.hasNext()) {
final String varOrders = ci.next().getValue().toString();
- final String bindingSet = getBindingSet(triple, pattern, varOrders);
- if(bindingSet.length() != 0) {
- tx.mutate().row(spID + NODEID_BS_DELIM + bindingSet).col(FluoQueryColumns.STATEMENT_PATTERN_BINDING_SET).set(bindingSet);
+ final VariableOrder varOrder = new VariableOrder(varOrders);
+ final String bindingSetString = getBindingSet(triple, pattern, varOrders);
+
--- End diff --
whitespace
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r58911571
--- Diff: extras/rya.pcj.fluo/pcj.fluo.api/src/main/java/org/apache/rya/indexing/pcj/fluo/api/InsertTriples.java ---
@@ -53,30 +55,35 @@
*/
private static final WholeRowTripleResolver TRIPLE_RESOLVER = new WholeRowTripleResolver();
+ private static final Encoder encoder = new StringEncoder();
--- End diff --
ENCODER
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r58911304
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/accumulo/VisibilityBindingSet.java ---
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.accumulo;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.openrdf.query.BindingSet;
+
+import mvm.rya.indexing.external.BindingSetDecorator;
+
+/**
+ * Decorates a {@link BindingSet} with a collection of visibilities.
+ */
--- End diff --
add parametersAreNonNullableByDefault
---
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: RYA-53 add Visibilty Support to RYA
Posted by kchilton2 <gi...@git.apache.org>.
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59431693
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/external/tupleSet/VisibilityBindingSetStringConverter.java ---
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.external.tupleSet;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import org.openrdf.query.BindingSet;
+
+import com.google.common.base.Strings;
+
+import mvm.rya.indexing.accumulo.VisibilityBindingSet;
+import mvm.rya.indexing.external.tupleSet.PcjTables.VariableOrder;
+
+/**
+ * Converts {@link BindingSet}s to Strings and back again. The Strings do not
+ * include the binding names and are ordered with a {@link VariableOrder}.
+ */
+@ParametersAreNonnullByDefault
+public class VisibilityBindingSetStringConverter extends BindingSetStringConverter {
+ public static final char VISIBILITY_DELIM = 1;
+
+ @Override
+ public String convert(final BindingSet bindingSet, final VariableOrder varOrder) {
+ String visibility = "";
+ if(bindingSet instanceof VisibilityBindingSet) {
--- End diff --
Using instanceof here is kind of an abstraction smell, but I'm not sure of how to fix this other than maybe having each converter take a generic type that extends BindingSet.
---
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: RYA-53 add Visibilty Support to RYA
Posted by kchilton2 <gi...@git.apache.org>.
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59427687
--- Diff: extras/rya.pcj.fluo/pcj.fluo.app/src/main/java/org/apache/rya/indexing/pcj/fluo/app/JoinResultUpdater.java ---
@@ -408,38 +408,28 @@ public boolean hasNext() {
}
@Override
- public BindingSet next() {
+ public VisibilityBindingSet next() {
final MapBindingSet bs = new MapBindingSet();
for(final Binding binding : newResult) {
bs.addBinding(binding);
}
- final BindingSet joinResult = joinedResults.next();
+ final VisibilityBindingSet joinResult = joinedResults.next();
for(final Binding binding : joinResult) {
bs.addBinding(binding);
}
String visibility = "";
- if(newResult instanceof VisibilityBindingSet && joinResult instanceof VisibilityBindingSet) {
- final Joiner join = Joiner.on(")&(");
- final String leftVisi = ((VisibilityBindingSet)newResult).getVisibility();
- final String rightVisi = ((VisibilityBindingSet)joinResult).getVisibility();
- if(leftVisi.isEmpty() || rightVisi.isEmpty()) {
- visibility = (leftVisi + rightVisi).trim();
- } else {
- visibility = "(" + join.join(leftVisi, rightVisi) + ")";
- }
- return new VisibilityBindingSet(bs, visibility);
- } else if(newResult instanceof VisibilityBindingSet) {
- visibility = ((VisibilityBindingSet) newResult).getVisibility();
- return new VisibilityBindingSet(bs, visibility);
- } else if(joinResult instanceof VisibilityBindingSet) {
- visibility = ((VisibilityBindingSet) joinResult).getVisibility();
- return new VisibilityBindingSet(bs, visibility);
+ final Joiner join = Joiner.on(")&(");
+ final String leftVisi = newResult.getVisibility();
+ final String rightVisi = joinResult.getVisibility();
+ if(leftVisi.isEmpty() || rightVisi.isEmpty()) {
+ visibility = (leftVisi + rightVisi).trim();
} else {
- return new VisibilityBindingSet(bs);
+ visibility = "(" + join.join(leftVisi, rightVisi) + ")";
--- End diff --
Using a joiner here is kind of overkill since you're only ever joining two items.
---
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: RYA-53 add Visibilty Support to RYA
Posted by isper3at <gi...@git.apache.org>.
Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59226766
--- Diff: extras/rya.pcj.fluo/pcj.fluo.app/src/test/java/org/apache/rya/indexing/pcj/fluo/app/NaturalJoinTest.java ---
@@ -46,120 +48,132 @@
@Test
public void newLeftResult_noRightMatches() {
- IterativeJoin naturalJoin = new NaturalJoin();
+ final IterativeJoin naturalJoin = new NaturalJoin();
// There is a new left result.
- MapBindingSet newLeftResult = new MapBindingSet();
+ final MapBindingSet newLeftResult = new MapBindingSet();
newLeftResult.addBinding("name", vf.createLiteral("Bob"));
// There are no right results that join with the left result.
- Iterator<BindingSet> rightResults= new ArrayList<BindingSet>().iterator();
+ final Iterator<BindingSet> rightResults= new ArrayList<BindingSet>().iterator();
// Therefore, the left result is a new join result.
- Iterator<BindingSet> newJoinResultsIt = naturalJoin.newLeftResult(newLeftResult, rightResults);
+ final Iterator<BindingSet> newJoinResultsIt = naturalJoin.newLeftResult(newLeftResult, rightResults);
assertFalse( newJoinResultsIt.hasNext() );
}
@Test
public void newLeftResult_joinsWithRightResults() {
- IterativeJoin naturalJoin = new NaturalJoin();
+ final IterativeJoin naturalJoin = new NaturalJoin();
// There is a new left result.
- MapBindingSet newLeftResult = new MapBindingSet();
+ final MapBindingSet newLeftResult = new MapBindingSet();
newLeftResult.addBinding("name", vf.createLiteral("Bob"));
newLeftResult.addBinding("height", vf.createLiteral("5'9\""));
// There are a few right results that join with the left result.
- MapBindingSet nameAge = new MapBindingSet();
+ final MapBindingSet nameAge = new MapBindingSet();
nameAge.addBinding("name", vf.createLiteral("Bob"));
nameAge.addBinding("age", vf.createLiteral(56));
- MapBindingSet nameHair = new MapBindingSet();
+ final MapBindingSet nameHair = new MapBindingSet();
nameHair.addBinding("name", vf.createLiteral("Bob"));
nameHair.addBinding("hairColor", vf.createLiteral("Brown"));
- Iterator<BindingSet> rightResults = Lists.<BindingSet>newArrayList(nameAge, nameHair).iterator();
+ final Iterator<BindingSet> rightResults = Lists.<BindingSet>newArrayList(nameAge, nameHair).iterator();
// Therefore, there are a few new join results that mix the two together.
- Iterator<BindingSet> newJoinResultsIt = naturalJoin.newLeftResult(newLeftResult, rightResults);
+ final Iterator<BindingSet> newJoinResultsIt = naturalJoin.newLeftResult(newLeftResult, rightResults);
- Set<BindingSet> newJoinResults = new HashSet<>();
+ final Set<BindingSet> newJoinResults = new HashSet<>();
while(newJoinResultsIt.hasNext()) {
newJoinResults.add( newJoinResultsIt.next() );
}
- Set<BindingSet> expected = Sets.<BindingSet>newHashSet();
- MapBindingSet nameHeightAge = new MapBindingSet();
+ final Set<BindingSet> expected = Sets.<BindingSet>newHashSet();
+ final MapBindingSet nameHeightAge = new MapBindingSet();
nameHeightAge.addBinding("name", vf.createLiteral("Bob"));
nameHeightAge.addBinding("height", vf.createLiteral("5'9\""));
nameHeightAge.addBinding("age", vf.createLiteral(56));
- expected.add(nameHeightAge);
+ expected.add(new VisibilityBindingSet(nameHeightAge));
- MapBindingSet nameHeightHair = new MapBindingSet();
+ final MapBindingSet nameHeightHair = new MapBindingSet();
nameHeightHair.addBinding("name", vf.createLiteral("Bob"));
nameHeightHair.addBinding("height", vf.createLiteral("5'9\""));
nameHeightHair.addBinding("hairColor", vf.createLiteral("Brown"));
- expected.add(nameHeightHair);
+ expected.add(new VisibilityBindingSet(nameHeightHair));
assertEquals(expected, newJoinResults);
}
@Test
public void newRightResult_noLeftMatches() {
- IterativeJoin naturalJoin = new NaturalJoin();
+ final IterativeJoin naturalJoin = new NaturalJoin();
// There are no left results.
- Iterator<BindingSet> leftResults= new ArrayList<BindingSet>().iterator();
+ final Iterator<BindingSet> leftResults= new ArrayList<BindingSet>().iterator();
// There is a new right result.
- MapBindingSet newRightResult = new MapBindingSet();
+ final MapBindingSet newRightResult = new MapBindingSet();
newRightResult.addBinding("name", vf.createLiteral("Bob"));
// Therefore, there are no new join results.
- Iterator<BindingSet> newJoinResultsIt = naturalJoin.newRightResult(leftResults, newRightResult);
+ final Iterator<BindingSet> newJoinResultsIt = naturalJoin.newRightResult(leftResults, newRightResult);
assertFalse( newJoinResultsIt.hasNext() );
}
@Test
public void newRightResult_joinsWithLeftResults() {
- IterativeJoin naturalJoin = new NaturalJoin();
+ final IterativeJoin naturalJoin = new NaturalJoin();
// There are a few left results that join with the new right result.
- MapBindingSet nameAge = new MapBindingSet();
+ final MapBindingSet nameAge = new MapBindingSet();
nameAge.addBinding("name", vf.createLiteral("Bob"));
nameAge.addBinding("age", vf.createLiteral(56));
- MapBindingSet nameHair = new MapBindingSet();
+ final MapBindingSet nameHair = new MapBindingSet();
nameHair.addBinding("name", vf.createLiteral("Bob"));
nameHair.addBinding("hairColor", vf.createLiteral("Brown"));
- Iterator<BindingSet> leftResults = Lists.<BindingSet>newArrayList(nameAge, nameHair).iterator();
+ final Iterator<BindingSet> leftResults = Lists.<BindingSet>newArrayList(nameAge, nameHair).iterator();
// There is a new right result.
- MapBindingSet newRightResult = new MapBindingSet();
+ final MapBindingSet newRightResult = new MapBindingSet();
newRightResult.addBinding("name", vf.createLiteral("Bob"));
newRightResult.addBinding("height", vf.createLiteral("5'9\""));
// Therefore, there are a few new join results that mix the two together.
- Iterator<BindingSet> newJoinResultsIt = naturalJoin.newRightResult(leftResults, newRightResult);
+ final Iterator<BindingSet> newJoinResultsIt = naturalJoin.newRightResult(leftResults, newRightResult);
- Set<BindingSet> newJoinResults = new HashSet<>();
+ final Set<BindingSet> newJoinResults = new HashSet<>();
while(newJoinResultsIt.hasNext()) {
newJoinResults.add( newJoinResultsIt.next() );
}
- Set<BindingSet> expected = Sets.<BindingSet>newHashSet();
- MapBindingSet nameHeightAge = new MapBindingSet();
+ final Set<BindingSet> expected = Sets.<BindingSet>newHashSet();
+ final MapBindingSet nameHeightAge = new MapBindingSet();
nameHeightAge.addBinding("name", vf.createLiteral("Bob"));
nameHeightAge.addBinding("height", vf.createLiteral("5'9\""));
nameHeightAge.addBinding("age", vf.createLiteral(56));
- expected.add(nameHeightAge);
+ expected.add(new VisibilityBindingSet(nameHeightAge));
- MapBindingSet nameHeightHair = new MapBindingSet();
+ final MapBindingSet nameHeightHair = new MapBindingSet();
nameHeightHair.addBinding("name", vf.createLiteral("Bob"));
nameHeightHair.addBinding("height", vf.createLiteral("5'9\""));
nameHeightHair.addBinding("hairColor", vf.createLiteral("Brown"));
- expected.add(nameHeightHair);
+ expected.add(new VisibilityBindingSet(nameHeightHair));
+
+ for(final BindingSet bs : newJoinResults) {
--- End diff --
hah woops. done
---
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: RYA-53 add Visibilty Support to RYA
Posted by pujav65 <gi...@git.apache.org>.
Github user pujav65 commented on the pull request:
https://github.com/apache/incubator-rya/pull/36#issuecomment-218811735
no comments on this -- i will merge it once i verify tests pass.
---
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: RYA-53 add Visibilty Support to RYA
Posted by kchilton2 <gi...@git.apache.org>.
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59210679
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/external/tupleSet/FullBindingSetStringConverter.java ---
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.external.tupleSet;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import org.openrdf.model.Value;
+import org.openrdf.query.BindingSet;
+import org.openrdf.query.algebra.evaluation.QueryBindingSet;
+
+import com.google.common.base.Joiner;
+
+import mvm.rya.api.domain.RyaType;
+import mvm.rya.api.resolver.RdfToRyaConversions;
+import mvm.rya.indexing.external.tupleSet.PcjTables.VariableOrder;
+
+/**
+ * Converts {@link BindingSet}s to Strings and back again. The Strings do not
+ * include the binding names and are ordered with a {@link VariableOrder}.
+ */
+@ParametersAreNonnullByDefault
+public class FullBindingSetStringConverter extends BindingSetStringConverter {
--- End diff --
Because this implementation totally converts binding sets (including the binding names), you don't need to use variable order objects to keep track of the bindings.
---
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: RYA-53 add Visibilty Support to RYA
Posted by kchilton2 <gi...@git.apache.org>.
Github user kchilton2 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/36#discussion_r59428919
--- Diff: extras/indexing/src/main/java/mvm/rya/indexing/external/BindingSetDecorator.java ---
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+package mvm.rya.indexing.external;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import org.openrdf.model.Value;
+import org.openrdf.query.Binding;
+import org.openrdf.query.BindingSet;
+
+/**
+ * Abstracts out the decoration of a {@link BindingSet}.
+ */
+public abstract class BindingSetDecorator implements BindingSet {
+ private static final long serialVersionUID = 1L;
+ protected final BindingSet set;
+ private volatile int hashCode;
+
+ /**
+ * Constructs a new {@link BindingSetDecorator}, decorating the provided
+ * {@link BindingSet}.
+ * @param set - The {@link BindingSet} to be decorated. (not null)
+ */
+ public BindingSetDecorator(final BindingSet set) {
+ this.set = checkNotNull(set);
+ }
+
+ @Override
+ public Iterator<Binding> iterator() {
+ return set.iterator();
+ }
+
+ @Override
+ public Set<String> getBindingNames() {
+ return set.getBindingNames();
+ }
+
+ @Override
+ public Binding getBinding(final String bindingName) {
+ return set.getBinding(bindingName);
+ }
+
+ @Override
+ public boolean hasBinding(final String bindingName) {
+ return set.hasBinding(bindingName);
+ }
+
+ @Override
+ public Value getValue(final String bindingName) {
+ return set.getValue(bindingName);
+ }
+
+ @Override
+ public int size() {
+ return set.size();
+ }
+
--- End diff --
You should implement an equals method since you're overriding hashcode.
---
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.
---