diff -r d7c5b43d309a -r 0365fd9977a4 server/src/app/Models/Document.php --- a/server/src/app/Models/Document.php Wed Oct 19 15:55:04 2016 +0200 +++ b/server/src/app/Models/Document.php Wed Oct 19 18:05:51 2016 +0200 @@ -100,13 +100,13 @@ public function getDiscourseTypes() { return array_values(array_filter($this->getTypes(), function($v) { - return $v instanceof Literal && $v->getDatatypeUri() === Config::get('corpusparole.olac_discourse_type')['uri']; + return $v instanceof Resource && preg_match(config('corpusparole.bnf_ark_url_regexp'), $v->getUri()); })); } public function getOtherTypes() { $res = array_values(array_filter($this->getTypes(), function($v) { - return $v instanceof Resource || $v->getDatatypeUri() !== Config::get('corpusparole.olac_discourse_type')['uri']; + return !($v instanceof Resource) || !preg_match(config('corpusparole.bnf_ark_url_regexp'), $v->getUri()); })); return $res; } @@ -190,15 +190,14 @@ //delete foreach($this->getDiscourseTypes() as $discourseType) { - $literalValue = new Literal($discourseType, null, Config::get('corpusparole.olac_discourse_type')['uri']); - $this->getProvidedCHO()->delete('dc11:type', $literalValue); - $this->currentDelta->getDeletedGraph()->add($this->getProvidedCHO(), 'dc11:type', new Literal($discourseType, null, Config::get('corpusparole.olac_discourse_type')['uri'])); + $this->getProvidedCHO()->delete('dc11:type', $discourseType); + $this->currentDelta->getDeletedGraph()->addResource($this->getProvidedCHO(), 'dc11:type', $discourseType->getUri()); } // and re-add them foreach($discoursesTypes as $dType) { - $this->getProvidedCHO()->add('dc11:type', new Literal($dType, null, Config::get('corpusparole.olac_discourse_type')['uri'])); - $this->currentDelta->getAddedGraph()->add($this->getProvidedCHO(), 'dc11:type', new Literal($dType, null, Config::get('corpusparole.olac_discourse_type')['uri'])); + $this->getProvidedCHO()->addResource('dc11:type', $dType); + $this->currentDelta->getAddedGraph()->addResource($this->getProvidedCHO(), 'dc11:type', $dType); } $this->clearMemoizationCache();