[ https://issues.apache.org/jira/browse/RYA-53?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15235172#comment-15235172 ]
ASF GitHub Bot commented on RYA-53: ----------------------------------- 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. > Add Visibility to Rya PCJs > -------------------------- > > Key: RYA-53 > URL: https://issues.apache.org/jira/browse/RYA-53 > Project: Rya > Issue Type: New Feature > Reporter: Andrew Smith > > Update the PCJ api to support visibility attached to binding sets -- This message was sent by Atlassian JIRA (v6.3.4#6332)