示例#1
0
    public function execute()
    {
        global $wgRequest, $wgOut, $wgScriptPath, $wgUser;
        //$skin = $wgUser->getSkin();
        $wgOut->setPageTitle(wfMsg('ontologybrowser'));
        /*STARTLOG*/
        if ($wgRequest->getVal('src') == 'toolbar') {
            smwLog("", "OB", "opened_from_menu");
        } else {
            if ($wgRequest->getVal('entitytitle') != '') {
                $ns = $wgRequest->getVal('ns') == '' ? '' : $wgRequest->getVal('ns') . ":";
                smwLog($ns . $wgRequest->getVal('entitytitle'), "Factbox", "open_in_OB");
            } else {
                smwLog("", "OB", "opened");
            }
        }
        /*ENDLOG*/
        $showMenuBar = $wgUser->isAllowed("ontologyediting");
        // display query browser
        //$spectitle = Title::makeTitle( NS_SPECIAL, wfMsg('ontologybrowser') );
        $refactorstatstitle = Title::makeTitle(NS_SPECIAL, "RefactorStatistics");
        // add another container
        $treeContainer = "";
        $menu = "";
        $switch = "";
        wfRunHooks('smw_ob_add', array(&$treeContainer, &$boxContainer, &$menu, &$switch));
        $html = "<span id=\"OBHelp\">" . wfMsg('smw_ob_help') . "</span><br>";
        $html .= "<span id=\"OBHint\">" . wfMsg('smw_ac_hint') . "</span>\n";
        $html .= "<br><input type=\"text\" size=\"32\" id=\"FilterBrowserInput\" name=\"prefix\" class=\"wickEnabled\" constraints=\"all\"/>";
        $html .= "<button type=\"button\" id=\"filterBrowseButton\" name=\"filterBrowsing\" onclick=\"globalActionListener.filterBrowsing(event, true)\">" . wfMsg('smw_ob_filterbrowsing') . "</button>";
        $html .= "<button type=\"button\" name=\"refresh\" onclick=\"globalActionListener.reset(event)\">" . wfMsg('smw_ob_reset') . "</button>";
        $html .= "<button type=\"button\" id=\"hideInstancesButton\" name=\"hideInstances\" onclick=\"instanceActionListener.toggleInstanceBox(event)\">" . wfMsg('smw_ob_hideinstances') . "</button>";
        //  <a href=\"".$refactorstatstitle->getFullURL()."\">".wfMsg('smw_ob_link_stats')."</a>";
        $html .= "<span id=\"propertyRangeSpan\"><input type=\"checkbox\" id=\"directPropertySwitch\"/>" . wfMsg('smw_ob_onlyDirect') . "</input><input type=\"checkbox\" id=\"showForRange\"/>" . wfMsg('smw_ob_showRange') . "</input></span>";
        $html .= "<div id=\"ontologybrowser\">";
        //TODO: Add the following code to a hook. However, the problem is, that
        // advancedOption.js should also be moved to the Linked Data Extension, but it
        // is used for getting parameters for the ajax calls to smwf_ob_OntologyBrowserAccess().
        if (defined('LOD_LINKEDDATA_VERSION')) {
            // Check if the triples store is propertly connected.
            $connectionError = "";
            $tsa = new LODTripleStoreAccess();
            if (!$tsa->isConnected()) {
                $connectionError = "<div class=\"aoConnectionError\">" . wfMsg("smw_ob_ts_not_connected") . "</div>";
            }
            $ids = LODAdministrationStore::getInstance()->getAllSourceDefinitionIDs();
            $sourceOptions = "";
            foreach ($ids as $sourceID) {
                $sourceOptions .= "<option>{$sourceID}</option>";
            }
            $advancedOptions = wfMsg("smw_ob_advanced_options");
            $fromWiki = wfMsg("smw_ob_source_wiki");
            $selectDatasource = wfMsg("smw_ob_select_datasource");
            $selectMultiHint = wfMsg("smw_ob_select_multiple");
            $html .= <<<TEXT
<div id="advancedOptions" class="advancedOptions">
\t<div id="aoFoldIcon" class="aoFoldClosed"> </div>
\t<span id="aoTitle" class="aoTitle"><b>{$advancedOptions}</b> </span>
\t<div id="aoContent" class="aoContent">
\t\t{$connectionError}
\t\t<div><b>{$selectDatasource}</b></div>
\t\t<select id="dataSourceSelector" name="DataSource" size="5" multiple="multiple" class="aoDataSourceSelector">
\t\t\t<option>{$fromWiki}</option>
\t\t\t{$sourceOptions}
\t\t</select>
\t\t<div class="OBStaticHint">{$selectMultiHint}</div>
\t</div>
</div>
TEXT;
        }
        $html .= "\t\t\r\n\t\t<!-- Categore Tree hook -->\t" . "<div id=\"treeContainer\"><span class=\"OB-header\">\t\r\n\t\t\t<img src=\"{$wgScriptPath}/extensions/SMWHalo/skins/concept.gif\" style=\"margin-bottom: -1px\"></img><a class=\"selectedSwitch treeSwitch\" id=\"categoryTreeSwitch\" onclick=\"globalActionListener.switchTreeComponent(event,'categoryTree')\">" . wfMsg('smw_ob_categoryTree') . "</a>\r\n\t\t\t<img src=\"{$wgScriptPath}/extensions/SMWHalo/skins/property.gif\" style=\"margin-bottom: -1px\"></img><a class=\"treeSwitch\" id=\"propertyTreeSwitch\" onclick=\"globalActionListener.switchTreeComponent(event,'propertyTree')\">" . wfMsg('smw_ob_attributeTree') . "</a>";
        $html .= $switch;
        $html .= "</span>";
        if ($showMenuBar) {
            $html .= "<span class=\"menuBar menuBarTree menuBarcategoryTree\" id=\"menuBarcategoryTree\"><a onclick=\"categoryActionListener.showSubMenu(" . SMW_OB_COMMAND_ADDSUBCATEGORY . ")\">" . wfMsg('smw_ob_cmd_createsubcategory') . "</a> | <a onclick=\"categoryActionListener.showSubMenu(" . SMW_OB_COMMAND_ADDSUBCATEGORY_SAMELEVEL . ")\">" . wfMsg('smw_ob_cmd_createsubcategorysamelevel') . "</a> | <a onclick=\"categoryActionListener.showSubMenu(" . SMW_OB_COMMAND_CATEGORY_RENAME . ")\">" . wfMsg('smw_ob_cmd_renamecategory') . "</a><div id=\"categoryTreeMenu\"></div></span>\r\n\t\t\t<span style=\"display:none;\" class=\"menuBar menuBarTree menuBarpropertyTree\" id=\"menuBarpropertyTree\"><a onclick=\"propertyActionListener.showSubMenu(" . SMW_OB_COMMAND_ADDSUBPROPERTY . ")\">" . wfMsg('smw_ob_cmd_createsubproperty') . "</a> | <a onclick=\"propertyActionListener.showSubMenu(" . SMW_OB_COMMAND_ADDSUBPROPERTY_SAMELEVEL . ")\">" . wfMsg('smw_ob_cmd_createsubpropertysamelevel') . "</a> | <a onclick=\"propertyActionListener.showSubMenu(" . SMW_OB_COMMAND_PROPERTY_RENAME . ")\">" . wfMsg('smw_ob_cmd_renameproperty') . "</a><div id=\"propertyTreeMenu\"></div></span>";
            $html .= $menu;
        }
        // add containers
        $html .= "<div id=\"categoryTree\" class=\"categoryTreeColors treeContainer\">\r\n\t\t   </div>\t\t\r\n\t\t   <div id=\"propertyTree\" style=\"display:none\" class=\"propertyTreeListColors treeContainer\">\r\n\t\t   </div>";
        $html .= $treeContainer;
        $html .= "<span class=\"OB-filters\"><span>" . wfMsg('smw_ob_filter') . "</span><input type=\"text\" id=\"treeFilter\"><button type=\"button\" name=\"filterCategories\" onclick=\"globalActionListener.filterTree(event)\">" . wfMsg('smw_ob_filter') . "</button></span>\r\n\t\t</div>\r\n\t\t\r\n\t\t<!-- Attribute Tree hook -->\r\n\t\t\t\t\r\n\t\t<div id=\"leftArrow\" class=\"pfeil\">\r\n\t\t\t<img src=\"{$wgScriptPath}/extensions/SMWHalo/skins/OntologyBrowser/images/bigarrow.gif\" onclick=\"globalActionListener.toogleCatInstArrow(event)\" />\r\n\t\t</div>";
        $html .= $boxContainer;
        $html .= "<!-- Instance List hook -->\t\r\n\t\t<div id=\"instanceContainer\">\r\n\t\t  <span class=\"OB-header\"><img style=\"margin-bottom: -3px\" src=\"{$wgScriptPath}/extensions/SMWHalo/skins/instance.gif\"></img> " . wfMsg('smw_ob_instanceList') . "</span>\r\n\t\t  " . ($showMenuBar ? "<span class=\"menuBar menuBarInstance\" id=\"menuBarInstance\"><a onclick=\"instanceActionListener.showSubMenu(" . SMW_OB_COMMAND_INSTANCE_RENAME . ")\">" . wfMsg('smw_ob_cmd_renameinstance') . "</a> | <a onclick=\"instanceActionListener.showSubMenu(" . SMW_OB_COMMAND_INSTANCE_DELETE . ")\">" . wfMsg('smw_ob_cmd_deleteinstance') . "</a><div id=\"instanceListMenu\"></div></span>" : "") . "\t\t\t\r\n\t\t  <div id=\"instanceList\" class=\"instanceListColors\">\r\n\t\t  </div>\r\n\t\t  <span class=\"OB-filters\"><span>" . wfMsg('smw_ob_filter') . "</span><input type=\"text\" id=\"instanceFilter\"><button type=\"button\" name=\"filterInstances\" onclick=\"globalActionListener.filterInstances(event)\">" . wfMsg('smw_ob_filter') . "</button></span>\r\n\t\t</div>\r\n\t\t\t\r\n\t\t<div id=\"rightArrow\" class=\"pfeil\">\r\n\t\t\t<img src=\"{$wgScriptPath}/extensions/SMWHalo/skins/OntologyBrowser/images/bigarrow.gif\" onclick=\"globalActionListener.toogleInstPropArrow(event)\" />\r\n\t\t</div>\r\n\t\t\t\t\r\n\t\t<!-- Relation/Attribute Annotation level hook -->\r\n\t\t<div id=\"relattributesContainer\"><span class=\"OB-header\">\r\n\t\t\t<span><img style=\"margin-bottom: -3px\" src=\"{$wgScriptPath}/extensions/SMWHalo/skins/property.gif\"></img> " . wfMsg('smw_ob_att') . "</span>\r\n\t\t\t<span id=\"relattValues\">" . wfMsg('smw_ob_relattValues') . "</span><span id=\"relattRangeType\" style=\"display:none;\">" . wfMsg('smw_ob_relattRangeType') . "</span></span>\r\n\t\t\t" . ($showMenuBar ? "<span class=\"menuBar menuBarProperties\" id=\"menuBarProperties\"><a onclick=\"schemaActionPropertyListener.showSubMenu(" . SMW_OB_COMMAND_ADD_SCHEMAPROPERTY . ")\">" . wfMsg('smw_ob_cmd_addpropertytodomain') . "<span id=\"currentSelectedCategory\">...</span></a><div id=\"schemaPropertiesMenu\"></div></span>" : "") . "\t\r\n\t\t\t<div id=\"relattributes\" class=\"propertyTreeListColors\"></div>\r\n\t\t\t<span class=\"OB-filters\"><span>" . wfMsg('smw_ob_filter') . "</span><input type=\"text\" size=\"22\" id=\"propertyFilter\"><button type=\"button\" name=\"filterProperties\" onclick=\"globalActionListener.filterProperties(event)\">" . wfMsg('smw_ob_filter') . "</button></span>\t\t\r\n\t\t</div>\t\t\r\n\t\t<div id=\"OB-filters\">\r\n\t\t\t" . "" . "\r\n\t\t</div>" . "<div id=\"OB-footer\">" . wfMsg('smw_ob_footer') . "\r\n\t\t\t\r\n\t\t</div>\r\n\t\t</div>\r\n\t\t";
        $wgOut->addHTML($html);
    }
示例#2
0
 public function addWSAsDataSource($wsId)
 {
     if (defined('LOD_LINKEDDATA_VERSION')) {
         global $IP;
         $this->removeWSFromDataSourceInformationGraph($wsId);
         //require_once($IP."/extensions/LinkedData/storage/TripleStore/LOD_PersistentTripleStoreAccess.php");
         //require_once($IP."/extensions/LinkedData/storage/TripleStore/LOD_Triple.php");
         $tsA = new LODPersistentTripleStoreAccess(true);
         $lAS = LODAdministrationStore::getInstance();
         $tsA->createGraph($lAS->getSMWGraphsURI() . 'DataSourceInformationGraph');
         $tsA->addPrefixes(TSNamespaces::getAllPrefixes());
         $tsA->addPrefixes(LODAdministrationStore::getInstance()->getSourceDefinitionPrefixes());
         $triples = array();
         $triples[] = new LODTriple($this->getDataSourceURI("WS_" . $wsId), "rdf:type", "smw-lde:Datasource", "__objectURI");
         $triples[] = new LODTriple($this->getDataSourceURI("WS_" . $wsId), "smw-lde:label", Title::newFromID($wsId)->getFullText(), "xsd:string");
         $triples[] = new LODTriple($this->getDataSourceURI("WS_" . $wsId), "smw-lde:ID", Title::newFromID($wsId)->getFullText(), "xsd:string");
         //todo: deal with persistency id=wsid
         $tsA->insertTriples($lAS->getSMWGraphsURI() . 'DataSourceInformationGraph', $triples);
         $tsA->flushCommands('di_ws', $wsId . '_dsinfo');
     }
 }