diff -r 64caee7ce38d -r 02e2396bcbbc server/src/app/Libraries/Utils.php --- a/server/src/app/Libraries/Utils.php Sat Aug 06 21:27:53 2016 +0700 +++ b/server/src/app/Libraries/Utils.php Sat Aug 06 21:29:33 2016 +0700 @@ -3,6 +3,8 @@ use EasyRdf\Literal; use EasyRdf\Resource; +use EasyRdf\Graph; + /** * Utilities functions @@ -117,5 +119,19 @@ } } + /** + * @param EasyRdf\Graph $graph1 + * @param EasyRdf\Graph $graph2 + * + * @return EasyRdf\Graph + */ + public static function mergeGraphs(Graph $graph1, Graph $graph2) + { + $data1 = $graph1->toRdfPhp(); + $data2 = $graph2->toRdfPhp(); + $merged = array_merge_recursive($data1, $data2); + unset($data1, $data2); + return new Graph($graph1->getUri(), $merged, 'php'); + } }