On 12/01/17 10:15, George News wrote:
BTW I think I found a bug:
String b = "http://datypic.com/fraf1";
Literal a = (Literal) ResourceFactory.createTypedLiteral(b,
XSDDatatype.XSDanyURI);
System.out.println(a.getDatatype());
System.out.println(a.getValue().getClass());
a = (Literal) ResourceFactory.createTypedLiteral(URI.create(b));
System.out.println(a.getDatatype());
System.out.println(a.getValue().getClass());
Output:
Datatype[http://www.w3.org/2001/XMLSchema#anyURI -> class java.net.URI]
class java.lang.String
Datatype[http://www.w3.org/2001/XMLSchema#anyURI -> class java.net.URI]
class java.net.URI
Shouldn't both getValue() be java.net.URI? I guess this needs to be fixed as in
both cases the DataType indicastes it's an URI, so when casting the String to
URI the system complains ;)
Up till now we've never included a mapping from xsd:anyURI to
java.net.URI in the type mapping table. I seem to recall that was
originally because of some doubt as to whether, if there was a mapping,
it should use java.net.URI or the IRI machinery built into jena and
partly because the rest Jena uses strings so much for URI references.
I think you could register such a mapping yourself in your application.
Whether that should be added as a default I'm not sure.
Dave