[Nepomuk] Re: First problems with query API
Sebastian Trüg
trueg at kde.org
Wed Mar 2 12:28:04 CET 2011
On 03/02/2011 12:22 PM, Sebastian Trüg wrote:
>> For now simply put the query term in a single LiteralTerm:
>>
>> LiteralTerm("hello world this is several terms")
>>
>> That will do it.
>>
>> Your problem is that what you wrote with the query API is not what you
>> meant.
>>
>> AndTerm( LiteralTerm("A"), LiteralTerm("B") )
>>
>> will look for all resources that have term "A" in any property value and
>> term "B" in any property value. What you want (and do in your query) is
>> looking for all resources that have a properly value that contains "A"
>> and "B". See the difference? Using 6 LiteralTerms gets you a really big
>> join.
>>
>>
>> No, I precisely I'm trying that you mean. I look for all resources that
>> have term "A" in any property, etc... as my query does in a limited
>> manner. I have several asian names in my db "ha ji won", "kim sa rang",
>> 'lee dae hae", "uhm ji won", etc... and even this Asian names could be
>> writen in several manners: Yūko, Yuuko, Yuko, ゆうこ, 裕子, etc... so I
>> could need this kind of queries.
>>
>> I will work this night your queries because I think that can be improved.
>
> So you actually want this:
>
> select ?r where { { ?r ?p1 ?v1 . ?v1 bif:contains "A" . } UNION { ?r ?p2
> ?v2 . ?v2 bif:contains "B" . } UNION { ?r ?p3 ?v3 . ?v3 ... } . }"
>
> ? Are you sure?
Ignore that. You mean that what you want is this:
select ?r where {
?r ?p1 ?v1 . ?v1 bif:contains "A" .
?r ?p2 ?v2 . ?v2 bif:contains "B" .
?r ?p3 ?v3 . ?v3 ...
}
?
Cheers,
Sebastian
More information about the Nepomuk
mailing list