• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP SMWPropertyValue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中SMWPropertyValue的典型用法代码示例。如果您正苦于以下问题:PHP SMWPropertyValue类的具体用法?PHP SMWPropertyValue怎么用?PHP SMWPropertyValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: makeProperty

 /**
  * Static function for creating a new property object from a property
  * identifier (string) as it might be used internally. This might be
  * the DB key version of some property title text or the id of a
  * predefined property (such as '_TYPE').
  * @note This function strictly requires an internal identifier, i.e.
  * predefined properties must be referred to by their ID, and '-' is
  * not supported for indicating inverses.
  * @note The resulting property object might be invalid if
  * the provided name is not allowed. An object is returned
  * in any case.
  */
 public static function makeProperty($propertyid)
 {
     $diProperty = new SMWDIProperty($propertyid);
     $dvProperty = new SMWPropertyValue('__pro');
     $dvProperty->setDataItem($diProperty);
     return $dvProperty;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:19,代码来源:SMW_DV_Property.php


示例2: setTypeAndPossibleValues

 function setTypeAndPossibleValues()
 {
     $proptitle = Title::makeTitleSafe(SMW_NS_PROPERTY, $this->mSemanticProperty);
     if ($proptitle === null) {
         return;
     }
     $store = smwfGetStore();
     // this returns an array of objects
     $allowed_values = SFUtils::getSMWPropertyValues($store, $proptitle, "Allows value");
     $label_formats = SFUtils::getSMWPropertyValues($store, $proptitle, "Has field label format");
     if (class_exists('SMWDIProperty')) {
         // SMW 1.6+
         $propValue = SMWDIProperty::newFromUserLabel($this->mSemanticProperty);
         $this->mPropertyType = $propValue->findPropertyTypeID();
     } else {
         $propValue = SMWPropertyValue::makeUserProperty($this->mSemanticProperty);
         $this->mPropertyType = $propValue->getPropertyTypeID();
     }
     foreach ($allowed_values as $allowed_value) {
         // HTML-unencode each value
         $this->mPossibleValues[] = html_entity_decode($allowed_value);
         if (count($label_formats) > 0) {
             $label_format = $label_formats[0];
             $prop_instance = SMWDataValueFactory::findTypeID($this->mPropertyType);
             $label_value = SMWDataValueFactory::newTypeIDValue($prop_instance, $wiki_value);
             $label_value->setOutputFormat($label_format);
             $this->mValueLabels[$wiki_value] = html_entity_decode($label_value->getWikiValue());
         }
     }
     // HACK - if there were any possible values, set the property
     // type to be 'enumeration', regardless of what the actual type is
     if (count($this->mPossibleValues) > 0) {
         $this->mPropertyType = 'enumeration';
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:35,代码来源:SF_TemplateField.php


示例3: printoutFromString

	public static function printoutFromString( $printout ) {
		return new SMWPrintRequest(
			SMWPrintRequest::PRINT_PROP,
			$printout,
			SMWPropertyValue::makeUserProperty( $printout )
		);
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:7,代码来源:ApiAskArgs.php


示例4: addPropertyValueToSemanticData

 protected static function addPropertyValueToSemanticData($propertyName, $valueString, $semanticData)
 {
     $propertyDv = SMWPropertyValue::makeUserProperty($propertyName);
     $propertyDi = $propertyDv->getDataItem();
     self::addPropertyDiValueToSemanticData($propertyDi, $valueString, $semanticData);
     return $propertyDi;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:SMW_Subobject.php


示例5: processParameters

 /**
  * Read and interpret the given parameters.
  *
  * @since 1.8
  * @param string $query from the web request as given by MW
  */
 protected function processParameters($query)
 {
     global $wgRequest;
     // get the GET parameters
     $params = SMWInfolink::decodeParameters($query, false);
     reset($params);
     $inputPropertyString = $wgRequest->getText('property', current($params));
     $inputValueString = $wgRequest->getText('value', next($params));
     $inputValueString = str_replace(' ', ' ', $inputValueString);
     $inputValueString = str_replace(' ', ' ', $inputValueString);
     $this->property = SMWPropertyValue::makeUserProperty($inputPropertyString);
     if (!$this->property->isValid()) {
         $this->propertystring = $inputPropertyString;
         $this->value = null;
         $this->valuestring = $inputValueString;
     } else {
         $this->propertystring = $this->property->getWikiValue();
         $this->value = SMWDataValueFactory::newPropertyObjectValue($this->property->getDataItem(), $inputValueString);
         $this->valuestring = $this->value->isValid() ? $this->value->getWikiValue() : $inputValueString;
     }
     $limitString = $wgRequest->getVal('limit');
     if (is_numeric($limitString)) {
         $this->limit = intval($limitString);
     } else {
         $this->limit = 20;
     }
     $offsetString = $wgRequest->getVal('offset');
     if (is_numeric($offsetString)) {
         $this->offset = intval($offsetString);
     } else {
         $this->offset = 0;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:39,代码来源:SMW_SpecialSearchByProperty.php


示例6: testCheckIfPropertyRenamed

 function testCheckIfPropertyRenamed()
 {
     // do some checks
     $page = Title::newFromText("5 cylinder", NS_MAIN);
     $prop = SMWPropertyValue::makeUserProperty("Torsional moment");
     $values = smwfGetStore()->getPropertyValues($page, $prop);
     $this->assertTrue(count($values) > 0);
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:8,代码来源:TestWikiJobResults.php


示例7: registerSpecialProperties

 /**
  * Registers all special properties of this extension in Semantic Media Wiki.
  *
  * The language files of the ExtTab extension contain a mapping from special
  * property constants to their string representation. These mappings are
  * added to the mapping defined by Semantic Media Wiki.
  */
 function registerSpecialProperties()
 {
     global $smwgContLang;
     foreach ($this->smwSpecialProperties as $key => $prop) {
         list($typeid, $label) = $prop;
         SMWPropertyValue::registerProperty($key, $typeid, $label, true);
     }
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:15,代码来源:ET_Language.php


示例8: setXMLAttribute

	public function setXMLAttribute( $key, $value ) {
		if ( $value == '' ) throw new MWException( __METHOD__ . ": value cannot be empty" );

		if ( $key == 'name' ) {
			$property = SMWPropertyValue::makeUserProperty( $value );
		} else {
			throw new MWException( __METHOD__ . ": invalid key/value pair: name=property_name" );
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:9,代码来源:WOM_OM_NestProperty.php


示例9: render

 /**
  * Method for handling the declare parser function.
  * 
  * @since 1.5.3
  * 
  * @param Parser $parser
  * @param PPFrame $frame
  * @param array $args
  */
 public static function render(Parser &$parser, PPFrame $frame, array $args)
 {
     if ($frame->isTemplate()) {
         foreach ($args as $arg) {
             if (trim($arg) !== '') {
                 $expanded = trim($frame->expand($arg));
                 $parts = explode('=', $expanded, 2);
                 if (count($parts) == 1) {
                     $propertystring = $expanded;
                     $argumentname = $expanded;
                 } else {
                     $propertystring = $parts[0];
                     $argumentname = $parts[1];
                 }
                 $property = SMWPropertyValue::makeUserProperty($propertystring);
                 $argument = $frame->getArgument($argumentname);
                 $valuestring = $frame->expand($argument);
                 if ($property->isValid()) {
                     $type = $property->getPropertyTypeID();
                     if ($type == '_wpg') {
                         $matches = array();
                         preg_match_all('/\\[\\[([^\\[\\]]*)\\]\\]/u', $valuestring, $matches);
                         $objects = $matches[1];
                         if (count($objects) == 0) {
                             if (trim($valuestring) !== '') {
                                 SMWParseData::addProperty($propertystring, $valuestring, false, $parser, true);
                             }
                         } else {
                             foreach ($objects as $object) {
                                 SMWParseData::addProperty($propertystring, $object, false, $parser, true);
                             }
                         }
                     } elseif (trim($valuestring) !== '') {
                         SMWParseData::addProperty($propertystring, $valuestring, false, $parser, true);
                     }
                     // $value = SMWDataValueFactory::newPropertyObjectValue( $property->getDataItem(), $valuestring );
                     // if (!$value->isValid()) continue;
                 }
             }
         }
     } else {
         // @todo Save as metadata
     }
     global $wgTitle;
     if (!is_null($wgTitle) && $wgTitle->isSpecialPage()) {
         global $wgOut;
         SMWOutputs::commitToOutputPage($wgOut);
     } else {
         SMWOutputs::commitToParser($parser);
     }
     return '';
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:61,代码来源:SMW_Declare.php


示例10: addPropertyAndValue

	public function addPropertyAndValue( $propName, $value ) {
		// SMW 1.6+
		if ( class_exists( 'SMWDIProperty' ) ) {
			$property = SMWDIProperty::newFromUserLabel( $propName );
		} else {
			$property = SMWPropertyValue::makeUserProperty( $propName );
		}
		$dataValue = SMWDataValueFactory::newPropertyObjectValue( $property, $value );

		if ( $dataValue->isValid() ) {
			$this->mPropertyValuePairs[] = array( $property, $dataValue );
		} // else - show an error message?
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:13,代码来源:SemanticInternalObjects_body.php


示例11: getSMWPropertyValues

	/**
	 * Helper function to handle getPropertyValues() in both SMW 1.6
	 * and earlier versions.
	 * 
	 * @param SMWStore $store
	 * @param string $pageName
	 * @param integer $pageNamespace
	 * @param string $propID
	 * @param null|SMWRequestOptions $requestOptions
	 * 
	 * @return array of SMWDataItem
	 */
	public static function getSMWPropertyValues( SMWStore $store, $pageName, $pageNamespace, $propID, $requestOptions = null ) {
		// SMWDIProperty was added in SMW 1.6
		if ( class_exists( 'SMWDIProperty' ) ) {
			$pageName = str_replace( ' ', '_', $pageName );
			$page = new SMWDIWikiPage( $pageName, $pageNamespace, null );
			$property = new SMWDIProperty( $propID );
			return $store->getPropertyValues( $page, $property, $requestOptions );
		} else {
			$title = Title::makeTitleSafe( $pageNamespace, $pageName );
			$property = SMWPropertyValue::makeProperty( $propID );
			return $store->getPropertyValues( $title, $property, $requestOptions );
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:25,代码来源:SD_Utils.php


示例12: SMWSemanticStore

 /**
  * Must be called from derived class to initialize the member variables.
  */
 protected function SMWSemanticStore(Title $domainRangeHintRelation, Title $minCard, Title $maxCard, Title $transitiveCat, Title $symetricalCat, Title $inverseOf)
 {
     $this->domainRangeHintRelation = $domainRangeHintRelation;
     $this->maxCard = $maxCard;
     $this->minCard = $minCard;
     $this->transitiveCat = $transitiveCat;
     $this->symetricalCat = $symetricalCat;
     $this->inverseOf = $inverseOf;
     $this->domainRangeHintProp = SMWPropertyValue::makeUserProperty($this->domainRangeHintRelation->getDBkey());
     $this->minCardProp = SMWPropertyValue::makeUserProperty($this->minCard->getDBkey());
     $this->maxCardProp = SMWPropertyValue::makeUserProperty($this->maxCard->getDBkey());
     $this->inverseOfProp = SMWPropertyValue::makeUserProperty($this->inverseOf->getDBkey());
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:16,代码来源:SMW_SemanticStore.php


示例13: refreshConceptCache

 /**
  * Refresh the concept cache for the given concept.
  *
  * @param $concept Title
  */
 public function refreshConceptCache($concept)
 {
     global $smwgQMaxLimit, $smwgQConceptFeatures, $wgDBtype;
     $cid = $this->m_store->getSMWPageID($concept->getDBkey(), SMW_NS_CONCEPT, '');
     $cid_c = $this->m_store->getSMWPageID($concept->getDBkey(), SMW_NS_CONCEPT, '', false);
     if ($cid != $cid_c) {
         $this->m_errors[] = "Skipping redirect concept.";
         return $this->m_errors;
     }
     $dv = end($this->m_store->getPropertyValues($concept, SMWPropertyValue::makeProperty('_CONC')));
     $desctxt = $dv !== false ? $dv->getWikiValue() : false;
     $this->m_errors = array();
     if ($desctxt) {
         // concept found
         $this->m_qmode = SMWQuery::MODE_INSTANCES;
         $this->m_queries = array();
         $this->m_hierarchies = array();
         $this->m_querylog = array();
         $this->m_sortkeys = array();
         SMWSQLStore2Query::$qnum = 0;
         // Pre-process query:
         $qp = new SMWQueryParser($smwgQConceptFeatures);
         $desc = $qp->getQueryDescription($desctxt);
         $qid = $this->compileQueries($desc);
         $this->executeQueries($this->m_queries[$qid]);
         // execute query tree, resolve all dependencies
         $qobj = $this->m_queries[$qid];
         if ($qobj->joinfield === '') {
             return;
         }
         // Update database:
         $this->m_dbs->delete('smw_conccache', array('o_id' => $cid), 'SMW::refreshConceptCache');
         if ($wgDBtype == 'postgres') {
             // PostgresQL: no INSERT IGNORE, check for duplicates explicitly
             $where = $qobj->where . ($qobj->where ? ' AND ' : '') . 'NOT EXISTS (SELECT NULL FROM ' . $this->m_dbs->tableName('smw_conccache') . ' WHERE ' . $this->m_dbs->tablename('smw_conccache') . '.s_id = ' . $qobj->alias . '.s_id ' . ' AND   ' . $this->m_dbs->tablename('smw_conccache') . '.o_id = ' . $qobj->alias . '.o_id )';
         } else {
             // MySQL just uses INSERT IGNORE, no extra conditions
             $where = $qobj->where;
         }
         $this->m_dbs->query("INSERT " . ($wgDBtype == 'postgres' ? "" : "IGNORE ") . "INTO " . $this->m_dbs->tableName('smw_conccache') . " SELECT DISTINCT {$qobj->joinfield} AS s_id, {$cid} AS o_id FROM " . $this->m_dbs->tableName($qobj->jointable) . " AS {$qobj->alias}" . $qobj->from . ($where ? " WHERE " : '') . $where . " LIMIT {$smwgQMaxLimit}", 'SMW::refreshConceptCache');
         $this->m_dbs->update('smw_conc2', array('cache_date' => strtotime("now"), 'cache_count' => $this->m_dbs->affectedRows()), array('s_id' => $cid), 'SMW::refreshConceptCache');
     } else {
         // just delete old data if there is any
         $this->m_dbs->delete('smw_conccache', array('o_id' => $cid), 'SMW::refreshConceptCache');
         $this->m_dbs->update('smw_conc2', array('cache_date' => null, 'cache_count' => null), array('s_id' => $cid), 'SMW::refreshConceptCache');
         $this->m_errors[] = "No concept description found.";
     }
     $this->cleanUp();
     return $this->m_errors;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:55,代码来源:SMW_SQLStore2_QueriesNM.smw15.php


示例14: initProperties

function initProperties()
{
    if (class_exists('SMWDIProperty')) {
        SMWDIProperty::registerProperty("__SIA_RECTCOORDS", '_str', "SIArectangleCoordinates", true);
        SMWDIProperty::registerProperty("__SIA_IMG_URL", '_str', "SIAimageURL", true);
        SMWDIProperty::registerProperty("__SIA_ANNOTATED", '_str', "SIAannotatedImage", true);
        SMWDIProperty::registerProperty("__SIA_CREATED_BY", '_str', "SIAcreatedBy", true);
    } else {
        SMWPropertyValue::registerProperty("__SIA_RECTCOORDS", '_str', "SIArectangleCoordinates", true);
        SMWPropertyValue::registerProperty("__SIA_IMG_URL", '_str', "SIAimageURL", true);
        SMWPropertyValue::registerProperty("__SIA_ANNOTATED", '_str', "SIAannotatedImage", true);
        SMWPropertyValue::registerProperty("__SIA_CREATED_BY", '_str', "SIAcreatedBy", true);
    }
    return true;
}
开发者ID:whysasse,项目名称:kmwiki,代码行数:15,代码来源:SemanticImageAnnotator.php


示例15: __construct

 public function __construct(LingoMessageLog &$messages = null)
 {
     parent::__construct($messages);
     // get the store
     $store = smwfGetStore();
     // Create query
     $desc = new SMWSomeProperty(new SMWDIProperty('___glt'), new SMWThingDescription());
     $desc->addPrintRequest(new SMWPrintRequest(SMWPrintRequest::PRINT_PROP, null, SMWPropertyValue::makeProperty('___glt')));
     $desc->addPrintRequest(new SMWPrintRequest(SMWPrintRequest::PRINT_PROP, null, SMWPropertyValue::makeProperty('___gld')));
     $desc->addPrintRequest(new SMWPrintRequest(SMWPrintRequest::PRINT_PROP, null, SMWPropertyValue::makeProperty('___gll')));
     $query = new SMWQuery($desc, false, false);
     $query->sort = true;
     $query->sortkeys['___glt'] = 'ASC';
     // get the query result
     $this->mQueryResult = $store->getQueryResult($query);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:SemanticGlossaryBackend.php


示例16: addPropertyValueToSemanticData

 protected static function addPropertyValueToSemanticData($propertyName, $valueString, $semanticData)
 {
     $propertyDv = SMWPropertyValue::makeUserProperty($propertyName);
     $propertyDi = $propertyDv->getDataItem();
     if (!$propertyDi->isInverse()) {
         $valueDv = SMWDataValueFactory::newPropertyObjectValue($propertyDi, $valueString, false, $semanticData->getSubject());
         $semanticData->addPropertyObjectValue($propertyDi, $valueDv->getDataItem());
         // Take note of the error for storage (do this here and not in storage, thus avoiding duplicates).
         if (!$valueDv->isValid()) {
             $semanticData->addPropertyObjectValue(new SMWDIProperty('_ERRP'), $propertyDi->getDiWikiPage());
             self::$m_errors = array_merge(self::$m_errors, $valueDv->getErrors());
         }
     } else {
         self::$m_errors[] = wfMsgForContent('smw_noinvannot');
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:SMW_Subobject.php


示例17: execute

	/**
	 * Main entry point for Special Pages. Gets all required parameters.
	 *
	 * @param[in] $query string  Given by MediaWiki
	 */
	public function execute( $query ) {
		global $wgRequest, $wgOut;
		$this->setHeaders();

		// get the GET parameters
		$this->propertystring = $wgRequest->getText( 'property' );
		$this->valuestring = $wgRequest->getText( 'value' );

		$params = SMWInfolink::decodeParameters( $query, false );
		reset( $params );

		// no GET parameters? Then try the URL
		if ( $this->propertystring === '' ) $this->propertystring = current( $params );
		if ( $this->valuestring === '' ) $this->valuestring = next( $params );

		$this->valuestring = str_replace( ' ', ' ', $this->valuestring );
		$this->valuestring = str_replace( ' ', ' ', $this->valuestring );

		$this->property = SMWPropertyValue::makeUserProperty( $this->propertystring );
		if ( !$this->property->isValid() ) {
			$this->propertystring = '';
		} else {
			$this->propertystring = $this->property->getWikiValue();
			$this->value = SMWDataValueFactory::newPropertyObjectValue( $this->property->getDataItem(), $this->valuestring );

			if ( $this->value->isValid() ) {
				$this->valuestring = $this->value->getWikiValue();
			} else {
				$this->value = null;
			}
		}

		$limitstring = $wgRequest->getVal( 'limit' );
		if ( is_numeric( $limitstring ) ) {
			$this->limit =  intval( $limitstring );
		}

		$offsetstring = $wgRequest->getVal( 'offset' );
		if ( is_numeric( $offsetstring ) ) {
			$this->offset = intval( $offsetstring );
		}

		$wgOut->addHTML( $this->displaySearchByProperty() );
		$wgOut->addHTML( $this->queryForm() );

		SMWOutputs::commitToOutputPage( $wgOut ); // make sure locally collected output data is pushed to the output!
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:52,代码来源:SMW_SpecialSearchByProperty.php


示例18: newPropertyPrintRequest

 /**
  * @since 2.1
  *
  * @param DIProperty $property
  *
  * @return PrintRequest
  */
 public function newPropertyPrintRequest(DIProperty $property)
 {
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($property);
     $instance = new PrintRequest(PrintRequest::PRINT_PROP, $propertyValue->getWikiValue(), $propertyValue);
     return $instance;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:14,代码来源:PrintRequestFactory.php


示例19: searchForResultsThatCompareEqualToClassOf

 private function searchForResultsThatCompareEqualToClassOf($categoryName)
 {
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem(new DIProperty('_INST'));
     $description = new ClassDescription(new DIWikiPage($categoryName, NS_CATEGORY, ''));
     $description->addPrintRequest(new PrintRequest(PrintRequest::PRINT_PROP, null, $propertyValue));
     $query = new Query($description, false, false);
     $query->querymode = Query::MODE_INSTANCES;
     return $this->getStore()->getQueryResult($query);
 }
开发者ID:WolfgangFahl,项目名称:SemanticMediaWiki,代码行数:10,代码来源:CategoryClassQueryDBIntegrationTest.php


示例20: searchForResultsThatCompareEqualToOnlySingularPropertyOf

 private function searchForResultsThatCompareEqualToOnlySingularPropertyOf(DIProperty $property)
 {
     $propertyValue = new PropertyValue('__pro');
     $propertyValue->setDataItem($property);
     $description = new SomeProperty($property, new ThingDescription());
     $description->addPrintRequest(new PrintRequest(PrintRequest::PRINT_PROP, null, $propertyValue));
     $query = new Query($description);
     $query->querymode = Query::MODE_INSTANCES;
     return $this->getStore()->getQueryResult($query);
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:10,代码来源:GeneralQueryDBIntegrationTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP SMWQuery类代码示例发布时间:2022-05-23
下一篇:
PHP SMWOutputs类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap