You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Andy Seaborne <an...@apache.org> on 2013/09/24 19:03:45 UTC
Registering .owl as RDF/XML
I wrote a test program (at end) to investigate the difference when .owl
is registered as RDF/XML format and it is not.
The difference turns the case where the system has no idea of the
language into trying RDF/XML.
When the app provides a suggested language, this is used unless the far
end gives a non-text/plain content type. "text/plain" is too unreliable
to assume anything as it's what you get if you do nothing. RIOT does
not assume ISO-8859-1 in this case either.
In both cases, the server declared type is used. This covers the case
where the publisher changes the content type of a URL wihtou braking the
application that used to work.
Andy
== .owl not registered
URL=http://example/file.owl
Content-type=null
Lang=null
==> null
URL=http://example/file.owl
Content-type=null
Lang=Lang:Turtle
==> Lang:Turtle
URL=http://example/file.owl
Content-type=text/plain
Lang=null
==> null
URL=http://example/file.owl
Content-type=text/plain
Lang=Lang:Turtle
==> Lang:Turtle
URL=http://example/file.owl
Content-type=application/rdf+json
Lang=null
==> Lang:RDF/JSON
URL=http://example/file.owl
Content-type=application/rdf+json
Lang=Lang:Turtle
==> Lang:RDF/JSON
== With .owl registered
URL=http://example/file.owl
Content-type=null
Lang=null
==> Lang:RDF/XML
URL=http://example/file.owl
Content-type=null
Lang=Lang:Turtle
==> Lang:Turtle
URL=http://example/file.owl
Content-type=text/plain
Lang=null
==> Lang:RDF/XML
URL=http://example/file.owl
Content-type=text/plain
Lang=Lang:Turtle
==> Lang:Turtle
URL=http://example/file.owl
Content-type=application/rdf+json
Lang=null
==> Lang:RDF/JSON
URL=http://example/file.owl
Content-type=application/rdf+json
Lang=Lang:Turtle
==> Lang:RDF/JSON
public static void main(String ... argv) throws Exception
{
test("http://example/file.owl",
null, null) ;
test("http://example/file.owl",
null, Lang.TTL) ;
test("http://example/file.owl",
WebContent.contentTypeTextPlain, null) ;
test("http://example/file.owl",
WebContent.contentTypeTextPlain, Lang.TTL) ;
test("http://example/file.owl",
WebContent.contentTypeRDFJSON, null) ;
test("http://example/file.owl",
WebContent.contentTypeRDFJSON, Lang.TTL) ;
}
public static void test(String url, String ctStr, Lang lang) {
System.out.printf(
"URL=%s\nContent-type=%s\nLang=%s\n", url, ctStr, lang) ;
Lang lang2 = RDFDataMgr.determineLang(url, ctStr, lang) ;
System.out.println(" ==> "+lang2) ;
System.out.println() ;
}
Re: Registering .owl as RDF/XML
Posted by Andy Seaborne <an...@apache.org>.
See JENA-548
https://issues.apache.org/jira/browse/JENA-548