Claude Warren created JENA-331:
----------------------------------

             Summary: XSDDatatype does not properly handle URIs
                 Key: JENA-331
                 URL: https://issues.apache.org/jira/browse/JENA-331
             Project: Apache Jena
          Issue Type: Improvement
          Components: Jena
    Affects Versions: Jena 2.7.3
            Reporter: Claude Warren


Using the TypeMapper to convert a URI to a literal and back again fails as a 
String is returned not a URI.

Test code:


import com.hp.hpl.jena.datatypes.RDFDatatype;
import com.hp.hpl.jena.datatypes.TypeMapper;
import com.hp.hpl.jena.rdf.model.Literal;
import com.hp.hpl.jena.rdf.model.ResourceFactory;

import java.net.URI;

import org.junit.Assert;
import org.junit.Test;


public class XSDDatatypeTest
{
 @Test
 public void testURIConversion() throws Exception
 {
         TypeMapper typeMapper = TypeMapper.getInstance();
         RDFDatatype dt = typeMapper.getTypeByClass( java.net.URI.class );

         URI uri = new URI("http://example.com"; );

         String lexicalForm = dt.unparse( uri );
         Literal l = ResourceFactory.createTypedLiteral( lexicalForm, dt );
        
         Object o = dt.parse( l.getLexicalForm()  );
         Assert.assertEquals( uri, o );
 }
}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to