getModel()->getRdfsInterface()->getPropertyImplementation(); } /** * constructor * * @access public * @author Cédric Alfonsi, * @param string uri * @param string debug * @return void */ public function __construct($uri, $debug = '') { parent::__construct($uri, $debug); $this->lgDependent = null; $this->multiple = null; } /** * * @author Cédric Alfonsi, */ public function feed() { $this->getWidget(); $this->getRange(); $this->getDomain(); $this->isLgDependent(); } /** * return classes that are described by this property * * @access public * @author Cédric Alfonsi, * @return core_kernel_classes_ContainerCollection */ public function getDomain() { $returnValue = null; if (is_null($this->domain)) { $this->domain = new core_kernel_classes_ContainerCollection(new common_Object(__METHOD__)); $domainValues = $this->getPropertyValues($this->getProperty(OntologyRdfs::RDFS_DOMAIN)); foreach ($domainValues as $domainValue) { $this->domain->add($this->getClass($domainValue)); } } $returnValue = $this->domain; return $returnValue; } /** * Short description of method setDomain * * @access public * @author Cédric Alfonsi, * @param Class class * @return boolean */ public function setDomain(core_kernel_classes_Class $class) { $returnValue = (bool) false; if (!is_null($class)) { foreach ($this->getDomain()->getIterator() as $domainClass) { if ($class->equals($domainClass)) { $returnValue = true; break; } } if (!$returnValue) { $this->setPropertyValue($this->getProperty(OntologyRdfs::RDFS_DOMAIN), $class->getUri()); if (!is_null($this->domain)) { $this->domain->add($class); } $returnValue = true; } } return (bool) $returnValue; } /** * Short description of method getRange * * @access public * @author Cédric Alfonsi, * @return core_kernel_classes_ContainerCollection */ public function getRange() { $returnValue = null; if (is_null($this->range)) { $rangeProperty = $this->getProperty(OntologyRdfs::RDFS_RANGE); $rangeValues = $this->getPropertyValues($rangeProperty); if (sizeOf($rangeValues) > 0) { $returnValue = $this->getClass($rangeValues[0]); } $this->range = $returnValue; } $returnValue = $this->range; return $returnValue; } /** * Short description of method setRange * * @access public * @author Cédric Alfonsi, * @param Class class * @return boolean */ public function setRange(core_kernel_classes_Class $class) { $returnValue = (bool) false; $returnValue = $this->getImplementation()->setRange($this, $class); if ($returnValue) { $this->range = $class; } return (bool) $returnValue; } public function getDependsOnPropertyCollection(): DependsOnPropertyCollection { if (!isset($this->dependsOnPropertyCollection)) { $dependsOnProperty = $this->getProperty(GenerisRdf::PROPERTY_DEPENDS_ON_PROPERTY); $dependsOnPropertyValues = $this->getPropertyValues($dependsOnProperty); $this->dependsOnPropertyCollection = new DependsOnPropertyCollection(); foreach ($dependsOnPropertyValues as $dependsOnPropertyValue) { if ($dependsOnPropertyValue !== GenerisRdf::PROPERTY_DEPENDS_ON_PROPERTY) { $this->dependsOnPropertyCollection->append( $this->getProperty($dependsOnPropertyValue) ); } } } $this->dependsOnPropertyCollection->rewind(); return $this->dependsOnPropertyCollection; } /** * @TODO Improve setter */ public function setDependsOnPropertyCollection(DependsOnPropertyCollection $dependsOnPropertyCollection): void { foreach ($dependsOnPropertyCollection as $dependsOnProperty) { $this->getImplementation()->setDependsOnProperty($this, $dependsOnProperty); } $this->dependsOnPropertyCollection = $dependsOnPropertyCollection; } /** * Get the Property object corresponding to the widget of this Property. * * @author Cédric Alfonsi * @author Antoine Delamarre * @author Jérôme Bogaerts * @return core_kernel_classes_Property The Property object corresponding to the widget of this Property. */ public function getWidget() { if ($this->widget === false) { $this->widget = $this->getOnePropertyValue($this->getProperty(WidgetRdf::PROPERTY_WIDGET)); } return $this->widget; } /** * Is the property translatable? * * @access public * @author Cédric Alfonsi, * @return boolean */ public function isLgDependent() { if (is_null($this->lgDependent)) { $this->lgDependent = $this->getImplementation()->isLgDependent($this); } return (bool) $this->lgDependent; } /** * Set mannually if a property can be translated * * @access public * @author Cédric Alfonsi, * @param boolean isLgDependent * @return mixed */ public function setLgDependent($isLgDependent) { $this->getImplementation()->setLgDependent($this, $isLgDependent); $this->lgDependent = $isLgDependent; } /** * Check if a property can have multiple values. * * @access public * @author Cédric Alfonsi, * @return boolean */ public function isMultiple() { $returnValue = (bool) false; if (is_null($this->multiple)) { $multipleProperty = $this->getProperty(GenerisRdf::PROPERTY_MULTIPLE); $multiple = $this->getOnePropertyValue($multipleProperty); if (is_null($multiple)) { $returnValue = false; } else { $returnValue = ($multiple->getUri() == GenerisRdf::GENERIS_TRUE); } $this->multiple = $returnValue; } $returnValue = $this->multiple; return (bool) $returnValue; } /** * Define mannualy if a property is multiple or not. * Usefull on just created property. * * @access public * @author Cédric Alfonsi, * @param boolean isMultiple * @return mixed */ public function setMultiple($isMultiple) { $this->getImplementation()->setMultiple($this, $isMultiple); $this->multiple = $isMultiple; } /** * Short description of method delete * * @access public * @author Cédric Alfonsi, * @param boolean deleteReference * @return boolean */ public function delete($deleteReference = false) { $returnValue = (bool) false; $returnValue = $this->getImplementation()->delete($this, $deleteReference); return (bool) $returnValue; } }