xiedaode / jenabean

Automatically exported from code.google.com/p/jenabean
0 stars 0 forks source link

Clean remove for Bean with array #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Problem:
When creating a bean with Array-like attribute, it is correctly saved to the 
model but cannot be properly removed. The statement containing the array is not 
eliminated and the model is let with:
<rdf:Description rdf:nodeID="A0">
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq"/>
  </rdf:Description>

What steps will reproduce the problem?
1. Create a simple bean like the following:
public class Relation {
    Entity[] members;

    public Entity[] getMembers() {
        return members;
    }

    public void setMembers(Entity[] members) {
        this.members = members;
    }
}
Where Entity is a random JenaBean.

2. Create entities and link them with relation

Model m = ModelFactory.createDefaultModel();
MyBean2RDF writer = new MyBean2RDF(m);

Entity e1 = Entity();
Entity e2 = Entity();

Relation r1 = Relation();
r1.setMembers(new Entity[]{e1,e2});

// save
writer.save(e1);
writer.save(e2);
writer.save(r1);
m.write(System.out);

// delete
writer.delete(e1);
writer.delete(e2);
writer.delete(r1);
m.write(System.out);

3. look at the output...

What is the expected output? What do you see instead?
Expected output:
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:j.0="http://thewebsemantic.com/"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >
... 
</rdf:RDF>

What i got instead:
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:j.0="http://thewebsemantic.com/"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >
...
  <rdf:Description rdf:nodeID="A0">
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq"/>
  </rdf:Description>
</rdf:RDF>

What version of the product are you using? On what operating system?
Using 1.0.6 multi platform (platform not relevant here).

Original issue reported on code.google.com by remi.barraquand on 8 Jun 2010 at 12:35