generate hierarchical tree with grouping by on of the properties of the node

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

generate hierarchical tree with grouping by on of the properties of the node

Alexander N. Treyner
Hi,

I would like to generate hierarchical tree with grouping by on of the
properties of the node.

For example I have next rdf:
<rdf:seq>
        <rdf:li rdf:resource="urn:1"/>
        <rdf:li rdf:resource="urn:2"/>
</rdf:seq>

<rdf:description rdf:about="urn:1" myNS:type="type1" myNS:name="name1"/>
<rdf:description rdf:about="urn:2" myNS:type="type2" myNS:name="name2"/>

I want to generate tree with grouping by myNS:type. Is it possible to do
it without additional rdf:seq ?

Thanks,

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

Re: generate hierarchical tree with grouping by on of the properties of the node

Neil Deakin
Alexander N. Treyner wrote:

> Hi,
>
> I would like to generate hierarchical tree with grouping by on of the
> properties of the node.
>
> For example I have next rdf:
> <rdf:seq>
>     <rdf:li rdf:resource="urn:1"/>
>     <rdf:li rdf:resource="urn:2"/>
> </rdf:seq>
>
> <rdf:description rdf:about="urn:1" myNS:type="type1" myNS:name="name1"/>
> <rdf:description rdf:about="urn:2" myNS:type="type2" myNS:name="name2"/>
>
> I want to generate tree with grouping by myNS:type. Is it possible to do
> it without additional rdf:seq ?
>
> Thanks,
>
> Alex.

Do you mean sort by type, or have a list of types where each type has
children of that type?

If the latter, you would need to at least put the set of types in a
list, although it doesn't need to be a seq. In addition, you could also
just use rdf types.

The first level should use a triple:
   <triple subject="?member"
           predicate="myNS:isatype"
           target="type"/>

The second level can then iterate over the items of that type:

   <triple subject="?member"
           predicate="myNS:type"
           target="?uri"/>

where myNS is expanded to your namespace.

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

Re: generate hierarchical tree with grouping by on of the properties of the node

Alexander N. Treyner
Neil Deakin wrote:

> Alexander N. Treyner wrote:
>> Hi,
>>
>> I would like to generate hierarchical tree with grouping by on of the
>> properties of the node.
>>
>> For example I have next rdf:
>> <rdf:seq>
>>     <rdf:li rdf:resource="urn:1"/>
>>     <rdf:li rdf:resource="urn:2"/>
>> </rdf:seq>
>>
>> <rdf:description rdf:about="urn:1" myNS:type="type1" myNS:name="name1"/>
>> <rdf:description rdf:about="urn:2" myNS:type="type2" myNS:name="name2"/>
>>
>> I want to generate tree with grouping by myNS:type. Is it possible to
>> do it without additional rdf:seq ?
>>
>> Thanks,
>>
>> Alex.
>
> Do you mean sort by type, or have a list of types where each type has
> children of that type?
>
> If the latter, you would need to at least put the set of types in a
> list, although it doesn't need to be a seq. In addition, you could also
> just use rdf types.
>
> The first level should use a triple:
>   <triple subject="?member"
>           predicate="myNS:isatype"
>           target="type"/>
>
> The second level can then iterate over the items of that type:
>
>   <triple subject="?member"
>           predicate="myNS:type"
>           target="?uri"/>
>
> where myNS is expanded to your namespace.
>
> / Neil

I'm interesting how to generate tree like next:
-type1
  |-name1
-type2
  |-name2
  |-name3

without putting set of types to the list.

About using rdf:type, that you suggest. I'm not sure that I understand
first triple. What does it mean "isatype"? I never seen it before. Does
it part of template syntax?

Thanks,

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

Re: generate hierarchical tree with grouping by on of the properties of the node

Neil Deakin
Alexander N. Treyner wrote:


> About using rdf:type, that you suggest. I'm not sure that I understand
> first triple. What does it mean "isatype"? I never seen it before. Does
> it part of template syntax?
>

It's a predicate that you would associate with each type in RDF.
Assuming you had a type called Bookmark:

<RDF:Description RDF:about="http:myNS.com/typeslist"
                  myNS:isatype="Bookmark"/>

The <triple> would then let you collect all types.

RDF also has a built-in concept of types, so you can also use that
instead of using your own type mechanism. It doesn't make the template
any simpler though.

<myNS:Bookmark RDF:about="http:myNS.com:whatever"/>

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

Re: generate hierarchical tree with grouping by on of the properties of the node

Alexander N. Treyner
In reply to this post by Neil Deakin
Neil Deakin wrote:

> Do you mean sort by type, or have a list of types where each type has
> children of that type?
>
> If the latter, you would need to at least put the set of types in a
> list, although it doesn't need to be a seq. In addition, you could also
> just use rdf types.
>
> The first level should use a triple:
>   <triple subject="?member"
>           predicate="myNS:isatype"
>           target="type"/>
>
> The second level can then iterate over the items of that type:
>
>   <triple subject="?member"
>           predicate="myNS:type"
>           target="?uri"/>
>
> where myNS is expanded to your namespace.
>
> / Neil

I still does not succeeded to implement it. I have next RDF:
--------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<RDF:RDF xmlns:xt="xultest/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:prodtype">
             <RDF:li RDF:resource="urn:prodtype:1"/>
             <RDF:li RDF:resource="urn:prodtype:2"/>
             <RDF:li RDF:resource="urn:prodtype:3"/>
     </RDF:Seq>

     <RDF:Seq RDF:about="urn:item">
             <RDF:li RDF:resource="urn:item:1"/>
             <RDF:li RDF:resource="urn:item:2"/>
             <RDF:li RDF:resource="urn:item:3"/>
             <RDF:li RDF:resource="urn:item:4"/>
             <RDF:li RDF:resource="urn:item:5"/>
             <RDF:li RDF:resource="urn:item:6"/>
     </RDF:Seq>

     <RDF:Description RDF:about="urn:prodtype:1"
         xt:name="Type 1"/>
     <RDF:Description RDF:about="urn:prodtype:2"
         xt:name="Type 2"/>
     <RDF:Description RDF:about="urn:prodtype:3"
         xt:name="Type 3"/>

     <RDF:Description RDF:about="urn:item:1"
         xt:name="Item 1"
         xt:prodtype="urn:prodtype:1"/>
     <RDF:Description RDF:about="urn:item:2"
         xt:name="Item 2"
         xt:prodtype="urn:prodtype:1"/>
     <RDF:Description RDF:about="urn:item:3"
         xt:name="Item 3"
         xt:prodtype="urn:prodtype:2"/>
     <RDF:Description RDF:about="urn:item:4"
         xt:name="Item 4"
         xt:prodtype="urn:prodtype:2"/>
     <RDF:Description RDF:about="urn:item:5"
         xt:name="Item 5"
         xt:prodtype="urn:prodtype:3"/>
     <RDF:Description RDF:about="urn:item:6"
         xt:name="Item 6"
         xt:prodtype="urn:prodtype:4"/>

</RDF:RDF>
-----------------------------------------------------------

I need to get list of products grouped by Product Type like here:
+Type 1
-Type 2
|-Item 3
|-Item 4
+Type 3

Is it possible to create such hierarchy using given RDF, or I should
change it?
Can you, please, help me with example?

Thanks a lot.

Alex.
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf