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

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Зажигин Александр
I have created below RDF in memory:


<?xml version="1.0"?>
<RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
         xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <RDF:Seq RDF:about="urn:root">
    <RDF:li RDF:resource="urn:root:base_1"/>
    <RDF:li RDF:resource="urn:root:base_2"/>
    <RDF:li RDF:resource="urn:root:base_3"/>
  </RDF:Seq>
  <RDF:Description RDF:about="urn:root:base_2"
                   NC:id="2"
                   NC:name="10002" />
  <RDF:Description RDF:about="urn:root:base_3"
                   NC:id="3"
                   NC:name="10003" />
  <RDF:Description RDF:about="urn:root:base_1"
                   NC:id="1"
                   NC:name="10001" />
</RDF:RDF>



... and trying to Mark one and Sweep:


    ds.QueryInterface(Components.interfaces.nsIRDFPurgeableDataSource);
    ds.Mark(rdf.GetResource("urn:root:base_1"),
rdf.GetResource("http://home.netscape.com/NC-rdf#name"),
rdf.GetLiteral("1001"), true);
    ds.Sweep();


... and it remove whole document. The result is:


<?xml version="1.0"?>
<RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
         xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
</RDF:RDF>


... what is wrong?


Alexander.
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf
Reply | Threaded
Open this post in threaded view
|

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

Axel Hecht-2
On 01.05.2009 5:56 Uhr, Зажигин Александр wrote:

> I have created below RDF in memory:
>
>
> <?xml version="1.0"?>
> <RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
> xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> <RDF:Seq RDF:about="urn:root">
> <RDF:li RDF:resource="urn:root:base_1"/>
> <RDF:li RDF:resource="urn:root:base_2"/>
> <RDF:li RDF:resource="urn:root:base_3"/>
> </RDF:Seq>
> <RDF:Description RDF:about="urn:root:base_2"
> NC:id="2"
> NC:name="10002" />
> <RDF:Description RDF:about="urn:root:base_3"
> NC:id="3"
> NC:name="10003" />
> <RDF:Description RDF:about="urn:root:base_1"
> NC:id="1"
> NC:name="10001" />
> </RDF:RDF>
>
>
>
> ... and trying to Mark one and Sweep:
>
>
> ds.QueryInterface(Components.interfaces.nsIRDFPurgeableDataSource);
> ds.Mark(rdf.GetResource("urn:root:base_1"),
> rdf.GetResource("http://home.netscape.com/NC-rdf#name"),
> rdf.GetLiteral("1001"), true);
> ds.Sweep();
>
>
> ... and it remove whole document. The result is:
>
>
> <?xml version="1.0"?>
> <RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
> xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> </RDF:RDF>
>
>
> ... what is wrong?
>

No idea, can you create an xpcshell test for that?

Axel
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf
Reply | Threaded
Open this post in threaded view
|

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

user-41

>
> No idea, can you create an xpcshell test for that?
>
> Axel

This is the sctipt:

http://zazhigin.ru/testMarkSweep.js


And this is the output of the script:

<?xml version="1.0"?>
<RDF:RDF 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:chapter1"/>
   </RDF:Description>
</RDF:RDF>


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.

Alexander.
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf
Reply | Threaded
Open this post in threaded view
|

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

Axel Hecht-2
On 01.05.2009 13:18 Uhr, [hidden email] wrote:

>
>>
>> No idea, can you create an xpcshell test for that?
>>
>> Axel
>
> This is the sctipt:
>
> http://zazhigin.ru/testMarkSweep.js
>
>
> And this is the output of the script:
>
> <?xml version="1.0"?>
> <RDF:RDF 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:chapter1"/>
> </RDF:Description>
> </RDF:RDF>
>
>
> 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/ :

<?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:Seq
RDF:about="urn:root:chapter1">  <RDF:li
RDF:resource="urn:root:chapter1:article1"/>  <RDF:li
RDF:resource="urn:root:chapter1:article2"/>  </RDF:Seq>
<RDF:Description RDF:about="urn:root">  <Chapters
RDF:resource="urn:root:chapter1"/>  <Chapters
RDF:resource="urn:root:chapter2"/>  <Chapters
RDF:resource="urn:root:chapter3"/>  </RDF:Description>  <RDF:Description
RDF:about="urn:root:chapter1:article1">  <Title RDF:resource="title 1"/>
  <Author RDF:resource="author 1"/>  </RDF:Description>
<RDF:Description RDF:about="urn:root:chapter1:article2">  <Title
RDF:resource="title 2"/>  <Author RDF:resource="author 2"/>
</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>
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf
Reply | Threaded
Open this post in threaded view
|

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

Axel Hecht-2
In reply to this post by Зажигин Александр
On 01.05.2009 5:56 Uhr, Зажигин Александр wrote:

> I have created below RDF in memory:
>
>
> <?xml version="1.0"?>
> <RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
> xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> <RDF:Seq RDF:about="urn:root">
> <RDF:li RDF:resource="urn:root:base_1"/>
> <RDF:li RDF:resource="urn:root:base_2"/>
> <RDF:li RDF:resource="urn:root:base_3"/>
> </RDF:Seq>
> <RDF:Description RDF:about="urn:root:base_2"
> NC:id="2"
> NC:name="10002" />
> <RDF:Description RDF:about="urn:root:base_3"
> NC:id="3"
> NC:name="10003" />
> <RDF:Description RDF:about="urn:root:base_1"
> NC:id="1"
> NC:name="10001" />
> </RDF:RDF>
>
>
>
> ... and trying to Mark one and Sweep:
>
>
> ds.QueryInterface(Components.interfaces.nsIRDFPurgeableDataSource);
> ds.Mark(rdf.GetResource("urn:root:base_1"),
> rdf.GetResource("http://home.netscape.com/NC-rdf#name"),
> rdf.GetLiteral("1001"), true);
> ds.Sweep();
>
>
> ... and it remove whole document. The result is:
>
>
> <?xml version="1.0"?>
> <RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
> xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> </RDF:RDF>
>
>
> ... what is wrong?

The target you mark is rdf.GetLiteral("1001"), the target in your DS is
NC:name="10001". Missing '0'.

HTH

Axel
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf
Reply | Threaded
Open this post in threaded view
|

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

Зажигин Александр
In reply to this post by Axel Hecht-2
>>
>> 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?


Alexander.
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf
Reply | Threaded
Open this post in threaded view
|

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

Axel Hecht
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
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf
Reply | Threaded
Open this post in threaded view
|

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

Зажигин Александр
>> 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.
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf