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

Alexander <[email protected]> Sat, 02 May 2009 12:11:08 +0400
Newsgroups gmane.comp.mozilla.devel.rdf
Message-ID <[email protected]>
>> 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>
>>
>>
>>
>>
>> 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.
> 


To be able to exclude from sweeping whole "urn:root:chapter1" sub-graph
(see http://zazhigin.ru/testMarkSweep.jpg). I have add follwing to the 
script:


ds.Mark(
   rdf.GetResource("urn:root:chapter1"),
   rdf.GetResource("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
   rdf.GetResource("http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq"), true);
ds.Mark(
   rdf.GetResource("urn:root:chapter1"),
   rdf.GetResource("http://www.w3.org/1999/02/22-rdf-syntax-ns#_1"),
   rdf.GetResource("urn:root:chapter1:article1"), true);
ds.Mark(
   rdf.GetResource("urn:root:chapter1"),
   rdf.GetResource("http://www.w3.org/1999/02/22-rdf-syntax-ns#_2"),
   rdf.GetResource("urn:root:chapter1:article2"), true);


... and all of these doesn't influence Sweep, the result 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:chapter1" />
   <RDF:Description RDF:about="urn:root">
     <NS1:Chapters RDF:resource="urn:root:chapter1"/>
   </RDF:Description>
</RDF:RDF>



... I was expecting below code isin:


   <RDF:Seq RDF:about="urn:root:chapter1">
     <RDF:li RDF:resource="urn:root:chapter1:article1"/>
     <RDF:li RDF:resource="urn:root:chapter1:article2"/>
   </RDF:Seq>


Alexander.