*/ private function getOneCached($propertyUri) { if (is_null($this->cached)) { $props = [static::PROPERTY_INDEX_IDENTIFIER, static::PROPERTY_INDEX_TOKENIZER, static::PROPERTY_INDEX_FUZZY_MATCHING, static::PROPERTY_DEFAULT_SEARCH]; $this->cached = $this->getPropertiesValues($props); } return empty($this->cached[$propertyUri]) ? null : reset($this->cached[$propertyUri]); } public function getIdentifier() { return (string)$this->getOneCached(static::PROPERTY_INDEX_IDENTIFIER); } /** * @throws \common_exception_Error * @return PropertyValueTokenizer */ public function getTokenizer() { if ($this->getIdentifier() === self::INDEX_CLASS) { return new ResourceClasses(); } $tokenizer = $this->getOneCached(static::PROPERTY_INDEX_TOKENIZER); $implClass = (string)$tokenizer->getUniquePropertyValue($this->getProperty("http://www.tao.lu/Ontologies/TAO.rdf#TokenizerClass")); if (!class_exists($implClass)) { throw new \common_exception_Error('Tokenizer class "' . $implClass . '" not found for ' . $tokenizer->getUri()); } return new $implClass(); } /** * Should the string matching be fuzzy * defaults to false if no information present * * @return boolean */ public function isFuzzyMatching() { $res = $this->getOneCached(static::PROPERTY_INDEX_FUZZY_MATCHING); return !is_null($res) && is_object($res) && $res->getUri() == GenerisRdf::GENERIS_TRUE; } /** * Should the property be used by default if no index key is specified * defaults to false if no information present * * @return boolean */ public function isDefaultSearchable() { $res = $this->getOneCached(static::PROPERTY_DEFAULT_SEARCH); return !is_null($res) && is_object($res) && $res->getUri() == GenerisRdf::GENERIS_TRUE; } /** * Should the value be stored * * @return boolean */ public function isStored() { return $this->getUri() === OntologyRdfs::RDFS_LABEL; } }