protegeproject / protege

Protege Desktop
http://protege.stanford.edu
Other
1.01k stars 231 forks source link

Protege Mac content negotiation #973

Open rapw3k opened 4 years ago

rapw3k commented 4 years ago

Hi, I have been trying to provide proper responses for protege to open ontology via URI but is not working. URI: https://w3id.org/demeter/agri

First I defined rule for request header text/turtle and default to the html URL but didnt work. Now I am doing reverse (default the turtle) as shown below and still Protege cannot open the ontology (tries to open the HTML link).

RewriteCond %{HTTP_ACCEPT} text/html RewriteRule ^agri$ https://defs-dev.opengis.net/def/schema/demeter_aim [R=303,L] RewriteRule ^agri$ https://raw.githubusercontent.com/rapw3k/DEMETER/master/models/demeterAgriProfile.ttl [R=303,L]

Doing via curl :

so, how protege tries to open?

rapw3k commented 4 years ago

I logged the requests from Protege (mac v5.5.0). It tries multiple times using two different requests, with the headers below. So, no turtle is even considered, and it seems text/html has higher weight than text/turtle. So is there any way to change this behaviour ?

accept: 'application/rdf+xml, application/xml; q=0.7, text/xml; q=0.6, text/plain; q=0.1, /; q=0.09', 'accept-encoding': 'xz,gzip,deflate', 'user-agent': 'Java/1.8.0_121'

accept: 'text/html, image/gif, image/jpeg, ; q=.2, /*; q=.2',

rapw3k commented 4 years ago

I had to make rdf/xml version, and created the following rules, to make it work (open from protege). Obviously is not very nice to be forced to make (and maintain) another serialisation just to be able to open it via Protege. So again, is there any way to change the Protege behaviour to consider turtle ?

RewriteCond %{HTTP_ACCEPT} text/html RewriteRule ^agri$ https://defs-dev.opengis.net/def/w3id.org/demeter/agri [R=303,L] RewriteCond %{HTTP_ACCEPT} ^.application/rdf+xml. RewriteRule ^agri$ https://raw.githubusercontent.com/rapw3k/DEMETER/master/models/demeterAgriProfile.rdf [R=303,L] RewriteRule ^agri$ https://raw.githubusercontent.com/rapw3k/DEMETER/master/models/demeterAgriProfile.ttl [R=303,L]