Repository: incubator-rya Updated Branches: refs/heads/develop 2b30478cd -> e530aec63
RYA-24 issue with hashes and regex queries Project: http://git-wip-us.apache.org/repos/asf/incubator-rya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-rya/commit/d6635321 Tree: http://git-wip-us.apache.org/repos/asf/incubator-rya/tree/d6635321 Diff: http://git-wip-us.apache.org/repos/asf/incubator-rya/diff/d6635321 Branch: refs/heads/develop Commit: d6635321e4dcd6a29c15e850a065c74f2d946bf9 Parents: e6be84a Author: pujav65 <[email protected]> Authored: Fri Dec 18 10:52:18 2015 -0500 Committer: pujav65 <[email protected]> Committed: Fri Dec 18 10:52:18 2015 -0500 ---------------------------------------------------------------------- .../AbstractHashedTriplePatternStrategy.java | 90 ++++++++++++++++++++ .../HashedPoWholeRowTriplePatternStrategy.java | 17 ++-- .../HashedSpoWholeRowTriplePatternStrategy.java | 32 ++++--- .../impl/WholeRowHashedTripleResolver.java | 26 +++--- ...shedPoWholeRowTriplePatternStrategyTest.java | 83 ++++++++++++++++-- 5 files changed, 209 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/d6635321/common/rya.api/src/main/java/mvm/rya/api/query/strategy/wholerow/AbstractHashedTriplePatternStrategy.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/query/strategy/wholerow/AbstractHashedTriplePatternStrategy.java b/common/rya.api/src/main/java/mvm/rya/api/query/strategy/wholerow/AbstractHashedTriplePatternStrategy.java new file mode 100644 index 0000000..9a1aef3 --- /dev/null +++ b/common/rya.api/src/main/java/mvm/rya/api/query/strategy/wholerow/AbstractHashedTriplePatternStrategy.java @@ -0,0 +1,90 @@ +package mvm.rya.api.query.strategy.wholerow; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import com.google.common.base.Preconditions; +import mvm.rya.api.RdfCloudTripleStoreConstants; +import mvm.rya.api.query.strategy.AbstractTriplePatternStrategy; +import mvm.rya.api.query.strategy.TriplePatternStrategy; +import mvm.rya.api.resolver.triple.TripleRowRegex; + +import static mvm.rya.api.RdfCloudTripleStoreConstants.DELIM; +import static mvm.rya.api.RdfCloudTripleStoreConstants.TYPE_DELIM; + +public abstract class AbstractHashedTriplePatternStrategy extends AbstractTriplePatternStrategy implements TriplePatternStrategy { + public static final String HASHED_ALL_REGEX = "([0-9a-f]{32})\u0000"; + + public abstract RdfCloudTripleStoreConstants.TABLE_LAYOUT getLayout(); + + @Override + public TripleRowRegex buildRegex(String subject, String predicate, String object, String context, byte[] objectTypeInfo) { + RdfCloudTripleStoreConstants.TABLE_LAYOUT table_layout = getLayout(); + Preconditions.checkNotNull(table_layout); + + //O is not hashed so kick out to super + if(table_layout == RdfCloudTripleStoreConstants.TABLE_LAYOUT.OSP) { + return super.buildRegex(subject, predicate, object, context, objectTypeInfo); + } + + if (subject == null && predicate == null && object == null && context == null && objectTypeInfo == null) { + return null; //no regex + } + StringBuilder sb = new StringBuilder(); + String first = subject; + String second = predicate; + String third = object; + if (table_layout == RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO) { + first = predicate; + second = object; + third = subject; + } + + sb.append(HASHED_ALL_REGEX); + if (first != null) { + sb.append(first); + } else { + sb.append(ALL_REGEX); + } + sb.append(DELIM); + + if (second != null) { + sb.append(second); + } else { + sb.append(ALL_REGEX); + } + sb.append(DELIM); + + if (third != null) { + sb.append(third); + if (objectTypeInfo == null) { + sb.append(TYPE_DELIM); + sb.append(ALL_REGEX); + }else { + sb.append(new String(objectTypeInfo)); + } + }else { + sb.append(ALL_REGEX); + if (objectTypeInfo != null) { + sb.append(new String(objectTypeInfo)); + } + } + + return new TripleRowRegex(sb.toString(), (context != null) ? (context + ALL_REGEX) : null, null); + } +} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/d6635321/common/rya.api/src/main/java/mvm/rya/api/query/strategy/wholerow/HashedPoWholeRowTriplePatternStrategy.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/query/strategy/wholerow/HashedPoWholeRowTriplePatternStrategy.java b/common/rya.api/src/main/java/mvm/rya/api/query/strategy/wholerow/HashedPoWholeRowTriplePatternStrategy.java index 04d81ce..1c2bc3c 100644 --- a/common/rya.api/src/main/java/mvm/rya/api/query/strategy/wholerow/HashedPoWholeRowTriplePatternStrategy.java +++ b/common/rya.api/src/main/java/mvm/rya/api/query/strategy/wholerow/HashedPoWholeRowTriplePatternStrategy.java @@ -30,24 +30,25 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Map; +import org.apache.commons.codec.binary.Hex; + +import com.google.common.primitives.Bytes; + import mvm.rya.api.RdfCloudTripleStoreConfiguration; import mvm.rya.api.RdfCloudTripleStoreConstants; import mvm.rya.api.RdfCloudTripleStoreUtils; import mvm.rya.api.domain.RyaRange; import mvm.rya.api.domain.RyaType; import mvm.rya.api.domain.RyaURI; -import mvm.rya.api.query.strategy.AbstractTriplePatternStrategy; import mvm.rya.api.query.strategy.ByteRange; import mvm.rya.api.resolver.RyaContext; import mvm.rya.api.resolver.RyaTypeResolverException; -import com.google.common.primitives.Bytes; - /** * Date: 7/14/12 * Time: 7:35 AM */ -public class HashedPoWholeRowTriplePatternStrategy extends AbstractTriplePatternStrategy { +public class HashedPoWholeRowTriplePatternStrategy extends AbstractHashedTriplePatternStrategy { @Override public RdfCloudTripleStoreConstants.TABLE_LAYOUT getLayout() { @@ -80,7 +81,7 @@ public class HashedPoWholeRowTriplePatternStrategy extends AbstractTriplePattern byte[] objStartBytes = ryaContext.serializeType(rv.getStart())[0]; byte[] objEndBytes = ryaContext.serializeType(rv.getStop())[0]; byte[] predBytes = predicate.getData().getBytes(); - byte[] predHash = md.digest(predBytes); + byte[] predHash = Hex.encodeHexString(md.digest(predBytes)).getBytes(); start = Bytes.concat(predHash, DELIM_BYTES, predBytes, DELIM_BYTES, objStartBytes); stop = Bytes.concat(predHash, DELIM_BYTES, predBytes,DELIM_BYTES, objEndBytes, DELIM_BYTES, LAST_BYTES); } else { @@ -91,7 +92,7 @@ public class HashedPoWholeRowTriplePatternStrategy extends AbstractTriplePattern byte[] subjStartBytes = ru.getStart().getData().getBytes(); byte[] subjStopBytes = ru.getStop().getData().getBytes(); byte[] predBytes = predicate.getData().getBytes(); - byte[] predHash = md.digest(predBytes); + byte[] predHash = Hex.encodeHexString(md.digest(predBytes)).getBytes(); byte[] objBytes = ryaContext.serializeType(object)[0]; start = Bytes.concat(predHash, DELIM_BYTES, predBytes, DELIM_BYTES, objBytes, DELIM_BYTES, subjStartBytes); stop = Bytes.concat(predHash, DELIM_BYTES, predBytes, DELIM_BYTES, objBytes, DELIM_BYTES, subjStopBytes, TYPE_DELIM_BYTES, LAST_BYTES); @@ -99,7 +100,7 @@ public class HashedPoWholeRowTriplePatternStrategy extends AbstractTriplePattern //po //TODO: There must be a better way than creating multiple byte[] byte[] predBytes = predicate.getData().getBytes(); - byte[] predHash = md.digest(predBytes); + byte[] predHash = Hex.encodeHexString(md.digest(predBytes)).getBytes(); byte[] objBytes = ryaContext.serializeType(object)[0]; start = Bytes.concat(predHash, DELIM_BYTES, predBytes, DELIM_BYTES, objBytes, DELIM_BYTES); stop = Bytes.concat(start, LAST_BYTES); @@ -108,7 +109,7 @@ public class HashedPoWholeRowTriplePatternStrategy extends AbstractTriplePattern } else { //p byte[] predBytes = predicate.getData().getBytes(); - byte[] predHash = md.digest(predBytes); + byte[] predHash = Hex.encodeHexString(md.digest(predBytes)).getBytes(); start = Bytes.concat(predHash, DELIM_BYTES, predBytes, DELIM_BYTES); stop = Bytes.concat(start, LAST_BYTES); } http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/d6635321/common/rya.api/src/main/java/mvm/rya/api/query/strategy/wholerow/HashedSpoWholeRowTriplePatternStrategy.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/query/strategy/wholerow/HashedSpoWholeRowTriplePatternStrategy.java b/common/rya.api/src/main/java/mvm/rya/api/query/strategy/wholerow/HashedSpoWholeRowTriplePatternStrategy.java index b7204a9..f801525 100644 --- a/common/rya.api/src/main/java/mvm/rya/api/query/strategy/wholerow/HashedSpoWholeRowTriplePatternStrategy.java +++ b/common/rya.api/src/main/java/mvm/rya/api/query/strategy/wholerow/HashedSpoWholeRowTriplePatternStrategy.java @@ -1,5 +1,16 @@ package mvm.rya.api.query.strategy.wholerow; +import static mvm.rya.api.RdfCloudTripleStoreConstants.DELIM_BYTES; +import static mvm.rya.api.RdfCloudTripleStoreConstants.LAST_BYTES; +import static mvm.rya.api.RdfCloudTripleStoreConstants.TYPE_DELIM_BYTES; + +import java.io.IOException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Map; + +import org.apache.commons.codec.binary.Hex; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -24,28 +35,21 @@ package mvm.rya.api.query.strategy.wholerow; import com.google.common.primitives.Bytes; import mvm.rya.api.RdfCloudTripleStoreConfiguration; +import mvm.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT; import mvm.rya.api.RdfCloudTripleStoreUtils; import mvm.rya.api.domain.RyaRange; import mvm.rya.api.domain.RyaType; import mvm.rya.api.domain.RyaURI; import mvm.rya.api.domain.RyaURIRange; -import mvm.rya.api.query.strategy.AbstractTriplePatternStrategy; import mvm.rya.api.query.strategy.ByteRange; import mvm.rya.api.resolver.RyaContext; import mvm.rya.api.resolver.RyaTypeResolverException; -import java.io.IOException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Map; - -import static mvm.rya.api.RdfCloudTripleStoreConstants.*; - /** * Date: 7/14/12 * Time: 7:35 AM */ -public class HashedSpoWholeRowTriplePatternStrategy extends AbstractTriplePatternStrategy { +public class HashedSpoWholeRowTriplePatternStrategy extends AbstractHashedTriplePatternStrategy { @Override @@ -80,7 +84,7 @@ public class HashedSpoWholeRowTriplePatternStrategy extends AbstractTriplePatter byte[] objStartBytes = ryaContext.serializeType(rv.getStart())[0]; byte[] objEndBytes = ryaContext.serializeType(rv.getStop())[0]; byte[] subjBytes = subject.getData().getBytes(); - byte[] hashSubj = md.digest(subjBytes); + byte[] hashSubj = Hex.encodeHexString(md.digest(subjBytes)).getBytes(); byte[] predBytes = predicate.getData().getBytes(); start = Bytes.concat(hashSubj, DELIM_BYTES, subjBytes, DELIM_BYTES, predBytes, DELIM_BYTES, objStartBytes); stop = Bytes.concat(hashSubj, DELIM_BYTES,subjBytes, DELIM_BYTES, predBytes, DELIM_BYTES, objEndBytes, DELIM_BYTES, LAST_BYTES); @@ -89,7 +93,7 @@ public class HashedSpoWholeRowTriplePatternStrategy extends AbstractTriplePatter //range = spo->spo (remove last byte to remove type info) //TODO: There must be a better way than creating multiple byte[] byte[] subjBytes = subject.getData().getBytes(); - byte[] hashSubj = md.digest(subjBytes); + byte[] hashSubj = Hex.encodeHexString(md.digest(subjBytes)).getBytes(); byte[] objBytes = ryaContext.serializeType(object)[0]; start = Bytes.concat(hashSubj, DELIM_BYTES, subjBytes, DELIM_BYTES, predicate.getData().getBytes(), DELIM_BYTES, objBytes, TYPE_DELIM_BYTES); stop = Bytes.concat(start, LAST_BYTES); @@ -100,7 +104,7 @@ public class HashedSpoWholeRowTriplePatternStrategy extends AbstractTriplePatter RyaRange rv = (RyaRange) predicate; rv = ryaContext.transformRange(rv); byte[] subjBytes = subject.getData().getBytes(); - byte[] hashSubj = md.digest(subjBytes); + byte[] hashSubj = Hex.encodeHexString(md.digest(subjBytes)).getBytes(); byte[] predStartBytes = rv.getStart().getData().getBytes(); byte[] predStopBytes = rv.getStop().getData().getBytes(); start = Bytes.concat(hashSubj, DELIM_BYTES, subjBytes, DELIM_BYTES, predStartBytes); @@ -109,7 +113,7 @@ public class HashedSpoWholeRowTriplePatternStrategy extends AbstractTriplePatter //sp //range = sp byte[] subjBytes = subject.getData().getBytes(); - byte[] hashSubj = md.digest(subjBytes); + byte[] hashSubj = Hex.encodeHexString(md.digest(subjBytes)).getBytes(); start = Bytes.concat(hashSubj, DELIM_BYTES, subjBytes, DELIM_BYTES, predicate.getData().getBytes(), DELIM_BYTES); stop = Bytes.concat(start, LAST_BYTES); } @@ -117,7 +121,7 @@ public class HashedSpoWholeRowTriplePatternStrategy extends AbstractTriplePatter //s //range = s byte[] subjBytes = subject.getData().getBytes(); - byte[] hashSubj = md.digest(subjBytes); + byte[] hashSubj = Hex.encodeHexString(md.digest(subjBytes)).getBytes(); start = Bytes.concat(hashSubj, DELIM_BYTES, subjBytes, DELIM_BYTES); stop = Bytes.concat(start, LAST_BYTES); } http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/d6635321/common/rya.api/src/main/java/mvm/rya/api/resolver/triple/impl/WholeRowHashedTripleResolver.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/resolver/triple/impl/WholeRowHashedTripleResolver.java b/common/rya.api/src/main/java/mvm/rya/api/resolver/triple/impl/WholeRowHashedTripleResolver.java index 1fd3f1b..cbfc30f 100644 --- a/common/rya.api/src/main/java/mvm/rya/api/resolver/triple/impl/WholeRowHashedTripleResolver.java +++ b/common/rya.api/src/main/java/mvm/rya/api/resolver/triple/impl/WholeRowHashedTripleResolver.java @@ -1,5 +1,18 @@ package mvm.rya.api.resolver.triple.impl; +import static mvm.rya.api.RdfCloudTripleStoreConstants.DELIM_BYTE; +import static mvm.rya.api.RdfCloudTripleStoreConstants.DELIM_BYTES; +import static mvm.rya.api.RdfCloudTripleStoreConstants.EMPTY_BYTES; +import static mvm.rya.api.RdfCloudTripleStoreConstants.TYPE_DELIM_BYTE; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import org.apache.commons.codec.binary.Hex; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -23,6 +36,7 @@ package mvm.rya.api.resolver.triple.impl; import com.google.common.primitives.Bytes; +import mvm.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT; import mvm.rya.api.domain.RyaStatement; import mvm.rya.api.domain.RyaType; import mvm.rya.api.domain.RyaURI; @@ -32,14 +46,6 @@ import mvm.rya.api.resolver.triple.TripleRow; import mvm.rya.api.resolver.triple.TripleRowResolver; import mvm.rya.api.resolver.triple.TripleRowResolverException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import static mvm.rya.api.RdfCloudTripleStoreConstants.*; - /** * Will store triple in spo, po, osp. Storing everything in the whole row. * Date: 7/13/12 @@ -69,12 +75,12 @@ public class WholeRowHashedTripleResolver implements TripleRowResolver { byte[] predHashBytes = md.digest(predBytes); byte[][] objBytes = RyaContext.getInstance().serializeType(object); tripleRowMap.put(TABLE_LAYOUT.SPO, - new TripleRow(Bytes.concat(subjHashBytes, DELIM_BYTES, subjBytes, DELIM_BYTES, + new TripleRow(Bytes.concat(Hex.encodeHexString(subjHashBytes).getBytes(), DELIM_BYTES, subjBytes, DELIM_BYTES, predBytes, DELIM_BYTES, objBytes[0], objBytes[1]), cf, qualBytes, timestamp, columnVisibility, value)); tripleRowMap.put(TABLE_LAYOUT.PO, - new TripleRow(Bytes.concat(predHashBytes, DELIM_BYTES, predBytes, DELIM_BYTES, + new TripleRow(Bytes.concat(Hex.encodeHexString(predHashBytes).getBytes(), DELIM_BYTES, predBytes, DELIM_BYTES, objBytes[0], DELIM_BYTES, subjBytes, objBytes[1]), cf, qualBytes, timestamp, columnVisibility, value)); http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/d6635321/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/HashedPoWholeRowTriplePatternStrategyTest.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/HashedPoWholeRowTriplePatternStrategyTest.java b/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/HashedPoWholeRowTriplePatternStrategyTest.java index 81e9468..25fae9b 100644 --- a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/HashedPoWholeRowTriplePatternStrategyTest.java +++ b/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/HashedPoWholeRowTriplePatternStrategyTest.java @@ -1,5 +1,13 @@ package mvm.rya.api.query.strategy.wholerow; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.hadoop.io.Text; +import org.junit.Before; +import org.openrdf.model.impl.URIImpl; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -23,17 +31,18 @@ package mvm.rya.api.query.strategy.wholerow; import junit.framework.TestCase; import mvm.rya.api.RdfCloudTripleStoreConstants; -import mvm.rya.api.domain.*; +import mvm.rya.api.domain.RyaStatement; +import mvm.rya.api.domain.RyaType; +import mvm.rya.api.domain.RyaTypeRange; +import mvm.rya.api.domain.RyaURI; +import mvm.rya.api.domain.RyaURIRange; import mvm.rya.api.query.strategy.ByteRange; +import mvm.rya.api.query.strategy.TriplePatternStrategy; import mvm.rya.api.resolver.RyaContext; import mvm.rya.api.resolver.RyaTripleContext; import mvm.rya.api.resolver.triple.TripleRow; - -import org.apache.hadoop.io.Text; -import org.junit.Before; -import org.openrdf.model.impl.URIImpl; - -import java.util.Map; +import mvm.rya.api.resolver.triple.TripleRowRegex; +import mvm.rya.api.resolver.triple.impl.WholeRowHashedTripleResolver; /** * Date: 7/14/12 @@ -62,6 +71,66 @@ public class HashedPoWholeRowTriplePatternStrategyTest extends TestCase { ryaTripleContext = RyaTripleContext.getInstance(config); } + + public void testRegex() throws Exception { + RyaURI subj = new RyaURI("urn:test#1234"); + RyaURI pred = new RyaURI("urn:test#pred"); + RyaURI obj = new RyaURI("urn:test#obj"); + RyaStatement ryaStatement = new RyaStatement(subj, pred, obj); + Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = new WholeRowHashedTripleResolver().serialize(ryaStatement); + TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO); + + String row = new String(tripleRow.getRow()); + TriplePatternStrategy spoStrategy = new HashedSpoWholeRowTriplePatternStrategy(); + TriplePatternStrategy poStrategy = new HashedPoWholeRowTriplePatternStrategy(); + TriplePatternStrategy ospStrategy = new OspWholeRowTriplePatternStrategy(); + //pred + TripleRowRegex tripleRowRegex = spoStrategy.buildRegex(null, pred.getData(), null, null, null); + Pattern p = Pattern.compile(tripleRowRegex.getRow()); + Matcher matcher = p.matcher(row); + assertTrue(matcher.matches()); + //subj + tripleRowRegex = spoStrategy.buildRegex(subj.getData(), null, null, null, null); + p = Pattern.compile(tripleRowRegex.getRow()); + matcher = p.matcher(row); + assertTrue(matcher.matches()); + //obj + tripleRowRegex = spoStrategy.buildRegex(null, null, obj.getData(), null, null); + p = Pattern.compile(tripleRowRegex.getRow()); + matcher = p.matcher(row); + assertTrue(matcher.matches()); + + //po table + row = new String(serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO).getRow()); + tripleRowRegex = poStrategy.buildRegex(null, pred.getData(), null, null, null); + p = Pattern.compile(tripleRowRegex.getRow()); + matcher = p.matcher(row); + assertTrue(matcher.matches()); + + tripleRowRegex = poStrategy.buildRegex(null, pred.getData(), obj.getData(), null, null); + p = Pattern.compile(tripleRowRegex.getRow()); + matcher = p.matcher(row); + assertTrue(matcher.matches()); + + tripleRowRegex = poStrategy.buildRegex(subj.getData(), pred.getData(), obj.getData(), null, null); + p = Pattern.compile(tripleRowRegex.getRow()); + matcher = p.matcher(row); + assertTrue(matcher.matches()); + + //various regex + tripleRowRegex = poStrategy.buildRegex(null, "urn:test#pr[e|d]{2}", null, null, null); + p = Pattern.compile(tripleRowRegex.getRow()); + matcher = p.matcher(row); + assertTrue(matcher.matches()); + + //does not match + tripleRowRegex = poStrategy.buildRegex(null, "hello", null, null, null); + p = Pattern.compile(tripleRowRegex.getRow()); + matcher = p.matcher(row); + assertFalse(matcher.matches()); + } + + public void testPoRange() throws Exception { Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple( new RyaStatement(uri, uri, uri, null));
