Beispiel #1
0
function render($storeName)
{
    $data = array();
    $index = select_to_array($storeName, 'SELECT DISTINCT ?o WHERE {?s a ?o}');
    $content = '';
    $content .= '<form method="post" action="find.php"';
    $content .= '<input type="hidden" name="storeName" size="15%" value="' . $storeName . '"/>&nbsp;';
    $content .= '<div align="center">';
    $content .= '<input type="text" name="resourceUri" size="80%" value=""/>&nbsp;';
    $content .= '<input type="submit" name="submit" value="Find"/>';
    $content .= '</div>';
    $content .= '</form>';
    if (count($index) > 0) {
        $content .= 'Found ' . count($index) . ' data types<p>';
        $content .= '<div class="findResults">';
        $content .= '<ul>';
        foreach ($index as $item) {
            $itemUri = $item['o']['value'];
            $label = $itemUri;
            $showUri = 'find.php?storeName=' . $storeName . '&resourceUri=' . urlencode($itemUri);
            $content .= '<li><span class="lnkShowItem" ><a href="' . $showUri . '">' . $label . '</a></span></li>';
        }
        $content .= '</ul>';
        $content .= '</div>';
    } else {
        $content .= 'No data types found<p>';
    }
    renderPage($storeName, null, 'Data types', $content);
}
Beispiel #2
0
function render($storeName, $resourceUri)
{
    $content = '';
    $content .= '<form method="get" action="find.php"';
    $content .= '<input type="hidden" name="storeName" size="15%" value="' . $storeName . '"/>&nbsp;';
    $content .= '<div align="center">';
    $content .= '<input type="text" name="resourceUri" size="80%" value="' . $resourceUri . '"/>&nbsp;';
    $content .= '<input type="submit" name="submit" value="Find"/>';
    $content .= '</div>';
    $content .= '</form>';
    if (!empty($resourceUri)) {
        if (substr($resourceUri, 0, 5) == 'http:') {
            $index = describe_to_simple_index($storeName, $resourceUri);
            if (isset($index[$resourceUri])) {
                $content .= 'Found as subject<p>';
                $content .= '<div class="findResults">';
                $content .= '<ul>';
                $itemUri = $resourceUri;
                $showUri = 'show.php?storeName=' . $storeName . '&resourceUri=' . urlencode($itemUri);
                $content .= '<li><span class="lnkShowItem" ><a href="' . $showUri . '">' . $itemUri . '</a></span></li>';
                $content .= '</ul>';
                $content .= '</div>';
            } else {
                $content .= 'Not found as subject<p>';
            }
            $select = 'SELECT ?s where {?s ?p <' . $resourceUri . '>}';
            $selectResults = select_to_array($storeName, $select);
            if (!empty($selectResults)) {
                $content .= 'Found as object<p>';
                $content .= '<div class="findResults">';
                $content .= '<ul>';
                foreach ($selectResults as $selectResult) {
                    $itemUri = $selectResult['s']['value'];
                    $showUri = 'show.php?storeName=' . $storeName . '&resourceUri=' . urlencode($itemUri);
                    $content .= '<li><span class="lnkShowItem" ><a href="' . $showUri . '">' . $itemUri . '</a></span></li>';
                }
                $content .= '</ul>';
                $content .= '</div>';
            } else {
                $content .= 'Not found as object<p>';
            }
        } else {
            $results = search_to_resource_list($storeName, $resourceUri);
            $content .= 'Found ' . $results->total_results . ' items in indexes<p>';
            $content .= '<div class="findResults">';
            $content .= '<ul>';
            foreach ($results->items as $item) {
                $itemUri = $item['http://purl.org/rss/1.0/link'][0];
                $showUri = 'show.php?storeName=' . $storeName . '&resourceUri=' . urlencode($itemUri);
                $content .= '<li><span class="lnkShowItem" ><a href="' . $showUri . '">' . $itemUri . '</a></span></li>';
            }
            $content .= '</ul>';
            $content .= '</div>';
        }
    }
    renderPage($storeName, null, null, $content);
}