コード例 #1
0
 /**
  * Short description of method createOperation
  *
  * @access public
  * @author firstname and lastname of author, <*****@*****.**>
  * @param  Term term1
  * @param  Term term2
  * @param  Resource operator
  * @return core_kernel_rules_Operation
  */
 public static function createOperation(core_kernel_rules_Term $term1, core_kernel_rules_Term $term2, core_kernel_classes_Resource $operator)
 {
     $returnValue = null;
     $operationClass = new core_kernel_classes_Class(CLASS_OPERATION, __METHOD__);
     $label = 'Def Operation Label ' . $term1->getLabel() . ' ' . $operator->getLabel() . ' ' . $term2->getLabel();
     $comment = 'Def Operation Comment ' . $term1->getUri() . ' ' . $operator->getUri() . ' ' . $term2->getUri();
     $operatorProperty = new core_kernel_classes_Property(PROPERTY_OPERATION_OPERATOR, __METHOD__);
     $firstOperand = new core_kernel_classes_Property(PROPERTY_OPERATION_FIRST_OP, __METHOD__);
     $secondOperand = new core_kernel_classes_Property(PROPERTY_OPERATION_SECND_OP, __METHOD__);
     $termOperationInstance = core_kernel_classes_ResourceFactory::create($operationClass, $label, $comment);
     $returnValue = new core_kernel_rules_Operation($termOperationInstance->getUri());
     $returnValue->debug = __METHOD__;
     $returnValue->setPropertyValue($operatorProperty, $operator->getUri());
     $returnValue->setPropertyValue($firstOperand, $term1->getUri());
     $returnValue->setPropertyValue($secondOperand, $term2->getUri());
     return $returnValue;
 }
コード例 #2
0
ファイル: class.TermFactory.php プロジェクト: nagyist/generis
 /**
  * Short description of method createConst
  *
  * @access public
  * @author firstname and lastname of author, <*****@*****.**>
  * @param  string $constant
  * @return core_kernel_rules_Term
  */
 public static function createConst($constant)
 {
     $returnValue = null;
     $termConstClass = new core_kernel_classes_Class(CLASS_TERM_CONST, __METHOD__);
     $termValueProperty = new core_kernel_classes_Property(PROPERTY_TERM_VALUE, __METHOD__);
     $logicalOperatorProperty = new core_kernel_classes_Property(PROPERTY_HASLOGICALOPERATOR, __METHOD__);
     $terminalExpressionProperty = new core_kernel_classes_Property(PROPERTY_TERMINAL_EXPRESSION, __METHOD__);
     $label = 'Def Term Constant Label : ' . $constant;
     $comment = 'Def Term Constant Comment : ' . $constant;
     $constantResource = core_kernel_classes_ResourceFactory::create($termConstClass, $label, $comment);
     $returnValue = new core_kernel_rules_Term($constantResource->getUri());
     $returnValue->setPropertyValue($terminalExpressionProperty, $returnValue->getUri());
     $returnValue->setPropertyValue($logicalOperatorProperty, INSTANCE_EXISTS_OPERATOR_URI);
     $returnValue->setPropertyValue($termValueProperty, $constant);
     $returnValue->debug = __METHOD__;
     return $returnValue;
 }