bkaempgen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/69402


Change subject: * Patch by Sebastian Richer  Change-Id: 
I3ba6af3fb9485b0baa1851404161b29345b7e13d
......................................................................

* Patch by Sebastian Richer
 Change-Id: I3ba6af3fb9485b0baa1851404161b29345b7e13d

Change-Id: I3ba6af3fb9485b0baa1851404161b29345b7e13d
---
M SemanticWebBrowser.php
M includes/SWB_Infolink.php
M specials/SearchTriple/SWB_SpecialBrowseWiki.php
3 files changed, 25 insertions(+), 8 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticWebBrowser 
refs/changes/02/69402/1

diff --git a/SemanticWebBrowser.php b/SemanticWebBrowser.php
index 450dbe5..7a194c0 100644
--- a/SemanticWebBrowser.php
+++ b/SemanticWebBrowser.php
@@ -57,7 +57,7 @@
 
 function swbfShowBrowseSemWeb( $skintemplate ) {
        if ( $skintemplate->data['isarticle'] ) {
-               $browselink = SWBInfolink::newBrowsingLink( wfMsg( 
'swb_browse_semantic_web' ),
+               $browselink = SWBInfolink::newBrowsingLink( wfMsg( 'browsewiki' 
),
                        $skintemplate->data['titleprefixeddbkey'], false );
                echo '<li id="t-smwbrowselink">' . $browselink->getHTML() . 
'</li>';
        }
diff --git a/includes/SWB_Infolink.php b/includes/SWB_Infolink.php
index 555639f..3ea76fe 100644
--- a/includes/SWB_Infolink.php
+++ b/includes/SWB_Infolink.php
@@ -19,7 +19,7 @@
                return new SWBInfolink(
                        true,
                        $caption,
-                       $wgContLang->getNsText( NS_SPECIAL ) . ':BrowseWiki',
+                       $wgContLang->getNsText( NS_SPECIAL ) . ':BrowseSW',
                        $style,
                        array( $titleText )
                );
diff --git a/specials/SearchTriple/SWB_SpecialBrowseWiki.php 
b/specials/SearchTriple/SWB_SpecialBrowseWiki.php
index 764f637..59e3e15 100644
--- a/specials/SearchTriple/SWB_SpecialBrowseWiki.php
+++ b/specials/SearchTriple/SWB_SpecialBrowseWiki.php
@@ -70,7 +70,7 @@
 
                // get the GET parameters
                $this->articletext = $wgRequest->getVal( 'article' );
-        $this->title = $wgOut->getTitle();          
+                $this->title = $wgOut->getTitle();          
                // no GET parameters? Then try the URL
                if ( $this->articletext == '' ) {
                        $params = SMWInfolink::decodeParameters( $query, false 
);
@@ -150,7 +150,7 @@
                                $info = parse_url($this->articletext);
                                (!isset( $info['scheme'])  ) ? $scheme   = "" : 
$scheme   = $info['scheme'];
                                // Info: In front of host, we had // before, 
but those seem not needed, any more.
-                //(!isset( $info['host'])    ) ? $host     = "" : $host     = 
"//".$info['host'];
+                                //(!isset( $info['host'])    ) ? $host     = 
"" : $host     = "//".$info['host'];
                                (!isset( $info['host'])    ) ? $host     = "" : 
$host     = $info['host'];
                                (!isset( $info['path'])    ) ? $path     = "" : 
$path     = $info['path'];
                                (!isset( $info['query'])   ) ? $query    = "" : 
$query    = $info['query'];
@@ -197,7 +197,8 @@
                $html .= $this->displaySemanticHead( $uri->getURI() );
                if ( $this->showoutgoing ) {
                         // should be: $data is of type SMWSemanticData
-                   $swdata = $this->getSemanticWebData( $graph, $uri->getURI() 
);
+                         
+                        $swdata = $this->getSemanticWebData( $graph, 
$uri->getURI() ); // %swData contains only DataItems
                        $html .= $this->displaySemanticWebData( $swdata, 
$leftside );
                        $html .= $this->displayCenter();
                }
@@ -353,7 +354,23 @@
                foreach ( $theOutgoingProperties as $outProp ) {
                        $outPropResult = $this->getArrayObjects( $graph, 
$theResource, $outProp );
                        // now, we have the subject, the property, the object 
(uri/literal)
-                       foreach ( $outPropResult as $outPropObject ) {
+                       
+                        // replace blacklisted rdf(s) and owl properties
+                        $uri_blacklist = explode("\n", 
wfMessage('smw_uri_blacklist')->inContentLanguage()->text());
+                        foreach ($uri_blacklist as $uri) {
+                            $uri = trim($uri);
+                            if ($uri == mb_substr($outProp, 0, 
mb_strlen($uri))) { // disallowed URI!
+                                if (strcmp($uri, 
"http://www.w3.org/1999/02/22-rdf-syntax-ns#";) == 0) {
+                                    $outProp = str_replace($uri, "rdf:", 
$outProp);
+                                } else if (strcmp($uri, 
"http://www.w3.org/2000/01/rdf-schema#";) == 0) {
+                                    $outProp = str_replace($uri, "rdfs:", 
$outProp);
+                                } else if (strcmp($uri, 
"http://www.w3.org/2002/07/owl#";) == 0) {
+                                    $outProp = str_replace($uri, "owl:", 
$outProp);
+                                }
+                            }
+                        }
+                        
+                        foreach ( $outPropResult as $outPropObject ) {
 
                                /*
                                 * The question now is, what kind of propert.
@@ -387,7 +404,7 @@
 
                                        if ( !isset( $uriPageName ) && 
$uriPageName == null ) {
                                                // URI value
-                                               $dataValue = 
SMWDataValueFactory::newTypeIDValue( '_rur', $outPropObject["value"], $property 
= $dataProperty );
+                                               $dataValue = 
SMWDataValueFactory::newTypeIDValue( '_uri', $outPropObject["value"], $property 
= $dataProperty );
                                        } else {
                                                $dataValue = 
SMWDataValueFactory::newTypeIDValue( '_wpg', $uriPageName, $property = 
$dataProperty );
                                        }
@@ -527,7 +544,7 @@
 
                        // Here, we only create typical property values.
                        $dvProperty = SMWDataValueFactory::newDataItemValue( 
$diProperty, null );
-
+                        
                        if ( $dvProperty->isVisible() ) {
                                $dvProperty->setCaption( 
$this->getPropertyLabel( $dvProperty, $incoming ) );
                                $proptext = $dvProperty->getShortHTMLText( 
smwfGetLinker() ) . "\n";

-- 
To view, visit https://gerrit.wikimedia.org/r/69402
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ba6af3fb9485b0baa1851404161b29345b7e13d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticWebBrowser
Gerrit-Branch: master
Gerrit-Owner: bkaempgen <benedikt.kaemp...@kit.edu>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to