Re: RDF Mark doesn't influence Sweep and Sweep removes all, why?

Axel Hecht <[email protected]> Fri, 01 May 2009 16:41:18 -0700
Newsgroups gmane.comp.mozilla.devel.rdf
Message-ID <[email protected]>
On 01.05.2009 15:14 Uhr, Alexander wrote:
>>>
>>> It was Marked only here -> "urn:root:chapter1" and I was expecting that
>>> it will be removed by Sweep. And also I was expecting that
>>> "urn:root:chapter2" container will stay, because this doesn't Mark.
>>
>> This seems to be the expected output of Sweep.
>>
>> I slightly modified your data to make the RDF validator happy (default
>> namespace), and the arc that you Mark is preserved.
>>
>> I'll comment on your original post in a sec.
>>
>> Axel
>>
>> PS: Data that I looked at on http://www.w3.org/RDF/Validator/ :
>>
>
>
> Mark / Sweep code:
>
>
> ds.Mark(rdf.GetResource("urn:root"),
> rdf.GetResource("urn:mystuff#Chapters"),
> rdf.GetResource("urn:root:chapter1"), true);
> ds.Sweep();
>
>
> Output is:
>
>
> <?xml version="1.0"?>
> <RDF:RDF xmlns:NS1="urn:mystuff#"
> xmlns:NC="http://home.netscape.com/NC-rdf#"
> xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> <RDF:Description RDF:about="urn:root">
> <NS1:Chapters RDF:resource="urn:root:chapter1"/>
> </RDF:Description>
> </RDF:RDF>
>
>
> ... and this is more less the same and I am still confused. My goal is
> to receive something like (everything except removed "urn:root:chapter1"
> branch):
>
>
> <?xml version="1.0"?>
> <RDF:RDF xmlns="urn:mystuff#"
> xmlns:NC="http://home.netscape.com/NC-rdf#"
> xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> <RDF:Description RDF:about="urn:root">
> <Chapters RDF:resource="urn:root:chapter2"/>
> <Chapters RDF:resource="urn:root:chapter3"/>
> </RDF:Description>
> <RDF:Description RDF:about="urn:root:chapter2:article1">
> <Title RDF:resource="title 3"/>
> <Author RDF:resource="author 3"/>
> </RDF:Description>
> <RDF:Seq RDF:about="urn:root:chapter2">
> <RDF:li RDF:resource="urn:root:chapter2:article1"/>
> </RDF:Seq>
> </RDF:RDF>
>
>
> Sweep removes only Mark branches, am I right?

Sweep removes anything but marked arcs. RDF doesn't know anything about 
subtrees in RDF/XML. If you want to get a particular sub-graph excempt 
from sweeping, you need to mark each and every arc in that sub-graph.

Axel