Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0% optimise graph objects for tripod data model #61

Closed
wants to merge 13 commits into from
24 changes: 5 additions & 19 deletions src/classes/ChangeSet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class ChangeSet extends ExtendedGraph {
*/
var $a;
var $subjectIndex = array();
var $_index = array();

function __construct($a = '') {
$this->a = $a;
Expand Down Expand Up @@ -177,20 +176,7 @@ function __init() {
}
}


// foreach($this->_index as $uri => $props){
// if(
// !isset($props[$CSNS.'removal'])
// AND
// !isset($props[$CSNS.'addition'])
// ){
// unset($this->_index[$uri]);
// }
//
// }

$this->_index = ExtendedGraph::merge($this->_index, $reifiedAdditions, $reifiedRemovals);

$this->set_index(ExtendedGraph::merge($this->get_index(), $reifiedAdditions, $reifiedRemovals));
}

/**
Expand All @@ -201,25 +187,25 @@ function __init() {
function addT($s, $p, $o, $o_type='bnode'){
if(is_array($o) AND isset($o[0]['type'])){
foreach($o as $obj){
$this->addT($s, $p, $obj );
$this->add_triple($s, $p, $obj );
}
}else {
$obj = !is_array($o)? array('value' => $o, 'type'=> $o_type) : $o ;
$this->_index[$s][$p][]=$obj;
$this->add_triple($s, $p, $obj);
}
}

function toRDFXML(){
$ser = ARC2::getRDFXMLSerializer();
return $ser->getSerializedIndex($this->_index);
return $ser->getSerializedIndex($this->get_index());
}

function to_rdfxml(){
return $this->toRDFXML();
}

function has_changes(){
foreach($this->_index as $uri => $properties){
foreach($this->get_index() as $uri => $properties){
if(
isset($properties['http://purl.org/vocab/changeset/schema#addition'])
OR
Expand Down
Loading