--- a/server/src/app/Services/GeonamesResolver.php Fri Sep 30 00:43:04 2016 +0200
+++ b/server/src/app/Services/GeonamesResolver.php Sun Oct 02 11:49:00 2016 +0200
@@ -65,7 +65,7 @@
$label = isset($labels['fr']) ? $labels['fr'] : ( isset($labels[''])? $labels['']: null) ;
if(is_null($label)) {
- $labelLit = $graph->getLiteral("<$url>", "<http://www.geonames.org/ontology#name>");
+ $labelLit = $graph->getLiteral("<$url>", "<http://www.geonames.org/ontology#name>");
$label = (!is_null($labelLit)) ? $labelLit->getValue() : null;
}
@@ -86,8 +86,9 @@
*/
public function getLabel($id) {
$geonamesid = $id;
- if(strpos($id, config('corpusparole.geonames_base_url')) === 0) {
- $geonamesid = substr($id, strlen(config('corpusparole.geonames_base_url')));
+ $matches = [];
+ if( preg_match(config('corpusparole.geonames_url_regexp'), $id, $matches) === 1) {
+ $geonamesid = $matches[1];
}
$geonamesid = rtrim($geonamesid, '/');