# HG changeset patch # User ymh # Date 1435102606 -7200 # Node ID 2b3247d027694fcdb1de1cd89d3f6d9d3df6c2f2 # Parent 00e2916104fe16eaa1191a6318e26cd4bad34b5a Migrate to php 5.6 + Laravel 5.1 + add phpunit test diff -r 00e2916104fe -r 2b3247d02769 server/src/app/Console/Commands/ImportCocoonRDF.php --- a/server/src/app/Console/Commands/ImportCocoonRDF.php Tue Jun 23 17:01:39 2015 +0200 +++ b/server/src/app/Console/Commands/ImportCocoonRDF.php Wed Jun 24 01:36:46 2015 +0200 @@ -43,7 +43,8 @@ echo("hello\n"); libxml_use_internal_errors(true); - $gs = new \EasyRdf_GraphStore(Config::get('corpusparole.sesame_update_url')); + //$gs = new \EasyRdf_GraphStore(Config::get('corpusparole.sesame_update_url')); + $gs = new \EasyRdf_Sparql_Client(Config::get('corpusparole.sesame_query_url'), Config::get('corpusparole.sesame_update_url')); //$doc = new \EasyRdf_Graph("http://cocoon.huma-num.fr/exist/crdo/rdf/crdo-ESLO1_ENTCONT_203"); //$doc->load(); diff -r 00e2916104fe -r 2b3247d02769 server/src/app/Models/Document.php --- a/server/src/app/Models/Document.php Tue Jun 23 17:01:39 2015 +0200 +++ b/server/src/app/Models/Document.php Wed Jun 24 01:36:46 2015 +0200 @@ -3,20 +3,20 @@ use Config; use CorpusParole\Libraries\Utils; +use CorpusParole\Libraries\RdfModel\RdfModelResource; use Log; /** * Model class for Document. Inherit from EasyRdf_Resource + * SELECT DISTINCT ?g WHERE {GRAPH ?g {?s ?p ?o}} */ -class Document extends \EasyRdf_Resource { +class Document extends RdfModelResource { public function __construct($uri, $graph = null) { - parent::__construct($uri, $graph); - $this->innerDocument = $this->getResource('foaf:primaryTopic'); + parent::__construct($uri, $graph, 'foaf:primaryTopic'); } private $id = null; - private $innerDocument = null; public function getId() { if(is_null($this->id)) { @@ -65,13 +65,18 @@ } public function updateDiscourseTypes(array $discoursesTypes) { + + $this->startDelta(); + foreach($this->getDiscourseTypes() as $discourseType) { $this->innerDocument->delete('dc11:type', $discourseType); + $this->currentDelta->deletedGraph->add($this->innerDocument, 'dc11:type', $discourseType); } // re-add them foreach($discoursesTypes as $dType) { $this->innerDocument->add('dc11:type', new \EasyRdf_Literal($dType, null, Config::get('constants.OLAC_DISCOURSE_TYPE')['uri'])); + $this->currentDelta->addedGraph->add($this->innerDocument, 'dc11:type', $discourseType); } } diff -r 00e2916104fe -r 2b3247d02769 server/src/app/Repositories/RdfDocumentRepository.php --- a/server/src/app/Repositories/RdfDocumentRepository.php Tue Jun 23 17:01:39 2015 +0200 +++ b/server/src/app/Repositories/RdfDocumentRepository.php Wed Jun 24 01:36:46 2015 +0200 @@ -14,7 +14,7 @@ private $sparqlClient; function __construct() { - $this->sparqlClient = new \EasyRdf_Sparql_Client(Config::get('corpusparole.sesame_query_url')); + $this->sparqlClient = new \EasyRdf_Sparql_Client(Config::get('corpusparole.sesame_query_url'), Config::get('corpusparole.sesame_update_url')); } public function all() {