public function save() { $this->ensureDocumentLoaded(); foreach ($this->new_candidates as $raw_value => $field) { $term = Term::parse($raw_value); $norm_value = StringUtils::asciiLowerFold($term->getValue()); $norm_context = StringUtils::asciiLowerFold($term->getContext()); $element = $this->createElement($raw_value, $norm_value, $norm_context); $container = $this->findOrCreateFieldNode($field); $this->insertElement($container, $element); } $this->databox->saveCterms($this->document); }
public static function normalizeName($key) { return StringUtils::slugify($key, '_'); }
public static function conceptPathSegment(DOMElement $element) { // Path segment is named according to the first english term, and // default to the first term. $terms = self::filter($element->childNodes, array(Navigator::class, 'isTerm')); $term = self::find($terms, array('self', 'isPathLang')); if (!$term) { if (isset($terms[0])) { $term = $terms[0]; } else { throw new ThesaurusException(sprintf('No term linked to concept at path "%s".', $element->getNodePath())); } } return StringUtils::slugify($term->getAttribute(self::TERM_VALUE_ATTR)); }