Yes, I needed a query that'll work under assumption that "has friend" is the inverse of "has friend".

I wonder if storing all semantic data in some external storage that supports sparql would be better for SMW.

I understand that simple queries need to stay simple but complex ones should still be possible and there is no reason to invent new query language for those.


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