Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nmrCV IRI Unable to open the page (404 Error) #23

Open
Tracked by #42
bhavin2897 opened this issue May 2, 2024 · 4 comments
Open
Tracked by #42

nmrCV IRI Unable to open the page (404 Error) #23

bhavin2897 opened this issue May 2, 2024 · 4 comments
Labels
discussion This issue still needs discussion before resolving

Comments

@bhavin2897
Copy link

Encountering an issue accessing the webpage located of all "http://nmrml.org/nmrCV#".

Attempts to open the page result in a failure to fetch the URL. This problem is seen regardless of the browser or network used, suggesting a potential server or configuration issue.

Thank you.

Example:
Nuclear Magnetic Resonance CV
IRI : http://nmrml.org/nmrCV#NMR:1400014
Term ID : NMR:1400014
Label/Name: NMR probe

@sneumann
Copy link
Member

sneumann commented May 7, 2024

Hi, thanks for reporting that's a known issue, and I appreciate help on the following topic:

The website is hosted via github pages https://github.com/nmrML/nmrML/tree/gh-pages
=> how would I make the URL http://nmrml.org/nmrCV#NMR:1400014 resolveable ? Do we need to create a HTML file /nmrCV ?
Should that redirect to the nmrCV ? E.g. http://nmrml.org/cv/v1.1.0/nmrCV.owl ?
Yours, Steffen

@StroemPhi
Copy link
Contributor

The above-linked PR addresses this a little bit, by adding metadata to the nmrCV.owl which would at least be a resolvable link to the current d/l location of nmrCV.owl (v1.1).

Making the ontology IRI resolvable according to Perplexity

To configure your web server to redirect requests from http://nmrML.org/nmrCV to http://nmrml.org/cv/nmrCV.owl, you can use either Apache or Nginx web servers. Below are the steps for both configurations:

Apache Configuration

  1. Enable mod_alias Module:
    Ensure that the mod_alias module is enabled. This module is typically enabled by default in Apache installations.

  2. Edit the Virtual Host Configuration:
    Open the Apache configuration file for your site. This file is usually located in /etc/apache2/sites-available/ and might be named something like 000-default.conf.

    sudo nano /etc/apache2/sites-available/000-default.conf
  3. Add the Redirect Directive:
    Add the following lines to redirect requests from http://nmrML.org/nmrCV to http://nmrml.org/cv/nmrCV.owl:

    <VirtualHost *:80>
        ServerName nmrML.org
        Redirect permanent /nmrCV http://nmrml.org/cv/nmrCV.owl
    </VirtualHost>
  4. Save and Close the File:
    Save the changes and close the text editor.

  5. Restart Apache:
    Restart the Apache service to apply the changes.

    sudo systemctl restart apache2

Nginx Configuration

  1. Edit the Server Block Configuration:
    Open the Nginx configuration file for your site. This file is usually located in /etc/nginx/sites-available/ and might be named something like default.

    sudo nano /etc/nginx/sites-available/default
  2. Add the Redirect Directive:
    Add the following lines to redirect requests from http://nmrML.org/nmrCV to http://nmrml.org/cv/nmrCV.owl:

    server {
        listen 80;
        server_name nmrML.org;
    
        location /nmrCV {
            return 301 http://nmrml.org/cv/nmrCV.owl;
        }
    }
  3. Save and Close the File:
    Save the changes and close the text editor.

  4. Test the Configuration:
    Test the Nginx configuration to ensure there are no syntax errors.

    sudo nginx -t
  5. Restart Nginx:
    Restart the Nginx service to apply the changes.

    sudo systemctl restart nginx

By following these steps, you will configure your web server to redirect requests from http://nmrML.org/nmrCV to the actual path of the file http://nmrml.org/cv/nmrCV.owl[6][7][8].

Citations:
[1] https://stackoverflow.com/questions/15111754/hosting-an-owl-ontology-on-the-web-to-work-with-apache-stanbol
[2] https://docs.logowl.io/docs/how-to-self-host-log-owl
[3] https://mmisw.org/orrdoc/ontology/new/
[4] https://www.digitalocean.com/community/tutorials/how-to-create-temporary-and-permanent-redirects-with-apache-and-nginx
[5] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
[6] https://www.w3.org/2001/sw/BestPractices/VM/http-examples/2005-11-18/
[7] https://github.com/VisualDataWeb/WebVOWL
[8] https://httpd.apache.org/docs/current/rewrite/remapping.html
[9] http://nmrml.org/cv/nmrCV.owl
[10] http://nmrml.org/nmrCV

Term IRI resolvable fix according to Perplexity

To configure your server to handle term IRIs with the namespace http://nmrML.org/nmrCV# and implement content negotiation, you'll need to set up more advanced redirection rules. This can be achieved using Apache's mod_rewrite module or Nginx's rewrite rules. Here's how you can configure both servers:

Apache Configuration

  1. Enable the necessary modules:

    sudo a2enmod rewrite
    sudo a2enmod headers
    
  2. Edit your Apache configuration file (e.g., /etc/apache2/sites-available/000-default.conf):

    <VirtualHost *:80>
        ServerName nmrML.org
        
        RewriteEngine On
        
        # Redirect /nmrCV to the OWL file
        RewriteRule ^/nmrCV$ /cv/nmrCV.owl [R=301,L]
        
        # Handle term IRIs
        RewriteCond %{HTTP_ACCEPT} text/html [OR]
        RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml
        RewriteRule ^/nmrCV#(.*)$ https://terminology.nfdi4chem.de/ts/ontologies/nmrcv/terms?iri=http%3A%2F%2FnmrML.org%2FnmrCV%23$1 [R=303,L]
        
        RewriteCond %{HTTP_ACCEPT} application/rdf\+xml [OR]
        RewriteCond %{HTTP_ACCEPT} application/owl\+xml
        RewriteRule ^/nmrCV#(.*)$ /cv/nmrCV.owl [R=303,L]
        
        # Default to HTML representation
        RewriteRule ^/nmrCV#(.*)$ https://terminology.nfdi4chem.de/ts/ontologies/nmrcv/terms?iri=http%3A%2F%2FnmrML.org%2FnmrCV%23$1 [R=303,L]
    </VirtualHost>
  3. Restart Apache:

    sudo systemctl restart apache2
    

Nginx Configuration

  1. Edit your Nginx configuration file (e.g., /etc/nginx/sites-available/default):

    server {
        listen 80;
        server_name nmrML.org;
        
        # Redirect /nmrCV to the OWL file
        location = /nmrCV {
            return 301 /cv/nmrCV.owl;
        }
        
        # Handle term IRIs
        location ~ ^/nmrCV#(.*)$ {
            if ($http_accept ~* "text/html|application/xhtml\+xml") {
                return 303 "https://terminology.nfdi4chem.de/ts/ontologies/nmrcv/terms?iri=http%3A%2F%2FnmrML.org%2FnmrCV%23$1";
            }
            
            if ($http_accept ~* "application/rdf\+xml|application/owl\+xml") {
                return 303 /cv/nmrCV.owl;
            }
            
            # Default to HTML representation
            return 303 "https://terminology.nfdi4chem.de/ts/ontologies/nmrcv/terms?iri=http%3A%2F%2FnmrML.org%2FnmrCV%23$1";
        }
    }
  2. Test the configuration and restart Nginx:

    sudo nginx -t
    sudo systemctl restart nginx
    

These configurations will:

  1. Redirect http://nmrML.org/nmrCV to the OWL file.
  2. For term IRIs (e.g., http://nmrML.org/nmrCV#SomeTermIRI):
    • Redirect HTML requests to the terminology.nfdi4chem.de URL.
    • Redirect RDF/XML requests to the source OWL file.
    • Default to the HTML representation for other content types.

Note that these configurations assume that:

  • The OWL file is located at /cv/nmrCV.owl on your server.
  • You want to use 303 redirects for content negotiation, which is a common practice for Linked Data.

Remember to adjust paths and URLs as necessary to match your specific setup. Also, ensure that your server is properly configured to handle HTTPS if you're redirecting to an HTTPS URL.

Citations:
[1] http://nmrml.org/nmrCV

@sneumann
Copy link
Member

sneumann commented Aug 7, 2024

Hi, @NRayya and @CS76 are also interested.
So, http://nmrml.org/ is served via GitHub pages. That means, the above Apache and NGinx fixes don't apply, unless we setup web servers for that. But we can place whatever files on nmrml.org as we want. So which do we need ?
http://nmrml.org/nmrCV#NMR:1400014 would resolve as soon as we have a file nmrCV in https://github.com/nmrML/nmrCV/tree/gh-pages
What's missing is something sensible with the #NMR:1400014 part. So we could deploy a HTML-ified version of nmrCV.owl that has the <a name="#NMR:1400014"> tag. This html would require automatic updates (e.g. via GitHub actions) for every commit of nmrCV.owl.
Unless we do some github pages redirect magic possibly described here: https://theorangeone.net/posts/redirecting-static-pages/ , but again I am unsure if that would carry the #NMR:1400014 part to the new location.
Yours, Steffen

@sneumann
Copy link
Member

sneumann commented Aug 7, 2024

I had the liberty to create the file I suggested above. Now it is better than 404: One now gets (the same) output when accessing the IRI:

$ curl  "http://nmrml.org/nmrCV#NMR:1400014"
# nmrCV Terminology

Please find the nmrCV at http://nmrml.org/cv/v1.1.0/nmrCV.owl

but, the response is served as Content-Type: application/octet-stream, which means a browser will (once it is done complaining about http) then download the file instead of viewing it. Without file extension, there is no way to have it displayed/interpreted as HTML, which would be required for the above redirecting-static-pages approach.

Then I tried to have the HTML page http://nmrml.org/nmrCV.html#NMR:1400014 which now works,
and created a symbolic link to that HTML as http://nmrml.org/nmrCV#NMR:1400014
in https://github.com/nmrML/nmrML/tree/gh-pages,
which indeed returns the content of the HTML file, but still due to the missing filename extension served as application/octet-stream.

Not yet perfect, I guess. Suggestions ? Yours, Steffen

@NRayya NRayya mentioned this issue Sep 3, 2024
4 tasks
@NRayya NRayya added the discussion This issue still needs discussion before resolving label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion This issue still needs discussion before resolving
Projects
None yet
Development

No branches or pull requests

4 participants