I am loading model in apache jena using function FileManager.get().loadModel(url).And I also know that there may be some URLs in HTTP Response Link Header .I want to load model also from the links(URLs) in link header.How to do that ? Is there any inbuilt fuctionality to get access to header and process link header in Response header?
-
"sparql" tag removed. Not relevant to the question. – AndyS Aug 21 '16 at 15:53
2 Answers
FileManager.get().loadModel(url)
packages up reading a URL and parsing the results into a model. It is packing up a common thing to do; it is not claiming to be comprehensive. It is quite an old interface.
If you wanted detailed control over the HTTP handling, see if HttpOp (a lower level) mechanism helps, otherwise do the handling in the application and hand the input stream for the response directly to the parser.
You may also find it useful to look at the code in RDFDataMgr.process
for help with content negotiation.

- 16,345
- 17
- 21
I don't think that this is supported by Jena. I don't see any reason in doing so. The HTTP request is done to get the data and maybe also to get the response type. If you want to get the URLs in some header fields, why not simply use plain old Java:
URL url = new URL("http://your_ontology.owl");
URLConnection conn = url.openConnection();
Map<String, List<String>> map = conn.getHeaderFields();

- 8,397
- 1
- 14
- 23
-
That means I am calling same URL two times .First when I am loading model through URL and Second for getting Headers. – Badman Aug 21 '16 at 11:32
-
@Badman I think AKSW implicitly was saying that you can then use the `conn.getContent` to get the RDF content as well, which you can load into Jena, so that you're only connecting once. – Joshua Taylor Aug 26 '16 at 12:40
-
@JoshuaTaylor I am able to do that by using HttpGet but I am trying to avoid that .I want to do that with HttpOp.java in apache jena . I am want to know how and what exactly HttpContext , HttpAuthenticator ,HttpClient do in execHttpGet() function in HttpOp.java? – Badman Aug 31 '16 at 06:01