getOnePropertyValue($terminalExpressionProperty); $this->assertIsA($terminalExpressionVal, 'core_kernel_classes_Resource'); $this->assertEquals($terminalExpressionVal->getUri(), $constantResource->getUri()); $constantResource->delete(); $terminalExpression->delete(); } /** * */ public function testCreateRecursiveExpression() { $constantResource1 = core_kernel_rules_TermFactory::createConst('test1'); $constantResource2 = core_kernel_rules_TermFactory::createConst('test2'); $terminalExpression1 = core_kernel_rules_ExpressionFactory::createTerminalExpression($constantResource1); $terminalExpression2 = core_kernel_rules_ExpressionFactory::createTerminalExpression($constantResource2); $equalsOperator = new core_kernel_classes_Resource(RulesRdf::INSTANCE_EQUALS_OPERATOR_URI); $finalExpression = core_kernel_rules_ExpressionFactory::createRecursiveExpression($terminalExpression1, $terminalExpression2, $equalsOperator); //prop $terminalExpressionProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_TERMINAL_EXPRESSION, __METHOD__); $logicalOperatorProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_HASLOGICALOPERATOR, __METHOD__); $firstExpressionProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_FIRST_EXPRESSION, __METHOD__); $secondExpressionProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_SECOND_EXPRESSION, __METHOD__); //final expr $finalExpressionVal = $finalExpression->getOnePropertyValue($terminalExpressionProperty); $this->assertIsA($finalExpressionVal, 'core_kernel_classes_Resource'); $this->assertEquals($finalExpressionVal->getUri(), RulesRdf::INSTANCE_EMPTY_TERM_URI); //operator $logicalOperatorVal = $finalExpression->getOnePropertyValue($logicalOperatorProperty); $this->assertIsA($logicalOperatorVal, 'core_kernel_classes_Resource'); $this->assertEquals($logicalOperatorVal->getUri(), RulesRdf::INSTANCE_EQUALS_OPERATOR_URI); //first expr $firstExpressionVal = $finalExpression->getOnePropertyValue($firstExpressionProperty); $this->assertIsA($firstExpressionVal, 'core_kernel_classes_Resource'); $this->assertEquals($firstExpressionVal->getUri(), $terminalExpression1->getUri()); //Second expr $secondExpressionVal = $finalExpression->getOnePropertyValue($secondExpressionProperty); $this->assertIsA($secondExpressionVal, 'core_kernel_classes_Resource'); $this->assertEquals($secondExpressionVal->getUri(), $terminalExpression2->getUri()); $constantResource1->delete(); $constantResource2->delete(); $terminalExpression1->delete(); $terminalExpression2->delete(); $finalExpression->delete(); } }