Hi MovGP0,

I've come up with a workable workaround.

What I'll do is use two instances of my inline query parser function {{#ask}} instead of the extension tag <ask> and then perform parsing on the results to produce an intersection.

So basically (using the extension tag syntax), I'll do:
* <ask>[[Whoever]][[has friend::*]]</ask>
* <ask>[[has friend::Whoever]]</ask>
* Remove singletons using a regular expression - meaning anything thats' not duplicated later in the list.

The result then will be the reflexive result of the "has friend" relationship.

Since all this occurs using parser functions, it can be encapsulated within templates.

So I might have a Template:Reflexive_ask that takes two parameters: the originating page, and the relationship.  Continuing the previous example, it would be called like this: {{reflexive ask|Whoever|has friend}}

It's a work in progress.  I've got a functional parser function counterpoint to the <ask> extension tag - the next step is to produce a patch to push into the codebase.

-- Jim

On 5/23/07, MovGP0 <movgp0@gmail.com> wrote:
Sergey Chernyshev wrote:
> Does it work when Subject is defined as *?
>
> Like if you have a relation on Sergey's page defined as:
>
>    Sergey knows [[Has friend::John Doe]] and [[Has friend::Jane Doe]]
> from
> high school and [[Has friend::Peter Smith]] from college.
>
> and on Yaron's page defined as:
>
>    Yaron knows [[Has friend::John Doe]] from college and [[Has
> friend::Peter Smith]] from work.
>
> Regular query
>
>    [[Has friend::*]]
>
> will return:
>
>   Sergey           John Doe
>                        Jane Doe
>                        Peter Smith
>
>   Yaron             John Doe
>                        Peter Smith
>
> But what if I want to get result of "Is a friend of" (opposite to "Has
> friend") and expect results like this:
>
>   John Doe        Sergey
>                         Yaron
>
>   Jane Doe        Sergey
>
>   Peter Smith     Yaron
>                         Sergey
>
> What kind of query should I run? [[*::Has friend]] doesn't seem to
> help ;(
If you think that "has friend" is a symmetrical property, then this
would need semantic reasoning, which is currently simply not implemented
in SMW.
But I think that "has friend" is not symmetrical anyway, because the
other guy coul'd be an asshole.
If "is friend of" is the inverse of "has friend" you should search using
[[is friend of::*]], but again there is still no reasoning that can
figure this out automatically.
Also I think too that the subject should be queryable, but it isn't
currently.

ys, MovGP0
>
>
> On 5/18/07, Yaron Koren <yaron57@gmail.com> wrote:
>>
>> Well, my mistake - I tried it out, and it appears "inverse queries",
>> i.e. queries that return the object of triples, given the subject,
>> work. And it looks like the functionality has been in SMW for a
>> while... for some reason, it's not mentioned in the help page
>> (http://ontoworld.org/wiki/Help:Inline_queries), and I couldn't see
>> documentation anywhere else either. Is this a secret or unsupported
>> feature? In any case, good to know.
>>
>> -Yaron
>>
>>
>> On 5/17/07, Yaron Koren < yaron57@gmail.com> wrote:
>> > This question is a little confusing to think about (at least for me),
>> > because "friend of" is, in real life, always a bi-directional
>> > relationship. So let me substitute something that's more clearly
>> > one-directional for this example: how about "has been to the house
>> > of".
>> >
>> > Looking at it that way, I don't believe your first example will work.
>> > I don't think there's any way to determine whom a person "has been to
>> > the house of" - you can only find out who "has been to the house of" a
>> > certain person. I think what you're looking for is an inverse query,
>> > which isn't supported, though the issue has come up before on this
>> > mailing list.
>> >
>> > -Yaron
>> >
>> >
>> > On 5/17/07, Jim Wilson <wilson.jim.r@gmail.com> wrote:
>> > > Hi SMW Devs,
>> > >
>> > > Quick question: is there a way to get a list of all articles that
>> meet
>> a
>> > > reflexive criteria?
>> > >
>> > > For example, I've got a relation called "friend of", and I know
>> how to
>> do
>> > > these types of queries:
>> > >
>> > > <ask>[[User:Whoever]][[friend of::*]]</ask> - This will return all
>> articles
>> > > that User:Whoever is a "friend of"
>> > >
>> > > <ask>[[friend of::User:Whoever]]</ask> - This will return all
>> articles
>> that
>> > > are "friends of" User:Whoever
>> > >
>> > > Is there a way to get the intersection of these two sets?  Meaning,
>> everyone
>> > > who is both "friend of" User:Whoever, and who User:Whoever says
>> they're
>> > > "friend of"?
>> > >
>> > > Thanks in advance for your help - I really appreciate it.
>> > >
>> > > And if the answer is "no, there's no pure SMW way to do that",
>> that's
>> fine
>> > > too - I can find another solution.  I just don't want to waste my
>> time
>> > > looking for one if SMW can get the job done on its own.
>> > >
>> > > Thanks!
>> > >
>> > > -- Jim R. Wilson (jimbojw)
>> > >
>> > >
>> -

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel