primaryTopic() public method

Utility method (shamelessly ripped off from EasyRDF). Returns the primary topic of the first URL that was loaded. Handy when working with FOAF.
public primaryTopic ( $uri = null )
Beispiel #1
0
    $count = 0;
    $str = "";
    foreach ($reslist as $res) {
        $str .= renderResource($res, $intype);
        $count++;
    }
    if (preg_match("/^\\s*\$/", $str) == 0) {
        $html .= '<span class="header" id="' . $intype . '">' . $types[$intype]['srp'] . '</span>';
        echo '<li><a href="#' . $intype . '">' . $types[$intype]['srp'] . '</a></li>';
        $html .= $str;
    }
    unset($reslist);
}
echo '</ul>';
echo '<div class="header">';
$title = $g->primaryTopic()->label();
if (gettype($res = $g->resource($source)->get("foaf:primaryTopic")) == "string") {
    echo $res;
} else {
    echo $res->label();
}
echo '</div>';
echo '<div class="padding">';
echo $html;
echo ob_get_clean();
function renderResource($gRes, $type)
{
    // 		$node = new DOMNode('div');
    // 		$node->setAttribute('class', 'section');
    // 		$node->setAttribute('res', $gRes->toString());
    // 		$node->setAttribute('emph', 'major');