protege icon indicating copy to clipboard operation
protege copied to clipboard

Protege Mac content negotiation

Open rapw3k opened this issue 4 years ago • 2 comments

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 :

  • curl -v -X GET https://w3id.org/demeter/agri
  • curl -v -X GET -H "Accept: text/turtle" https://w3id.org/demeter/agri send me correctly to: ...."the answer to your request is located here...."

so, how protege tries to open?

rapw3k avatar Aug 24 '20 07:08 rapw3k

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 avatar Aug 24 '20 08:08 rapw3k

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]

rapw3k avatar Sep 02 '20 09:09 rapw3k