server/src/app/Libraries/Mappers/CocoonCollectionRdfMapper.php
changeset 18 f2a40bbc27f6
child 144 03678acbfda3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/app/Libraries/Mappers/CocoonCollectionRdfMapper.php	Tue Nov 17 13:11:55 2015 +0100
@@ -0,0 +1,138 @@
+<?php
+namespace CorpusParole\Libraries\Mappers;
+
+use EasyRdf\Graph;
+
+//<http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_ALA_CL> a <http://crdo.risc.cnrs.fr/schemas/Resource> ;
+//	<http://purl.org/dc/elements/1.1/description> """Cette série d'entretiens semi-dirigés avait comme objectif de susciter un discours
+//            sur les pratiques linguistiques des locuteurs. Les locuteurs se sont exprimés dans la langue de leur choix.
+//            Le questionnaire servant de trame à l'entretien comportait les volets suivants :
+//            # la biographie sociolinguistique
+//            # la délimitation de l'espace de vie et de l'espace linguistique d'appartenance
+//            # l'auto-évaluation des compétences linguistiques en alsacien, en français et en allemand
+//            # les normes linguistiques des trois variétés
+//            # les variations (alsacien, français, allemand)
+//            # les pratiques linguistiques et langagières
+//            # l'idéologie linguistique (rapport langue / identité, dialecte / école …)."""@fr ;
+//    <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> ;
+//    <http://purl.org/dc/elements/1.1/subject> <http://lexvo.org/id/iso639-3/gsw> ;
+//    <http://purl.org/dc/elements/1.1/language> <http://lexvo.org/id/iso639-3/gsw> ;
+//    <http://www.language-archives.org/OLAC/1.1/depositor> <http://viaf.org/viaf/9122216> ;
+//    <http://purl.org/dc/elements/1.1/publisher> "Atlas linguistiques, cultures et parlers régionaux de France" ;
+//    <http://purl.org/dc/elements/1.1/rights> "Copyright (c) Département de dialectologie alsacienne et mosellane de l'Université de Strasbourg" ;
+//    <http://purl.org/dc/elements/1.1/title> "Atlas Linguistique et ethnographique de l'Alsace: Enquêtes sur la conscience linguistique"@fr ;
+//    <http://purl.org/dc/terms/accessRights> "Freely available for non-commercial use" ;
+//    <http://purl.org/dc/terms/license> <http://creativecommons.org/licenses/by-nc-nd/2.5/> ;
+//    <http://purl.org/dc/terms/isPartOf> <http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-COLLECTION_ALA> ;
+//    <http://purl.org/dc/terms/created> "start=1988; end=1989"^^<http://purl.org/dc/terms/Period> ;
+//    <http://purl.org/dc/terms/spatial> "France, Alsace"@fr , "FR"^^<http://purl.org/dc/terms/ISO3166> ;
+//    <http://purl.org/dc/terms/available> "2014-04-18"^^<http://purl.org/dc/terms/W3CDTF> ;
+//    <http://purl.org/dc/terms/issued> "2015-07-09T09:40:21 02:00"^^<http://purl.org/dc/terms/W3CDTF> ;
+//    <http://www.language-archives.org/OLAC/1.1/transcriber> "Huck, Dominique" ;
+//    <http://www.language-archives.org/OLAC/1.1/researcher> "Bothorel-Witz, Arlette" .
+
+// http://purl.org/dc/elements/1.1/description
+// http://purl.org/dc/elements/1.1/language
+// http://purl.org/dc/elements/1.1/publisher
+// http://purl.org/dc/elements/1.1/rights
+// http://purl.org/dc/elements/1.1/subject
+// http://purl.org/dc/elements/1.1/title
+// http://purl.org/dc/elements/1.1/type
+// http://purl.org/dc/terms/accessRights
+// http://purl.org/dc/terms/available
+// http://purl.org/dc/terms/created
+// http://purl.org/dc/terms/issued
+// http://purl.org/dc/terms/license
+// http://purl.org/dc/terms/spatial
+// http://www.language-archives.org/OLAC/1.1/depositor
+// http://www.language-archives.org/OLAC/1.1/researcher
+// http://www.language-archives.org/OLAC/1.1/transcriber
+// http://purl.org/dc/terms/isPartOf
+// http://www.language-archives.org/OLAC/1.1/compiler
+// http://www.language-archives.org/OLAC/1.1/data_inputter
+// http://www.language-archives.org/OLAC/1.1/developer
+// http://www.language-archives.org/OLAC/1.1/interviewer
+// http://www.language-archives.org/OLAC/1.1/sponsor
+// http://www.w3.org/2003/01/geo/wgs84_pos#lat
+// http://www.w3.org/2003/01/geo/wgs84_pos#long
+
+class CocoonCollectionRdfMapper extends CocoonAbstractRdfMapper {
+
+    protected function getResourceBaseId($res=null) {
+
+        if(is_null($res)) {
+            $res = $this->inputGraph->resource($this->uri);
+        }
+        return $res->getUri();
+    }
+
+    /**
+     * Build the main outputgraph
+     * @return the new empty graph
+     */
+     protected function buildOutputGraph() {
+
+         $outputGraph = new Graph($this->uri);
+         $this->outputGraphes[$this->getResourceBaseId()] = $outputGraph;
+
+         return $outputGraph;
+     }
+
+
+    protected function mapResource($res, $outputGraph) {
+        $resUri = $res->getUri();
+
+        $collNode = $outputGraph->resource($resUri, 'edm:Collection');
+
+        $this->addSimpleProperties($collNode, $res);
+        $this->addDateProperties($collNode, $res, $outputGraph);
+        $this->addSpatialProperties($collNode, $res, $outputGraph);
+
+        $this->mapCollections($res);
+    }
+
+
+    protected function addSimpleProperties($targetRes, $sourceRes) {
+        $this->applyPropertiesToRes($sourceRes, $targetRes, [
+            ['http://purl.org/dc/elements/1.1/description', null],
+            ['http://purl.org/dc/elements/1.1/language', null],
+            ['http://purl.org/dc/elements/1.1/publisher', null],
+            ['http://purl.org/dc/elements/1.1/rights', null],
+            ['http://purl.org/dc/elements/1.1/type', null],
+            ['http://purl.org/dc/terms/license', null],
+            ['http://purl.org/dc/elements/1.1/subject', null],
+            ['http://purl.org/dc/elements/1.1/title', null],
+            ['http://purl.org/dc/elements/1.1/language', null],
+            ['http://purl.org/dc/terms/accessRights', 'propertyTrimMap'],
+            ['http://purl.org/dc/terms/extent', null],
+            ['http://purl.org/dc/terms/isPartOf', null],
+            ['http://www.language-archives.org/OLAC/1.1/annotator', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/author', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/compiler', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/consultant', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/data_inputter', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/depositor', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/developer', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/editor', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/illustrator', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/interpreter', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/interviewer', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/participant', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/performer', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/photographer', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/recorder', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/researcher', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/research_participant', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/responder', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/signer', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/singer', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/speaker', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/sponsor', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/transcriber', 'propertyOlacRoleMap'],
+            ['http://www.language-archives.org/OLAC/1.1/translator', 'propertyOlacRoleMap'],
+        ]);
+    }
+
+
+
+}