Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Direct look-up of resources with urlencoded URIs does not work #145

Closed
frodeseverin opened this issue Oct 11, 2012 · 4 comments
Closed

Direct look-up of resources with urlencoded URIs does not work #145

frodeseverin opened this issue Oct 11, 2012 · 4 comments

Comments

@frodeseverin
Copy link
Contributor

I have the following URIs in my KB:

The first one works with fine in OntoWiki, the second does not, but rather produces the error message:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OntoWiki Error</title>
<style type="text/css">
body {
    font-family: sans-serif;
    line-height: 1.5;
    background-color: #eff9ff;
}

.info {
    margin: 0.5% 10%;
    border: 1px solid #aaa;
    padding: 1%;
    background-color: #f9f9f9;
}

.error {
    margin: 0.5% 10%;
    border: 1px solid #f00;
    padding: 1%;
    background-color: #fcc;
}
</style>
</head>
<body>
<div class="error">
<h1>OntoWiki Error</h1>
<details>
<summary>Invalid controller specified (data)</summary>
<p><code>Zend_Controller_Dispatcher_Exception</code></p>

<p>
<code>/usr/local/ontowiki/libraries/Zend/Controller/Dispatcher/Standard.php@248</code>
<br/ ><code>#0: Zend_Controller_Dispatcher_Standard->dispatch@/usr/local/ontowiki/libraries/Zend/Controller/Front.php:954<br />#1: Zend_Controller_Front->dispatch@/usr/local/ontowiki/libraries/Zend/Application/Bootstrap/Bootstrap.php:97<br />#2: Zend_Application_Bootstrap_Bootstrap->run@/usr/local/ontowiki/libraries/Zend/Application.php:366<br />#3: Zend_Application->run@/usr/local/ontowiki/index.php:179<br /></code>
</p>
</details>
<p>
<a href="http://data.bbib.no/">home</a>
</p>
</div>
</body>
</html>

If I try to open http://data.bbib.no/data/Emmerich_K%C3%A1lm%C3%A1n with lynx I get a HTTP 404: Not found warning, and then I am redirected to the above error page.

Headers from cURL invocation:

Dvorak:

curl -LIN "http://data.bbib.no/data/Antonin_Dvorak"
HTTP/1.1 302 Moved Temporarily
Server: nginx/0.7.65
Date: Thu, 11 Oct 2012 12:12:14 GMT
Content-Type: text/html
Connection: keep-alive
X-Powered-By: PHP/5.3.2-1ubuntu4.18
Set-Cookie: PHPSESSID=88cs64i597n66tqft5996eddc3; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Access-Control-Allow-Origin: "*"
X-Pingback: http://data.bbib.no/pingback/ping/
Location: http://data.bbib.no/view/?r=http%3A%2F%2Fdata.bbib.no%2Fdata%2FAntonin_Dvorak&m=http%3A%2F%2Fdata.bbib.no%2Fdata%2F

HTTP/1.1 200 OK
Server: nginx/0.7.65
Date: Thu, 11 Oct 2012 12:12:14 GMT
Content-Type: text/html
Connection: keep-alive
X-Powered-By: PHP/5.3.2-1ubuntu4.18
Set-Cookie: PHPSESSID=fnpe7uoc567aqsbahtq0g7gva0; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Access-Control-Allow-Origin: "*"
X-Pingback: http://data.bbib.no/pingback/ping/
Last-Modified: Wed, 10 Oct 2012 13:36:21 +0200

Emmerich Kálmán:

curl -LIN "http://data.bbib.no/data/Emmerich_K%C3%A1lm%C3%A1n"
HTTP/1.1 404 Not Found
Server: nginx/0.7.65
Date: Thu, 11 Oct 2012 12:15:29 GMT
Content-Type: text/html
Connection: keep-alive
X-Powered-By: PHP/5.3.2-1ubuntu4.18
Set-Cookie: PHPSESSID=acrao0n50tnvgk25vdcdsfoen2; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Access-Control-Allow-Origin: "*"

A working URL to confirm that the resource for Emmerich Kálmán is indeed in the KB:
http://data.bbib.no/resource/properties/?r=http%3A%2F%2Fdata.bbib.no%2Fdata%2FEmmerich_K%25C3%25A1lm%25C3%25A1n&m=http%3A%2F%2Fdata.bbib.no%2Fdata%2F

Nginx configuration:

