Hi Andy,

Hereunder a test case:

        Node defaultNode = Node.createURI("http://www.openjena.org";);

        Binding parentBinding = BindingFactory.create();
        parentBinding.add(Var.alloc("parent"), defaultNode);

        Binding binding = BindingFactory.create(parentBinding);
        binding.add(Var.alloc("var1"), defaultNode);
        binding.add(Var.alloc("var2"), defaultNode);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        BindingOutputStream bos = new BindingOutputStream(baos);
        bos.send(binding);

        bos.close();

        ByteArrayInputStream bais =
                new ByteArrayInputStream(baos.toByteArray());

        BindingInputStream bis = new BindingInputStream(bais);

        Binding unserializedBinding = bis.next();
        Binding unserializedParentBinding = unserializedBinding.getParent();

        try {
            bais.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

        System.out.println("parent value=" + unserializedParentBinding);


The deserialized parent value is null whereas the initial binding
contain a parent value with a variable.

Also, why is there no close method in BindingInputStream? and why
BindingInputStream and BindingOutputStream are not implementing the
Java InputStream and OutputStream interfaces?

I ask for that because when I decorate an InputStream
(ByteArrayInputStream, FileInputStream, GZipInputStream, etc.) with a
BindingInputStream, I expect to have a close method that close
BindingInputStream and the underlying InputStreams.

Laurent

On Tue, Sep 6, 2011 at 11:27 AM, Andy Seaborne
<[email protected]> wrote:
> Laurent,
>
> Do you have a test case?
>
> Parent values should be flattened out and lost on reading back.  Parents for
> bindings is just a space saving optimization.  The API to bindings does not
> expose them and the read-back bindings should have the same variables and
> same values.
>
>        Andy
>
> On 06/09/11 09:14, Laurent Pellegrino wrote:
>>
>> Hello,
>>
>> It seems that BindingOutputStream and BindingInputStream are not
>> taking into account the parent value associated to a binding (i.e. the
>> parent value is not serialized). Is it a desired behavior?
>>
>> Kind Regards,
>>
>> Laurent
>

Reply via email to