On 11/01/2017 16:25, Chris Dollin wrote:
> 
> 
> On 11/01/17 14:55, George News wrote:
>> Hi,
>>
>> I have this literal:
>> http://hola^^http://www.w3.org/2001/XMSchema#anyURI
> 
> What do you mean by "have"? A String value, a Literal
> value, or what?

I want to get http://hola as a String or as a URI. Better as a URI, but
only if it is conforming with the type linked.


>> And I want to create a URI from it. Is there any way to do so?
> 
> And do you want an actual URI object or just its spelling?
> 
> Because you can get the spelling of the URI using getLexicalForm.

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.

> Chris
> 

Reply via email to