Hi Karel,
I wouldn't put the knowledge save logic in the semProp macro itself
but rather in an event listener that catches the document save event.
The listener can retrieve all occurrences of the semProp macro from
the document content XDOM and save the corresponding semantic
properties in the knowledge DB.
See
http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingEventListenerTutor…
.
Hope this helps,
Marius
On Thu, Jun 12, 2014 at 6:22 PM, Karel Gardas <karel.gardas(a)centrum.cz> wrote:
Hello,
I'm working on semantic extension for XWiki[1][2] and currently on
performance tunning to be ready for scaling up. The problem with current
implementation is that it always modifies semantics DB on all page views.
E.g. when I do have a page with
{{semProp
value="http://purl.org/dc/elements/1.1/title::The Hobbit"/}}
to define property 'title' to value 'The Hobbit', this macro basically
saves
this knowledge to the DB everytime the page is viewed which is obvious
performance killer. Of course there is a possibility to optimize this call
to first check if the property is already defined and if not, do nothing,
but it's still not the best.
What I think I'd like to do is to kind of check if the pages is saved or
viewed and based on this semProp will do its job (during page save) or will
do nothing (during page view).
Now, my question is if something like that is possible since I've not found
any hints about it so far.
Thanks!
Karel
[1]:
http://extensions.xwiki.org/xwiki/bin/view/Extension/Semantic+XWiki
[2]:
https://github.com/kgardas/semxwiki
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs