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


PHP SMWDataValueFactory::newPropertyObjectValue方法代码示例

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


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

示例1: 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

示例2: 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

示例3: addPropertyDiValueToSemanticData

 protected static function addPropertyDiValueToSemanticData($propertyDi, $valueString, $semanticData)
 {
     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[] = wfMessage('smw_noinvannot')->inContentLanguage()->text();
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:14,代码来源:SMW_Subobject.php

示例4: writeOrDeleteDataToWiki

    /**
     * Write (or delte, if $delete is set to true) the data in the object
     * variables, to the wiki page corresponding to this page handler
     * @param boolean $delete
     */
    public function writeOrDeleteDataToWiki( $delete = false ) {
        if ( $delete ) {
            if ( $this->checkWikiPageExists() ) {
                $this->initSMWWriter( $delete = true );
            } else {
                return;
            }
        } else {
            $this->ensureWikiPageExists();
            $this->initSMWWriter();
        }

        $properties = $this->m_properties;
        foreach ( $properties as $cur_prop ) {
            $propertystring = $cur_prop['p'];
            // TODO: Remove old code:
            // $property = SMWPropertyValue::makeUserProperty( $propertystring );
            $property_di = SMWDIProperty::newFromUserLabel($propertystring);
            $valuestring = RDFIOUtils::sanitizeSMWValue( $cur_prop['v'] );
            $value    = SMWDataValueFactory::newPropertyObjectValue( $property_di, $valuestring );

            $propertyErrorText = $property->getErrorText();
            $propertyHasError = ( $propertyErrorText != '' );
            if ( $propertyHasError ) {
                $this->addError( "<p>In RDFIOPageHandler::writeOrDeleteDataToWiki(): " . $property->getErrorText() . "</p>" );
            }

            $valueErrorText = $value->getErrorText();
            $valueHasError = ( $valueErrorText != '' );
            if ( $valueHasError ) {
                $this->addError( "<p>Error creating property value object in RDFIOPageHandler::writeOrDeleteDataToWiki():</p><p>" . $value->getErrorText() . "</p>" );
            }
            if ( $delete ) {
                $this->m_smwwriter_remove->addPropertyObjectValue( $property, $value );
                $editmessage = "Deleting properties. Last property delete: " . $propertystring . " : " . $valuestring;
            } else {
                $this->m_smwwriter_add->addPropertyObjectValue( $property, $value );
                $editmessage = "Importing properties. Last property added: " . $propertystring . " : " . $valuestring;
            }
        }

        $this->m_smwwriter->update( $this->m_smwwriter_remove, $this->m_smwwriter_add, $editmessage );
        $smwWriterError = $this->m_smwwriter->getError();
        $smwWriterHasError = ( $smwWriterError != '' );
        if ( $smwWriterHasError ) {
            $this->addError( "<p>SMWWriter Error: " . $smwWriterError . "</p>" );
        }
    }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:53,代码来源:PageHandler.php

示例5: 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( '&nbsp;', ' ', $this->valuestring );
		$this->valuestring = str_replace( '&#160;', ' ', $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

示例6: __construct

	public function __construct( $property, $value, $caption = '' ) {
		parent::__construct( WOM_TYPE_PROPERTY );

		if ( !defined( 'SMW_VERSION' ) ) {
			// MW hook will catch this exception
			throw new MWException( __METHOD__ . ": Property model is invalid. Please install 'SemanticMediaWiki extension' first." );
		}

		$user_property = SMWPropertyValue::makeUserProperty( $property );
		if ( count ( $user_property->getErrors() ) > 0 ) {
			$user_property = SMWPropertyValue::makeUserProperty( '///NA///' );
		} else {
			$property = '';
		}
		$smwdatavalue = null;
		// FIXME: property should be collection object according to templates
		// if template/field used
		if ( preg_match ( '/\{\{.+\}\}/s', $value . $caption ) ) {
			$value = $value . ( $caption == '' ? '' : "|{$caption}" );
			$caption = '';
		} else {
			if ( version_compare ( SMW_VERSION, '1.6', '>=' ) ) {
				$smwdatavalue = SMWDataValueFactory::newPropertyObjectValue( $user_property->getDataItem(), $value, $caption );
			} else {
				$smwdatavalue = SMWDataValueFactory::newPropertyObjectValue( $user_property, $value, $caption );
			}
			if ( count ( $smwdatavalue->getErrors() ) > 0 ) {
				$smwdatavalue = null;
			}
		}

		$this->m_user_property = $user_property;
		$this->m_smwdatavalue = $smwdatavalue;
		$this->m_property = $property;
		$this->m_value = $value;
		$this->m_caption = $caption;
		$this->m_visible = !preg_match( '/^\s+$/', $caption );
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:38,代码来源:WOM_OM_Property.php

示例7: getPropertyValues

 public function getPropertyValues($subject, SMWDIProperty $property, $requestoptions = null, $outputformat = '')
 {
     wfProfileIn("SMWSQLStoreLight::getPropertyValues (SMW)");
     if ($property->isInverse()) {
         // inverses are working differently
         $noninverse = clone $property;
         $noninverse->setInverse(false);
         $result = $this->getPropertySubjects($noninverse, $subject, $requestoptions);
     } elseif ($subject !== null) {
         // subject given, use semantic data cache:
         $sd = $this->getSemanticData($subject, array($property->getPropertyTypeID()));
         $result = $this->applyRequestOptions($sd->getPropertyValues($property), $requestoptions);
         if ($outputformat !== '') {
             // reformat cached values
             $newres = array();
             foreach ($result as $dv) {
                 $ndv = clone $dv;
                 $ndv->setOutputFormat($outputformat);
                 $newres[] = $ndv;
             }
             $result = $newres;
         }
     } else {
         // no subject given, get all values for the given property
         $tablename = SMWSQLStoreLight::findPropertyTableName($property);
         $db = wfGetDB(DB_SLAVE);
         $res = $db->select($tablename, array('value'), array('propname' => $property->getDBkey()), 'SMW::getPropertyValues', $this->getSQLOptions($requestoptions, 'value') + array('DISTINCT'));
         $result = array();
         foreach ($res as $row) {
             $dv = SMWDataValueFactory::newPropertyObjectValue($property);
             if ($outputformat !== '') {
                 $dv->setOutputFormat($outputformat);
             }
             $dv->setDBkeys($tablename == 'smwsimple_special' ? array($row->value) : unserialize($row->value));
             $result[] = $dv;
         }
         $db->freeResult($res);
     }
     wfProfileOut("SMWSQLStoreLight::getPropertyValues (SMW)");
     return $result;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:41,代码来源:SMW_SQLStoreLight.php

示例8: parseAnnotations

 protected function parseAnnotations($response, &$annotations)
 {
     global $smwgSPARQLResultEncoding;
     // PHP strings are always interpreted in ISO-8859-1 but may be actually encoded in
     // another charset.
     if (isset($smwgSPARQLResultEncoding) && $smwgSPARQLResultEncoding == 'UTF-8') {
         $response = utf8_decode($response);
     }
     $dom = simplexml_load_string($response);
     $results = $dom->xpath('//result');
     foreach ($results as $r) {
         $children = $r->children();
         // binding nodes
         $b = $children->binding[0];
         // predicate
         $sv = $b->children()->uri[0];
         $title = TSHelper::getTitleFromURI((string) $sv);
         if (is_null($title)) {
             continue;
         }
         $predicate = SMWPropertyValue::makeUserProperty($title->getText());
         $categories = array();
         $b = $children->binding[1];
         // categories
         $values = array();
         foreach ($b->children()->uri as $sv) {
             $object = TSHelper::getTitleFromURI((string) $sv);
             if (TSHelper::isLocalURI((string) $sv)) {
                 $value = SMWDataValueFactory::newPropertyObjectValue($predicate, $object);
             } else {
                 $value = SMWDataValueFactory::newTypeIDValue('_uri', (string) $sv);
             }
             // add metadata
             $metadata = array();
             foreach ($sv->attributes() as $mdProperty => $mdValue) {
                 if (strpos($mdProperty, "_meta_") === 0) {
                     $value->setMetadata(strtoupper($mdProperty), explode("|||", $mdValue));
                 }
             }
             $values[] = $value;
         }
         foreach ($b->children()->literal as $sv) {
             $literal = array((string) $sv, $sv->attributes()->datatype);
             $value = $this->getLiteral($literal, $predicate);
             // add metadata
             $metadata = array();
             foreach ($sv->attributes() as $mdProperty => $mdValue) {
                 if (strpos($mdProperty, "_meta_") === 0) {
                     $value->setMetadata(strtoupper($mdProperty), explode("|||", $mdValue));
                 }
             }
             $values[] = $value;
         }
         $annotations[] = array($predicate, $values);
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:56,代码来源:SMW_OntologyBrowserAjaxAccess.php

示例9: getLiteral

 private function getLiteral($literal, $predicate)
 {
     list($literalValue, $literalType) = $literal;
     if (!empty($literalValue)) {
         // create SMWDataValue either by property or if that is not possible by the given XSD type
         if ($predicate instanceof SMWPropertyValue) {
             $value = SMWDataValueFactory::newPropertyObjectValue($predicate, $literalValue);
         } else {
             $value = SMWDataValueFactory::newTypeIDValue(WikiTypeToXSD::getWikiType($literalType));
         }
         if ($value->getTypeID() == '_dat') {
             // exception for dateTime
             if ($literalValue != '') {
                 $value->setDBkeys(array(str_replace("-", "/", $literalValue)));
             }
         } else {
             if ($value->getTypeID() == '_ema') {
                 // exception for email
                 $value->setDBkeys(array($literalValue));
             } else {
                 $value->setUserValue($literalValue);
             }
         }
     } else {
         if ($predicate instanceof SMWPropertyValue) {
             $value = SMWDataValueFactory::newPropertyObjectValue($predicate);
         } else {
             $value = SMWDataValueFactory::newTypeIDValue('_wpg');
         }
     }
     return $value;
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:32,代码来源:SMW_TripleStoreQuad.php

示例10: setIsSPQRQLQuery

 public function setIsSPQRQLQuery($isSPARQL)
 {
     $propertyValue = SMWPropertyValue::makeUserProperty(QRC_ISQ_LABEL);
     $dataValue = SMWDataValueFactory::newPropertyObjectValue($propertyValue, $isSPARQL);
     $this->m_data->addPropertyObjectValue($propertyValue, $dataValue);
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:6,代码来源:SMW_QRC_DV_QueryCallMetadata.php

示例11: ft_getPropertyValues

function ft_getPropertyValues($property, $store)
{
    $pid = $store->getSMWPropertyID($property);
    $db =& wfGetDB(DB_SLAVE);
    $result = array();
    $mode = SMWSQLStore2::getStorageMode($property->getPropertyTypeID());
    switch ($mode) {
        case SMW_SQL2_TEXT2:
            $res = $db->select('smw_text2', 'value_blob', 'p_id=' . $db->addQuotes($pid));
            while ($row = $db->fetchObject($res)) {
                $dv = SMWDataValueFactory::newPropertyObjectValue($property);
                $dv->setOutputFormat($outputformat);
                $dv->setDBkeys(array($row->value_blob));
                $result[] = $dv;
            }
            $db->freeResult($res);
            break;
        case SMW_SQL2_RELS2:
            $res = $db->select(array('smw_rels2', 'smw_ids'), 'smw_namespace, smw_title, smw_iw', 'p_id=' . $db->addQuotes($pid) . ' AND o_id=smw_id');
            while ($row = $db->fetchObject($res)) {
                $dv = SMWDataValueFactory::newPropertyObjectValue($property);
                $dv->setOutputFormat($outputformat);
                $dv->setDBkeys(array($row->smw_title, $row->smw_namespace, $row->smw_iw));
                $result[] = $dv;
            }
            $db->freeResult($res);
            break;
        case SMW_SQL2_ATTS2:
            if ($requestoptions !== NULL && $requestoptions->boundary !== NULL) {
                $value_column = $requestoptions->boundary->isNumeric() ? 'value_num' : 'value_xsd';
            } else {
                $testval = SMWDatavalueFactory::newTypeIDValue($property->getPropertyTypeID());
                $value_column = $testval->isNumeric() ? 'value_num' : 'value_xsd';
            }
            $sql = 'p_id=' . $db->addQuotes($pid);
            $res = $db->select('smw_atts2', 'value_unit, value_xsd', 'p_id=' . $db->addQuotes($pid));
            while ($row = $db->fetchObject($res)) {
                $dv = SMWDataValueFactory::newPropertyObjectValue($property);
                $dv->setOutputFormat($outputformat);
                $dv->setDBkeys(array($row->value_xsd, $row->value_unit));
                $result[] = $dv;
            }
            $db->freeResult($res);
            break;
    }
    return $result;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:47,代码来源:FolkTagCloud.php

示例12: readData

	/**
	 * Reads the paramstring for remove and add and turns it into
	 * SMWSemanticData object that can be used with the SMWWriter API
	 *
	 * @param Title $title Title of the page to be modified
	 * @param string $text The param value
	 * @return SMWSemanticData Object with the interpreted data from the param value
	 */
	private function readData( Title $title, /* string */ $text ) {
		if ( empty( $text ) )
			return new SMWSemanticData( SMWWikiPageValue::makePage( false, 0 ) );
		if ( $text == '*' )
			return new SMWSemanticData( SMWWikiPageValue::makePage( $title, 0 ) );

		$result = new SMWSemanticData( SMWWikiPageValue::makePageFromTitle( $title ) );

		$matches = array();
		preg_match_all( "/\[\[([^\[\]]*)\]\]/", $text, $matches, PREG_PATTERN_ORDER );
		foreach ( $matches[1] as $match ) {
			$parts = explode( "::", $match );
			if ( count( $parts ) != 2 ) continue;
			$property = SMWPropertyValue::makeUserProperty( trim( $parts[0] ) );
			if ( trim( $parts[1] ) == '*' )
				$value = SMWDataValueFactory::newPropertyObjectValue( $property, false );
			else
				$value = SMWDataValueFactory::newPropertyObjectValue( $property, trim( $parts[1] ) );
			$result->addPropertyObjectValue( $property, $value );
		}
		return $result;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:30,代码来源:SMWWriter_API.php

示例13: getInternalMapping

	/**
	 * Checks if the URI is known and an equivalent URI to any of the already
	 * existing pages. If so, it returns the name of the page, otherwise null.
	 *
	 * @param string $uri Identifier for an entity
	 * @return string The name of the page describing the entity, otherwise null
	 */
	public static function getInternalMapping( $uri ) {

		// Watch out correct spelling: [[equivalent URI::XXX]]
		$equivalentURI = new SMWDIProperty( "_URI" );
		$urivalue = SMWDataValueFactory::newPropertyObjectValue( $equivalentURI, $uri );

		// $values = smwfGetStore()->getPropertySubjects( $property, $this->subject->getDataItem(), $valoptions );
		$results = smwfGetStore()->getPropertySubjects( $equivalentURI, $urivalue->getDataItem() );

		$mappings = array();
		foreach( $results as $result ) {
			//$mappings[] = $result->getWikiValue();
			$mappings[] = $result->getTitle()->getText();
		}
		if ( count( $mappings ) === 0) return null;
		return $mappings[0]; // TODO Only returns one. There never should be more than one.
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:24,代码来源:SWB_SpecialBrowseWiki.php

示例14: addLiteralToResult

 /**
  * Gets an array of literal tuples (value, type, metadata-uri) and creates according
  * SMWDataValue objects.
  *
  * @param array Tuple (string value, string xsd-type, hash array metadata) $literals
  * @param PrintRequest $pr QueryPrinter contains property and thus denotes type (optional)
  * @param array SMWDataValue (out) & $allValues
  */
 protected function addLiteralToResult($literals, $pr, &$allValues)
 {
     foreach ($literals as $literal) {
         list($literalValue, $literalType, $metadata) = $literal;
         $property = !is_null($pr) ? $pr->getData() : NULL;
         if (!empty($literalValue)) {
             // create SMWDataValue either by property or if that is not possible by the given XSD type
             if ($property instanceof SMWPropertyValue) {
                 $propertyTitle = Title::newFromText($pr->getData()->getText(), SMW_NS_PROPERTY);
                 if (!$propertyTitle->exists()) {
                     // fallback if property does not exist, then use tyoe
                     $value = SMWDataValueFactory::newTypeIDValue(WikiTypeToXSD::getWikiType($literalType));
                 } else {
                     $value = SMWDataValueFactory::newPropertyObjectValue($pr->getData(), $literalValue);
                 }
             } else {
                 $value = SMWDataValueFactory::newTypeIDValue(WikiTypeToXSD::getWikiType($literalType));
             }
             if ($value->getTypeID() == '_dat') {
                 // exception for dateTime
                 if ($literalValue != '') {
                     // do not display time if it is 00:00:00
                     if (substr($literalValue, -9) == 'T00:00:00') {
                         $literalValue = substr($literalValue, 0, strpos($literalValue, "T"));
                     }
                     $value->setDBkeys(array(str_replace("-", "/", $literalValue)));
                 }
             } else {
                 if ($value->getTypeID() == '_ema' || $value->getTypeID() == '_tel') {
                     // exception for email
                     $value->setDBkeys(array($literalValue));
                 } else {
                     $value->setUserValue($literalValue);
                 }
             }
         } else {
             if ($property instanceof SMWPropertyValue) {
                 $value = SMWDataValueFactory::newPropertyObjectValue($property);
             } else {
                 $value = SMWDataValueFactory::newTypeIDValue('_wpg');
             }
         }
         foreach ($metadata as $mdProperty => $mdValue) {
             if (strpos($mdProperty, "_meta_") === 0) {
                 $value->setMetadata(substr($mdProperty, 6), explode("|||", $mdValue));
             }
         }
         $allValues[] = $value;
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:58,代码来源:SMW_TripleStore.php

示例15: encapsulateAsProperty

 /**
  * Returns an XML represenatation of a schema property
  *
  * @param array & schemaData. Tuple of (title, minCard, maxCard, type, isSym, isTrans, range)
  * @param count continuous number for generating new IDs
  * @param array & issues Gardening issues for that property
  *
  * @return XML string (fragment)
  */
 private static function encapsulateAsProperty(array &$schemaData, $count, array &$issues)
 {
     $id = uniqid(rand());
     $content = "";
     // unpack schemaData array
     $title = $schemaData[0];
     $minCardinality = $schemaData[1];
     $maxCardinality = $schemaData[2];
     $type = $schemaData[3];
     $isMemberOfSymCat = $schemaData[4];
     $isMemberOfTransCat = $schemaData[5];
     $range = $schemaData[6];
     $inherited = $schemaData[7] == true ? "inherited=\"true\"" : "";
     if ($type == '_wpg') {
         // binary relation?
         if ($range == NULL) {
             $content .= "<rangeType>" . wfMsg('smw_ob_undefined_type') . "</rangeType>";
         } else {
             $content .= "<rangeType isLink=\"true\">" . $range . "</rangeType>";
         }
     } else {
         // it must be an attribute or n-ary relation otherwise.
         $v = SMWDataValueFactory::newPropertyObjectValue(SMWPropertyValue::makeProperty("_TYPE"));
         $v->setDBkeys(array($type));
         $typesOfAttributeAsString = $v->getTypeLabels();
         foreach ($typesOfAttributeAsString as $typeOfAttributeAsString) {
             $content .= "<rangeType>" . $typeOfAttributeAsString . "</rangeType>";
         }
     }
     // generate attribute strings
     $maxCardText = $maxCardinality != CARDINALITY_UNLIMITED ? "maxCard=\"" . $maxCardinality . "\"" : "maxCard=\"*\"";
     $minCardText = $minCardinality != CARDINALITY_MIN ? "minCard=\"" . $minCardinality . "\"" : "minCard=\"0\"";
     $isSymetricalText = $isMemberOfSymCat ? "isSymetrical=\"true\"" : "";
     $isTransitiveText = $isMemberOfTransCat ? "isTransitive=\"true\"" : "";
     $title_esc = htmlspecialchars($title->getDBkey());
     $titleURLEscaped = htmlspecialchars(self::urlescape($title->getDBkey()));
     $numberofUsage = smwfGetSemanticStore()->getNumberOfUsage($title);
     $numberOfUsageAtt = 'num="' . $numberofUsage . '"';
     $gi_issues = SMWOntologyBrowserErrorHighlighting::getGardeningIssuesAsXML($issues);
     return "<property title_url=\"{$titleURLEscaped}\" title=\"" . $title_esc . "\" id=\"ID_" . $id . $count . "\" " . "{$minCardText} {$maxCardText} {$isSymetricalText} {$isTransitiveText} {$numberOfUsageAtt} {$inherited}>" . $content . $gi_issues . "</property>";
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:50,代码来源:SMW_OntologyBrowserXMLGenerator.php


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