本文整理汇总了PHP中SMWPropertyValue::isUserDefined方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWPropertyValue::isUserDefined方法的具体用法?PHP SMWPropertyValue::isUserDefined怎么用?PHP SMWPropertyValue::isUserDefined使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWPropertyValue
的用法示例。
在下文中一共展示了SMWPropertyValue::isUserDefined方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPropertySubjects
/**
* @see superclass
*/
function getPropertySubjects(SMWPropertyValue $property, $value, $requestoptions = NULL)
{
if (!$property->isUserDefined()) {
return parent::getPropertySubjects($property, $value, $requestoptions);
}
if (smwfCheckIfPredefinedSMWHaloProperty($property)) {
return parent::getPropertyValues($subject, $property, $requestoptions, $outputformat);
}
global $smwgTripleStoreGraph;
$client = TSConnection::getConnector();
$client->connect();
$values = array();
$propertyName = $property->getWikiPageValue()->getTitle()->getDBkey();
$limit = isset($requestoptions->limit) ? " LIMIT " . $requestoptions->limit : "";
$offset = isset($requestoptions->offset) ? " OFFSET " . $requestoptions->offset : "";
$nsPrefixProp = $this->tsNamespace->getNSPrefix($property->getWikiPageValue()->getTitle()->getNamespace());
try {
if (is_null($value)) {
$response = $client->query("SELECT ?s WHERE { GRAPH ?g { ?s <{$smwgTripleStoreGraph}/{$nsPrefixProp}#{$propertyName}> ?o. } } {$limit} {$offset}", "merge=false|graph={$smwgTripleStoreGraph}");
} else {
if ($value instanceof SMWWikiPageValue) {
$objectName = $value->getTitle()->getDBkey();
$nsPrefixObj = $this->tsNamespace->getNSPrefix($value->getTitle()->getNamespace());
$response = $client->query("SELECT ?s WHERE { GRAPH ?g { ?s <{$smwgTripleStoreGraph}/{$nsPrefixProp}#{$propertyName}> <{$smwgTripleStoreGraph}/{$nsPrefixObj}#{$objectName}>. } } {$limit} {$offset}", "merge=false");
} else {
$objectvalue = str_replace('"', '\\"', array_shift($value->getDBkeys()));
$objecttype = WikiTypeToXSD::getXSDType($value->getTypeID());
$response = $client->query("SELECT ?s WHERE { GRAPH ?g { ?s <{$smwgTripleStoreGraph}/{$nsPrefixProp}#{$propertyName}> \"{$objectvalue}\"^^{$objecttype}. } } {$limit} {$offset}", "merge=false");
}
}
} catch (Exception $e) {
wfDebug("Triplestore does probably not run.\n");
$response = TSNamespaces::$EMPTY_SPARQL_XML;
}
// query
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);
$annotations = array();
$results = $dom->xpath('//result');
foreach ($results as $r) {
$children = $r->children();
// binding nodes
$b = $children->binding[0];
// predicate
$sv = $b->children()->uri[0];
$title = $this->getTitleFromURI((string) $sv);
$value = SMWWikiPageValue::makePage($title->getDBkey(), $title->getNamespace());
$metadata = $sv->attributes();
foreach ($metadata as $mdProperty => $mdValue) {
if (strpos($mdProperty, "_meta_") === 0) {
$value->setMetadata(substr($mdProperty, 6), explode("|||", $mdValue));
}
}
$values[] = $value;
}
return $values;
}