And I and Chris Dollin answered your question. Again,
ResourceFactory.createTypedLiteral("http://hola^^http://www.w3.org/2001/XMSchema#anyURI",
XSDDatatype.XSDanyURI)
Don't do a bunch of string processing.
---
A. Soroka
The University of Virginia Library
> On Jan 11, 2017, at 12:11 PM, George News <[email protected]> wrote:
>
>
>
> On 11/01/2017 17:18, A. Soroka wrote:
>> You do know the type: http://www.w3.org/2001/XMSchema#anyURI
>>
>> It is clearly written in your example.
>
> I know. What I wanted is to know if there is a utility in Jena that
> parses the string, like the example function I posted.
>
> Thanks for your help.
>
>> ---
>> A. Soroka
>> The University of Virginia Library
>>
>>> On Jan 11, 2017, at 10:25 AM, George News <[email protected]> wrote:
>>>
>>> On 11/01/2017 15:59, A. Soroka wrote:
>>>> Perhaps parse it as a Jena Literal (e.g. using
>>>> ResourceFactory.createTypedLiteral() ), then use Literal.getString() to
>>>> get the value you seek.
>>>
>>> then I need to know the type. The issue is that I wanted to know if
>>> there is any Jena function that directly parses the literal in the
>>> Turtle (or any other) form and get the object type.
>>>
>>>> ---
>>>> A. Soroka
>>>> The University of Virginia Library
>>>>
>>>>> On Jan 11, 2017, at 9:55 AM, George News <[email protected]> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I have this literal:
>>>>> http://hola^^http://www.w3.org/2001/XMSchema#anyURI
>>>>>
>>>>> And I want to create a URI from it. Is there any way to do so?
>>>>>
>>>>> I have tried
>>>>> URI z = (URI) XSDDatatype.XSDanyURI.parseValidated(literalString);
>>>>>
>>>>> but I get:
>>>>> java.lang.ClassCastException: java.lang.String cannot be cast to
>>>>> java.net.URI
>>>>>
>>>>> I don't know if I should take the shortcut, that is, remove everything
>>>>> after ^^ using substring, and then URI.create(shortenedLiteralString).
>>>>>
>>>>> Any help is welcome.
>>>>> Jorge
>>>>
>>>>
>>
>>