本文整理汇总了PHP中SMWDataValueFactory::getKnownTypeLabels方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWDataValueFactory::getKnownTypeLabels方法的具体用法?PHP SMWDataValueFactory::getKnownTypeLabels怎么用?PHP SMWDataValueFactory::getKnownTypeLabels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWDataValueFactory
的用法示例。
在下文中一共展示了SMWDataValueFactory::getKnownTypeLabels方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTypesList
protected function getTypesList()
{
$html = '<p>' . htmlspecialchars(wfMsg('smw_types_docu')) . "</p><br />\n";
$typeLabels = SMWDataValueFactory::getKnownTypeLabels();
asort($typeLabels, SORT_STRING);
$html .= "<ul>\n";
foreach ($typeLabels as $typeId => $label) {
$typeValue = SMWTypesValue::newFromTypeId($typeId);
$html .= '<li>' . $typeValue->getLongHTMLText(smwfGetLinker()) . "</li>\n";
}
$html .= "</ul>\n";
return $html;
}
示例2: getPropertyTargetProposals
/**
* Get Property target proposals. Consider special properties too
*/
public static function getPropertyTargetProposals($userContext, $match)
{
// special handling for special relations
global $smwgContLang, $smwgHaloContLang, $wgLang;
$specialProperties = $smwgContLang->getPropertyLabels();
$specialSchemaProperties = $smwgHaloContLang->getSpecialSchemaPropertyArray();
// special properties
if (stripos(strtolower($userContext), strtolower($specialProperties["_SUBP"])) > 0) {
$pages = smwfGetAutoCompletionStore()->getPages($match, array(SMW_NS_PROPERTY));
return AutoCompletionRequester::encapsulateAsXML($pages, true);
// return namespace too!
} else {
if (stripos(strtolower($userContext), strtolower($specialSchemaProperties[SMW_SSP_IS_INVERSE_OF])) > 0) {
$pages = smwfGetAutoCompletionStore()->getPages($match, array(SMW_NS_PROPERTY));
return AutoCompletionRequester::encapsulateAsXML($pages, true);
// return namespace too!
} else {
if (stripos(strtolower($userContext), strtolower($specialProperties["_TYPE"])) > 0) {
// has type relation. First check for user types
$pages = smwfGetAutoCompletionStore()->getPages($match, array(SMW_NS_TYPE));
// then check builtin types
$typeLabels = array_values(SMWDataValueFactory::getKnownTypeLabels());
$lower_match = strtolower($match);
foreach ($typeLabels as $l) {
if (strpos(strtolower($l), $lower_match) !== false) {
$pages[] = Title::newFromText($l, SMW_NS_TYPE);
}
}
return AutoCompletionRequester::encapsulateAsXML($pages, true);
// return namespace too!
} else {
if (stripos(strtolower($userContext), strtolower($specialSchemaProperties[SMW_SSP_HAS_DOMAIN_AND_RANGE_HINT])) > 0) {
// has domain hint relation
$pages = smwfGetAutoCompletionStore()->getPages($match, array(NS_CATEGORY));
return AutoCompletionRequester::encapsulateAsXML($pages, true);
// return namespace too!
} else {
$propertyTitle = self::getTitleFromContext($userContext);
if (!is_null($propertyTitle)) {
$property = Title::newFromText($propertyTitle, SMW_NS_PROPERTY);
$domainRangeAnnotations = smwfGetStore()->getPropertyValues($property, smwfGetSemanticStore()->domainRangeHintProp);
$pages = smwfGetAutoCompletionStore()->getInstanceAsTarget($match, $domainRangeAnnotations);
}
if (empty($pages)) {
// fallback
$pages = smwfGetAutoCompletionStore()->getPages($match, array(NS_MAIN));
}
return AutoCompletionRequester::encapsulateAsXML($pages);
}
}
}
}
}
示例3: smwf_tb_GetUserDatatypes
/**
* function smwfGetUserDatatypes
* This function returns a comma separated list of all user defined data types
*/
function smwf_tb_GetUserDatatypes()
{
$result = "User defined types:";
$db =& wfGetDB(DB_SLAVE);
$NStype = SMW_NS_TYPE;
$page = $db->tableName('page');
$sql = "SELECT 'Types' as type,\r\n\t{$NStype} as namespace,\r\n\tpage_title as title,\r\n\tpage_title as value,\r\n\t1 as count\r\n\tFROM {$page}\r\n\tWHERE page_namespace = {$NStype}";
$res = $db->query($sql);
// Builtin types may appear in the list of user types (if there is an
// article for them). They have to be removed from the user types
$builtinTypes = SMWDataValueFactory::getKnownTypeLabels();
$userTypes = array();
if ($db->numRows($res) > 0) {
while ($row = $db->fetchObject($res)) {
$userTypes[] = str_replace("_", " ", $row->title);
}
}
$db->freeResult($res);
$userTypes = array_diff($userTypes, $builtinTypes);
foreach ($userTypes as $key => $type) {
$result .= "," . $type;
}
return $result;
}
示例4: smwf_qi_QIAccess
function smwf_qi_QIAccess($method, $params)
{
$p_array = explode(",", $params);
global $smwgQEnabled;
if ($method == "getPropertyInformation") {
return qiGetPropertyInformation($p_array[0]);
} else {
if ($method == "getPropertyTypes") {
$p_array = func_get_args();
$types = "<propertyTypes>";
for ($i = 1; $i < count($p_array); $i++) {
$types .= qiGetPropertyInformation($p_array[$i]);
}
$types .= "</propertyTypes>";
return $types;
} else {
if ($method == "getNumericTypes") {
$numtypes = array();
$types = SMWDataValueFactory::getKnownTypeLabels();
foreach ($types as $v) {
$id = SMWDataValueFactory::findTypeID($v);
if (SMWDataValueFactory::newTypeIDValue($id)->isNumeric()) {
array_push($numtypes, strtolower($v));
}
}
return implode(",", $numtypes);
} else {
if ($method == "getQueryResult") {
$result = "null";
if ($smwgQEnabled) {
// read fix parameters from QI GUI
$params = count($p_array) > 1 ? explode("|", $p_array[1]) : array();
$fixparams = array();
foreach ($params as $p) {
if (strlen($p) > 0 && strpos($p, "=") !== false) {
list($key, $value) = explode("=", $p);
$fixparams[trim($key)] = str_replace('%2C', ',', $value);
}
}
// indicate that it comes from an ajax call
$fixparams['ajaxCall'] = true;
// fix bug 10812: if query string contains a ,
$p_array[0] = str_replace('%2C', ',', $p_array[0]);
// read query with printouts and (possibly) other parameters like sort, order, limit, etc...
$pos = strpos($p_array[0], "|?");
if ($pos > 0) {
$rawparams[] = trim(substr($p_array[0], 0, $pos));
$ps = explode("|?", trim(substr($p_array[0], $pos + 2)));
foreach ($ps as $param) {
$rawparams[] = "?" . trim($param);
}
} else {
$ps = preg_split('/[^\\|]{1}\\|{1}(?!\\|)/s', $p_array[0]);
if (count($ps) > 1) {
// last char of query condition is missing (matched with [^\|]{1}) therefore copy from original
$rawparams[] = trim(substr($p_array[0], 0, strlen($ps[0]) + 1));
array_shift($ps);
// remove the query condition
// add other params for formating etc.
foreach ($ps as $param) {
$rawparams[] = trim($param);
}
} else {
$rawparams[] = trim($p_array[0]);
}
}
$rawparams = array_merge($rawparams, $fixparams);
// set some default values, if params are not set
if (!in_array('reasoner', array_keys($fixparams))) {
$fixparams['reasoner'] = 'ask';
}
if (!in_array('format', array_keys($fixparams))) {
$fixparams['format'] = 'table';
}
// use SMW classes or TSC classes and parse params and answer query
if ($fixparams['reasoner'] == 'ask') {
SMWQueryProcessor::processFunctionParams($rawparams, $querystring, $params, $printouts);
} else {
if ($fixparams['reasoner'] == 'sparql') {
SMWSPARQLQueryProcessor::processFunctionParams($rawparams, $querystring, $params, $printouts);
}
}
// check if there is any result and if it corresponds to the selected format
$mainlabel = isset($rawparams['mainlabel']) && $rawparams['mainlabel'] == '-';
$invalidRes = smwf_qi_CheckValidResult($printouts, $fixparams['format'], $mainlabel);
if ($invalidRes != 0) {
return wfMsg('smw_qi_printout_err' . $invalidRes);
}
// quickfix: unset conflicting params for maps
if (in_array($fixparams['format'], array("map", "googlemaps2", "openlayers", "yahoomaps"))) {
if (isset($params['reasoner'])) {
unset($params['reasoner']);
}
if (isset($params['ajaxcall'])) {
unset($params['ajaxcall']);
}
if (isset($params['merge'])) {
unset($params['merge']);
}
}
//.........这里部分代码省略.........