You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "federico.paparoni@gmail.com" <fe...@gmail.com> on 2010/07/06 11:22:50 UTC

Tagging system for GSoC

Hi all,
I thought about a possible implementation of the tagging system.
My idea is that an article can have a multi value node where can be saved the tags. This is useful because when I read an article I haven't to read another resource to know the related tags.
In addition to this node, it's possible to create a parallel structure, with the tag value as root node and as children the UUIDs of the articles.&nbsp;
In this way there is a duplication of information but it's easier to manipulate tags information in the system (for example tag clouds or search by tag could be processed in a very fast way).
What do you think about?

Cheers

Federico



Re: Tagging system for GSoC

Posted by Simon Gaeremynck <ga...@gmail.com>.
We (Sakai) do a very similar thing. [1]
Only we don't store the path too the tag on the tagged node but we store the UUID of the tagnode.
This way we should be able to move tags around and get the same flexibility as storing a path.
A tag can just as easily be deleted.

Regards,
Simon


[1] http://confluence.sakaiproject.org/display/KERNDOC/KERN-554+File+Content+Tags+and+Hierarchy


On 6 Jul 2010, at 10:42, Alexander Klimetschek wrote:

> On Tue, Jul 6, 2010 at 11:22, federico.paparoni@gmail.com
> <fe...@gmail.com> wrote:
>> Hi all,
>> I thought about a possible implementation of the tagging system.
>> My idea is that an article can have a multi value node where can be saved the tags. This is useful because when I read an article I haven't to read another resource to know the related tags.
>> In addition to this node, it's possible to create a parallel structure, with the tag value as root node and as children the UUIDs of the articles.&nbsp;
>> In this way there is a duplication of information but it's easier to manipulate tags information in the system (for example tag clouds or search by tag could be processed in a very fast way).
>> What do you think about?
> 
> http://dev.day.com/content/ddc/blog/2009/04/cq5tags.html (built on
> JCR) might give you some ideas ;-)
> 
> Regards,
> Alex
> 
> -- 
> Alexander Klimetschek
> alexander.klimetschek@day.com


Re: Tagging system for GSoC

Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, Jul 6, 2010 at 11:22, federico.paparoni@gmail.com
<fe...@gmail.com> wrote:
> Hi all,
> I thought about a possible implementation of the tagging system.
> My idea is that an article can have a multi value node where can be saved the tags. This is useful because when I read an article I haven't to read another resource to know the related tags.
> In addition to this node, it's possible to create a parallel structure, with the tag value as root node and as children the UUIDs of the articles.&nbsp;
> In this way there is a duplication of information but it's easier to manipulate tags information in the system (for example tag clouds or search by tag could be processed in a very fast way).
> What do you think about?

http://dev.day.com/content/ddc/blog/2009/04/cq5tags.html (built on
JCR) might give you some ideas ;-)

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: Tagging system for GSoC

Posted by Justin Edelson <ju...@gmail.com>.
On 7/13/10 9:14 AM, Bertrand Delacretaz wrote:
> On Tue, Jul 13, 2010 at 3:02 PM, Mike Müller <mi...@mysign.ch> wrote:
>>> If you need to maintain related nodes B after saving a node A, the
>>> recommended way with JCR is to use observation: you'll get a callback
>>> when A is modified, and you setup B at this point, asynchronously.
>>
>> What would you suggest if saving of node B should be done transactionally?
> 
> You'd then need to implement custom code (POST handler or servlet) to
> save A and update B transactionally. Event listeners are called
> asynchronously after the observed node is saved.
You should be able to use Jackrabbit's SynchronousEventListener as well.

But I would use a SlingPostProcessor...

SynchronousEventListener would be necessary if you needed to handle
nodes created by methods other than the POST servlet.

Justin

Re: Tagging system for GSoC

Posted by Federico Paparoni <fe...@gmail.com>.
2010/7/13 Bertrand Delacretaz <bd...@apache.org>

> On Tue, Jul 13, 2010 at 3:02 PM, Mike Müller <mi...@mysign.ch> wrote:
> >> If you need to maintain related nodes B after saving a node A, the
> >> recommended way with JCR is to use observation: you'll get a callback
> >> when A is modified, and you setup B at this point, asynchronously.
> >
> > What would you suggest if saving of node B should be done
> transactionally?
>
> You'd then need to implement custom code (POST handler or servlet) to
> save A and update B transactionally. Event listeners are called
> asynchronously after the observed node is saved.
>
> Or use a temporary "incoming" path for the A node, and in the listener
> update B and move A to its final location in a transaction.
>
> -Bertrand
>

I don't see the need of managing it transactionally.
If I use an event listener, the node is already added, and the creation of
redundant structure for tagging hasn't to be transactional.
If the creation of the node in the tagging structure has some problems, we
will have a dishomogeneity in the content, but I think it can be solved in
another way, later.
Does it make sense?

-- 
Federico

Re: Tagging system for GSoC

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Tue, Jul 13, 2010 at 3:02 PM, Mike Müller <mi...@mysign.ch> wrote:
>> If you need to maintain related nodes B after saving a node A, the
>> recommended way with JCR is to use observation: you'll get a callback
>> when A is modified, and you setup B at this point, asynchronously.
>
> What would you suggest if saving of node B should be done transactionally?

You'd then need to implement custom code (POST handler or servlet) to
save A and update B transactionally. Event listeners are called
asynchronously after the observed node is saved.

Or use a temporary "incoming" path for the A node, and in the listener
update B and move A to its final location in a transaction.

-Bertrand

RE: Tagging system for GSoC