server {
    listen   80; ## listen for ipv4; this line is default and implied
    #listen 8080; ## Second webserver
    #listen   [::]:80 default ipv6only=on; ## listen for ipv6

    # Set max body size (i.e. value of 'Content-Length' HTTP header).
    # Limits e.g. upload filesize
#    client_max_body_size 2G;

    ## path to ontowiki
    # !!! please adopt to fit your needs !!!
    root /usr/local/ontowiki; 

    index index.php;

    # where the logs should go
    # !!! you can also adopt this as you want !!!
#    error_log /var/log/nginx/error.log;


    # Make site accessible from given hostname
    server_name data.bbib.no;

    # Zugriff auf sensible Dateien verwehren
    location ~ (\.inc\.php|\.tpl|\.sql|\.tpl\.php|\.db|\.ini)$ {
        deny all;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny all;
    }

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to index.html
        try_files $uri $uri/ /index.php;
    }

    # Rewrite for favicon
    rewrite ^/favicon\.(.*)$ /application/favicon.$1 break;

    # Die eigentliche RewriteRule für das Zend Framework
    set $is_image "f";

    if ($request_filename ~ ((extensions|libraries).*|\.(js|ico|gif|jpg|png|css|php|swf|json))$) {
        set $is_image "t";
    }

    # rewrite all other URLs to index.php
    if ($is_image = "f") {
        rewrite ^.*$ /index.php last;
    }    

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    # Rather use UNIX Socket /tmp/php-fastcgi
    #
    location ~ \.php(.*)$ {
    #    fastcgi_pass 127.0.0.1:9000;

        rewrite ^.*$ /index.php break;

        include fastcgi_params;
        fastcgi_pass unix:/tmp/php-fastcgi;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_script_name;

        # tell OntoWiki that rewrite is enabled
        fastcgi_param ONTOWIKI_APACHE_MOD_REWRITE_ENABLED 1;
    }
}

Hmm ...

@frodeseverin
Copy link
Contributor Author

As noted in #145, direct lookup of URI's with international characters, i.e. containing urlencoded strings, does not work.

Further investigation into the matter, as detailed in AKSW/RDFauthor#15, revealed that viewing these URI's from within OntoWiki is also problematic.

Example:
http://data.bbib.no/view/r/Nordahl_Grieg
has the property
frbr:creatorOf http://data.bbib.no/data/Ung%20m%C3%A5%20verden%20ennu%20v%C3%A6re%20%3A%20roman
which in turn has the property
rdfs:label "Ung må verden ennu være : roman"

However, it seems that the URI is urlencoded twice, at least partially. When I paste
http://data.bbib.no/data/Ung%20m%C3%A5%20verden%20ennu%20v%C3%A6re%20%3A%20roman
into the View Resource box of OntoWiki and hit the button, I am directed to this URL:
http://data.bbib.no/resource/properties?r=http%3A%2F%2Fdata.bbib.no%2Fdata%2FUng%2520m%25C3%25A5%2520verden%2520ennu%2520v%25C3%25A6re%2520%253A%2520roman
The source for this resource

<http://data.bbib.no/data/Ung%20m%C3%A5%20verden%20ennu%20v%C3%A6re%20%3A%20roman> rdfs:label "Ung må verden ennu være : roman" .

is correct, but the URL in the address bar is not, thus causing problems in the OntoWiki interface. The URL that appears in the address bar of the browser when clicking on the label "Ung må verden ennu være : roman" in the OntoWiki resource view
http://data.bbib.no/data/Nordahl_Grieg
is
http://data.bbib.no/view/r/Ung%2520m%25C3%25A5%2520verden%2520ennu%2520v%25C3%25A6re%2520%253A%2520roman
which is yet different, and now produces the error message

OntoWiki Error

Supplied resource <http://data.bbib.no/data/Ung må verden ennu være : roman> is not a valid URI.
OntoWiki_Model_Exception

/usr/local/ontowiki/application/classes/OntoWiki/Model/TitleHelper.php@201 
#0: OntoWiki_Model_TitleHelper->addResource@/usr/local/ontowiki/application/classes/OntoWiki/Resource.php:53
#1: OntoWiki_Resource->getTitle@/usr/local/ontowiki/application/classes/OntoWiki/Controller/Base.php:144
#2: OntoWiki_Controller_Base->init@/usr/local/ontowiki/libraries/Zend/Controller/Action.php:133
#3: Zend_Controller_Action->__construct@/usr/local/ontowiki/libraries/Zend/Controller/Dispatcher/Standard.php:268
#4: Zend_Controller_Dispatcher_Standard->dispatch@/usr/local/ontowiki/libraries/Zend/Controller/Front.php:954
#5: Zend_Controller_Front->dispatch@/usr/local/ontowiki/libraries/Zend/Application/Bootstrap/Bootstrap.php:97
#6: Zend_Application_Bootstrap_Bootstrap->run@/usr/local/ontowiki/libraries/Zend/Application.php:366
#7: Zend_Application->run@/usr/local/ontowiki/index.php:179

