OK, poll closed. Thanks to all who shared their thoughts on this. We 
discussed, and I have now implemented the solution with ".". The SVN version 
already supports this syntax. Here are some examples to explain the new 
feature:

A query for people (or anything) born in a place that is located in Germany:

{{#ask: [[born in.located in::Germany]] }}

The old query (still works):

{{#ask: [[born in::<q>[[located in::Germany]]</q>]] }}

In that syntax, all but the last property in a chain must of course be of type 
Page (i.e. be a "relation"). The last part can be anything, e.g.

{{#ask: [[born in.population::< 1000]] }}


In the rest of this mail, I will explain how to deal with cases where "." 
or "::" is part of a page name and should not be interpreted in a special way 
by #ask.

Firstly, to ask for a property that really has a "." in its name, use an 
initial space:

{{#ask: [[ strange.name::Germany]] }}

This example finds all things having the value "Germany" 
for "Property:strange.name".

Secondly, you can also now ask for pages that have a :: in their name, e.g.

{{#ask: [[:std::out]] }}

returns "std::out" as its only result (this is useful to print property values 
for this particular thing). Here we use an initial ":" as you would also do 
in MediaWiki for [[:Category:Test]] or in SMW for non-semantic links 
[[:std::out]]. Note the difference to the above:

{{#ask: [[:strange.name::Germany]] }}

is a query for one page, called "strange.name::Germany".

Thirdly, there is no way to use property names that contain "::" (the above 
only uses some page names with "::"). This should be clear and is no concern 
to us; no SMW wiki should use properties with such::a::name.

Finally, since I am talking about "escaping" problemantic symbols, I also 
recall that SMW's special comparator symbols (like "<" in the population 
query above) can also be used in property values. For example

{{#ask: [[property::<test>]] }}

would look for all things with a value alphabetically smaller than "test>" 
(where I assume that "property" has Type:String), which is probably not 
desired. But

{{#ask: [[property:: <test>]] }}

really looks for things with value "<test>".


So, in general, initial ":" and " " are used in #ask to prevent some symbols 
from having their special meaning (and both have their use and cannot replace 
the other). I hope that this is not relevant in most cases anyway, but of 
course we also want to cover the corner cases.


Cheers,

Markus


On Freitag, 6. Juni 2008, Markus Krötzsch wrote:
> Hi all,
>
> I have a proposal for a simplification in #ask query syntax that I would
> like to get some feedback on.
>
> If you currently ask for property chains, you need something like the
> following:
>
> {{#ask: [[works at::<q>[[located
> in::<q>[[population::>1000000]]</q>]]</q>]]}}
>
> to find someone working at an organisation located in a place with more
> than 1000000 inhabitants. The many [[ and <q> are sure annoying.
>
> My proposal is to instead allow writing
>
> {{#ask: [[works at.located in.population::>1000000]] }}
>
> with exactly the same interpretation as above.
>
> Effects:
> * "." in property names become problematic (though some escape can be
> provided to allow them),
> * the syntax becomes shorter, and maybe also more readable.
>
> Would that be an improvement? Other comments? (There is also another issue
> regarding the syntax with <q>, but I will have to check what can be done
> there before proposing alternatives.)
>
> Cheers
>
> Markus



-- 
Markus Krötzsch
Semantic MediaWiki    http://semantic-mediawiki.org
http://korrekt.org    [EMAIL PROTECTED]

Attachment: signature.asc
Description: This is a digitally signed message part.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to