/** * Decode a previously encoded value. * * @param encodedValue * the encoded value * @param valueFactory * the factory to use for constructing the Value * @return the decoded Value * @see #encodeValue(Value) */ public static Value decodeValue(String encodedValue, ValueFactory valueFactory) { if (encodedValue != null) { return NTriplesUtil.parseValue(encodedValue, valueFactory); } return null; }
/** * Decode a previously encoded value. * * @param encodedValue * the encoded value * @param valueFactory * the factory to use for constructing the Value * @return the decoded Value * @see #encodeValue(Value) */ public static Value decodeValue(String encodedValue, ValueFactory valueFactory) { if (encodedValue != null) { return NTriplesUtil.parseValue(encodedValue, valueFactory); } return null; }
/** * Decode a previously encoded value. * * @param encodedValue * the encoded value * @param valueFactory * the factory to use for constructing the Value * @return the decoded Value * @see #encodeValue(Value) */ public static Value decodeValue(String encodedValue, ValueFactory valueFactory) { if (encodedValue != null) { return NTriplesUtil.parseValue(encodedValue, valueFactory); } return null; }
protected Value parseValue(final String s) { if (s.equals("null")) { return null; } return NTriplesUtil.parseValue(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)); } } } }
writeStatement(graphNode, SVF.createIRI(predicate + "Partition"), subset); writeStatement(subset, RDF.TYPE, VOID.DATASET); writeStatement(subset, pred, NTriplesUtil.parseValue(new String(partitionId, UTF8), SVF)); writeStatement(subset, VOID.TRIPLES, SVF.createLiteral(count)); } else {