back  home
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OntoWiki Error</title>
<style type="text/css">
body {
    font-family: sans-serif;
    line-height: 1.5;
    background-color: #eff9ff;
}

.info {
    margin: 0.5% 10%;
    border: 1px solid #aaa;
    padding: 1%;
    background-color: #f9f9f9;
}

.error {
    margin: 0.5% 10%;
    border: 1px solid #f00;
    padding: 1%;
    background-color: #fcc;
}
</style>
</head>
<body>
<div class="error">
<h1>OntoWiki Error</h1>
<details>
<summary>Supplied resource &lt;http://data.bbib.no/data/Ung m&Atilde;&yen; verden ennu v&Atilde;&brvbar;re : roman&gt; is not a valid URI.</summary>
<p><code>OntoWiki_Model_Exception</code></p>
<p>
<code>/usr/local/ontowiki/application/classes/OntoWiki/Model/TitleHelper.php@201</code>
<br/ ><code>#0: OntoWiki_Model_TitleHelper->addResource@/usr/local/ontowiki/application/classes/OntoWiki/Resource.php:53<br />#1: OntoWiki_Resource->getTitle@/usr/local/ontowiki/application/classes/OntoWiki/Controller/Base.php:144<br />#2: OntoWiki_Controller_Base->init@/usr/local/ontowiki/libraries/Zend/Controller/Action.php:133<br />#3: Zend_Controller_Action->__construct@/usr/local/ontowiki/libraries/Zend/Controller/Dispatcher/Standard.php:268<br />#4: Zend_Controller_Dispatcher_Standard->dispatch@/usr/local/ontowiki/libraries/Zend/Controller/Front.php:954<br />#5: Zend_Controller_Front->dispatch@/usr/local/ontowiki/libraries/Zend/Application/Bootstrap/Bootstrap.php:97<br />#6: Zend_Application_Bootstrap_Bootstrap->run@/usr/local/ontowiki/libraries/Zend/Application.php:366<br />#7: Zend_Application->run@/usr/local/ontowiki/index.php:179<br /></code>
</p>
</details>
<p>
     <a href="http://data.bbib.no/view/r/Nordahl_Grieg">back</a>&nbsp;
<a href="http://data.bbib.no/">home</a>
</p>
</div>
</body>
</html>

;)Frode

@frodeseverin
Copy link
Contributor Author

Interestingly, links to exsternal IRI's seems to be handled differently, albeit still wrong.

I added

@base <http://data.bbib.no/data/> .
<Nordahl_Grieg>  m:plays <http://data.bbib.no/data/husvask%20er%20fint>,
    <http://data.bergenbibliotek.no/data/husvask%20er%20fint> .

to my knowledge base by way of the

Now, following the first of these links in OntoWiki points my browser to
http://data.bbib.no/view/r/husvask%2520er%2520fint
which renders the said error message

OntoWiki Error

Supplied resource <http://data.bbib.no/data/husvask er fint> is not a valid URI.
OntoWiki_Model_Exception

/usr/local/ontowiki/application/classes/OntoWiki/Model/TitleHelper.php@201 
#0: OntoWiki_Model_TitleHelper->addResource@/usr/local/ontowiki/application/classes/OntoWiki/Resource.php:53
#1: OntoWiki_Resource->getTitle@/usr/local/ontowiki/application/classes/OntoWiki/Controller/Base.php:144
#2: OntoWiki_Controller_Base->init@/usr/local/ontowiki/libraries/Zend/Controller/Action.php:133
#3: Zend_Controller_Action->__construct@/usr/local/ontowiki/libraries/Zend/Controller/Dispatcher/Standard.php:268
#4: Zend_Controller_Dispatcher_Standard->dispatch@/usr/local/ontowiki/libraries/Zend/Controller/Front.php:954
#5: Zend_Controller_Front->dispatch@/usr/local/ontowiki/libraries/Zend/Application/Bootstrap/Bootstrap.php:97
#6: Zend_Application_Bootstrap_Bootstrap->run@/usr/local/ontowiki/libraries/Zend/Application.php:366
#7: Zend_Application->run@/usr/local/ontowiki/index.php:179

back  home

However, following the latter of the two links lands my browser at
http://data.bbib.no/view/?r=http%3A%2F%2Fdata.bergenbibliotek.no%2Fdata%2Fhusvask%2520er%2520fint

;)Frode

@frodeseverin
Copy link
Contributor Author

To actually see what is represented at the different URL's you'd have to instantiate the model for your browser by visiting http://data.bbib.no/ once prior to following the links.

This situation is due to some strange behaviour of the DefaultModel extention, possibly misconfiguration on my part.

;)Frode

@white-gecko
Copy link
Member

This issue is also in AKSW/Erfurt#59

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants