On 12/01/2017 11:31, Dave Reynolds wrote:
> 
> 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.

I got your point, but the problem is that is confusing when you are
trying to automate the code. If getValue() returns an String but
datatype is saying it is an URI then you have a reflection problem.

I just wanted to pointed this out. I'm newbie and not maintainer of the
code. I accept the internal decisions of people that knows much more
than I do for sure.

Thanks a lot for the help you all have provided!!!!
Jorge

Reply via email to