Posted by Mike Müller <mi...@mysign.ch>.
> If you need to maintain related nodes B after saving a node A, the
> recommended way with JCR is to use observation: you'll get a callback
> when A is modified, and you setup B at this point, asynchronously.

What would you suggest if saving of node B should be done transactionally?

best regards
mike

Re: Tagging system for GSoC

Posted by Federico Paparoni <fe...@gmail.com>.
Hi Bertrand,

2010/7/13 Bertrand Delacretaz <bd...@apache.org>

> Hi,
>
> On Tue, Jul 13, 2010 at 10:30 AM, Federico Paparoni
> <fe...@gmail.com> wrote:
> > ...I thought that after saving the article with the related tag I can
> call a
> > new operation (defined extending SlingPostOperation) to create the node.
> But
> > I have some questions:
> >
> > 1) Is this way the "Sling way" to implement it? What are the
> alternatives?...
>
> If you need to maintain related nodes B after saving a node A, the
> recommended way with JCR is to use observation: you'll get a callback
> when A is modified, and you setup B at this point, asynchronously.
>
> There's an example of this in the samples/espblog's ThumbnailGenerator
> [1] - that component listens for modifications of nt:file nodes, and
> created thumbnails when images are saved.
>
> > 2) How can I have the UUID of the created node? I thought that it's
> possible
> > to have UUID sending the article URL to the new SlingPostOperation but I
> > don't really like this way....
>
> The JCR event handler lets you access to the modified nodes, so you
> can get their UUIDs there.
>
> -Bertrand
>
> [1]
> samples/espblog/src/main/java/org/apache/sling/samples/espblog/internal/ThumbnailGenerator.java
>

Thanks for the suggestion, I didn't think about JCR events (so there is one
less HTTP call to save the tag).
I started the implementation using SlingPostOperation, so I haven't so much
work to handle the JCR event and do the same thing.
Thanks a lot


-- 
Federico

Re: Tagging system for GSoC

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,

On Tue, Jul 13, 2010 at 10:30 AM, Federico Paparoni
<fe...@gmail.com> wrote:
> ...I thought that after saving the article with the related tag I can call a
> new operation (defined extending SlingPostOperation) to create the node. But
> I have some questions:
>
> 1) Is this way the "Sling way" to implement it? What are the alternatives?...

If you need to maintain related nodes B after saving a node A, the
recommended way with JCR is to use observation: you'll get a callback
when A is modified, and you setup B at this point, asynchronously.

There's an example of this in the samples/espblog's ThumbnailGenerator
[1] - that component listens for modifications of nt:file nodes, and
created thumbnails when images are saved.

> 2) How can I have the UUID of the created node? I thought that it's possible
> to have UUID sending the article URL to the new SlingPostOperation but I
> don't really like this way....

The JCR event handler lets you access to the modified nodes, so you
can get their UUIDs there.

-Bertrand

[1] samples/espblog/src/main/java/org/apache/sling/samples/espblog/internal/ThumbnailGenerator.java

Re: Tagging system for GSoC

Posted by Federico Paparoni <fe...@gmail.com>.
Hi,

2010/7/6 Torgeir Veimo <to...@pobox.com>

> On 6 July 2010 19:22, federico.paparoni@gmail.com
> <fe...@gmail.com> wrote:
> > I thought about a possible implementation of the tagging system.
> > My idea is that an article can have a multi value node where can be saved
> the tags. This is useful because when I read an article I haven't to read
> another resource to know the related tags.
> > In addition to this node, it's possible to create a parallel structure,
> with the tag value as root node and as children the UUIDs of the
> articles.&nbsp;
> > In this way there is a duplication of information but it's easier to
> manipulate tags information in the system (for example tag clouds or search
> by tag could be processed in a very fast way).
> > What do you think about?
>
> Storage is one issue to look at. Another is search.
>
> Say you'd like to find matches between items depending on how many
> tags they share. (Eg. a dating system, or a system to find jobs based
> on your knowledge.) How would you implement such a search with
> weighted scores in JCR space, ie. without downloading all such nodes
> and doing search and sort in memory.
>
> --
> -Tor
>

Thanks for ideas, I have now a Sling question for the development. I
developed the tags multi value property and now I have to create the tag
tree (as shown in the next image).

http://davidgsoc.files.wordpress.com/2010/07/tag-jcr-structure.png

I thought that after saving the article with the related tag I can call a
new operation (defined extending SlingPostOperation) to create the node. But
I have some questions:

1) Is this way the "Sling way" to implement it? What are the alternatives?
2) How can I have the UUID of the created node? I thought that it's possible
to have UUID sending the article URL to the new SlingPostOperation but I
don't really like this way.

Cheers

-- 
Federico

Re: Tagging system for GSoC

Posted by Torgeir Veimo <to...@pobox.com>.
On 6 July 2010 19:22, federico.paparoni@gmail.com
<fe...@gmail.com> wrote:
> I thought about a possible implementation of the tagging system.
> My idea is that an article can have a multi value node where can be saved the tags. This is useful because when I read an article I haven't to read another resource to know the related tags.
> In addition to this node, it's possible to create a parallel structure, with the tag value as root node and as children the UUIDs of the articles.&nbsp;
> In this way there is a duplication of information but it's easier to manipulate tags information in the system (for example tag clouds or search by tag could be processed in a very fast way).
> What do you think about?

Storage is one issue to look at. Another is search.

Say you'd like to find matches between items depending on how many
tags they share. (Eg. a dating system, or a system to find jobs based
on your knowledge.) How would you implement such a search with
weighted scores in JCR space, ie. without downloading all such nodes
and doing search and sort in memory.

-- 
-Tor