server/src/app/Libraries/Mappers/CocoonCollectionRdfMapper.php
changeset 18 f2a40bbc27f6
child 144 03678acbfda3
equal deleted inserted replaced
17:ac3dc090e987 18:f2a40bbc27f6
       
     1 <?php
       
     2 namespace CorpusParole\Libraries\Mappers;
       
     3 
       
     4 use EasyRdf\Graph;
       
     5 
       
     6 //<http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_ALA_CL> a <http://crdo.risc.cnrs.fr/schemas/Resource> ;
       
     7 //	<http://purl.org/dc/elements/1.1/description> """Cette série d'entretiens semi-dirigés avait comme objectif de susciter un discours
       
     8 //            sur les pratiques linguistiques des locuteurs. Les locuteurs se sont exprimés dans la langue de leur choix.
       
     9 //            Le questionnaire servant de trame à l'entretien comportait les volets suivants :
       
    10 //            # la biographie sociolinguistique
       
    11 //            # la délimitation de l'espace de vie et de l'espace linguistique d'appartenance
       
    12 //            # l'auto-évaluation des compétences linguistiques en alsacien, en français et en allemand
       
    13 //            # les normes linguistiques des trois variétés
       
    14 //            # les variations (alsacien, français, allemand)
       
    15 //            # les pratiques linguistiques et langagières
       
    16 //            # l'idéologie linguistique (rapport langue / identité, dialecte / école …)."""@fr ;
       
    17 //    <http://purl.org/dc/elements/1.1/type> "primary_text"^^<http://www.language-archives.org/OLAC/1.1/linguistic-type> , "dialogue"^^<http://www.language-archives.org/OLAC/1.1/discourse-type> , <http://purl.org/dc/dcmitype/Collection> , "lexicon"^^<http://www.language-archives.org/OLAC/1.1/linguistic-type> ;
       
    18 //    <http://purl.org/dc/elements/1.1/subject> <http://lexvo.org/id/iso639-3/gsw> ;
       
    19 //    <http://purl.org/dc/elements/1.1/language> <http://lexvo.org/id/iso639-3/gsw> ;
       
    20 //    <http://www.language-archives.org/OLAC/1.1/depositor> <http://viaf.org/viaf/9122216> ;
       
    21 //    <http://purl.org/dc/elements/1.1/publisher> "Atlas linguistiques, cultures et parlers régionaux de France" ;
       
    22 //    <http://purl.org/dc/elements/1.1/rights> "Copyright (c) Département de dialectologie alsacienne et mosellane de l'Université de Strasbourg" ;
       
    23 //    <http://purl.org/dc/elements/1.1/title> "Atlas Linguistique et ethnographique de l'Alsace: Enquêtes sur la conscience linguistique"@fr ;
       
    24 //    <http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ;
       
    25 //    <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-nd/2.5/> ;
       
    26 //    <http://purl.org/dc/terms/isPartOf> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_ALA> ;
       
    27 //    <http://purl.org/dc/terms/created> "start=1988; end=1989"^^<http://purl.org/dc/terms/Period> ;
       
    28 //    <http://purl.org/dc/terms/spatial> "France, Alsace"@fr , "FR"^^<http://purl.org/dc/terms/ISO3166> ;
       
    29 //    <http://purl.org/dc/terms/available> "2014-04-18"^^<http://purl.org/dc/terms/W3CDTF> ;
       
    30 //    <http://purl.org/dc/terms/issued> "2015-07-09T09:40:21 02:00"^^<http://purl.org/dc/terms/W3CDTF> ;
       
    31 //    <http://www.language-archives.org/OLAC/1.1/transcriber> "Huck, Dominique" ;
       
    32 //    <http://www.language-archives.org/OLAC/1.1/researcher> "Bothorel-Witz, Arlette" .
       
    33 
       
    34 // http://purl.org/dc/elements/1.1/description
       
    35 // http://purl.org/dc/elements/1.1/language
       
    36 // http://purl.org/dc/elements/1.1/publisher
       
    37 // http://purl.org/dc/elements/1.1/rights
       
    38 // http://purl.org/dc/elements/1.1/subject
       
    39 // http://purl.org/dc/elements/1.1/title
       
    40 // http://purl.org/dc/elements/1.1/type
       
    41 // http://purl.org/dc/terms/accessRights
       
    42 // http://purl.org/dc/terms/available
       
    43 // http://purl.org/dc/terms/created
       
    44 // http://purl.org/dc/terms/issued
       
    45 // http://purl.org/dc/terms/license
       
    46 // http://purl.org/dc/terms/spatial
       
    47 // http://www.language-archives.org/OLAC/1.1/depositor
       
    48 // http://www.language-archives.org/OLAC/1.1/researcher
       
    49 // http://www.language-archives.org/OLAC/1.1/transcriber
       
    50 // http://purl.org/dc/terms/isPartOf
       
    51 // http://www.language-archives.org/OLAC/1.1/compiler
       
    52 // http://www.language-archives.org/OLAC/1.1/data_inputter
       
    53 // http://www.language-archives.org/OLAC/1.1/developer
       
    54 // http://www.language-archives.org/OLAC/1.1/interviewer
       
    55 // http://www.language-archives.org/OLAC/1.1/sponsor
       
    56 // http://www.w3.org/2003/01/geo/wgs84_pos#lat
       
    57 // http://www.w3.org/2003/01/geo/wgs84_pos#long
       
    58 
       
    59 class CocoonCollectionRdfMapper extends CocoonAbstractRdfMapper {
       
    60 
       
    61     protected function getResourceBaseId($res=null) {
       
    62 
       
    63         if(is_null($res)) {
       
    64             $res = $this->inputGraph->resource($this->uri);
       
    65         }
       
    66         return $res->getUri();
       
    67     }
       
    68 
       
    69     /**
       
    70      * Build the main outputgraph
       
    71      * @return the new empty graph
       
    72      */
       
    73      protected function buildOutputGraph() {
       
    74 
       
    75          $outputGraph = new Graph($this->uri);
       
    76          $this->outputGraphes[$this->getResourceBaseId()] = $outputGraph;
       
    77 
       
    78          return $outputGraph;
       
    79      }
       
    80 
       
    81 
       
    82     protected function mapResource($res, $outputGraph) {
       
    83         $resUri = $res->getUri();
       
    84 
       
    85         $collNode = $outputGraph->resource($resUri, 'edm:Collection');
       
    86 
       
    87         $this->addSimpleProperties($collNode, $res);
       
    88         $this->addDateProperties($collNode, $res, $outputGraph);
       
    89         $this->addSpatialProperties($collNode, $res, $outputGraph);
       
    90 
       
    91         $this->mapCollections($res);
       
    92     }
       
    93 
       
    94 
       
    95     protected function addSimpleProperties($targetRes, $sourceRes) {
       
    96         $this->applyPropertiesToRes($sourceRes, $targetRes, [
       
    97             ['http://purl.org/dc/elements/1.1/description', null],
       
    98             ['http://purl.org/dc/elements/1.1/language', null],
       
    99             ['http://purl.org/dc/elements/1.1/publisher', null],
       
   100             ['http://purl.org/dc/elements/1.1/rights', null],
       
   101             ['http://purl.org/dc/elements/1.1/type', null],
       
   102             ['http://purl.org/dc/terms/license', null],
       
   103             ['http://purl.org/dc/elements/1.1/subject', null],
       
   104             ['http://purl.org/dc/elements/1.1/title', null],
       
   105             ['http://purl.org/dc/elements/1.1/language', null],
       
   106             ['http://purl.org/dc/terms/accessRights', 'propertyTrimMap'],
       
   107             ['http://purl.org/dc/terms/extent', null],
       
   108             ['http://purl.org/dc/terms/isPartOf', null],
       
   109             ['http://www.language-archives.org/OLAC/1.1/annotator', 'propertyOlacRoleMap'],
       
   110             ['http://www.language-archives.org/OLAC/1.1/author', 'propertyOlacRoleMap'],
       
   111             ['http://www.language-archives.org/OLAC/1.1/compiler', 'propertyOlacRoleMap'],
       
   112             ['http://www.language-archives.org/OLAC/1.1/consultant', 'propertyOlacRoleMap'],
       
   113             ['http://www.language-archives.org/OLAC/1.1/data_inputter', 'propertyOlacRoleMap'],
       
   114             ['http://www.language-archives.org/OLAC/1.1/depositor', 'propertyOlacRoleMap'],
       
   115             ['http://www.language-archives.org/OLAC/1.1/developer', 'propertyOlacRoleMap'],
       
   116             ['http://www.language-archives.org/OLAC/1.1/editor', 'propertyOlacRoleMap'],
       
   117             ['http://www.language-archives.org/OLAC/1.1/illustrator', 'propertyOlacRoleMap'],
       
   118             ['http://www.language-archives.org/OLAC/1.1/interpreter', 'propertyOlacRoleMap'],
       
   119             ['http://www.language-archives.org/OLAC/1.1/interviewer', 'propertyOlacRoleMap'],
       
   120             ['http://www.language-archives.org/OLAC/1.1/participant', 'propertyOlacRoleMap'],
       
   121             ['http://www.language-archives.org/OLAC/1.1/performer', 'propertyOlacRoleMap'],
       
   122             ['http://www.language-archives.org/OLAC/1.1/photographer', 'propertyOlacRoleMap'],
       
   123             ['http://www.language-archives.org/OLAC/1.1/recorder', 'propertyOlacRoleMap'],
       
   124             ['http://www.language-archives.org/OLAC/1.1/researcher', 'propertyOlacRoleMap'],
       
   125             ['http://www.language-archives.org/OLAC/1.1/research_participant', 'propertyOlacRoleMap'],
       
   126             ['http://www.language-archives.org/OLAC/1.1/responder', 'propertyOlacRoleMap'],
       
   127             ['http://www.language-archives.org/OLAC/1.1/signer', 'propertyOlacRoleMap'],
       
   128             ['http://www.language-archives.org/OLAC/1.1/singer', 'propertyOlacRoleMap'],
       
   129             ['http://www.language-archives.org/OLAC/1.1/speaker', 'propertyOlacRoleMap'],
       
   130             ['http://www.language-archives.org/OLAC/1.1/sponsor', 'propertyOlacRoleMap'],
       
   131             ['http://www.language-archives.org/OLAC/1.1/transcriber', 'propertyOlacRoleMap'],
       
   132             ['http://www.language-archives.org/OLAC/1.1/translator', 'propertyOlacRoleMap'],
       
   133         ]);
       
   134     }
       
   135 
       
   136 
       
   137 
       
   138 }