2008/6/8 Rolf Lampa <[EMAIL PROTECTED]>:
> Markus Krötzsch skrev:
>> could ever be name clashes on "."? (Is there anyone who ever used a
>> "." within a property name?) I can do both ... whatever most users
>> prefer.
>
> Yes, in Mediawiki I planned to use dots for just that. Sometimes there'e
> a need to distinguish Class1.PropertyName from Class2.PropertyName in
> just that manner (i.e. <Class name> - dot - <property name>)
>
> As for the arrows, one could think of using -> to refer to classes (or
> in MW, Categories) and once the class (category) is reached one could
> switch to dot. Thus:
>
> Class->Class.propertyName
>
> Example:
>
> Self->Parent.firstName
>
> (A Self variable to determine the context would be fine too, by the way).
>
> One could also think of distinguishing Class/Category from property by
> capital letter for Class/Category and lower case for properties? (like
> in OCL) One could more lend ideas from OCL.
>
>> Here is again the new proposal in comparison to the old one:
>>
>> {{#ask: [[works at->located in->population::>1000000]] }}
>
> Assuming works at = Category(City) and located in = Category(Country):
>
> Self.works at->located in.population
>
>>
>> Old:
>>
>> {{#ask: [[works at.located in.population::>1000000]] }}
>>
>> (Personally, I find the old slightly more readable, maybe because the
>> . is smaller and just one symbol).
>
> {{#ask: [[works at->located in.population::>1000000]] }} or (using Self)
>
> {{#ask: [[Self.works at->located in.population::>1000000]] }}
> ...would contain more info, and still be, well, readable...
Articifical Intelligence had the simple concept of unification which
is basically
the concept of #ask.
You match a pattern against a list of facts/rules, and recursively bind
variables to the result.
In the end you get a list of matched patterns with the bound variables.
You might know that from perl regex pattern matching, though the perl syntax
is considerably limited compared to the original lisp or prolog syntax.
But even the perl matcher is still better than this proposal here.
Not comparing to typical prolog or lisp matchers.
Where is the logic? Where are the bound variables?
I see only an AND combination and one public variable and two unnamed
internal chained variables.
{{#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.
Would be written as (reverse lisp syntax):
(match (and (works_at _who _org) (located_in _org _place)(population
_place _num)(> _num 10000000))
*database*)
=> (((_who someone)(_org name)(_place city)(_num 12000000))
(...)))
but usually in more readable horn clauses.
Wiki syntax should be simple and an advantage for the untrained user,
not some horrifying xml mess.
What you are trying here is using xml syntax as () replacement
(<q>...</q>), but without
using the advantages of nested trees.
You omit the vars, which are temporarily bound and should most likely
be returned to the user.
You omit the possibility to do logic calculation in the query, the
pattern matcher.
Well, you can seperate the var definition which will be presented as
result from the logic.
This could be a seperate argument to the function.
(#ask rules-with-vars-to-be-bound format-to-represent-bound-vars)
[[..]] denotes in link syntax the fact and rule representation. okay.
better than nothing (whitespace and operator precedence rules)
<q>...</q> denote recursive subqueries. well, also better than nothing.
But with this simple tail-recursive-only chain you are very limited in
your query language.
Also, what you cannot do with this syntax, is OR and NOT, and also not
the explicitly bound vars.
Better allow variables and find a syntax against the [[ ]] and xml mess.
I would consult an AI expert who can explain the basics of a matcher / unifier
and the typical query languages.
phpwiki uses simple php syntax for the allowed mathematical
expressions in its query language,
with typical () nesting and operator precedence and temporary
variables, which are bound
to the found results.
The lisp or Visual Basic alike syntax (for _var ...) binds the
pagename _var to the subquery.
(with is also nice).
Optionally you can define a formatting template to present the list of
bound vars as list,
for the default html output.
A simple query with one implicit var, the pagename, and the attribute
population:
<?plugin SemanticSearchAdvanced
s="is_a::city and (population < 1.000.000 or population > 10.000.000)" ?>
<?plugin SemanticSearchAdvanced
s="(is_a::city or is_a::country) and population < 10.000.000" ?>
Now your example with subqueries and temp. variables:
<?plugin SemanticSearchAdvanced
s="works_at::_organization
and (for _organization located_in::_city
and (for _city population>1000000))" ?>
=> table of
_organization _city population
and now
<?plugin SemanticSearchAdvanced
s="works_at::_organization
and (for _organization
(located_in::_city and (for _city is_a::City and
population>1000000))
or (located_in::_country and (for _country
is_a::Country and population>5000000)))" ?>
=> table of
_organization _city _country population
--
Reini Urban
http://phpwiki.org/ http://murbreak.at/
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel