geovistory / ontome

https://ontome.net
MIT License
6 stars 0 forks source link

Namespace resolves to OWL/Identification page #152

Closed rnsrk closed 8 months ago

rnsrk commented 8 months ago

Problem description / use case OntoME ontologies are given an internal namespace, i.e. https://ontome.net/ns/xyz/. Currently this IRI resolves to an error page (Oops! An Error Occurred. The server returned a "404 Not Found".)

Functional Requirements It would be nice if this name resolved to the OWL file, to use direct imports in OWL. It would be even better if OntoME reads the User-Agent header in the request and recognises whether it is a browser access, then refers to the Indentification Page, otherwise to the OWL file.

Technical Specification You could do something like that:

<?php
$user_agent = $_SERVER['HTTP_USER_AGENT'];

if (strpos($user_agent, 'Firefox') !== false || 
    strpos($user_agent, 'Chrome') !== false || 
    strpos($user_agent, 'Safari') !== false ||
    strpos($user_agent, 'MSIE') !== false ||
    strpos($user_agent, 'Trident') !== false ) {
    // send the HTML version
    header('Content-Type: text/html');
    header('Content-Disposition: attachment; filename="file.html"');
    readfile('/path/to/your/file.html');
    exit;
} else {
    // send the OWL file
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="file.owl"');
    readfile('/path/to/your/file.owl');
    exit;
}
?>
valamercery commented 8 months ago

Thanks for your feedback, this issue has been transferred to the Geovistory discussion section: https://github.com/orgs/geovistory/discussions/21