You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Matúš Novotný <ma...@gmail.com> on 2012/04/12 21:26:51 UTC
problem reading RDF from URL
Hello,
I need to read an RDF file from
http://www.cidoc-crm.org/rdfs/cidoc-crm . It is "generic" link to
current version of ontology which I use. When I open it in web browser
I am automatically redirected to current version
(http://www.cidoc-crm.org/rdfs/5.0.4/cidoc-crm) but I don’t know how
to read my ontology from generic url:
http://www.cidoc-crm.org/rdfs/cidoc-crm in Java.
When I use url: http://www.cidoc-crm.org/rdfs/5.0.4/cidoc-crm in my
code everything goes fine but when I use generic url I get fallowing
exception: com.hp.hpl.jena.shared.JenaException:
org.xml.sax.SAXParseException: The element type "meta" must be
terminated by the matching end-tag "</meta>".
My code is very simple:
//Works:
//String path = "http://www.cidoc-crm.org/rdfs/5.0.4/cidoc-crm";
//Doees not work:
String path = "http://www.cidoc-crm.org/rdfs/cidoc-crm";
String NS = "http://www.cidoc-crm.org/rdfs/cidoc-crm/_";
OntModel model = ModelFactory.createOntologyModel();
InputStream in = FileManager.get().open(path);
if (in == null) {
throw new IllegalArgumentException( "File: " + path + " not found");
}
model.read(in, NS, "RDF/XML-ABBREV"); //exception thrown here…
It is important for me to read from generic link, please If you could
help me I will be very grateful.
Mat
Re: problem reading RDF from URL
Posted by Damian Steer <d....@bristol.ac.uk>.
On 12 Apr 2012, at 20:26, Matúš Novotný wrote:
> Hello,
> I need to read an RDF file from
> http://www.cidoc-crm.org/rdfs/cidoc-crm .
> //Doees not work:
> String path = "http://www.cidoc-crm.org/rdfs/cidoc-crm";
This looks broken to me:
http://www.cidoc-crm.org/rdfs/cidoc-crm
301 -> http://www.cidoc-crm.org/rdfs/cidoc-crm/
(which is fair enough)
http://www.cidoc-crm.org/rdfs/cidoc-crm/
200
<html>
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=../5.0.4/cidoc-crm">
</head>
</html>
Ugh...
> It is important for me to read from generic link, please If you could
> help me I will be very grateful.
Looks to me that the problem is at the cidoc end. It's simulating a redirect, rather than actually redirecting :-(
You could work around this using the location manager, I suppose. [1]
Damian
[1] <http://incubator.apache.org/jena/documentation/notes/file-manager.html>