21 } |
21 } |
22 return $lexvoid; |
22 return $lexvoid; |
23 } |
23 } |
24 |
24 |
25 /** |
25 /** |
26 * Get name from Viaf id |
26 * Get name from Lexvo id |
27 * @param string $id The id to resolve. Can be an url starting with http://viaf.org/viaf/ |
27 * @param string $id The id to resolve. Can be an url starting with http://lexvo.org/ |
28 * @return a string with the name |
28 * @return a string with the name |
29 */ |
29 */ |
30 public function getName($id) { |
30 public function getName($id) { |
31 $res = $this->getNames([$id,]); |
31 $res = $this->getNames([$id,]); |
32 assert(array_key_exists($id,$res), "the result must contains $id"); |
32 assert(array_key_exists($id,$res), "the result must contains $id"); |
33 return $res[$id]; |
33 return $res[$id]; |
34 } |
34 } |
35 |
35 |
36 /** |
36 /** |
37 * Get a list of names from an array of viaf ids. |
37 * Get a list of names from an array of Lexvo ids. |
38 * @param array $ids The array of ids to resolve. |
38 * @param array $ids The array of ids to resolve. |
39 * Each id can be an url starting with http://viaf.org/viaf/ |
39 * Each id can be an url starting with http://lexvo.org/ |
40 * @return array key is id, value is the name |
40 * @return array key is id, value is the name |
41 */ |
41 */ |
42 public function getNames(array $ids) { |
42 public function getNames(array $ids) { |
43 |
43 |
44 if(count($ids) > config('corpusparole.lexvo_max_ids')) { |
44 if(count($ids) > config('corpusparole.lexvo_max_ids')) { |