Claude Warren created JENA-2075:
-----------------------------------

             Summary: Seq "set" and "add" methods yield different results.
                 Key: JENA-2075
                 URL: https://issues.apache.org/jira/browse/JENA-2075
             Project: Apache Jena
          Issue Type: Bug
          Components: Core
    Affects Versions: Jena 3.17.0
            Reporter: Claude Warren


I think the issue is in the Seq.set() method but the if the example below is 
executed the results are variously boolean values or strings representing 
boolean values.

Code:
{code:java}
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Seq;

public class SeqTest {    
    public static void main(String[] args) {
        Model m = ModelFactory.createDefaultModel();
        Seq seq = m.createSeq();
        seq.add( 1L );
        seq.add(2, 2L );
        m.write(System.out, "TURTLE");
        seq.set(1, 1L);
        m.write(System.out, "TURTLE");
    }
}

{code}
Result:
{code:java}
[ a       <http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq> ;
  <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1>
          "1" ;
  <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2>
          "2"
] .
[ a       <http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq> ;
  <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1>
          "1"^^<http://www.w3.org/2001/XMLSchema#long> ;
  <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2>
          "2"
] .
{code}
The Collection.add() code and the Seq.add() methods both insert string 
representations for the long values.  The Seq.set() method on the other hand 
places a typed literal in the graph. 

Personally I would rather see the typed literal but I don't know that the 
standard says.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to