/** * Decode a previously encoded Resource. * * @param encodedValue * the encoded value * @param valueFactory * the factory to use for constructing the Resource * @return the decoded Resource * @see #encodeValue(Value) */ public static Resource decodeResource(String encodedValue, ValueFactory valueFactory) { if (encodedValue != null) { return NTriplesUtil.parseResource(encodedValue, valueFactory); } return null; }
/** * Decode a previously encoded Resource. * * @param encodedValue * the encoded value * @param valueFactory * the factory to use for constructing the Resource * @return the decoded Resource * @see #encodeValue(Value) */ public static Resource decodeResource(String encodedValue, ValueFactory valueFactory) { if (encodedValue != null) { return NTriplesUtil.parseResource(encodedValue, valueFactory); } return null; }
/** * Decode a previously encoded Resource. * * @param encodedValue * the encoded value * @param valueFactory * the factory to use for constructing the Resource * @return the decoded Resource * @see #encodeValue(Value) */ public static Resource decodeResource(String encodedValue, ValueFactory valueFactory) { if (encodedValue != null) { return NTriplesUtil.parseResource(encodedValue, valueFactory); } return null; }
protected Resource parseResource(final String s) { if (s.equals("null")) { return null; } return NTriplesUtil.parseResource(s, valueFactory); }
/** * Parser method returning Statement from a single HBase Result Cell * @param c HBase Result Cell * @return Statements */ public static Statement parseStatement(Cell c) { ByteBuffer bb = ByteBuffer.wrap(c.getQualifierArray(), c.getQualifierOffset(), c.getQualifierLength()); byte[] sb = new byte[bb.getInt()]; byte[] pb = new byte[bb.getInt()]; byte[] ob = new byte[bb.getInt()]; bb.get(sb); bb.get(pb); bb.get(ob); byte[] cb = new byte[bb.remaining()]; bb.get(cb); ValueFactory vf = SimpleValueFactory.getInstance(); return vf.createStatement(NTriplesUtil.parseResource(new String(sb, UTF8), vf), NTriplesUtil.parseURI(new String(pb, UTF8), vf), NTriplesUtil.parseValue(new String(ob,UTF8), vf), cb.length == 0 ? null : NTriplesUtil.parseResource(new String(cb,UTF8), vf)); }
@Override protected void setup(Context context) throws IOException, InterruptedException { SimpleValueFactory vf = SimpleValueFactory.getInstance(); Configuration conf = context.getConfiguration(); String s = conf.get(SUBJECT); if (s!= null) { subj = NTriplesUtil.parseResource(s, vf); } String p = conf.get(PREDICATE); if (p!= null) { pred = NTriplesUtil.parseURI(p, vf); } String o = conf.get(OBJECT); if (o!= null) { obj = NTriplesUtil.parseValue(o, vf); } String cs[] = conf.getStrings(CONTEXTS); if (cs != null) { ctx = new ArrayList<>(); for (String c : cs) { if ("NONE".equals(c)) { ctx.add(null); } else { ctx.add(NTriplesUtil.parseResource(c, vf)); } } } }
if (cmd.hasOption('g')) { byte[] graphHash = HalyardTableUtils.hashKey(NTriplesUtil.parseResource(cmd.getOptionValue('g'), SimpleValueFactory.getInstance())); scan.setStartRow(HalyardTableUtils.concat(HalyardTableUtils.COSP_PREFIX, false, graphHash)); scan.setStopRow(HalyardTableUtils.concat(HalyardTableUtils.COSP_PREFIX, true, graphHash, HalyardTableUtils.STOP_KEY, HalyardTableUtils.STOP_KEY, HalyardTableUtils.STOP_KEY));