On 11/01/17 15:42, George News wrote:

Literal a = (Literal)
ResourceFactory.createTypedLiteral("http://hola^^http://www.w3.org/2001/XMSchema#anyURI";,
XSDDatatype.XSDanyURI);
System.out.println(a.getDatatype());
System.out.println(a.getLexicalForm());
System.out.println(a.getDatatypeURI());
System.out.println(a.getString());

Output:
Datatype[http://www.w3.org/2001/XMLSchema#anyURI -> class java.net.URI]
http://hola^^http://www.w3.org/2001/XMSchema#anyURI
http://www.w3.org/2001/XMLSchema#anyURI
http://hola^^http://www.w3.org/2001/XMSchema#anyURI


None of them returns "http://hola"; which is the actual URI.

ResourceFactory.createTypedLiteral doesn't do what you think it does.

You've given it a String and so it creates a typed literal of type
xsd:string since that's the xsd datatype Jena takes as being "the"
datatype for strings.

So all of the ^^http gubbins is just part of the string value
you passed in and, naturally, that's what you get out when
you use getLexicalForm.

Don't do that.

Chris

--
"He could not weigh up which was worse and so tried not to think about either."
                                                /The Spellgrinder's Apprentice/

Epimorphics Ltd, http://www.epimorphics.com
Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT
Epimorphics Ltd. is a limited company registered in England (number 7016688)

Reply via email to