@Override public JSONObject call(JSONObject left, JSONObject right) throws Exception { return JSONLDUtilSimple.mergeJSONObjects(left, right, provenaceProperties); } }, numPartitions);
public static JSONObject mergeJSONObjects(Iterator<String> iterator) throws ParseException { return mergeJSONObjects(iterator, new HashMap<String, String>()); }
public static JSONObject mergeJSONObjects(String left, String right, Map<String, String> provenanceProperties) throws ParseException { JSONParser parser = new JSONParser(); return mergeJSONObjects((JSONObject)parser.parse(left), (JSONObject)parser.parse(right), provenanceProperties); }
public static JSONObject mergeJSONObjects(Iterator<String> iterator, Map<String, String> provenanceProperties) throws ParseException { JSONParser parser = new JSONParser(); JSONObject accumulatorObject = new JSONObject(); while(iterator.hasNext()) { String value = iterator.next(); JSONObject object = (JSONObject)parser.parse(value); accumulatorObject = mergeJSONObjects(accumulatorObject, object, provenanceProperties); } return accumulatorObject; }
public String merge() throws ParseException { return JSONLDUtilSimple.mergeJSONObjects(jsonBySource.values().iterator()).toString(); }
protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException { JSONObject accumulatorObject = null; try { accumulatorObject = JSONLDUtilSimple.mergeJSONObjects(new TextToStringIterator(values.iterator())); } catch (ParseException e) { throw new IOException(e); } reusableOutputValue.set(accumulatorObject.toString()); context.write(NullWritable.get(), reusableOutputValue); }
protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException { JSONObject accumulatorObject = null; try { accumulatorObject = JSONLDUtilSimple.mergeJSONObjects(new TextToStringIterator(values.iterator())); } catch (ParseException e) { throw new IOException(e); } reusableOutputValue.set(accumulatorObject.toString()); context.write(key, reusableOutputValue); }