84 |
84 |
85 if(is_null($docType) || !array_key_exists($docType,ImportCocoonRDF::MAPPER_CLASS_MAP)) { |
85 if(is_null($docType) || !array_key_exists($docType,ImportCocoonRDF::MAPPER_CLASS_MAP)) { |
86 $this->error("\nError processing $identifier ($docRdfUrl) : $docType unknown mapper"); |
86 $this->error("\nError processing $identifier ($docRdfUrl) : $docType unknown mapper"); |
87 Log::error("Error processing $identifier ($docRdfUrl) : $docType unknown mapper"); |
87 Log::error("Error processing $identifier ($docRdfUrl) : $docType unknown mapper"); |
88 $this->documentCount['unknown'] += 1; |
88 $this->documentCount['unknown'] += 1; |
89 continue; |
89 return ['unknown', null]; |
90 } |
90 } |
91 |
91 |
92 $mapperClass = ImportCocoonRDF::MAPPER_CLASS_MAP[$docType]; |
92 $mapperClass = ImportCocoonRDF::MAPPER_CLASS_MAP[$docType]; |
93 $mapper = new $mapperClass($doc, $docUri); |
93 $mapper = new $mapperClass($doc, $docUri); |
94 |
94 |
95 try { |
95 try { |
96 $mapper->mapGraph(); |
96 $mapper->mapGraph(); |
97 } catch (\Exception $e) { |
97 } catch (\Exception $e) { |
98 Log::error("Error processing $identifier ($docRdfUrl) : error mapping graph : $e"); |
98 Log::error("Error processing $identifier ($docRdfUrl) : error mapping graph : $e"); |
99 $this->documentCount['error'] += 1; |
99 $this->documentCount['error'] += 1; |
|
100 return ['error', null]; |
100 } |
101 } |
101 $this->documentCount['all'] += 1; |
102 $this->documentCount['all'] += 1; |
102 $this->documentCount[$docType] = isset($this->documentCount[$docType])?$this->documentCount[$docType]+1:1; |
103 $this->documentCount[$docType] = isset($this->documentCount[$docType])?$this->documentCount[$docType]+1:1; |
103 |
104 |
104 return [$docType, $mapper->getOutputGraphes()]; |
105 return [$docType, $mapper->getOutputGraphes()]; |
331 $doc = $this->gs_raw->query("CONSTRUCT { ?s ?p ?o } WHERE { GRAPH <$docUri> { ?s ?p ?o. }}"); |
332 $doc = $this->gs_raw->query("CONSTRUCT { ?s ?p ?o } WHERE { GRAPH <$docUri> { ?s ?p ?o. }}"); |
332 |
333 |
333 //map the doc |
334 //map the doc |
334 list($docType, $mappedGraphes) = $this->mapDoc($doc, $docUri); |
335 list($docType, $mappedGraphes) = $this->mapDoc($doc, $docUri); |
335 |
336 |
|
337 if($docType === 'unknown' || $docType === 'error') { |
|
338 // The error has been traced in mapDoc |
|
339 continue; |
|
340 } |
|
341 |
336 //merge the result docs |
342 //merge the result docs |
337 $this->mergeDocs($docType, $mappedGraphes); |
343 $this->mergeDocs($docType, $mappedGraphes); |
338 |
344 |
339 } |
345 } |
340 |
346 |