Hi, devs.
I would like to discuss about the new xwiki query language.
http://dev.xwiki.org/xwiki/bin/view/Design/XWikiQueryLanguage
We need to choose a syntax and data model of the query language
There are some examples in
http://dev.xwiki.org/xwiki/bin/view/Design/XWiki+Query+Language+Specificati…
I already have a prototype based on my JPQL parser (SableCC based) and
hql generator. It is quite easy to modify syntax and generator. Results
of my query parser research in the end of the message.
I propose:
0) Name: XWiki Query Language, XWQL as a name of the new language.
1) Data Model: Choose query method #1 from specification
http://dev.xwiki.org/xwiki/bin/view/Design/XWiki+Query+Language+Specificati…
with corrections:
add Document as a virtual class for our XWikiDocument.
use "docalias.XWiki.ClassName instead" of "XWiki.ClassName". docalias is
some alias for Document.
add optional select clause.
example:
"select doc.fullName
from Document as doc, doc.XWiki.XWikiUsers as user
where user.email like '%xwiki.com' and doc.author=:username"
"select doc.fullName from Document as doc" may be omitted. It will be
added if there is no Document in query statement. So "from
doc.XWiki.XWikiUsers as user" is correct query statement.
It is possible to use several documents and objects in one query.
Attachment, Class, and other xwiki entities will be added later if needed.
2) Syntax: XWQL will be JPQL subset.
(hint: JPQL is part of Java Persistance API standard, JSR#317. HQL is
a superset of JPQL. Hibernate support JPA)
All JPQL features and all hibernate data model will be accessible for
hibernate store. But it is not true for JCR store.
Only described data model will be available for XWQL on JCRStore. (But
we may add some extensions later)
In JCRv2 will not work (JCRSQL2 constraint):
arithmetic expressions (+-*/)
aggregation funtions (max,min,sum,avg)
some other functions
In JCRv1 also will not work (XPath constraint):
query on several documents (from Document as doc1, Document as doc2)
Some JPQL limitations compared with HQL:
no arithmetic expressions (+-*/) in select clause
aliases at from clause are mandatory (from Document as alias)
So the main idea is to use simple JPQL preprocessor to rewrite virtual
data model to real.
This is quite easy for HQL and JCRSQL2. But it is hard(but doable) for
JCRv1 XPath.
WDYT?
Appendix:
I researched a many of query engines and found nothing appropriate. All
query engines/parsers is either very specific or cannot be used
standalone or cannot be used as a preprocessor. JCRSQL2 language parser
from Jackrabbit is still unusable.
Next I researched a parser generators and found that SableCC is best
choose for my needs. Other tools (ANTLR, JavaCC, Cup, Beaver) requires
much more hand work to write parse tree (AST) and preprocessors
(Visitors and ast.toString). JTB and JJTree also generate AST and
visitors, but SableCC generated code is much more clean.
SableCC generate all of this from one clear grammar file. Maybe it is
not as perfect as hand-written one, but it is quite suitable.
Reason to choose sql-like syntax:
XPath isn't still much spread. XPath language is deprecated in JCRv2.
JCRv2 uses JCRSQL2 and criteria-like AQM instead. JCRSQL2 is much more
powerful (in expression sense) than JCR's XPath and JCRSQL1.
--
Artem Melentyev
Hi,
We can do things like this in pages.
#set( $myvar = ["123"] )
If I want to make a global variable that share across the entire wiki (XE),
where can i set that pls?
Thanks
Art
--
View this message in context: http://n2.nabble.com/Global-Variable--tp789520p789520.html
Sent from the XWiki- Dev mailing list archive at Nabble.com.
Hi devs,
Right now we have:
platform/
|_ core/
|_ xwiki-core/
|_ (others)/
|_ plugins/
|_ ...
The problem I see is twofold:
1) We can have platform components that are not core components (for
example I'd like to commit the office component done by Wang Ning).
2) I'd like that we decide to deprecate the plugins/ system going
forward and that all new code only write components.
For 1) I'd like to propose:
platform/
|_ components/ (contains (others)/ from above)
|_ core/ (is the core/xwiki-core from above, to be removed once
fully split into components)
|_ plugins/ (to be removed once fully split into components)
|_ ...
For 2) I'd like to propose:
* Create an interface for Velocity APIs. Something like VelocityBridge
(or VelocityAccess or VelocityApi or...). It would be empty.
* Each component that want to be accessed from velocity will need to
implement a component implementing VelocityBridge. It'll have a role-
hint being the name under which it'll be access from Velocity.
* Create a VelocityService class (component) which has a single
get(String name) method and which uses the ComponentManager to look up
components which implement VelocityBridge using the name as the role
hint.
* Put that VelocityService in the Velocity context under the name
"services".
In practice this means that users will be able to access all our
components through the VelocityBridge implementations with a syntax
like:
$services.office.convert(...)
$services.translation.translate(...)
...
Note1: We would need to be careful that it would be forbidden for any
java code to use a VelocityBridge. This is to ensure all code logic is
put into components and not into the bridges. We should use the maven
enforcer plugin to enforce this rule.
Note2: This means we'll have 2 APIs to maintain: the velocity one (the
bridges) + the "Java"' one (the main components). But I don't see any
other way...
WDYT?
Thanks
-Vincent
HI,
How to view current space using HSQL.
For Example:
select prop.value from BaseObject as obj, StringProperty as prop where
obj.className='Blog.Categories' and obj.name = 'Blog.Categories' and
prop.id.id = obj.id and prop.id.name='name'* and prop.value = $doc.web*
whether above one is correct..?
--
Prathap
Some open issues/questions:
1) I think we need a syntax for escaping a block of text. I'd propose
using {{{whatever here}}} (same as creole and confluence). We could do
it with a macro but I don't know how we could implement it easily...
2) Do we want double curly braces for macros or simple ones:
{{macro/}} or {macro/}. If we use simple ones then it won't be easy to
enter { and } chars in a text (they would need to be escaped) and
since we've decided to have double chars for items ( **, --, ~~, etc)
we might as well do that for macros.
3) Do we want to support images in links. For example:
[[image:someimage.png]]? We already support URIs in links, such as
mailto: so maybe it wouldn't be too hard to support images too I
guess. Or do we want only the Image macro? A related question is do we
support http images (http://.../someimage.png) inside links and as an
inline element directly in the text?
4) Tables: do we keep the table macro or do we want a wiki syntax for
tables.
Thanks
-Vincent
Hi,
Since we've reorganized our products into projects I'm now proposing
that we change their group id from "com.xpn.xwiki.products" to
"org.xwiki.<project>".
Note that we're already using org.xwiki.platform for the platform
project.
Note also that this means rename org.xwiki.eclipse to
org.xwiki.xeclipse.
Here's my +1
Thanks
-Vincent
Hi,
I tried to use the new WYSIWYG editor in 1.6M1. I found some issues.
1) The new wysiwyg don't handle multi-level list correct. When I edit
a multi-level list in wysiwyg and save. The multi-level became flat.Is
this related to the xhtmlparser?
2) I type some letters and set them to strike format( the same for
bold, underline and italic). Then I want to type some new works who is
format is not strike. I just can't do this. All the words I typed
after is strike.
--
Thanks
Wang Ning
Greetings
My objective is to list every document with some tag (e.g. "MainTag"), and next, select all tags of these
documents without repeating any of them (including "MainTag").
I tried to merge the next two queries but without sucess.
This query selects every document that have the tag "KB-4D":
#set($sql = ", BaseObject as obj, DBStringListProperty as prop where obj.name=doc.fullName and
obj.className='XWiki.TagClass' and obj.id=prop.id.id and prop.id.name='tags' and 'KB-4D' in
elements(prop.list) order by doc.name asc")
#set ($list = $xwiki.searchDocuments($sql))
This query selects every tags present in the documents listed by the previous query:
#set($sql = "select distinct elements(prop.list) from BaseObject as obj, DBStringListProperty as prop where
obj.className='XWiki.TagClass' and obj.id=prop.id.id and prop.id.name='tags' and obj.name='$item'")
#set ($tags = $xwiki.search($sql))
Can anyone help me with this?
Thanks in advance
Bruno Neves
PS: How can I put snippet code on code.xwiki.org? I need to login but I am not registered.
Hi,
Since the XE 1.6 release is planned for the 22nd of September, I think
it would be good that we plan the 1.7 release for Javapolis 2008
(around the 10th of December). That leaves a bit more than 2 months so
we could have:
- 1.7M1: 20th of October (that's more than 3 weeks after the 1.6
release)
- 1.7M2: 10th of November (3 weeks after 1.7M1)
- 1.7RC1: 17 Nov (one week after)
- 1.7RC2 or final: 24 Nov (one week after)
- 1.7 final (if needed): 1st of December
We could have the following for it already:
1) fully operational new WYSIWYG + new rendering
2) working JCR implementation + Query Manager
3) office import/export integrated into XE and in the new WYSIWYG
4) finished full revamping of the blog application
And more... (Please Add below)
The most important feature will be the new WYSIWYG that we will be
able to showcase at Javapolis.
WDYT?
Thanks
-Vincent