当前位置: 首页>>代码示例>>PHP>>正文


PHP DIProperty::getLabel方法代码示例

本文整理汇总了PHP中SMW\DIProperty::getLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP DIProperty::getLabel方法的具体用法?PHP DIProperty::getLabel怎么用?PHP DIProperty::getLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SMW\DIProperty的用法示例。


在下文中一共展示了DIProperty::getLabel方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: findBasePropertyToRedirectFor

 private function findBasePropertyToRedirectFor($label)
 {
     $property = new DIProperty(PropertyRegistry::getInstance()->findPropertyIdByLabel($label));
     if ($property->getLabel() !== '' && $label !== $property->getLabel()) {
         $outputPage = $this->getContext()->getOutput();
         $outputPage->redirect($property->getDiWikiPage()->getTitle()->getFullURL());
     }
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:8,代码来源:SMW_OrderedListPage.php

示例2: testCorrectInversePrefixForPredefinedProperty

 public function testCorrectInversePrefixForPredefinedProperty()
 {
     $property = new DIProperty('_SOBJ', true);
     $this->assertTrue($property->isInverse());
     $label = $property->getLabel();
     $this->assertEquals('-', $label[0]);
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:7,代码来源:DIPropertyTest.php

示例3: getQueryString

 public function getQueryString($asValue = false)
 {
     $subDescription = $this->description;
     $propertyChainString = $this->property->getLabel();
     $propertyname = $propertyChainString;
     while ($propertyname !== '' && $subDescription instanceof SomeProperty) {
         // try to use property chain syntax
         $propertyname = $subDescription->getProperty()->getLabel();
         if ($propertyname !== '') {
             $propertyChainString .= '.' . $propertyname;
             $subDescription = $subDescription->getDescription();
         }
     }
     if ($asValue) {
         return '<q>[[' . $propertyChainString . '::' . $subDescription->getQueryString(true) . ']]</q>';
     }
     return '[[' . $propertyChainString . '::' . $subDescription->getQueryString(true) . ']]';
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:18,代码来源:SomeProperty.php

示例4: formatPropertyItem

 /**
  * Produce a formatted string representation for showing a property in
  * the list of unused properties.
  *
  * @since 1.8
  *
  * @param DIProperty $property
  *
  * @return string
  */
 protected function formatPropertyItem(DIProperty $property)
 {
     // Clear formatter before invoking messages and
     // avoid having previous data to be present
     $this->getMessageFormatter()->clear();
     if ($property->isUserDefined()) {
         $title = $property->getDiWikiPage()->getTitle();
         if (!$title instanceof \Title) {
             return '';
         }
         $propertyLink = $this->getLinker()->link($title, $property->getLabel());
         $types = $this->store->getPropertyValues($property->getDiWikiPage(), new DIProperty('_TYPE'));
         if (count($types) >= 1) {
             $typeDataValue = DataValueFactory::getInstance()->newDataItemValue(current($types), new DIProperty('_TYPE'));
         } else {
             $typeDataValue = SMWTypesValue::newFromTypeId('_wpg');
             $this->getMessageFormatter()->addFromKey('smw_propertylackstype', $typeDataValue->getLongHTMLText());
         }
     } else {
         $typeDataValue = SMWTypesValue::newFromTypeId($property->findPropertyTypeID());
         $propertyLink = DataValueFactory::getInstance()->newDataItemValue($property, null)->getShortHtmlText($this->getLinker());
     }
     return $this->msg('smw_unusedproperty_template', $propertyLink, $typeDataValue->getLongHTMLText($this->getLinker()))->text() . ' ' . $this->getMessageFormatter()->getHtml();
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:34,代码来源:UnusedPropertiesQueryPage.php

示例5: descriptionProvider

 public function descriptionProvider()
 {
     $stringBuilder = UtilityFactory::getInstance()->newStringBuilder();
     # 0
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\FalseCondition';
     $description = new SomeProperty(new DIProperty('Foo'), new Disjunction());
     $orderByProperty = null;
     $sortkeys = array();
     $expected = $stringBuilder->addString('<http://www.example.org> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#nothing> .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 1
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $description = new SomeProperty(new DIProperty('Foo'), new ThingDescription());
     $orderByProperty = null;
     $sortkeys = array();
     $expected = $stringBuilder->addString('?result property:Foo ?v1 .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 2 Inverse
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $description = new SomeProperty(new DIProperty('Foo', true), new ThingDescription());
     $orderByProperty = null;
     $sortkeys = array();
     $expected = $stringBuilder->addString('?v1 property:Foo ?result .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 3
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $description = new SomeProperty(new DIProperty('Foo'), new ThingDescription());
     $orderByProperty = new DIProperty('Foo');
     $sortkeys = array();
     $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString('?result property:Foo ?v1 .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 4
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $property = new DIProperty('Foo');
     $property->setPropertyTypeId('_txt');
     $description = new SomeProperty($property, new ValueDescription(new DIBlob('SomePropertyBlobValue')));
     $orderByProperty = null;
     $sortkeys = array();
     $expected = $stringBuilder->addString('?result property:Foo "SomePropertyBlobValue" .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 5
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $property = new DIProperty('Foo');
     $property->setPropertyTypeId('_txt');
     $description = new SomeProperty($property, new ValueDescription(new DIBlob('SomePropertyBlobValue')));
     $orderByProperty = $property;
     $sortkeys = array();
     $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString('?result property:Foo "SomePropertyBlobValue" .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 6
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $property = new DIProperty('Foo');
     $property->setPropertyTypeId('_wpg');
     $propertyValue = new DIWikiPage('SomePropertyPageValue', NS_HELP);
     $propertyValueName = \SMWTurtleSerializer::getTurtleNameForExpElement(\SMWExporter::getInstance()->getResourceElementForWikiPage($propertyValue));
     $description = new SomeProperty($property, new ValueDescription($propertyValue));
     $orderByProperty = $property;
     $sortkeys = array();
     $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString("?result property:Foo {$propertyValueName} .")->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 7
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $property = new DIProperty('Foo');
     $property->setPropertyTypeId('_wpg');
     $description = new SomeProperty($property, new ValueDescription(new DIWikiPage('SomePropertyPageValue', NS_HELP), $property, SMW_CMP_LEQ));
     $orderByProperty = new DIProperty('SomePropertyPageValue');
     $sortkeys = array();
     $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString('?result property:Foo ?v1 .')->addNewLine()->addString('FILTER( ?v1sk <= "SomePropertyPageValue" )')->addNewLine()->addString('?v1 swivt:wikiPageSortKey ?v1sk .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 8
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $property = new DIProperty('Foo');
     $property->setPropertyTypeId('_wpg');
     $description = new SomeProperty($property, new ValueDescription(new DIWikiPage('SomePropertyPageValue', NS_HELP), $property, SMW_CMP_LEQ));
     $description = new SomeProperty(new DIProperty('Bar'), $description);
     $orderByProperty = new DIProperty('Bar');
     $sortkeys = array('Foo' => 'ASC');
     $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString('?result property:Bar ?v1 .')->addNewLine()->addString('{ ?v1 property:Foo ?v2 .')->addNewLine()->addString('FILTER( ?v2sk <= "SomePropertyPageValue" )')->addNewLine()->addString('?v2 swivt:wikiPageSortKey ?v2sk .')->addNewLine()->addString('}')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 9 Inverse -> ?v1 property:Foo ?v2 vs. ?v2 property:Foo ?v1
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $property = new DIProperty('Foo', true);
     $property->setPropertyTypeId('_wpg');
     $description = new SomeProperty($property, new ValueDescription(new DIWikiPage('SomePropertyPageValue', NS_HELP), $property, SMW_CMP_LEQ));
     $description = new SomeProperty(new DIProperty('Bar'), $description);
     $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString('?result property:Bar ?v1 .')->addNewLine()->addString('{ ?v2 property:Foo ?v1 .')->addNewLine()->addString('FILTER( ?v2sk <= "SomePropertyPageValue" )')->addNewLine()->addString('?v2 swivt:wikiPageSortKey ?v2sk .')->addNewLine()->addString('}')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 10
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $property = new DIProperty('_MDAT');
     $description = new SomeProperty($property, new ThingDescription());
     $sortkeys = array('_MDAT' => 'ASC');
     $propertyLabel = str_replace(' ', '_', $property->getLabel());
     $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString("?result property:{$propertyLabel}-23aux ?v1 .")->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 11, issue 556
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $property = new DIProperty('Foo');
     $property->setPropertyTypeId('_txt');
     $description = new SomeProperty($property, new Disjunction(array(new ValueDescription(new DIBlob('Bar')), new ValueDescription(new DIBlob('Baz')))));
//.........这里部分代码省略.........
开发者ID:bogota,项目名称:SemanticMediaWiki,代码行数:101,代码来源:SomePropertyInterpreterTest.php

示例6: parameterDataProvider

 public function parameterDataProvider()
 {
     $provider = array();
     // Anonymous identifier
     // {{#subobject:
     // |Foo=bar
     // }}
     $provider[] = array(array('', 'Foo=bar'), array('hasErrors' => false, 'identifier' => '_', 'propertyCount' => 1, 'propertyLabels' => 'Foo', 'propertyValues' => 'Bar'));
     // Anonymous identifier
     // {{#subobject:-
     // |Foo=1001 9009
     // }}
     $provider[] = array(array('-', 'Foo=1001 9009'), array('hasErrors' => false, 'identifier' => '_', 'propertyCount' => 1, 'propertyLabels' => 'Foo', 'propertyValues' => '1001 9009'));
     // Named identifier
     // {{#subobject:FooBar
     // |FooBar=Bar foo
     // }}
     $provider[] = array(array('FooBar', 'FooBar=Bar foo'), array('hasErrors' => false, 'identifier' => 'FooBar', 'propertyCount' => 1, 'propertyLabels' => 'FooBar', 'propertyValues' => 'Bar foo'));
     // Named identifier
     // {{#subobject:Foo bar
     // |Foo=Help:Bar
     // }}
     $provider[] = array(array('Foo bar', 'Foo=Help:Bar'), array('hasErrors' => false, 'identifier' => 'Foo_bar', 'propertyCount' => 1, 'propertyLabels' => 'Foo', 'propertyValues' => 'Help:Bar'));
     // Named identifier
     // {{#subobject: Foo bar foo
     // |Bar=foo Bar
     // }}
     $provider[] = array(array(' Foo bar foo ', 'Bar=foo Bar'), array('hasErrors' => false, 'identifier' => 'Foo_bar_foo', 'propertyCount' => 1, 'propertyLabels' => 'Bar', 'propertyValues' => 'Foo Bar'));
     // Named identifier
     // {{#subobject: Foo bar foo
     // |状況=超やばい
     // |Bar=http://www.semantic-mediawiki.org/w/index.php?title=Subobject
     // }}
     $provider[] = array(array(' Foo bar foo ', '状況=超やばい', 'Bar=http://www.semantic-mediawiki.org/w/index.php?title=Subobject'), array('hasErrors' => false, 'identifier' => 'Foo_bar_foo', 'propertyCount' => 2, 'propertyLabels' => array('状況', 'Bar'), 'propertyValues' => array('超やばい', 'Http://www.semantic-mediawiki.org/w/index.php?title=Subobject')));
     // Returns an error due to wrong declaration (see Modification date)
     // Get the right language for an error object
     $diPropertyError = new DIProperty(DIProperty::TYPE_ERROR);
     // {{#subobject: Foo bar foo
     // |Bar=foo Bar
     // |Modification date=foo Bar
     // }}
     $provider[] = array(array(' Foo bar foo ', 'Bar=foo Bar', 'Modification date=foo Bar'), array('hasErrors' => true, 'identifier' => 'Foo_bar_foo', 'propertyCount' => 2, 'propertyLabels' => array('Bar', $diPropertyError->getLabel()), 'propertyValues' => array('Foo Bar', 'Modification date')));
     return $provider;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:44,代码来源:SubobjectParserFunctionTest.php

示例7: parameterDataProvider

 public function parameterDataProvider()
 {
     $helpNS = Localizer::getInstance()->getNamespaceTextById(NS_HELP);
     $provider = array();
     #0 Anonymous identifier
     // {{#subobject:
     // |Foo=bar
     // }}
     $provider[] = array(array('', 'Foo=bar'), array('hasErrors' => false, 'identifier' => '_', 'propertyCount' => 1, 'propertyLabels' => 'Foo', 'propertyValues' => 'Bar'));
     #1 Anonymous identifier
     // {{#subobject:-
     // |Foo=1001 9009
     // }}
     $provider[] = array(array('-', 'Foo=1001 9009'), array('hasErrors' => false, 'identifier' => '_', 'propertyCount' => 1, 'propertyLabels' => 'Foo', 'propertyValues' => '1001 9009'));
     #2 Named identifier
     // {{#subobject:FooBar
     // |FooBar=Bar foo
     // }}
     $provider[] = array(array('FooBar', 'FooBar=Bar foo'), array('hasErrors' => false, 'identifier' => 'FooBar', 'propertyCount' => 1, 'propertyLabels' => 'FooBar', 'propertyValues' => 'Bar foo'));
     #3 Named identifier
     // {{#subobject:Foo bar
     // |Foo=Help:Bar
     // }}
     $provider[] = array(array('Foo bar', 'Foo=Help:Bar'), array('hasErrors' => false, 'identifier' => 'Foo_bar', 'propertyCount' => 1, 'propertyLabels' => 'Foo', 'propertyValues' => "{$helpNS}:Bar"));
     #4 Named identifier
     // {{#subobject: Foo bar foo
     // |Bar=foo Bar
     // }}
     $provider[] = array(array(' Foo bar foo ', 'Bar=foo Bar'), array('hasErrors' => false, 'identifier' => 'Foo_bar_foo', 'propertyCount' => 1, 'propertyLabels' => 'Bar', 'propertyValues' => 'Foo Bar'));
     #5 Named identifier
     // {{#subobject: Foo bar foo
     // |状況=超やばい
     // |Bar=http://www.semantic-mediawiki.org/w/index.php?title=Subobject
     // }}
     $provider[] = array(array(' Foo bar foo ', '状況=超やばい', 'Bar=http://www.semantic-mediawiki.org/w/index.php?title=Subobject'), array('hasErrors' => false, 'identifier' => 'Foo_bar_foo', 'propertyCount' => 2, 'propertyLabels' => array('状況', 'Bar'), 'propertyValues' => array('超やばい', 'Http://www.semantic-mediawiki.org/w/index.php?title=Subobject')));
     #6 {{#subobject: Foo bar foo
     // |Bar=foo Bar
     // |Modification date=foo Bar
     // }}
     $provider[] = array(array(' Foo bar foo ', 'Bar=foo Bar', 'Modification date=foo Bar'), array('hasErrors' => true, 'identifier' => 'Foo_bar_foo', 'propertyCount' => 1, 'propertyLabels' => array('Bar'), 'propertyValues' => array('Foo Bar')));
     #7 {{#subobject: Foo bar foo
     // |Bar=foo Bar
     // |-Foo=foo Bar
     // }}
     $provider[] = array(array(' Foo bar foo ', 'Bar=foo Bar', '-Foo=foo Bar'), array('hasErrors' => true, 'identifier' => 'Foo_bar_foo', 'propertyCount' => 1, 'propertyLabels' => array('Bar'), 'propertyValues' => array('Foo Bar')));
     // An empty subobject is not being classified as valid (to create an object)
     #8 {{#subobject: Foo bar foo
     // |Bar=foo Bar
     // |Modification date=1 Jan 1970
     // }}
     $provider[] = array(array(' Foo bar foo ', 'Modification date=1 Jan 1970'), array('hasErrors' => true, 'identifier' => 'Foo_bar_foo', 'propertyCount' => 0));
     // Get the right language for an error object
     $diPropertyError = new DIProperty(DIProperty::TYPE_ERROR);
     #9 {{#subobject: Foo bar foo
     // |Bar=foo Bar
     // |Date=Foo
     // }}
     $provider[] = array(array(' Foo bar foo ', 'Date=Foo'), array('hasErrors' => true, 'identifier' => 'Foo_bar_foo', 'propertyCount' => 1, 'propertyLabels' => array($diPropertyError->getLabel()), 'propertyValues' => array('Date')));
     return $provider;
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:60,代码来源:SubobjectParserFunctionTest.php

示例8: assertContainsPropertyLabels

 private function assertContainsPropertyLabels($labels, DIProperty $property)
 {
     $this->assertContains($property->getLabel(), $labels, __METHOD__ . " asserts property label for '{$property->getKey()}' with ({$this->formatAsString($labels)})");
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:4,代码来源:SemanticDataValidator.php

示例9: transformPropertyLabelToAuxiliary

 private function transformPropertyLabelToAuxiliary(DIProperty $property)
 {
     return str_replace(' ', '_', $property->getLabel());
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:4,代码来源:ExportSemanticDataTest.php

示例10: descriptionProvider

 public function descriptionProvider()
 {
     $stringBuilder = UtilityFactory::getInstance()->newStringBuilder();
     # 0
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\FalseCondition';
     $description = new SomeProperty(new DIProperty('Foo'), new Disjunction());
     $orderByProperty = null;
     $sortkeys = array();
     $expected = $stringBuilder->addString('<http://www.example.org> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#nothing> .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 1
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $description = new SomeProperty(new DIProperty('Foo'), new ThingDescription());
     $orderByProperty = null;
     $sortkeys = array();
     $expected = $stringBuilder->addString('?result property:Foo ?v1 .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 2 Inverse
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $description = new SomeProperty(new DIProperty('Foo', true), new ThingDescription());
     $orderByProperty = null;
     $sortkeys = array();
     $expected = $stringBuilder->addString('?v1 property:Foo ?result .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 3
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $description = new SomeProperty(new DIProperty('Foo'), new ThingDescription());
     $orderByProperty = new DIProperty('Foo');
     $sortkeys = array();
     $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString('?result property:Foo ?v1 .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 4
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $property = new DIProperty('Foo');
     $property->setPropertyTypeId('_txt');
     $description = new SomeProperty($property, new ValueDescription(new DIBlob('SomePropertyBlobValue')));
     $orderByProperty = null;
     $sortkeys = array();
     $expected = $stringBuilder->addString('?result property:Foo "SomePropertyBlobValue" .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 5
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $property = new DIProperty('Foo');
     $property->setPropertyTypeId('_txt');
     $description = new SomeProperty($property, new ValueDescription(new DIBlob('SomePropertyBlobValue')));
     $orderByProperty = $property;
     $sortkeys = array();
     $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString('?result property:Foo "SomePropertyBlobValue" .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 6
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $property = new DIProperty('Foo');
     $property->setPropertyTypeId('_wpg');
     $description = new SomeProperty($property, new ValueDescription(new DIWikiPage('SomePropertyPageValue', NS_HELP)));
     $orderByProperty = $property;
     $sortkeys = array();
     $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString('?result property:Foo wiki:Help-3ASomePropertyPageValue .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 7
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $property = new DIProperty('Foo');
     $property->setPropertyTypeId('_wpg');
     $description = new SomeProperty($property, new ValueDescription(new DIWikiPage('SomePropertyPageValue', NS_HELP), $property, SMW_CMP_LEQ));
     $orderByProperty = new DIProperty('SomePropertyPageValue');
     $sortkeys = array();
     $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString('?result property:Foo ?v1 .')->addNewLine()->addString('FILTER( ?v1sk <= "SomePropertyPageValue" )')->addNewLine()->addString('?v1 swivt:wikiPageSortKey ?v1sk .')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 8
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $property = new DIProperty('Foo');
     $property->setPropertyTypeId('_wpg');
     $description = new SomeProperty($property, new ValueDescription(new DIWikiPage('SomePropertyPageValue', NS_HELP), $property, SMW_CMP_LEQ));
     $description = new SomeProperty(new DIProperty('Bar'), $description);
     $orderByProperty = new DIProperty('Bar');
     $sortkeys = array('Foo' => 'ASC');
     $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString('?result property:Bar ?v1 .')->addNewLine()->addString('{ ?v1 property:Foo ?v2 .')->addNewLine()->addString('FILTER( ?v2sk <= "SomePropertyPageValue" )')->addNewLine()->addString('?v2 swivt:wikiPageSortKey ?v2sk .')->addNewLine()->addString('}')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 9 Inverse -> ?v1 property:Foo ?v2 vs. ?v2 property:Foo ?v1
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $property = new DIProperty('Foo', true);
     $property->setPropertyTypeId('_wpg');
     $description = new SomeProperty($property, new ValueDescription(new DIWikiPage('SomePropertyPageValue', NS_HELP), $property, SMW_CMP_LEQ));
     $description = new SomeProperty(new DIProperty('Bar'), $description);
     $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString('?result property:Bar ?v1 .')->addNewLine()->addString('{ ?v2 property:Foo ?v1 .')->addNewLine()->addString('FILTER( ?v2sk <= "SomePropertyPageValue" )')->addNewLine()->addString('?v2 swivt:wikiPageSortKey ?v2sk .')->addNewLine()->addString('}')->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     # 10
     $conditionType = '\\SMW\\SPARQLStore\\QueryEngine\\Condition\\WhereCondition';
     $property = new DIProperty('_MDAT');
     $description = new SomeProperty($property, new ThingDescription());
     $sortkeys = array('_MDAT' => 'ASC');
     $propertyLabel = str_replace(' ', '_', $property->getLabel());
     $expected = $stringBuilder->addString('?result swivt:wikiPageSortKey ?resultsk .')->addNewLine()->addString("?result property:{$propertyLabel}-23aux ?v1 .")->addNewLine()->getString();
     $provider[] = array($description, $orderByProperty, $sortkeys, $conditionType, $expected);
     return $provider;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:95,代码来源:PropertyConditionBuilderTest.php

示例11: unserializeDataItem

 /**
  * @return DataItem
  */
 protected function unserializeDataItem($property, $data, $value, $semanticData)
 {
     $dataItem = null;
     $type = $this->getDataItemId($property);
     // Verify that the current property type definition and the type of the
     // property during serialization do match, throw an error value to avoid any
     // exception during unserialization caused by the DataItem object due to a
     // mismatch of type definitions
     if ($type === $value['type']) {
         $dataItem = DataItem::newFromSerialization($value['type'], $value['item']);
     } else {
         $dataItem = $property->getDiWikiPage();
         $property = new DIProperty(DIProperty::TYPE_ERROR);
         $semanticData->addError(array(new ErrorValue($type, 'type mismatch', $property->getLabel())));
     }
     // Check whether the current dataItem has a subobject reference
     if ($dataItem->getDIType() === DataItem::TYPE_WIKIPAGE && $dataItem->getSubobjectName() !== '') {
         $dataItem = $this->unserializeSubobject($data, $value['item'], new SMWContainerSemanticData($dataItem));
     }
     // Ensure that errors are collected from a subobject level as well and
     // made available at the top
     if ($dataItem instanceof DIContainer) {
         $semanticData->addError($dataItem->getSemanticData()->getErrors());
     }
     if ($property !== null && $dataItem !== null) {
         $semanticData->addPropertyObjectValue($property, $dataItem);
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:31,代码来源:SemanticDataDeserializer.php

示例12: getUserDefinedPropertyInfo

 /**
  * Returns information related to user-defined properties
  *
  * @since 1.9
  *
  * @param Title $title
  * @param DIProperty $property
  * @param integer $useCount
  *
  * @return array
  */
 private function getUserDefinedPropertyInfo($title, $property, $useCount)
 {
     if ($useCount <= $this->settings->get('smwgPropertyLowUsageThreshold')) {
         $this->getMessageFormatter()->addFromKey('smw_propertyhardlyused');
     }
     // User defined types default to Page
     $typestring = SMWTypesValue::newFromTypeId($this->settings->get('smwgPDefaultType'))->getLongHTMLText($this->getLinker());
     $label = htmlspecialchars($property->getLabel());
     if ($title->exists()) {
         $typeProperty = new DIProperty('_TYPE');
         $types = $this->store->getPropertyValues($property->getDiWikiPage(), $typeProperty);
         if (count($types) >= 1) {
             $typeDataValue = DataValueFactory::getInstance()->newDataItemValue(current($types), $typeProperty);
             $typestring = $typeDataValue->getLongHTMLText($this->getLinker());
         } else {
             $this->getMessageFormatter()->addFromKey('smw_propertylackstype', $typestring);
         }
         $proplink = $this->getLinker()->link($title, $label);
     } else {
         $this->getMessageFormatter()->addFromKey('smw_propertylackspage');
         $proplink = $this->getLinker()->link($title, $label, array(), array('action' => 'view'));
     }
     return array($typestring, $proplink);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:35,代码来源:PropertiesQueryPage.php

示例13: getDataProvider

 /**
  * @return array
  */
 public function getDataProvider()
 {
     $provider = array();
     // #0 / asserting conditions for a named identifier
     $provider[] = array(array('identifier' => 'Bar', 'properties' => array('Foo' => 'bar')), array('errors' => 0, 'identifier' => 'Bar', 'propertyCount' => 1, 'propertyLabels' => 'Foo', 'propertyValues' => 'Bar'));
     // #1 / asserting conditions for an anon identifier
     $provider[] = array(array('identifier' => '', 'properties' => array('FooBar' => 'bar Foo')), array('errors' => 0, 'identifier' => '_', 'propertyCount' => 1, 'propertyLabels' => 'FooBar', 'propertyValues' => 'Bar Foo'));
     // #2 / asserting conditions
     $provider[] = array(array('identifier' => 'foo', 'properties' => array(9001 => 1001)), array('errors' => 0, 'identifier' => 'foo', 'propertyCount' => 1, 'propertyLabels' => array(9001), 'propertyValues' => array(1001)));
     // #3
     $provider[] = array(array('identifier' => 'foo bar', 'properties' => array(1001 => 9001, 'Foo' => 'Bar')), array('errors' => 0, 'identifier' => 'foo bar', 'propertyCount' => 2, 'propertyLabels' => array(1001, 'Foo'), 'propertyValues' => array(9001, 'Bar')));
     // #4 / asserting that a property with a leading underscore would produce an error
     $provider[] = array(array('identifier' => 'bar', 'properties' => array('_FooBar' => 'bar Foo')), array('errors' => 1, 'identifier' => 'bar', 'propertyCount' => 0, 'propertyLabels' => '', 'propertyValues' => ''));
     // #5 / asserting that an inverse property would produce an error
     $provider[] = array(array('identifier' => 'bar', 'properties' => array('-FooBar' => 'bar Foo')), array('errors' => 1, 'identifier' => 'bar', 'propertyCount' => 0, 'propertyLabels' => '', 'propertyValues' => ''));
     // #6 / asserting that an improper value for a _wpg property would add "Has improper value for"
     $diPropertyError = new DIProperty(DIProperty::TYPE_ERROR);
     $provider[] = array(array('identifier' => 'bar', 'properties' => array('Foo' => '')), array('identifier' => 'bar', 'errors' => 1, 'propertyCount' => 1, 'propertyLabels' => array($diPropertyError->getLabel()), 'propertyValues' => 'Foo'));
     return $provider;
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:23,代码来源:SubobjectTest.php


注:本文中的SMW\DIProperty::getLabel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。