/** * @note rdfs:subPropertyOf* where * means a property path of arbitrary length * can be found using the "zero or more" will resolve the complete path * * @see http://www.w3.org/TR/sparql11-query/#propertypath-arbitrary-length */ private function tryToAddPropertyPathForSaturatedHierarchy(&$condition, DIProperty $property, &$propertyName) { if (!$this->compoundConditionBuilder->canUseQFeature(SMW_SPARQL_QF_SUBP) || !$property->isUserDefined()) { return null; } if ($this->compoundConditionBuilder->getPropertyHierarchyLookup() == null || !$this->compoundConditionBuilder->getPropertyHierarchyLookup()->hasSubpropertyFor($property)) { return null; } $subPropExpElement = $this->exporter->getSpecialPropertyResource('_SUBP', SMW_NS_PROPERTY); $propertyByVariable = '?' . $this->compoundConditionBuilder->getNextVariable('sp'); $condition->weakConditions[$propertyName] = "\n" . "{$propertyByVariable} " . $subPropExpElement->getQName() . "*" . " {$propertyName} .\n" . ""; $propertyName = $propertyByVariable; }
private function tryToAddClassHierarchyPattern($category, &$categoryExpName) { if (!$this->compoundConditionBuilder->canUseQFeature(SMW_SPARQL_QF_SUBC)) { return ''; } if ($this->compoundConditionBuilder->getPropertyHierarchyLookup() === null || !$this->compoundConditionBuilder->getPropertyHierarchyLookup()->hasSubcategoryFor($category)) { return ''; } $subClassExpElement = $this->exporter->getSpecialPropertyResource('_SUBC'); $classHierarchyByVariable = "?" . $this->compoundConditionBuilder->getNextVariable('sc'); $condition = "{$classHierarchyByVariable} " . $subClassExpElement->getQName() . "*" . " {$categoryExpName} .\n"; $categoryExpName = "{$classHierarchyByVariable}"; return $condition; }
public function testCanUseQFeature() { $instance = new CompoundConditionBuilder(); $this->assertInternalType('boolean', $instance->canUseQFeature('Foo')); }