server/src/app/Libraries/Mappers/CocoonSoundRdfMapper.php
changeset 111 af85c436048f
parent 18 f2a40bbc27f6
child 116 e60c55988ed4
equal deleted inserted replaced
110:8e5fcebb9018 111:af85c436048f
    87         }
    87         }
    88         return $res->getUri();
    88         return $res->getUri();
    89     }
    89     }
    90 
    90 
    91     /**
    91     /**
    92      * Build teh webresources
    92      * Build the webresource
    93      */
    93      */
    94     protected function mapWebResources($res, $outputGraph) {
    94     protected function mapWebResources($res, $outputGraph) {
    95 
    95 
    96         $resId = CocoonUtils::getIdFromUri($res->getUri());
    96         $resId = CocoonUtils::getIdFromUri($res->getUri());
    97         $resUri = CocoonUtils::getCorpusUriFromId($resId);
    97         $resUri = CocoonUtils::getCorpusUriFromId($resId);
   103         $extent = $res->get($this->inputGraph->resource('http://purl.org/dc/terms/extent'));
   103         $extent = $res->get($this->inputGraph->resource('http://purl.org/dc/terms/extent'));
   104 
   104 
   105         // build master webresources
   105         // build master webresources
   106         $masterReprUrl = $res->get($this->inputGraph->resource('http://crdo.risc.cnrs.fr/schemas/master'));
   106         $masterReprUrl = $res->get($this->inputGraph->resource('http://crdo.risc.cnrs.fr/schemas/master'));
   107         if(! is_null($masterReprUrl)) {
   107         if(! is_null($masterReprUrl)) {
   108             $masterWebResource = $outputGraph->resource($masterReprUrl, 'edm:WebResources');
   108             $masterWebResource = $outputGraph->resource($masterReprUrl, 'edm:WebResource');
   109             if(!is_null($extent)) {
   109             if(!is_null($extent)) {
   110                 $masterWebResource->addLiteral($outputGraph->resource('http://purl.org/dc/terms/extent'),$extent);
   110                 $masterWebResource->addLiteral($outputGraph->resource('http://purl.org/dc/terms/extent'),$extent);
   111             }
   111             }
   112             $formatAdded = false;
   112             $formatAdded = false;
   113             foreach($res->all($this->inputGraph->resource('http://purl.org/dc/elements/1.1/format')) as $wrformat) {
   113             foreach($res->all($this->inputGraph->resource('http://purl.org/dc/elements/1.1/format')) as $wrformat) {
   123 
   123 
   124         }
   124         }
   125 
   125 
   126         // build others
   126         // build others
   127         foreach($res->all($this->inputGraph->resource('http://purl.org/dc/terms/isFormatOf')) as $reprUrl) {
   127         foreach($res->all($this->inputGraph->resource('http://purl.org/dc/terms/isFormatOf')) as $reprUrl) {
   128             $webResource = $outputGraph->resource($reprUrl, 'edm:WebResources');
   128             $webResource = $outputGraph->resource($reprUrl, 'edm:WebResource');
   129             if(!is_null($extent)) {
   129             if(!is_null($extent)) {
   130                 $webResource->addLiteral($outputGraph->resource('http://purl.org/dc/terms/extent'),$extent);
   130                 $webResource->addLiteral($outputGraph->resource('http://purl.org/dc/terms/extent'),$extent);
   131             }
   131             }
   132             $mimetype = Utils::getMimetype($reprUrl);
   132             $mimetype = Utils::getMimetype($reprUrl);
   133             $webResource->addLiteral('http://purl.org/dc/elements/1.1/format', Literal::create($mimetype, null, $outputGraph->resource('http://purl.org/dc/terms/IMT')));
   133             $webResource->addLiteral('http://purl.org/dc/elements/1.1/format', Literal::create($mimetype, null, $outputGraph->resource('http://purl.org/dc/terms/IMT')));