/** * Short description of method createProperty * * @access public * @author Jerome Bogaerts, <*****@*****.**> * @param Class clazz * @param string label * @param string comment * @param boolean isLgDependent * @param string uri * @return core_kernel_classes_Property */ public static function createProperty(core_kernel_classes_Class $clazz, $label = '', $comment = '', $isLgDependent = false, $uri = '') { $returnValue = null; $property = new core_kernel_classes_Class(RDF_PROPERTY); $propertyInstance = self::createInstance($property, $label, $comment, $uri); $returnValue = new core_kernel_classes_Property($propertyInstance->getUri()); if (!$returnValue->setDomain($clazz)) { throw new common_Exception('An error occured during Property creation.'); } else { $returnValue->setLgDependent($isLgDependent); } return $returnValue; }
/** * Add a process variable in the model * @param string $code * @return boolean */ private function addProcessVariable($code) { $code = preg_replace("/^\\^/", '', $code); if (!$this->processVarExists($code)) { $processVar = $this->processVarClass->createInstance(self::unCamelize($code)); if (!is_null($processVar)) { //set the new instance of process variable as a property of the class process instance: if ($processVar->setType(new core_kernel_classes_Class(RDF_PROPERTY))) { $newProcessInstanceProperty = new core_kernel_classes_Property($processVar->getUri()); $newProcessInstanceProperty->setDomain(new core_kernel_classes_Class(CLASS_TOKEN)); $newProcessInstanceProperty->setRange($this->rdfLiteralClass); } return $processVar->setPropertyValue($this->processVarCodeProp, $code); } } return false; }
/** * Short description of method createProcessVariable * * @access public * @author Somsack Sipasseuth, <*****@*****.**> * @param string label * @param string code * @return core_kernel_classes_Resource */ public function createProcessVariable($label = '', $code = '') { $returnValue = null; if (!empty($code) && $this->getProcessVariable($code)) { throw new Exception("A process variable with the code '{$code}' already exists"); } if (empty($label)) { $label = "Process variable"; if (!empty($code)) { $label .= " " . $code; } } $returnValue = $this->createInstance($this->processVariablesClass, $label); if (!empty($code)) { $returnValue->setPropertyValue($this->codeProperty, $code); } //set the new instance of process variable as a property of the class process instance: $ok = $returnValue->setType(new core_kernel_classes_Class(RDF_PROPERTY)); if ($ok) { $newTokenProperty = new core_kernel_classes_Property($returnValue->getUri()); $newTokenProperty->setDomain(new core_kernel_classes_Class(CLASS_ACTIVITY_EXECUTION)); $newTokenProperty->setRange(new core_kernel_classes_Class(RDFS_LITERAL)); //literal only! $newTokenProperty->setPropertyValue(new core_kernel_classes_Property(PROPERTY_MULTIPLE), GENERIS_TRUE); } else { throw new Exception("the newly created process variable {$label} ({$returnValue->getUri()}) cannot be set as a property of the class Activity Execution"); } return $returnValue; }
/** * (non-PHPdoc) * @see core_kernel_persistence_ClassInterface::createProperty() */ public function createProperty(core_kernel_classes_Class $resource, $label = '', $comment = '', $isLgDependent = false) { $returnValue = null; $property = new core_kernel_classes_Class(RDF_PROPERTY, __METHOD__); $propertyInstance = $property->createInstance($label, $comment); $returnValue = new core_kernel_classes_Property($propertyInstance->getUri(), __METHOD__); $returnValue->setLgDependent($isLgDependent); if (!$returnValue->setDomain($resource)) { throw new common_Exception('problem creating property'); } return $returnValue; }