diff -r ac3dc090e987 -r f2a40bbc27f6 server/src/app/Libraries/Mappers/CocoonSoundRdfMapper.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/app/Libraries/Mappers/CocoonSoundRdfMapper.php Tue Nov 17 13:11:55 2015 +0100 @@ -0,0 +1,142 @@ + -> providedCHO + * -> webRepresentation + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> for text -> webRepresentation (2 val : http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-dtd_transcriber : transcript, http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-dtd_archive) + * -> providedCHO + * -> webResource + *** ->collections + * -> providedCHO + * -> providedCHO + *** -> transcriptions + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> webRepresentation + * -> webRepresentation + * -> transcriptions + * -> edm:Place + * -> edm:Place + * -> edm:Place + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO but question... + * -> providedCHO + * -> providedCHO + * - providedCHO + * -> ProvidedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * -> providedCHO + * + * pour olac : http://quijote.fdi.ucm.es:8084/LLOD-LSASummerWorkshop2015/Presentations/Simons--OLAC%20Metadata.pdf + * DATA consolidation + * -> edm:place : get label + altLabel + */ +class CocoonSoundRdfMapper extends CocoonContentRdfMapper { + + protected function getResourceBaseId($res=null) { + + if(is_null($res)) { + $res = $this->inputGraph->resource($this->uri); + } + return $res->getUri(); + } + + /** + * Build teh webresources + */ + protected function mapWebResources($res, $outputGraph) { + + $resId = CocoonUtils::getIdFromUri($res->getUri()); + $resUri = CocoonUtils::getCorpusUriFromId($resId); + + + $aggregationNode = $outputGraph->resource($resUri, 'ore:Aggregation'); + + // get extent + $extent = $res->get($this->inputGraph->resource('http://purl.org/dc/terms/extent')); + + // build master webresources + $masterReprUrl = $res->get($this->inputGraph->resource('http://crdo.risc.cnrs.fr/schemas/master')); + if(! is_null($masterReprUrl)) { + $masterWebResource = $outputGraph->resource($masterReprUrl, 'edm:WebResources'); + if(!is_null($extent)) { + $masterWebResource->addLiteral($outputGraph->resource('http://purl.org/dc/terms/extent'),$extent); + } + $formatAdded = false; + foreach($res->all($this->inputGraph->resource('http://purl.org/dc/elements/1.1/format')) as $wrformat) { + $masterWebResource->addLiteral('http://purl.org/dc/elements/1.1/format', $wrformat); + $formatAdded = true; + } + if(!$formatAdded) { + $mimetype = Utils::getMimetype($masterReprUrl); + $masterWebResource->addLiteral('http://purl.org/dc/elements/1.1/format', Literal::create($mimetype, null, $outputGraph->resource('http://purl.org/dc/terms/IMT'))); + } + + $this->addDateToWebResource($res, $masterWebResource); + + } + + // build others + foreach($res->all($this->inputGraph->resource('http://purl.org/dc/terms/isFormatOf')) as $reprUrl) { + $webResource = $outputGraph->resource($reprUrl, 'edm:WebResources'); + if(!is_null($extent)) { + $webResource->addLiteral($outputGraph->resource('http://purl.org/dc/terms/extent'),$extent); + } + $mimetype = Utils::getMimetype($reprUrl); + $webResource->addLiteral('http://purl.org/dc/elements/1.1/format', Literal::create($mimetype, null, $outputGraph->resource('http://purl.org/dc/terms/IMT'))); + + if(!is_null($masterReprUrl)) { + $webResource->addResource('edm:isDerivativeOf', $masterReprUrl); + } + $this->addDateToWebResource($res, $webResource); + $aggregationNode->addResource('edm:hasView', $reprUrl); + } + } +}